aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v1/author_format.rb122
-rw-r--r--lib/sisu/v1/cgi.rb86
-rw-r--r--lib/sisu/v1/cgi_pgsql.rb231
-rw-r--r--lib/sisu/v1/cgi_sql_common.rb976
-rw-r--r--lib/sisu/v1/cgi_sqlite.rb217
-rw-r--r--lib/sisu/v1/character_encoding.rb381
-rw-r--r--lib/sisu/v1/composite.rb239
-rw-r--r--lib/sisu/v1/concordance.rb350
-rw-r--r--lib/sisu/v1/conf.rb269
-rw-r--r--lib/sisu/v1/constants.rb172
-rw-r--r--lib/sisu/v1/css.rb2015
-rw-r--r--lib/sisu/v1/dal.rb272
-rw-r--r--lib/sisu/v1/dal_character_check.rb109
-rw-r--r--lib/sisu/v1/dal_doc_str.rb266
-rw-r--r--lib/sisu/v1/dal_doc_str_code.rb187
-rw-r--r--lib/sisu/v1/dal_doc_str_tables.rb198
-rw-r--r--lib/sisu/v1/dal_endnotes.rb129
-rw-r--r--lib/sisu/v1/dal_expand_insertions.rb196
-rw-r--r--lib/sisu/v1/dal_hash_digest.rb173
-rw-r--r--lib/sisu/v1/dal_idx.rb323
-rw-r--r--lib/sisu/v1/dal_images.rb145
-rw-r--r--lib/sisu/v1/dal_metadata.rb225
-rw-r--r--lib/sisu/v1/dal_numbering.rb368
-rw-r--r--lib/sisu/v1/dal_substitutions_and_insertions.rb154
-rw-r--r--lib/sisu/v1/dal_syntax.rb421
-rw-r--r--lib/sisu/v1/db_columns.rb229
-rw-r--r--lib/sisu/v1/db_create.rb597
-rw-r--r--lib/sisu/v1/db_dbi.rb93
-rw-r--r--lib/sisu/v1/db_drop.rb155
-rw-r--r--lib/sisu/v1/db_import.rb924
-rw-r--r--lib/sisu/v1/db_indexes.rb111
-rw-r--r--lib/sisu/v1/db_load_tuple.rb155
-rw-r--r--lib/sisu/v1/db_remove.rb107
-rw-r--r--lib/sisu/v1/db_select.rb193
-rw-r--r--lib/sisu/v1/db_tests.rb119
-rw-r--r--lib/sisu/v1/dbi.rb149
-rw-r--r--lib/sisu/v1/defaults.rb2225
-rw-r--r--lib/sisu/v1/digests.rb377
-rw-r--r--lib/sisu/v1/embedded.rb139
-rw-r--r--lib/sisu/v1/errors.rb82
-rw-r--r--lib/sisu/v1/harvest.rb103
-rw-r--r--lib/sisu/v1/harvest_authors.rb325
-rw-r--r--lib/sisu/v1/harvest_topics.rb563
-rw-r--r--lib/sisu/v1/help.rb2035
-rw-r--r--lib/sisu/v1/html.rb703
-rw-r--r--lib/sisu/v1/html_format.rb1405
-rw-r--r--lib/sisu/v1/html_minitoc.rb239
-rw-r--r--lib/sisu/v1/html_promo.rb442
-rw-r--r--lib/sisu/v1/html_scroll.rb200
-rw-r--r--lib/sisu/v1/html_segments.rb540
-rw-r--r--lib/sisu/v1/html_table.rb152
-rw-r--r--lib/sisu/v1/html_tune.rb383
-rw-r--r--lib/sisu/v1/hub.rb590
-rw-r--r--lib/sisu/v1/i18n.rb1605
-rw-r--r--lib/sisu/v1/manifest.rb648
-rw-r--r--lib/sisu/v1/manpage.rb465
-rw-r--r--lib/sisu/v1/manpage_format.rb119
-rw-r--r--lib/sisu/v1/odf.rb738
-rw-r--r--lib/sisu/v1/odf_format.rb263
-rw-r--r--lib/sisu/v1/options.rb191
-rw-r--r--lib/sisu/v1/param.rb1008
-rw-r--r--lib/sisu/v1/param_identify_markup.rb145
-rw-r--r--lib/sisu/v1/particulars.rb130
-rw-r--r--lib/sisu/v1/plaintext.rb423
-rw-r--r--lib/sisu/v1/plaintext_format.rb120
-rw-r--r--lib/sisu/v1/relaxng.rb1177
-rw-r--r--lib/sisu/v1/remote.rb266
-rw-r--r--lib/sisu/v1/response.rb76
-rw-r--r--lib/sisu/v1/rexml.rb127
-rw-r--r--lib/sisu/v1/screen_text_color.rb414
-rw-r--r--lib/sisu/v1/share_src.rb97
-rw-r--r--lib/sisu/v1/share_src_kdissert.rb91
-rw-r--r--lib/sisu/v1/shared_html.rb65
-rw-r--r--lib/sisu/v1/shared_html_lite.rb276
-rw-r--r--lib/sisu/v1/shared_sem.rb157
-rw-r--r--lib/sisu/v1/shared_structure.rb173
-rw-r--r--lib/sisu/v1/shared_txt.rb223
-rw-r--r--lib/sisu/v1/shared_xml.rb739
-rw-r--r--lib/sisu/v1/sisupod_make.rb337
-rw-r--r--lib/sisu/v1/sitemaps.rb224
-rw-r--r--lib/sisu/v1/spell.rb102
-rw-r--r--lib/sisu/v1/sst_convert_markup.rb318
-rw-r--r--lib/sisu/v1/sst_do_inline_footnotes.rb482
-rw-r--r--lib/sisu/v1/sst_from_kdissert.rb194
-rw-r--r--lib/sisu/v1/sst_from_xml.rb170
-rw-r--r--lib/sisu/v1/sst_identify_markup.rb439
-rw-r--r--lib/sisu/v1/sst_to_s_xml_dom.rb589
-rw-r--r--lib/sisu/v1/sst_to_s_xml_node.rb649
-rw-r--r--lib/sisu/v1/sst_to_s_xml_sax.rb454
-rw-r--r--lib/sisu/v1/sysenv.rb3282
-rw-r--r--lib/sisu/v1/termsheet.rb167
-rw-r--r--lib/sisu/v1/texinfo.rb438
-rw-r--r--lib/sisu/v1/texinfo_format.rb520
-rw-r--r--lib/sisu/v1/texpdf.rb797
-rw-r--r--lib/sisu/v1/texpdf_format.rb1556
-rw-r--r--lib/sisu/v1/update.rb131
-rw-r--r--lib/sisu/v1/urls.rb284
-rw-r--r--lib/sisu/v1/webrick.rb174
-rw-r--r--lib/sisu/v1/wikispeak.rb407
-rw-r--r--lib/sisu/v1/xhtml.rb465
-rw-r--r--lib/sisu/v1/xml.rb482
-rw-r--r--lib/sisu/v1/xml_dom.rb561
-rw-r--r--lib/sisu/v1/xml_fictionbook.rb313
-rw-r--r--lib/sisu/v1/xml_format.rb357
-rw-r--r--lib/sisu/v1/xml_md_oai_pmh_dc.rb211
-rw-r--r--lib/sisu/v1/xml_scaffold.rb206
-rw-r--r--lib/sisu/v1/xml_tables.rb213
-rw-r--r--lib/sisu/v1/zap.rb81
-rw-r--r--lib/sisu/v3/air.rb2
-rw-r--r--lib/sisu/v3/author_format.rb2
-rw-r--r--lib/sisu/v3/cgi.rb2
-rw-r--r--lib/sisu/v3/cgi_pgsql.rb2
-rw-r--r--lib/sisu/v3/cgi_sql_common.rb8
-rw-r--r--lib/sisu/v3/cgi_sqlite.rb2
-rw-r--r--lib/sisu/v3/character_encoding.rb2
-rw-r--r--lib/sisu/v3/composite.rb2
-rw-r--r--lib/sisu/v3/concordance.rb2
-rw-r--r--lib/sisu/v3/conf.rb2
-rw-r--r--lib/sisu/v3/constants.rb2
-rw-r--r--lib/sisu/v3/css.rb2
-rw-r--r--lib/sisu/v3/dal.rb2
-rw-r--r--lib/sisu/v3/dal_character_check.rb2
-rw-r--r--lib/sisu/v3/dal_doc_objects.rb2
-rw-r--r--lib/sisu/v3/dal_doc_str.rb2
-rw-r--r--lib/sisu/v3/dal_endnotes.rb2
-rw-r--r--lib/sisu/v3/dal_expand_insertions.rb2
-rw-r--r--lib/sisu/v3/dal_hash_digest.rb2
-rw-r--r--lib/sisu/v3/dal_idx.rb2
-rw-r--r--lib/sisu/v3/dal_images.rb2
-rw-r--r--lib/sisu/v3/dal_metadata.rb2
-rw-r--r--lib/sisu/v3/dal_numbering.rb2
-rw-r--r--lib/sisu/v3/dal_substitutions_and_insertions.rb2
-rw-r--r--lib/sisu/v3/dal_syntax.rb2
-rw-r--r--lib/sisu/v3/db_columns.rb2
-rw-r--r--lib/sisu/v3/db_create.rb2
-rw-r--r--lib/sisu/v3/db_dbi.rb2
-rw-r--r--lib/sisu/v3/db_drop.rb2
-rw-r--r--lib/sisu/v3/db_import.rb2
-rw-r--r--lib/sisu/v3/db_indexes.rb2
-rw-r--r--lib/sisu/v3/db_load_tuple.rb2
-rw-r--r--lib/sisu/v3/db_remove.rb2
-rw-r--r--lib/sisu/v3/db_select.rb2
-rw-r--r--lib/sisu/v3/db_sqltxt.rb2
-rw-r--r--lib/sisu/v3/db_tests.rb2
-rw-r--r--lib/sisu/v3/dbi.rb2
-rw-r--r--lib/sisu/v3/defaults.rb2
-rw-r--r--lib/sisu/v3/digests.rb2
-rw-r--r--lib/sisu/v3/embedded.rb2
-rw-r--r--lib/sisu/v3/epub.rb2
-rw-r--r--lib/sisu/v3/epub_concordance.rb2
-rw-r--r--lib/sisu/v3/epub_format.rb2
-rw-r--r--lib/sisu/v3/epub_segments.rb2
-rw-r--r--lib/sisu/v3/epub_tune.rb2
-rw-r--r--lib/sisu/v3/errors.rb2
-rw-r--r--lib/sisu/v3/git.rb2
-rw-r--r--lib/sisu/v3/harvest.rb2
-rw-r--r--lib/sisu/v3/harvest_authors.rb2
-rw-r--r--lib/sisu/v3/harvest_topics.rb2
-rw-r--r--lib/sisu/v3/help.rb8
-rw-r--r--lib/sisu/v3/html.rb2
-rw-r--r--lib/sisu/v3/html_format.rb2
-rw-r--r--lib/sisu/v3/html_minitoc.rb2
-rw-r--r--lib/sisu/v3/html_promo.rb2
-rw-r--r--lib/sisu/v3/html_scroll.rb2
-rw-r--r--lib/sisu/v3/html_segments.rb2
-rw-r--r--lib/sisu/v3/html_table.rb2
-rw-r--r--lib/sisu/v3/html_tune.rb2
-rw-r--r--lib/sisu/v3/hub.rb2
-rw-r--r--lib/sisu/v3/i18n.rb2
-rw-r--r--lib/sisu/v3/manifest.rb2
-rw-r--r--lib/sisu/v3/manpage.rb2
-rw-r--r--lib/sisu/v3/manpage_format.rb2
-rw-r--r--lib/sisu/v3/odf.rb2
-rw-r--r--lib/sisu/v3/odf_format.rb2
-rw-r--r--lib/sisu/v3/options.rb45
-rw-r--r--lib/sisu/v3/param.rb2
-rw-r--r--lib/sisu/v3/param_identify_markup.rb2
-rw-r--r--lib/sisu/v3/particulars.rb2
-rw-r--r--lib/sisu/v3/plaintext.rb2
-rw-r--r--lib/sisu/v3/plaintext_format.rb2
-rw-r--r--lib/sisu/v3/po4a.rb2
-rw-r--r--lib/sisu/v3/po4a_set.rb2
-rw-r--r--lib/sisu/v3/relaxng.rb6
-rw-r--r--lib/sisu/v3/remote.rb2
-rw-r--r--lib/sisu/v3/response.rb2
-rw-r--r--lib/sisu/v3/rexml.rb2
-rw-r--r--lib/sisu/v3/screen_text_color.rb2
-rw-r--r--lib/sisu/v3/share_src.rb2
-rw-r--r--lib/sisu/v3/share_src_kdissert.rb2
-rw-r--r--lib/sisu/v3/shared_html.rb2
-rw-r--r--lib/sisu/v3/shared_html_lite.rb2
-rw-r--r--lib/sisu/v3/shared_markup_alt.rb2
-rw-r--r--lib/sisu/v3/shared_metadata.rb2
-rw-r--r--lib/sisu/v3/shared_sem.rb2
-rw-r--r--lib/sisu/v3/shared_txt.rb2
-rw-r--r--lib/sisu/v3/shared_xhtml.rb2
-rw-r--r--lib/sisu/v3/shared_xml.rb2
-rw-r--r--lib/sisu/v3/sisupod_make.rb2
-rw-r--r--lib/sisu/v3/sitemaps.rb2
-rw-r--r--lib/sisu/v3/spell.rb2
-rw-r--r--lib/sisu/v3/sst_convert_markup.rb2
-rw-r--r--lib/sisu/v3/sst_do_inline_footnotes.rb2
-rw-r--r--lib/sisu/v3/sst_from_xml.rb2
-rw-r--r--lib/sisu/v3/sst_identify_markup.rb2
-rw-r--r--lib/sisu/v3/sst_to_s_xml_sax.rb2
-rw-r--r--lib/sisu/v3/sysenv.rb4
-rw-r--r--lib/sisu/v3/termsheet.rb2
-rw-r--r--lib/sisu/v3/texinfo.rb2
-rw-r--r--lib/sisu/v3/texinfo_format.rb2
-rw-r--r--lib/sisu/v3/texpdf.rb2
-rw-r--r--lib/sisu/v3/texpdf_format.rb2
-rw-r--r--lib/sisu/v3/update.rb2
-rw-r--r--lib/sisu/v3/urls.rb2
-rw-r--r--lib/sisu/v3/webrick.rb2
-rw-r--r--lib/sisu/v3/wikispeak.rb2
-rw-r--r--lib/sisu/v3/xhtml.rb2
-rw-r--r--lib/sisu/v3/xhtml_table.rb2
-rw-r--r--lib/sisu/v3/xml.rb2
-rw-r--r--lib/sisu/v3/xml_dom.rb2
-rw-r--r--lib/sisu/v3/xml_fictionbook.rb2
-rw-r--r--lib/sisu/v3/xml_format.rb2
-rw-r--r--lib/sisu/v3/xml_md_oai_pmh_dc.rb2
-rw-r--r--lib/sisu/v3/xml_scaffold.rb2
-rw-r--r--lib/sisu/v3/xml_tables.rb2
-rw-r--r--lib/sisu/v3/zap.rb2
225 files changed, 167 insertions, 46026 deletions
diff --git a/lib/sisu/v1/author_format.rb b/lib/sisu/v1/author_format.rb
deleted file mode 100644
index 4f391dfd..00000000
--- a/lib/sisu/v1/author_format.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module FORMAT
- class Author
- def initialize(author_param)
- @author_param=author_param
- end
- def author_details
- @authors,@author_array=[],[]
- authors=@author_param.scan(/[^;]+/)
- authors.each do |a|
- a.strip!
- if a =~/"(.+?)"/
- @authors << { :the => $1 }
- @author_array << $1.upcase
- else #if a =~/,/
- x=a.scan(/[^,]+/)
- x[0].strip!
- x[1].strip! if x[1]
- if x.length == 1
- @authors << { :the => x[0] }
- @author_array << x[0].upcase
- elsif x.length == 2
- @authors << { :the=> x[0], :others => x[1] }
- @author_array << "#{x[0].upcase}, #{x[1]}"
- else #p x.length
- end
- end
- end
- l = @authors.length
- authors_string=''
- @authors.each_with_index do |a,i|
- authors_string += if a[:others]
- if (l - i) > 1
- "#{a[:others]} #{a[:the]}, "
- else
- "#{a[:others]} #{a[:the]}"
- end
- else
- if (l - i) > 2
- "#{a[:the]}, "
- else
- "#{a[:the]}"
- end
- end
- #author_format += if a[:others]
- # if (l - i) > 1
- # "#{a[:others]} #{a[:the]}, "
- # else
- # "#{a[:others]} #{a[:the]}"
- # end
- #else
- # if (l - i) > 2
- # "#{a[:the]}, "
- # else
- # "#{a[:the]}"
- # end
- #end
- end
- {:last_first_a => authors, :last_first_format_a => @author_array, :authors_h => @authors, :authors_s => authors_string, :authors_param => @author_param}
- #{:authors_array => authors, :authors_hash => @authors, :authors_string => authors_string, :authors_param => @author_param}
- #{:authors_array => authors, :authors_hash => @authors, :authors_string => authors_string, :authors_format => author_format, :authors_param => @author_param}
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/cgi.rb b/lib/sisu/v1/cgi.rb
deleted file mode 100644
index ed0331f3..00000000
--- a/lib/sisu/v1/cgi.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: generates naive cgi search form for search of sisu database
- (pgsql sqlite)
-
-=end
-module SiSU_CGI #% database building documents
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/cgi_pgsql"
- require "#{SiSU_lib}/cgi_sqlite"
- include SiSU_CGI_pgsql
- class SiSU_search
- def initialize(opt)
- @opt=opt
- @webserv=@opt.files[0].to_s.strip #verify @opt.files[0].class
- end
- def search_info
- a=%{
- For help on sisu search, type:
- sisu --help search
- For help on setting up hyperestraier for sisu, type:
- sisu --help hyperestraier
- }
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a)
- tell.print_grey
- end
- def read
- SiSU_CGI_sqlite::SiSU_search_sqlite.new(@opt,@webserv).sqlite
- SiSU_CGI_pgsql::SiSU_search_pgsql.new(@opt,@webserv).pgsql
- search_info unless @opt.cmd =~/q/
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/cgi_pgsql.rb b/lib/sisu/v1/cgi_pgsql.rb
deleted file mode 100644
index f1e12110..00000000
--- a/lib/sisu/v1/cgi_pgsql.rb
+++ /dev/null
@@ -1,231 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
-
-=end
-module SiSU_CGI_pgsql #% database building documents
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/cgi_sql_common"
- include SiSU_CGI_sql
- class SiSU_search_pgsql < SiSU_CGI_common
- def initialize(opt,webserv)
- @opt,@webserv=opt,webserv
- @env=SiSU_Env::Info_env.new('',opt)
- @sys=SiSU_Env::System_call.new
- @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
- @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env)
- @db=SiSU_Env::Info_db.new
- #p @db.port_psql
- end
- def pgsql
- serve=[]
- if @sys.psql
- available_db_table=`psql --list` # system call requires psql
- available_db=available_db_table.scan(/(SiSU_\S+)/) if not available_db_table.nil?
- if available_db \
- and available_db.class == Array
- available_db.flatten.each do |x|
- serve << x.gsub(/SiSU_(\S+)/,'\1')
- end
- else put "WARNING: no postgresql database available, (have you created one?)"
- end
- serve.sort!
- f1,f2,f3=[],[],[]
- serve.each do |x|
- f1 << %{ <option value="SiSU_#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check
- end
- f2 << %{ selected_db=case cgi['db']\n}
- serve.each do |x|
- f2 << %{ when /SiSU_#{x}/; '<option value="SiSU_#{x}">#{x}</option>'\n} unless x =~/apache|sisu\/image/ #check
- end
- end
- f2 << " end\n"
- if FileTest.writable?('.')
- output=File.open('sisu_pgsql.cgi','w')
- output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2
- a=%{ generated sisu_pgsql.cgi,
- BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D)
- }
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a)
- tell.print_grey
- c=case @webserv
- when /pwd/; ''
- else "if necessary make the directory /usr/lib/cgi-bin :
- sudo cp -vi #{Dir.pwd}/sisu_pgsql.cgi /usr/lib/cgi-bin/.
- sudo chmod -v 755 /usr/lib/cgi-bin/sisu_pgsql.cgi
- (copy sisu_pgsql.cgi to your cgi directory) and set file permissions to 755"
- end
- a=%{#{c}
- #{@env.webserv_base_cgi}/cgi-bin/sisu_pgsql.cgi
- }
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a)
- tell.warn
- a="postgresql db used for present directory: #{@db.psql.db}"
- b="\n\t(to create and populate postgresql database see 'man sisu' and in particular the -D flag)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tsee 'sisu --help sql'\n\tif you have permission to create databases:\n\t'sisu -d --createdb'\n\tor using postgresql tools directly:\n\t'createdb #{@db.psql.db}'\n\tfor a list of existing databases try 'psql --list']"
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a,b)
- tell.txt_cyan
- else puts 'failed in attempt to write sisu_pgsql.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 (pgsql)
-#{gpl}
-=end
- require 'cgi'
- require 'fcgi'
- require 'dbi'
- @version='sisu_pgsql'
- @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
- @hosturl_db="#{@env.url.webserv_base_cgi}"
- @hosturl_files="#{@env.url.webserv_files_from_db}"
- @port="#{@db.psql.port}"
- user='#{@env.user}' # check user name for access to pg database: '#{@env.user}'
- WOK_SQL
- end
- def search_statement
- <<-'WOK_SQL'
- 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
- 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+$/,'') #watch
- @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.join.gsub!(/AND\s+$/,'') #watch
- @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\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.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
- %{<font color="#666666" size="2">#{sql_select_body}</font>}
- end
- def sql_select_endnotes_format
- %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
- end
- def contents
- @conn.select_all(sql_select_body)
- end
- def endnotes
- @conn.select_all(sql_select_endnotes)
- end
- end
- WOK_SQL
- end
- def buttons1_pgsql
- <<-'WOK_SQL'
- <input type="checkbox" name="casesense" #{@checked_case}> case sensitive
- WOK_SQL
- end
- def dbi_connect
- <<-'WOK_SQL'
- dbi="dbi:Pg:database=#{@db};port=#{@port}"
- @conn=DBI.connect(dbi,user)
- WOK_SQL
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/cgi_sql_common.rb b/lib/sisu/v1/cgi_sql_common.rb
deleted file mode 100644
index 5b2ef9b2..00000000
--- a/lib/sisu/v1/cgi_sql_common.rb
+++ /dev/null
@@ -1,976 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
-
-=end
-module SiSU_CGI_sql
- class SiSU_CGI_common
- def initialize(webserv,cmd,image_src,dir)
- @webserv,@cmd,@image_src,@env=webserv,cmd,image_src,dir
- end
- def about
- <<-'WOK_SQL'
- * Name: SiSU information Structuring Universe
- * Author: Ralph Amissah
- * http://www.jus.uio.no/sisu
- * http://www.jus.uio.no/sisu/SiSU/download
- WOK_SQL
- end
- def gpl
- <<-'WOK_SQL'
- * 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 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
- WOK_SQL
- end
- def header1
- <<-'WOK_SQL'
-#Common TOP
- @@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/
- '<font size="2" color="#666666">text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />'
- else ''
- end
- end
- def submission_form
- search_form=<<-WOK
- WOK_SQL
- end
- def header_desc
- <<-WOK_SQL
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>
- SiSU search form (sample): SiSU information Structuring Universe
- </title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <meta name="sourcefile" content="SiSU._sst" />
- <link rel="generator" href="http://www.jus.uio.no/sisu" />
- <link rel="shortcut icon" href="#{@image_src}/rb7.ico" />
- <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" />
- </head>
- <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
- <table summary="band" border="0" cellpadding="3" cellspacing="0">
- <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{@image_src}/sisu.png" alt="SiSU --&gt;" /></a></td><td>
-<!-- <p class="tiny"><a href="http://www.jus.uio.no/sisu/SiSU/">&nbsp;http://www.jus.uio.no/sisu/SiSU/</a></p> -->
- <label for="find"><b>#{@env.sample_search_form_title}</b></label>
- </td></tr>
- </table>
- WOK_SQL
- end
- def header2
- <<-'WOK_SQL'
- <form action="#{@base}" id="Test Form" method="post">
- <table cellpadding="2">
- <tr><td valign=\"top\">
- <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#{@search_field}</textarea>
- </td>
- <td valign=\"top\">
- #{@tip}
- #{@search_note}
- #{@the_can}
- </td></tr></table>
- <td valign=\"top\"><tr><td>
- <!input type="text" id="find" name="find" value="#{@search_field}" />
- <!input type="text" id="find" name="find" value="" />
- <font size="2" color="#222222">
- <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below)
- <br />
- <select name="db" size="1">
- #{@selected_db}
- WOK_SQL
- end
- def buttons1
- <<-'WOK_SQL'
- </select>
- <input type="submit" value="SiSU search" />
- <input type="radio" name="view" value="index" #{@checked_index}> index
- <input type="radio" name="view" value="text" #{@checked_text}> text / grep
- WOK_SQL
- end
- def buttons2
- <<-'WOK_SQL'
- <br />
- <input type="checkbox" name="echo" #{@checked_echo}> echo query
- <input type="checkbox" name="stats" #{@checked_stats}> result stats
- <input type="checkbox" name="url" #{@checked_url}> search url
- <input type="checkbox" name="searched" #{@checked_searched}> searched
- <input type="checkbox" name="tip" #{@checked_tip}> available fields
- <input type="checkbox" name="sql" #{@checked_sql}> sql statement
- <br />
- checks:
- <input type="radio" name="checks" value="check_default" #{@checked_default}> default
- <input type="radio" name="checks" value="check_selected" #{@checked_selected}> selected
- <input type="radio" name="checks" value="check_all" #{@checked_all}> all
- <input type="radio" name="checks" value="check_none" #{@checked_none}> none
- </font>
- </td></tr>
- </table>
- </form>
- WOK
- end
- end
- WOK_SQL
- end
- def search_request
- <<-'WOK_SQL'
- 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=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=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
- WOK_SQL
- end
- def pages
- <<-'WOK_SQL'
- 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 + '&ltd=' + sql_limit.to_s + '&off=' + sql_offset.to_s
- end
- def next
- @@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_next.to_s
- end
- def previous
- @offset_previous >= 0 \
- ? (@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) \
- : ''
- end
- def start
- @@canned_search_url.to_s + '&ltd=' + sql_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_limit.to_i)/sql_limit.to_i
- if beyond_limit
- if page.to_s =~ /^1$/
- %{<hr /><br /><center>
- pg. #{page.to_s}
- <a href="#{can.next}">
- <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
- </a>
- </center>}
- elsif page.to_s =~ /^2$/
- %{<hr /><br /><center>
- <a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
- </a>
- pg. #{page.to_s}
- <a href="#{can.next}">
- <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
- </a>
- </center>}
- else
- %{<hr /><br /><center>
- <a href="#{can.start}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|&lt;&nbsp;" />
- </a>
- <a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
- </a>
- pg. #{page.to_s}
- <a href="#{can.next}">
- <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
- </a>
- </center>}
- end
- else
- if page.to_s =~ /^1$/; ''
- elsif page.to_s =~ /^2$/
- %{<hr /><br /><center>
- <a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
- </a>
- pg. #{page.to_s}
- </center>}
- else
- %{<hr /><br /><center>
- <a href="#{can.start}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|&lt;&nbsp;" />
- </a>
- <a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
- </a>
- pg. #{page.to_s}
- </center>}
- end
- end
- end
- WOK_SQL
- end
- def tail
- v=SiSU_Env::Info_version.instance.get_version
- <<-WOK_SQL
- def tail
- <<-'WOK'
- <br /><hr /><br />
-<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="2" border="0">
- <!-- widget sisu -->
-<tr><td valign="top" width="10%">
- <p class="tiny_left"><font color="#666666" size="2">
- <a href="http://www.jus.uio.no/sisu" >
- <img border="0" src="#{@image_src}/sisu.png" alt="SiSU" width="120" height="39" />
- </a>
- </font></p>
-</td><td valign="top" width="45%">
-<!-- SiSU Rights -->
- <p class="tiny_left"><font color="#666666" size="2">
- Generated by
- <a href="http://www.jus.uio.no/sisu" >
- #{v[:project]}</a> #{v[:version]} #{v[:date]} (#{v[:date_stamp]})
- <br />
- <a href="http://www.jus.uio.no/sisu" >
- <b>#{v[:project]}</b></a> <sup>&copy;</sup> Ralph Amissah
- 1993, current 2010.
- All Rights Reserved.
- <br />
- <a href="http://www.jus.uio.no/sisu" >
- #{v[:project]}</a>
- is software for document structuring, publishing and search,
- <br />
- <a href="http://www.jus.uio.no/sisu" >
- www.jus.uio.no/sisu
- </a>
- and
- <a href="http://www.sisudoc.org" >
- www.sisudoc.org
- </a>
- <br />
- <i>w3 since October 3 1993</i>
- <a href="mailto://ralph@amissah.com" >
- ralph@amissah.com
- </a>
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- #{v[:project]} using:
- <br />Standard SiSU markup syntax,
- <br />Standard SiSU meta-markup syntax, and the
- <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system)
- <br />
- <sup>&copy;</sup> Ralph Amissah 1997, current 2010.
- All Rights Reserved.
- </font></p>
-</td></tr>
- <!-- widget way better -->
-<tr><td valign="top" width="10%">
- <p class="tiny_left"><font color="#666666" size="2">
- <a href="http://www.gnu.org/licenses/gpl.html">
- <img border="0" src="#{@image_src}/gplv3_free_software.png" alt="GPLv3" width="127" height="51" />
- </a>
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- SiSU is released under
- <a href="http://www.gnu.org/licenses/gpl.html">GPL&nbsp;v3</a>
- or later,
- <a href="http://www.gnu.org/licenses/gpl.html">
- http://www.gnu.org/licenses/gpl.html
- </a>
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- #{v[:project]}, developed using
- <a href="http://www.ruby-lang.org/en/">
- Ruby
- </a>
- on
- <a href="http://www.debian.org/">
- Debian/Gnu/Linux
- </a>
- software infrastructure,
- with the usual GPL (or OSS) suspects.
- <br />
- Better - "performance, reliability, scalability, security &amp; total cost of ownership"
- [not to mention flexibility &amp; choice] use of and adherence to open standards (where practical and fair) and it is software libré.
- <br />
- Get With the Future
- <a href="http://www.jus.uio.no/sisu/">
- Way Better!
- </a>
- </font></p>
-</td></tr>
-</table>
- <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a>
- </body></html>
- 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=/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
- 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.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}?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|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=%{<font size="2" color="#004000">}
- canned_search_url_txt=CGI.escapeHTML(@@canned_search_url)
- the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />}
- p_text=p_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}</font><br />} if @search_for.text1 =~/\S+/
- p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br />} if @search_for.keywords =~/\S+/
- p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/
- p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/
- p_subject=%{subject: #{green}#{@search_for.subject}</font><br />} if @search_for.subject =~/\S+/
- p_description=%{description: #{green}#{@search_for.description}</font><br />} if @search_for.description =~/\S+/
- p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br />} if @search_for.publisher =~/\S+/
- p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/
- p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/
- p_type=%{type: #{green}#{@search_for.type}</font><br />} if @search_for.type =~/\S+/
- p_format=%{format: #{green}#{@search_for.format}</font><br />} if @search_for.format =~/\S+/
- p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br />} if @search_for.identifier =~/\S+/
- p_source=%{source: #{green}#{@search_for.source}</font><br />} if @search_for.source =~/\S+/
- p_language=%{language: #{green}#{@search_for.language}</font><br />} if @search_for.language =~/\S+/
- p_relation=%{relation: #{green}#{@search_for.relation}</font><br />} if @search_for.relation =~/\S+/
- p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br />} if @search_for.coverage =~/\S+/
- p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/
- p_comment=%{comment: #{green}#{@search_for.comment}</font><br />} if @search_for.comment =~/\S+/
- p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br />} if @search_for.abstract =~/\S+/
- p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/
- search_note=<<-WOK
- <font size="2" color="#666666">
- <b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font>
- <b>search string:</b> "#{green}#{analyze_format}</font>"<br />
- #{p_text} #{p_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}
- </font>
- WOK
- #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />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 << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body
- @endnotes << '<p><hr><br /><b>Endnotes:</b><br />' << sql_select_endnotes
- else
- end
- #text_objects_body
- s_contents.each do |c| #% text body
- location=c['filename'][/(.+?)\.(?:ssm\.sst|sst)$/,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/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- end
- title=%{<span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix
- if @text_search_flag; title='<br /><hr>'+title
- else title='<br />'+title
- end
- @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|
- 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(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})
- else c['body']
- end
- %{<hr><p><font size="2">ocn <b><a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}}
- elsif c['suffix'] =~/1/ #doc
- %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}}
- end
- @counter_txt_ocn+=1
- output=if c['seg'] =~/\S+/; title+text
- else text
- end
- else #elsif cgi['view']=~/index/ #% idx body
- if c['suffix'] !~/1/ #seg
- index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag
- elsif c['suffix'] =~/1/ #doc
- index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, }
- 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_limit='over the limit set of'
- over_this_number='more than'
- true
- else
- over_limit,over_this_number='',''
- false
- end
- %{<hr /><font size="2" color="#666666">Found in the main body of #{over_this_number} #{@counter_txt_doc} documents, and at #{over_limit} #{@counter_txt_ocn} locations within.</font><br />}
- else ''
- end
- else ''
- end
- @body_main << output #+ details
- end
- #text_objects_endnote
- oldtid = 0
- s_endnotes.each do |e| #% endnotes
- location=e['filename'][/(.+?)\.(?:ssm\.sst|sst)$/,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/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
- end
- title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a>&nbsp;&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/
- @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=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/)
- matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})
- else e['body']
- end
- output=%{#{title}<hr><font size="2">note <b><a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
- else #elsif cgi['view']=~/index/ #% idx endnotes
- @counter_endn_ocn+=1
- output=%{#{title}<a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [&sect; <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], }
- 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_limit='over the limit set of'
- over_this_number='more than'
- true
- else
- over_limit,over_this_number='',''
- false
- end
- %{<font size="2" color="#666666">Found in the endnotes of #{over_this_number} #{@counter_endn_doc} documents, and at #{over_limit} #{@counter_endn_ocn} locations within.</font><br />}
- 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.pre_next(true,@image_src).to_s
- else
- dbi_statement.pre_next(false,@image_src).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='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
- s << CGI::escapeHTML(e.message) + '</pre>'
- 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/v1/cgi_sqlite.rb b/lib/sisu/v1/cgi_sqlite.rb
deleted file mode 100644
index 6f0bec06..00000000
--- a/lib/sisu/v1/cgi_sqlite.rb
+++ /dev/null
@@ -1,217 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: generates naive cgi search form for search of sisu database (pgsql sqlite)
-
-=end
-module SiSU_CGI_sqlite #% database building documents
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/cgi_sql_common"
- 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 << %{ <option value="SiSU_#{x}">#{x}</option>\n}
- end
- f2 << %{ selected_db=case cgi['db']\n}
- serve.each do |x|
- f2 << %{ when /SiSU_#{x}/; '<option value="SiSU_#{x}">#{x}</option>'\n}
- end
- f2 << " end\n"
- #f3
- f3 << %{ db_name='sisu_sqlite.db'\n}
- f3 << %{ db_sqlite=case cgi['db']\n}
- serve.each do |x|
- f3 << %{ when /SiSU_#{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)
- }
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a)
- tell.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)'
- tell=SiSU_Screen::Ansi.new(@opt.cmd,a,b)
- tell.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}"
- 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!(/(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.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.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
- %{<font color="#666666" size="2">#{sql_select_body}</font>}
- end
- def sql_select_endnotes_format
- %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
- 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/v1/character_encoding.rb b/lib/sisu/v1/character_encoding.rb
deleted file mode 100644
index 202cdcaf..00000000
--- a/lib/sisu/v1/character_encoding.rb
+++ /dev/null
@@ -1,381 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules related to locales, character encoding for different
- output generators [requires kirbybase]
-
-=end
-module SiSU_character_encode
- require 'kirbybase'
- require "#{SiSU_lib}/sysenv"
- class Characters
- attr_accessor(:character_encoding,:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- def initialize(&block)
- instance_eval(&block)
- end
- end
- class Create <Characters
- def initialize
- #NOTE places character_encoding.tbl in correct subdirectory ./_sisu_processing/encoding
- #@env=SiSU_Env::Info_env.new
- #env=@env.path.encoding
- #@db=KirbyBase.new(:local,nil,nil,env)
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.create_table.documents(:character_encoding, :glyph,:String, :dec,:Integer, :hex,:String, :rb,:String, :html,:String, :html_name,:String, :tex,:String, :tex_licr,:String, :tex_alt,:String, :name,:String)
- end
- def db
- x=Character_encoding.new.table
- #x.each {|y| puts y[2].inspect}
- x.each do |c|
- #puts "#{c[0]}, #{c[1]}, #{c[2]}, #{c[3]}, #{c[4]}, #{c[5]}, #{c[6]}, #{c[7]}, #{c[8]}, #{c[9]}"
- @ce_tbl.insert(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9])
- end
- end
- end
- class Query
- def initialize(find='',show='')
- #NOTE character_encoding.tbl not read from subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.get_table(:character_encoding)
- @find=find
- end
- def selected(selected,show)
- @y=[]
- selected.each do |x|
- @y<<case show
- when 'glyph'; x.glyph
- when 'dec'; x.dec
- when 'hex'; x.hex
- when 'rb'; x.rb
- when 'html'; x.html
- when 'html_name'; x.html_name
- when 'tex'; x.tex
- when 'ot1'; x.ot1
- when 'ts1'; x.ts1
- when 'name'; x.name
- else x.hex
- end
- end
- #@ce_tbl.select(:glyph,:name) { |r| r.hex == hex }.each do |r|
- # puts '%s %s' % [r.glyph, r.name]
- #end
- #:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name
- #list=['number','glyph','html','hex','rb','tex','ot1','ts1','name']
- end
- def hex(hex,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.hex == hex }
- selected(select,show)
- @y
- end
- def dec(dec,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.dec == dec }
- selected(select,show)
- @y
- end
- def name(name,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.name =~ /#{name}/ }
- selected(select,show)
- @y
- end
- def report
- puts @ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name).to_report
- end
- def table
- selected=@ce_tbl.select
- #selected=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- selected.each do |c|
- puts '%s %s %s %s %s %s %s %s %s %s' % [c.glyph,c.dec,c.hex,c.rb,c.html,c.html_name,c.tex,c.tex_licr,c.tex_alt,c.name]
- #puts "#{c.glyph}, #{c.dec}, #{c.hex}, #{c.rb}, #{c.html}, #{c.name}, #{c.tex}, #{c.tec_licr}, #{c.tex_alt}, #{c.c_name}"
- end
- end
- end
- class Character_encoding
- def table
- x=[]
-#:glyph, :dec,:hex, :rb, :xml , :html_name, :tex, :tex_licr, :tex_alt, :name
- x=[
- ['', 9, '', '', '&#009;', nil, '', '', '', 'Horizontal tab' ],
- ['', 15, '', '', '&#015;', nil, '', '', '', 'Line feed' ],
- ['', 17, '', '', '&#017;', nil, '', '', '', 'Carriage return' ],
- [' ', 32, '40', '\40', '&#032;', nil, '', '', '', 'Space' ],
- ['!', 33, '41', '\41', '&#033;', nil, '!', '!', '!', 'Punctuation Exclamation !' ],
- ['', 34, '42', '\42', '&#034;', '&quot;', '', '', '', 'Punctuation Quotation mark' ],
- ['#', 35, '43', '\43', '&#035;', nil, '{\#}', '\#', '', 'Hash mark #' ],
- ['$', 36, '44', '\44', '&#036;', nil, '{\$}', '\textdollar', '', 'Dollar sign $' ],
- ['%', 37, '45', '\45', '&#037;', nil, '{\%}', '\%', '', 'Percent sign %' ],
- ['&', 38, '46', '\46', '&#038;', '&amp;', '{\&}', '\&', '', 'Ampersand &' ],
- ['\'', 39, '47', '\47', '&#039;', nil, '', '', '', 'Apostrophe \''],
- ['(', 40, '50', '\50', '&#040;', nil, '', '', '', 'Left parenthesis (' ],
- [')', 41, '51', '\51', '&#041;', nil, '', '', '', 'Right parenthesis )' ],
- ['*', 42, '52', '\52', '&#042;', nil, '', '', '', 'Asterisk *' ],
- ['+', 43, '53', '\53', '&#043;', nil, '', '', '', 'Plus sign +' ],
- [',', 44, '54', '\54', '&#044;', nil, ',', ',', ',', 'Puncutation Comma ,' ],
- ['-', 45, '55', '\55', '&#045;', nil, '-', '-', '-', 'Puncutation Hyphen -' ],
- ['.', 46, '56', '\56', '&#046;', nil, '.', '.', '.', 'Puncutation Period .' ],
- ['/', 47, '57', '\57', '&#047;', nil, '/', '/', '/', 'Puncutation Slash /' ],
- ['0', 48, '60', '\60', '&#048;', nil, '0', '0', '0', 'Digit zero 0' ],
- ['1', 49, '61', '\61', '&#049;', nil, '1', '1', '1', 'Digit one 1' ],
- ['2', 50, '62', '\62', '&#050;', nil, '2', '2', '2', 'Digit two 2' ],
- ['3', 51, '63', '\63', '&#051;', nil, '3', '3', '3', 'Digit three 3' ],
- ['4', 52, '64', '\64', '&#052;', nil, '4', '4', '4', 'Digit four 4' ],
- ['5', 53, '65', '\65', '&#053;', nil, '5', '5', '5', 'Digit five 5' ],
- ['6', 54, '66', '\66', '&#054;', nil, '6', '6', '6', 'Digit six 6' ],
- ['7', 55, '67', '\67', '&#055;', nil, '7', '7', '7', 'Digit seven 7' ],
- ['8', 56, '70', '\70', '&#056;', nil, '8', '8', '8', 'Digit eight 8' ],
- ['9', 57, '71', '\71', '&#057;', nil, '9', '9', '9', 'Digit nine 9' ],
- [':', 58, '72', '\72', '&#058;', nil, '', '', '', 'Punctuation Colon :' ],
- [';', 59, '73', '\73', '&#059;', nil, '', '', '', 'Punctuation Semicolon ;' ],
- ['<', 60, '74', '\74', '&#060;', '&lt;', '', '', '', 'Less than <' ],
- ['=', 61, '75', '\75', '&#061;', nil, '', '', '', 'Equals sign =' ],
- ['>', 62, '76', '\76', '&#062;', '&gt;', '', '', '', 'Greater than >' ],
- ['?', 63, '77', '\77', '&#063;', nil, '?', '?', '?', 'Punctuation Question mark ?' ],
- ['@', 64, '100', '\100', '&#064;', nil, '', '', '', 'Commercial at sign @' ],
- ['A', 65, '101', '\101', '&#065;', nil, 'A', 'A', 'A', 'Captial A' ],
- ['B', 66, '102', '\102', '&#066;', nil, 'B', 'B', 'B', 'Captial B' ],
- ['C', 67, '103', '\103', '&#067;', nil, 'C', 'C', 'C', 'Captial C' ],
- ['D', 68, '104', '\104', '&#068;', nil, 'D', 'D', 'D', 'Captial D' ],
- ['E', 69, '105', '\105', '&#069;', nil, 'E', 'E', 'E', 'Captial E' ],
- ['F', 70, '106', '\106', '&#070;', nil, 'F', 'F', 'F', 'Captial F' ],
- ['G', 71, '107', '\107', '&#071;', nil, 'G', 'G', 'G', 'Captial G' ],
- ['H', 72, '110', '\110', '&#072;', nil, 'H', 'H', 'H', 'Captial H' ],
- ['I', 73, '111', '\111', '&#073;', nil, 'I', 'I', 'I', 'Captial I' ],
- ['J', 74, '112', '\112', '&#074;', nil, 'J', 'J', 'J', 'Captial J' ],
- ['K', 75, '113', '\113', '&#075;', nil, 'K', 'K', 'K', 'Captial K' ],
- ['L', 76, '114', '\114', '&#076;', nil, 'L', 'L', 'L', 'Captial L' ],
- ['M', 77, '115', '\115', '&#077;', nil, 'M', 'M', 'M', 'Captial M' ],
- ['N', 78, '116', '\116', '&#078;', nil, 'N', 'N', 'N', 'Captial N' ],
- ['O', 79, '117', '\117', '&#079;', nil, 'O', 'O', 'O', 'Captial O' ],
- ['P', 80, '120', '\120', '&#080;', nil, 'P', 'P', 'P', 'Captial P' ],
- ['Q', 81, '121', '\121', '&#081;', nil, 'Q', 'Q', 'Q', 'Captial Q' ],
- ['R', 82, '122', '\122', '&#082;', nil, 'R', 'R', 'R', 'Captial R' ],
- ['S', 83, '123', '\123', '&#083;', nil, 'S', 'S', 'S', 'Captial S' ],
- ['T', 84, '124', '\124', '&#084;', nil, 'T', 'T', 'T', 'Captial T' ],
- ['U', 85, '125', '\125', '&#085;', nil, 'U', 'U', 'U', 'Captial U' ],
- ['V', 86, '126', '\126', '&#086;', nil, 'V', 'V', 'V', 'Captial V' ],
- ['W', 87, '127', '\127', '&#087;', nil, 'W', 'W', 'W', 'Captial W' ],
- ['X', 88, '130', '\130', '&#088;', nil, 'X', 'X', 'X', 'Captial X' ],
- ['Y', 89, '131', '\131', '&#089;', nil, 'Y', 'Y', 'Y', 'Captial Y' ],
- ['Z', 90, '132', '\132', '&#090;', nil, 'Z', 'Z', 'Z', 'Captial Z' ],
- ['[', 91, '133', '\133', '&#091;', nil, '', '', '', 'Left square bracket [' ],
- ['\\', 92, '134', '\134', '&#092;', nil, '', '\textbackslash', '', 'Backslash \\'],
- [']', 93, '135', '\135', '&#093;', nil, '', '', '', 'Right square bracket ]' ],
- ['^', 94, '136', '\136', '&#094;', nil, '', '', '', 'Caret ^' ],
- ['_', 95, '137', '\137', '&#095;', nil, '{\_}', '\textunderscore', '', 'Underscore _' ],
- ['`', 96, '140', '\140', '&#096;', nil, '', '', '', 'Grave accent `' ],
- ['a', 97, '141', '\141', '&#097;', nil, 'a', 'a', 'a', 'Small a' ],
- ['b', 98, '142', '\142', '&#098;', nil, 'b', 'b', 'b', 'Small b' ],
- ['c', 99, '143', '\143', '&#099;', nil, 'c', 'c', 'c', 'Small c' ],
- ['d', 100, '144', '\144', '&#100;', nil, 'd', 'd', 'd', 'Small d' ],
- ['e', 101, '145', '\145', '&#101;', nil, 'e', 'e', 'e', 'Small e' ],
- ['f', 102, '146', '\146', '&#102;', nil, 'f', 'f', 'f', 'Small f' ],
- ['g', 103, '147', '\147', '&#103;', nil, 'g', 'g', 'g', 'Small g' ],
- ['h', 104, '150', '\150', '&#104;', nil, 'h', 'h', 'h', 'Small h' ],
- ['i', 105, '151', '\151', '&#105;', nil, 'i', 'i', 'i', 'Small i' ],
- ['j', 106, '152', '\152', '&#106;', nil, 'j', 'j', 'j', 'Small j' ],
- ['k', 107, '153', '\153', '&#107;', nil, 'k', 'k', 'k', 'Small k' ],
- ['l', 108, '154', '\154', '&#108;', nil, 'l', 'l', 'l', 'Small l' ],
- ['m', 109, '155', '\155', '&#109;', nil, 'm', 'm', 'm', 'Small m' ],
- ['n', 110, '156', '\156', '&#110;', nil, 'n', 'n', 'n', 'Small n' ],
- ['o', 111, '157', '\157', '&#111;', nil, 'o', 'o', 'o', 'Small o' ],
- ['p', 112, '160', '\160', '&#112;', nil, 'p', 'p', 'p', 'Small p' ],
- ['q', 113, '161', '\161', '&#113;', nil, 'q', 'q', 'q', 'Small q' ],
- ['r', 114, '162', '\162', '&#114;', nil, 'r', 'r', 'r', 'Small r' ],
- ['s', 115, '163', '\163', '&#115;', nil, 's', 's', 's', 'Small s' ],
- ['t', 116, '164', '\164', '&#116;', nil, 't', 't', 't', 'Small t' ],
- ['u', 117, '165', '\165', '&#117;', nil, 'u', 'u', 'u', 'Small u' ],
- ['v', 118, '166', '\166', '&#118;', nil, 'v', 'v', 'v', 'Small v' ],
- ['w', 119, '167', '\167', '&#119;', nil, 'w', 'w', 'w', 'Small w' ],
- ['x', 120, '170', '\170', '&#120;', nil, 'x', 'x', 'x', 'Small x' ],
- ['y', 121, '171', '\171', '&#121;', nil, 'y', 'y', 'y', 'Small y' ],
- ['z', 122, '172', '\172', '&#122;', nil, 'z', 'z', 'z', 'Small z' ],
- ['{', 123, '173', '\173', '&#123;', nil, '{\{}', '\{', '', 'Left curly brace {' ],
- ['|', 124, '174', '\174', '&#124;', nil, '', '', '', 'Vertical bar / pipe |' ],
- ['}', 125, '175', '\175', '&#125;', nil, '{\}}', '\}', '', 'Right curly brace }' ],
- ['~', 126, '176', '\176', '&#126;', nil, '', '', '', 'Tilde ~' ],
- ['', 127, '177', '', '&#127;', nil, '', '', '', ' ' ],
- ['', 128, '200', '', '&#128;', nil, '', '', '', ' ' ],
- ['', 129, '201', '', '&#129;', nil, '', '', '', ' ' ],
- ['\'', 130, '202', '', '&#130;', nil, '', '', '', 'Low left single quote \''],
- [' ', 131, '203', '', '&#131;', nil, '', '', '', 'Florin ' ],
- ['"', 132, '204', '', '&#132;', nil, '', '', '', 'Low left double quote "' ],
- ['…', 133, '205', '\342\200\246', '&#133;', nil, '…', '\textellipsis', '', 'Ellipsis …' ],
- ['†', 134, '206', '\342\200\240', '&#134;', nil, '†', '\textdagger', '', 'Dagger †' ],
- ['‡', 135, '207', '\342\200\241', '&#135;', nil, '‡', '\textdaggerbl', '', 'Double dagger ‡' ],
- ['^', 136, '210', '', '&#136;', nil, '', '', '', 'Circumflex ^' ],
- ['', 137, '211', '', '&#137;', nil, '', '', '', 'Permil ' ],
- ['', 138, '212', '', '&#138;', nil, '', '', '', 'Capital S, caron ' ],
- ['<', 139, '213', '', '&#139;', nil, '', '', '', 'Less than sign (see &060;) <' ],
- ['', 140, '214', '', '&#140;', nil, '', '', '', 'Capital OE ligature ' ],
- ['', 141, '215', '', '&#141;', nil, '', '', '', ' ' ],
- ['', 142, '216', '', '&#142;', nil, '', '', '', 'Capital Z, caron ' ],
- ['', 143, '217', '', '&#143;', nil, '', '', '', ' ' ],
- ['', 144, '220', '', '&#144;', nil, '', '', '', ' ' ],
- ['', 145, '221', '', '&#145;', nil, '', '', '', 'Left single quote ' ],
- ['', 146, '222', '', '&#146;', nil, '', '', '', 'Right single quote ' ],
- ['', 147, '223', '', '&#147;', nil, '', '', '', 'Left double quote ' ],
- ['', 148, '224', '', '&#148;', nil, '', '', '', 'Right double quote ' ],
- ['', 149, '225', '', '&#149;', nil, '', '', '', 'Bullet ' ],
- ['-', 150, '226', '', '&#150;', nil, '', '', '', 'En dash -' ],
- ['', 151, '227', '', '&#151;', nil, '', '', '', 'Em dash -' ],
- ['~', 152, '230', '', '&#152;', nil, '', '', '', 'Tilde (see &126;) ~' ],
- ['t', 153, '231', '', '&#153;', nil, '', '', '', 'Trademark t' ],
- ['', 154, '232', '', '&#154;', nil, '', '', '', 'small s, caron ' ],
- ['', 155, '233', '', '&#155;', nil, '', '', '', 'Greater than sign (see &062;) ' ],
- ['', 156, '234', '', '&#156;', nil, '', '', '', 'Small oe ligature ' ],
- ['', 157, '235', '', '&#157;', nil, '', '', '', ' ' ],
- ['', 158, '236', '', '&#158;', nil, '', '', '', 'Small z, caron ' ],
- ['', 159, '237', '', '&#159;', nil, '', '', '', 'Capital Y, umlaut ' ],
- ['', 160, '240', '', '&#160;', '&nbsp;', '', '', '', 'Non-breaking space ' ],
- ['¡', 161, '241', '\302\241', '&#161;', '&iexcl;', '¡', '', '', 'Inverted exclamation ' ],
- ['¢', 162, '242', '\302\242', '&#162;', '&cent;', '¢', '', '', 'Cent sign ¢' ],
- ['£', 163, '243', '\302\243', '&#163;', '&pound;', '£', '\textsterling', '', 'Pound sign £' ],
- ['¤', 164, '244', '\302\244', '&#164;', '&curren;', '¤', '\textcurrency', '', 'General currency sign ' ],
- ['¥', 165, '245', '\302\245', '&#165;', '&yen;', '¥', '', '', 'Yen sign ¥' ],
- ['¦', 166, '246', '\302\246', '&#166;', '&brvbar;', '¦', '', '', 'Broken vertical bar ' ],
- ['§', 167, '247', '\302\247', '&#167;', '&sect;', '§', '\textsection', '', 'Section sign §' ],
- ['¨', 168, '250', '\302\250', '&#168;', '&uml;', '¨', '\"', '', 'Umlaut ' ],
- ['©', 169, '251', '\302\251', '&#169;', '&copy;', '©', '\copyright', '\textcopyright', 'Copyright ©' ],
- ['ª', 170, '252', '\302\252', '&#170;', '&ordf;', 'ª', '', '', 'Feminine ordinal ª' ],
- ['«', 171, '253', '\302\253', '&#171;', '&laquo;', '«', '', '', 'Left angle quote «' ],
- ['¬', 172, '254', '\302\254', '&#172;', '&not;', '¬', '', '', 'Not sign ' ],
- ['­', 173, '255', '\302\255', '&#173;', '&shy;', '­', '', '', 'Soft hyphen ' ],
- ['®', 174, '256', '\302\256', '&#174;', '&reg;', '®', '', '', 'Registered trademark ®' ],
- ['¯', 175, '257', '\302\257', '&#175;', '&macr;', '¯', '', '', 'Macron accent ' ],
- ['°', 176, '260', '\302\260', '&#176;', '&deg;', '°', '', '', 'Degree sign °' ],
- ['±', 177, '261', '\302\261', '&#177;', '&plusmin;', '±', '', '', 'Plus or minus ±' ],
- ['²', 178, '262', '\302\262', '&#178;', '&sup2;', '²', '', '', 'Superscript 2 ²' ],
- ['³', 179, '263', '\302\263', '&#179;', '&sup3;', '³', '', '', 'Superscript 3 ³' ],
- ['', 180, '264', '\302\264', '&#180;', '&acute;', ''', '', '', 'Acute accent ' ],
- ['µ', 181, '265', '\302\265', '&#181;', '&micro;', 'µ', '', '', 'Micro sign (Greek mu) µ' ],
- ['¶', 182, '266', '\302\266', '&#182;', '&para;', '¶', '\textparagraph', '', 'Paragraph sign ¶' ],
- ['·', 183, '267', '\302\267', '&#183;', '&middot;', %q{·}, '', %q{}, 'Middle dot ' ],
- ['¸', 184, '270', '\302\270', '&#184;', '&cedil;', '¸', '', '', 'Cedilla ' ],
- ['¹', 185, '271', '\302\271', '&#185;', '&sup1;', '¹', '', '', 'Superscript 1 ¹' ],
- ['º', 186, '272', '\302\272', '&#186;', '&ordm;', 'º', '', '', 'Masculine ordinal º' ],
- ['»', 187, '273', '\302\273', '&#187;', '&raquo;', '»', '', '', 'Right angle quote ' ],
- ['¼', 188, '274', '\302\274', '&#188;', '&frac14;', '¼', '', '', 'Fraction one quarter ¼' ],
- ['½', 189, '275', '\302\275', '&#189;', '&frac12;', '½', '', '', 'Fraction on half ½' ],
- ['¾', 190, '276', '\302\276', '&#190;', '&frac34;', '¾', '', '', 'Fraction three quarters ¾' ],
- ['¿', 191, '277', '\302\277', '&#191;', '&iquest;', '¿', '', '', 'Inverted question mark ¿' ],
- ['À', 192, '300', '\303\200', '&#192;', '&Agrave;', 'À', '\`{A}', '', 'Capital A, grave accent À' ],
- ['Á', 193, '301', '\303\201', '&#193;', '&Aacute;', 'Á', %q{\'{A}}, '', 'Capital A, acute accent Á' ],
- ['Â', 194, '302', '\303\202', '&#194;', '&Acirc;', 'Â', '^{A}', '', 'Capital A, circumflex accent Â' ],
- ['Ã', 195, '303', '\303\203', '&#195;', '&Atilde;', 'Ã', '~{A}', '', 'Capital A, tilde Ã' ],
- ['Ä', 196, '304', '\303\204', '&#196;', '&Auml;', 'Ä', '"{A}', '', 'Capital A, umlaut Ä' ],
- ['Å', 197, '305', '\303\205', '&#197;', '&Aring;', 'Å', 'r{A}', '', 'Capital A, ring Å' ],
- ['Æ', 198, '306', '\303\206', '&#198;', '&AElig;', 'Æ', 'AE', '', 'Capital AE ligature Æ' ],
- ['Ç', 199, '307', '\303\207', '&#199;', '&Ccedil;', 'Ç', '', '', 'Capital C, cedilla Ç' ],
- ['È', 200, '310', '\303\210', '&#200;', '&Egrave;', 'È', '`{E}', '', 'Capital E, grave accent È' ],
- ['É', 201, '311', '\303\211', '&#201;', '&Eacute;', 'É', ''{E}', '', 'Capital E, acute accent É' ],
- ['Ê', 202, '312', '\303\212', '&#202;', '&Ecirc;', 'Ê', '^{E}', '', 'Capital E, circumflex accent Ê' ],
- ['Ë', 203, '313', '\303\213', '&#203;', '&Euml;', 'Ë', '"{E}', '', 'Capital E, umlaut Ë' ],
- ['Ì', 204, '314', '\303\214', '&#204;', '&Igrave;', 'Ì', '`{I}', '', 'Capital I, grave accent Ì' ],
- ['Í', 205, '315', '\303\215', '&#205;', '&Iacute;', 'Í', ''{I}', '', 'Capital I, acute accent Í' ],
- ['Î', 206, '316', '\303\216', '&#206;', '&Icirc;', 'Î', '^{I}', '', 'Capital I, circumflex accent Î' ],
- ['Ï', 207, '317', '\303\217', '&#207;', '&Iuml;', 'Ï', '"{I}', '', 'Capital I, umlaut Ï' ],
- ['Ð', 208, '320', '\303\220', '&#208;', '&ETH;', 'Ð', '', '', 'Capital eth, Icelandic ' ],
- ['Ñ', 209, '321', '\303\221', '&#209;', '&Ntilde;', 'Ñ', '', '', 'Capital N, tilde Ñ' ],
- ['Ò', 210, '322', '\303\222', '&#210;', '&Ograve;', 'Ò', '`{O}', '', 'Capital O, grave accent Ò' ],
- ['Ó', 211, '323', '\303\223', '&#211;', '&Oacute;', 'Ó', ''{O}', '', 'Capital O, acute accent Ó' ],
- ['Ô', 212, '324', '\303\224', '&#212;', '&Ocirc;', 'Ô', '^{O}', '', 'Capital O, circumflex accent Ô' ],
- ['Õ', 213, '325', '\303\225', '&#213;', '&Otilde;', 'Õ', '~{O}', '', 'Capital O, tilde Õ' ],
- ['Ö', 214, '326', '\303\226', '&#214;', '&Ouml;', 'Ö', '"{O}', '', 'Capital O, umlaut Ö' ],
- ['×', 215, '327', '\303\227', '&#215;', '&times;', '×', '', '', 'Multiply sign ×' ],
- ['Ø', 216, '330', '\303\230', '&#216;', '&Oslash;', 'Ø', 'O', '', 'Capital O, slash Ø' ],
- ['Ù', 217, '331', '\303\231', '&#217;', '&Ugrave;', 'Ù', '', '', 'Capital U, grave accent Ù' ],
- ['Ú', 218, '332', '\303\232', '&#218;', '&Uacute;', 'Ú', '', '', 'Capital U, acute accent Ú' ],
- ['Û', 219, '333', '\303\233', '&#219;', '&Ucirc;', 'Û', '', '', 'Capital U, circumflex accent Û' ],
- ['Ü', 220, '334', '\303\234', '&#220;', '&Uuml;', 'Ü', '', '', 'Capital U, umlaut Ü' ],
- ['Ý', 221, '335', '\303\235', '&#221;', '&Yacute;', 'Ý', '', '', 'Capital Y, acute accent Ý' ],
- ['Þ', 222, '336', '\303\236', '&#222;', '&THORN;', 'Þ', '', '', 'Capital thorn, Icelandic Þ' ],
- ['ß', 223, '337', '\303\237', '&#223;', '&szlig;', 'ß', '', '', 'Small sz ligature, German ß' ],
- ['à', 224, '340', '\303\240', '&#224;', '&agrave;', 'à', '\`{a}', '', 'Small a, grave accent à' ],
- ['á', 225, '341', '\303\241', '&#225;', '&aacute;', 'á', %q{\'{a}}, '', 'Small a, acute accent á' ],
- ['â', 226, '342', '\303\242', '&#226;', '&acirc;', 'â', '\^{a}', '', 'Small a, circumflex accent â' ],
- ['ã', 227, '343', '\303\243', '&#227;', '&atilde;', 'ã', '\~{a}', '', 'Small a, tilde ã' ],
- ['ä', 228, '344', '\303\244', '&#228;', '&auml;', 'ä', '\"{a}', '', 'Small a, umlaut ä' ],
- ['å', 229, '345', '\303\245', '&#229;', '&aring;', 'å', '\r{a}', '', 'Small a, ring å' ],
- ['æ', 230, '346', '\303\246', '&#230;', '&aelig;', 'æ', '\ae', '', 'Small ae ligature æ' ],
- ['ç', 231, '347', '\303\257', '&#231;', '&ccedil;', 'ç', '', '', 'Small c, cedilla ç' ],
- ['è', 232, '350', '\303\250', '&#232;', '&egrave;', 'è', '\`{e}', '', 'Small e, grave accent è' ],
- ['é', 233, '351', '\303\251', '&#233;', '&eacute;', 'é', %q{\'{e}}, '', 'Small e, acute accent é' ],
- ['ê', 234, '352', '\303\252', '&#234;', '&ecirc;', 'ê', '\^{e}', '', 'Small e, circumflex accent ê' ],
- ['ë', 235, '353', '\303\253', '&#235;', '&euml;', 'ë', '\"{e}', '', 'Small e, umlaut ë' ],
- ['ì', 236, '354', '\303\254', '&#236;', '&igrave;', 'ì', '\`{i}', '', 'Small i, grave accent ì' ],
- ['í', 237, '355', '\303\255', '&#237;', '&iacute;', 'í', '\'{i}', '', 'Small i, acute accent í' ],
- ['î', 238, '356', '\303\256', '&#238;', '&icirc;', 'î', '\^{i}', '', 'Small i, circumflex accent î' ],
- ['ï', 239, '357', '\303\257', '&#239;', '&iuml;', 'ï', '\"{i}', '', 'Small i, umlaut ï' ],
- ['ð', 240, '360', '\303\260', '&#240;', '&eth;', 'ð', '', '', 'Small eth, Icelandic ð' ],
- ['ñ', 241, '361', '\303\261', '&#241;', '&ntilde;', 'ñ', '', '', 'Small n, tilde ñ' ],
- ['ò', 242, '362', '\303\262', '&#242;', '&ograve;', 'ò', '\`{o}', '', 'Small o, grave accent ò' ],
- ['ó', 243, '363', '\303\263', '&#243;', '&oacute;', 'ó', %q{\'{o}}, '', 'Small o, acute accent ó' ],
- ['ô', 244, '364', '\303\264', '&#244;', '&ocirc;', 'ô', '\^{o}', '', 'Small o, circumflex accent ô' ],
- ['õ', 245, '365', '\303\265', '&#245;', '&otilde;', 'õ', '\^{o}', '', 'Small o, tilde õ' ],
- ['ö', 246, '366', '\303\266', '&#246;', '&ouml;', 'ö', '\"{o}', '', 'Small o, umlaut ö' ],
- ['÷', 247, '367', '\303\267', '&#247;', '&divide;', '÷', '', '', 'Divide sign ÷' ],
- ['ø', 248, '370', '\303\270', '&#248;', '&oslash;', 'ø', '', '', 'Small o, slash ø' ],
- ['ù', 249, '371', '\303\271', '&#249;', '&ugrave;', 'ù', '\`{u}', '', 'Small u, grave accent ù' ],
- ['ú', 250, '372', '\303\272', '&#250;', '&uacute;', 'ú', %q{\'{u}}, '', 'Small u, acute accent ú' ],
- ['û', 251, '373', '\303\273', '&#251;', '&ucirc;', 'û', '\^{u}', '', 'Small u, circumflex accent û' ],
- ['ü', 252, '374', '\303\274', '&#252;', '&uuml;', 'ü', '\"{u}', '', 'Small u, umlaut ü' ],
- ['ý', 253, '375', '\303\275', '&#253;', '&yacute;', 'ý', '', '', 'Small y, acute accent ý' ],
- ['þ', 254, '376', '\303\276', '&#254;', '&thorn;', 'þ', '', '', 'Small thorn, Icelandic þ' ],
- ['ÿ', 255, '377', '\303\277', '&#255;', '&yuml;', 'ÿ', '', '', 'Smally y, umlaut ÿ' ],
- ['∝', , '', '', '&#8733;', '&prop;', '∝', '', '', 'proportional to U+221D (8733) ∝' ],
- ['∞', , '', '', '&#8734;', '&infin;', '∞', '', '', 'infinity U+221E (8734) ∞' ],
-]
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/composite.rb b/lib/sisu/v1/composite.rb
deleted file mode 100644
index 9d8a1558..00000000
--- a/lib/sisu/v1/composite.rb
+++ /dev/null
@@ -1,239 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: composite documents, assemble/build documents from other
- documents or parts of marked up text
-
-=end
-module SiSU_Assemble
- require 'fileutils'
- require "#{SiSU_lib}/sysenv"
- 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))/
- #rgx_image=/([a-zA-Z0-9._-]+?\.(?: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 =~/^0~|^@\S+?:/
- i.gsub!(/\n/m,"\n% ")
- i.gsub!(/\n%\s+$/m,'')
- i.gsub!(/^0~|^@\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 =~/http:\/\// }
- end
- file
- end
- def insertions?
- data=@fns_array
- tuned_file,imagedir=[],[]
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fns)
- tell.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
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile)
- tell.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
-end
-__END__
-
diff --git a/lib/sisu/v1/concordance.rb b/lib/sisu/v1/concordance.rb
deleted file mode 100644
index c5d2820b..00000000
--- a/lib/sisu/v1/concordance.rb
+++ /dev/null
@@ -1,350 +0,0 @@
-# coding: utf-8
-=begin
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: concordance file (html concordance, wordmap, linked index of
- words in document)
-
-=end
-module SiSU_Concordance
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/html_format"
- include SiSU_HTML_Format
- require "#{SiSU_lib}/html_minitoc"
- 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=if @md.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool)
- tell.grey_title_hi unless @md.cmd =~/q/
- wordmax=@env.concord_max
- unless @md.wc_words.nil?
- if @md.wc_words < wordmax
- SiSU_Concordance::Source::Words.new(@particulars).songsheet
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})")
- tell.warn unless @md.cmd =~/q/
- end
- else
- tell=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")
- tell.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"
- require "#{SiSU_lib}/html"
- def initialize(particulars)
- @particulars,@md=particulars,particulars.md
- @data=SiSU_HTML::Source::Html_environment.new(particulars).tuned_file_instructions
- @vz=SiSU_Env::Get_init.instance.skin
- txt_path=%{#{@md.dir_out}}
- SiSU_Env::Info_skin.new(@md).select
- @fnb=@md.fnb
- @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
- @doc_details =<<WOK
-<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.full_title}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table>
-WOK
- end
- def create
- head_banner=SiSU_HTML_Format::Head_toc.new(@md)
- minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet.join("\n")
- toc='<div class="toc">' + minitoc + '</div>'
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>
- SiSU created Concordance (WordIndex) for: #{@md.full_title}
- </title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <meta name="Description" content="&nbsp;SiSU created">
- <meta name="keywords" content="word index for #{@md.full_title}">
- <meta name="generator" content="SiSU (Linux &amp; Ruby!)">
- <link rel="generator" href="http://www.jus.uio.no/sisu" />
- <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
- <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" />
- #{@vz.js_head}
-</head>
-<body>
- #{@vz.js_top}
- #{head_banner.concordance_navigation_band('pdf')}
- #{toc}
-<div class="content">
- #@doc_details
-<p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br />[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p>
-<p>(The word listing/index is Case sensitive: Capitalized words appear before lower case)</p>
- <p>
- <b>word</b> (number of occurences)<br />linked references to word within document <br />
- [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]
- </p>
- <p>
- (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [&nbsp;http://[web host]/#{@fnb}/concordance.html#your_word&nbsp;]
- </p>
-WOK
- end
- end
- class Word
- @@word_previous=''
- def initialize(word,freq)
- @word,@freq=word,freq
- end
- def html
- w=if @word.capitalize==@@word_previous
- %{\n<p class="concordance_word">#@word</p><p class="concordance_count">(#@freq)</p>\n\t<p class="concordance_object"> }
- else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html
- %{\n<p class="concordance_word"><a name="#{n}">#@word</a></p><p class="concordance_count">(#@freq)</p>\n\t<p class="concordance_object"> }
- end
- @@word_previous=@word.capitalize
- w
- end
- end
- class Words
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/html_format"
- include SiSU_HTML_Format
- require "#{SiSU_lib}/sysenv"
- include SiSU_Screen
- @@dp=nil
- def initialize(particulars)
- @particulars=particulars
- begin
- @vz=SiSU_Env::Get_init.instance.skin
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @path="#{@env.path.output}/#{@md.fnb}"
- @freq=Hash.new(0)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @rxp_to=Regexp.new("#{Mx[:id_o]}~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:id_o]}\S+?#{Mx[:id_c]}$")
- @rxp_lv1=/^#{Mx[:lv_o]}1:/
- @rxp_lv2=/^#{Mx[:lv_o]}2:/
- @rxp_lv3=/^#{Mx[:lv_o]}3:/
- @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+|&nbsp;|#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#@dp|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!
- @rgx_splitlist=%r{[—.,;:-]|#{Mx[:id_o]}\S+?#{Mx[:id_c]}}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+|#{Mx[:gr_o]}code#{Mx[:gr_o]}.+?#{Mx[:gr_o]}code-end#{Mx[:gr_o]}|<\S+?>|\w+|[a-zA-Z]+}mi
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- def songsheet
- begin
- mkdir_p(@path) unless FileTest.directory?(@path)
- @file_concordance=File.open("#@path/#{@md.fn[: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=wordlocation
- %{<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}\##@wordlocation">#@wordlocation</a>; }
- end
- def location_seg(wordlocation,show)
- @wordlocation,@show=wordlocation,show
- @sfx='.html' #used for hardlinks, previous setting @sfx='', web server takes care of suffix
- @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}#\\2") unless wordlocation.nil?
- case @wordlocation
- when @rxp_t1
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}##@show">H</a>]#@show, }
- when @rxp_t2
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}##@show">H</a>]#@show, }
- when @rxp_t3
- %{[<a href="#{@md.fnl[:pre]}doc#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}##@show">H</a>]#@show, }
- else %{<a href="#@word_location_seg">#@show</a>, }
- end
- end
- def map_para
- @seg,toy=nil,nil
- @word_map={}
- @dal_array.each do |line|
- if line !~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #lines to ignore: # are added but not part of authors substantive text; 0 are mostly machine generated
- if line =~@rxp_seg; @seg=line[@rxp_seg,1]
- end
- if line =~@rxp_to; toy=line[@rxp_to,1]
- end
- if toy =~/\d+/ \
- and toy !~/^0$/
- line=line.split(@rgx_splitlist).join(' ') #%take in word or other match
- for word in line.scan(@rgx_scanlist) #%take in word or other match
- #word.gsub!(@rxp_clean,'')
- word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}(?:http)?/,'')
- 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[:lv_o]}\d:\S*?#{Mx[:lv_c]}/,'')
- word.gsub!(/#{Mx[:pa_o]}:i\d#{Mx[:pa_c]}/,'')
- word.gsub!(/#{Mx[:id_o]}~\d+;\S+?#{Mx[:id_c]}/,'')
- 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!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_c]}/,'') #watch
- 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
- #word.downcase! if word =~lesser
- #word.capitalize! if word =~greater
- @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='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">&nbsp;scroll:&nbsp;</font><font size="1" color="#222222" face=times new roman>doc#&nbsp;</font> '
- seg=''
- @file_concordance << SiSU_Concordance::Source::Doc_title.new(@particulars).create
- alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @file_concordance << '<p>'
- alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,&nbsp;}}
- @file_concordance << '</p>'
- letter=alph.shift
- @file_concordance << %{\n<p class="letter"><a name="A">A</a></p>}
- for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase}
- f=/^(\S)/.match(word)[1]
- if letter < f.upcase
- while letter < f.upcase
- if alph.length > 0
- letter=alph.shift
- @file_concordance << %{\n<p class="letter"><a name="#{letter}">#{letter}</a></p>}
- else break
- end
- end
- end
- keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html
- if keyword !~ @rxp_excluded0
- if @word_map[word][0] =~ /\d+/
- wm=[]
- @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}}
- end
- @file_concordance << '</p>'
- end
- # special cases endnotes and header levels 1 - 3
- end
- credits=@vz.credits_sisu
- @file_concordance << %{</div><div class="content">#{credits}<div></body>\n</html>} # footer
- tell=SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}")
- tell.flow if @md.cmd =~/[MV]/
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/conf.rb b/lib/sisu/v1/conf.rb
deleted file mode 100644
index 1eee963b..00000000
--- a/lib/sisu/v1/conf.rb
+++ /dev/null
@@ -1,269 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: configuration
-
-=end
-module SiSU_Initialize
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- require "#{SiSU_lib}/relaxng"
- include SiSU_relaxng
- require "#{SiSU_lib}/css"
- include SiSU_Style
- #require "#{SiSU_lib}/remote"
- #include SiSU_Remote
- 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/
- #if @opt.cmd =~/R/
- # SiSU_Config.new(@opt).cp_remote_dirs
- #end
- 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"
- 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'
- #@path_dtd= @env.path.output + '/_sisu/dtd'
- @pwd,@home=Dir.pwd,@env.path.home
- end
- def make_homepage
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','')
- tell.colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).homepage
- end
- def cp_local_images
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','')
- tell.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
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','')
- tell.colorize if @opt.cmd =~/V/
- SiSU_Env::Create_site.new(@opt.cmd).cp_external_images
- end
- def cp_webserver_images
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','')
- tell.colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images
- SiSU_Env::Create_system_link.new.images
- end
- #def cp_remote_dirs
- # if @opt.cmd =~/R/
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images to remote server','')
- # tell.colorize unless @opt.cmd =~/q/
- # SiSU_Remote::Put.new(@opt).rsync_base
- # end
- #end
- def css
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','')
- tell.colorize unless @opt.cmd =~/q/
- SiSU_Env::Create_site.new(@opt.cmd).cp_css
- end
- def dtd
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','')
- tell.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
- #use dtd
- 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/v1/constants.rb b/lib/sisu/v1/constants.rb
deleted file mode 100644
index 8ea65b2a..00000000
--- a/lib/sisu/v1/constants.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-# coding:utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- constants
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-Sfx={:txt=>'.txt',:html=>'.html',:xhtml=>'.xhtml',:xml=>'.xml',:epub=>'.epub',:epub_xhtml=>'.xhtml',:odt=>'.odt',:pdf=>'.pdf'}
-Mx,Rx={},{}
-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]='〔','〕'
-# '1~','2~','3~','4~','5~','6~','7~','8~','9~'; Mx[:lv_c]=''
-Mx[:en_a_o]='【'; Mx[:en_a_c]='】' #Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~'
-Mx[:en_b_o]='〖'; Mx[:en_b_c]='〗' #Mx[:en_b_o]='~['; Mx[:en_b_c]=']~'
-Mx[:br_line]="#{Mx[:mk_o]}br#{Mx[:mk_c]}"
-Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark
-Mx[:id_o]='〔'; Mx[:id_c]='〕' #object id mark
-Mx[:tc_o]='『'; Mx[:tc_c]='』' #table column mark
-Mx[:tc_p]='┆' #table row/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[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}"
-#non substantive text sort: <-#> <~#>
- 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]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}"
-Mx[:br_paragraph]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}"
-Mx[:br_nl]= "#{Mx[:mk_o]}nl#{Mx[:mk_c]}"
-Mx[:br_page]= "#{Mx[:mk_o]}pb#{Mx[:mk_c]}"
-Mx[:br_page_new]= "#{Mx[:mk_o]}pn#{Mx[:mk_c]}"
-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[:sm_set_o]='《'; Mx[:sm_set_c]='》'
-Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》'
-#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]}/
-unless RUBY_VERSION < '1.9'
- Mx[:meta_o].force_encoding('utf-8'); Mx[:meta_c].force_encoding('utf-8')
- Mx[:lv_o_1].force_encoding('utf-8'); Mx[:lv_o_2].force_encoding('utf-8'); Mx[:lv_o_3].force_encoding('utf-8'); Mx[:lv_o_4].force_encoding('utf-8'); Mx[:lv_o_5].force_encoding('utf-8'); Mx[:lv_o_6].force_encoding('utf-8'); Mx[:lv_o_7].force_encoding('utf-8'); Mx[:lv_o_8].force_encoding('utf-8'); Mx[:lv_o_9].force_encoding('utf-8')
- Mx[:lv_o].force_encoding('utf-8'); Mx[:lv_c].force_encoding('utf-8')
- Mx[:gr_o].force_encoding('utf-8'); Mx[:gr_c].force_encoding('utf-8')
- Mx[:id_o].force_encoding('utf-8'); Mx[:id_c].force_encoding('utf-8')
- Mx[:tc_p].force_encoding('utf-8')
- Mx[:tc_o].force_encoding('utf-8'); Mx[:tc_c].force_encoding('utf-8')
- Mx[:pa_o].force_encoding('utf-8'); Mx[:pa_c].force_encoding('utf-8')
- Mx[:mk_o].force_encoding('utf-8'); Mx[:mk_c].force_encoding('utf-8')
- Mx[:gl_o].force_encoding('utf-8'); Mx[:gl_c].force_encoding('utf-8')
- Mx[:fa_o].force_encoding('utf-8'); Mx[:fa_c].force_encoding('utf-8')
- Mx[:fa_o_c].force_encoding('utf-8'); Mx[:fa_c_o].force_encoding('utf-8')
- Mx[:fa_bold_o].force_encoding('utf-8'); Mx[:fa_bold_c].force_encoding('utf-8')
- Mx[:fa_italics_o].force_encoding('utf-8'); Mx[:fa_italics_c].force_encoding('utf-8')
- Mx[:fa_underscore_o].force_encoding('utf-8'); Mx[:fa_underscore_c].force_encoding('utf-8')
- Mx[:fa_cite_o].force_encoding('utf-8'); Mx[:fa_cite_c].force_encoding('utf-8')
- Mx[:fa_insert_o].force_encoding('utf-8'); Mx[:fa_insert_c].force_encoding('utf-8')
- Mx[:fa_strike_o].force_encoding('utf-8'); Mx[:fa_strike_c].force_encoding('utf-8')
- Mx[:fa_superscript_o].force_encoding('utf-8'); Mx[:fa_superscript_c].force_encoding('utf-8')
- Mx[:fa_subscript_o].force_encoding('utf-8'); Mx[:fa_subscript_c].force_encoding('utf-8')
- Mx[:fa_hilite_o].force_encoding('utf-8'); Mx[:fa_hilite_c].force_encoding('utf-8')
- Mx[:gl_bullet].force_encoding('utf-8')
- Mx[:pa_non_object_dummy_heading].force_encoding('utf-8'); Mx[:pa_non_object_no_heading].force_encoding('utf-8')
- Mx[:br_line].force_encoding('utf-8'); Mx[:br_nl].force_encoding('utf-8')
- Mx[:br_paragraph].force_encoding('utf-8')
- Mx[:br_page].force_encoding('utf-8'); Mx[:br_page_new].force_encoding('utf-8')
- Mx[:br_endnotes].force_encoding('utf-8')
- Mx[:br_eof].force_encoding('utf-8')
- Mx[:lnk_o].force_encoding('utf-8'); Mx[:lnk_c].force_encoding('utf-8')
- Mx[:sm_set_o].force_encoding('utf-8'); Mx[:sm_set_c].force_encoding('utf-8')
- Mx[:sm_subset_o].force_encoding('utf-8'); Mx[:sm_subset_c].force_encoding('utf-8')
-#
- #Rx[:mx_fa_clean].force_encoding('utf-8')
- #Rx[:lv].force_encoding('utf-8');Rx[:lv_1].force_encoding('utf-8');Rx[:lv_2].force_encoding('utf-8');Rx[:lv_3].force_encoding('utf-8');Rx[:lv_4].force_encoding('utf-8');Rx[:lv_5].force_encoding('utf-8');Rx[:lv_6].force_encoding('utf-8');Rx[:lv_7].force_encoding('utf-8');Rx[:lv_8].force_encoding('utf-8');Rx[:lv_9].force_encoding('utf-8')
- #Rx[:meta].force_encoding('utf-8')
-end
-__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://
diff --git a/lib/sisu/v1/css.rb b/lib/sisu/v1/css.rb
deleted file mode 100644
index 6a918131..00000000
--- a/lib/sisu/v1/css.rb
+++ /dev/null
@@ -1,2015 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: css stylesheets
-
-=end
-module SiSU_Style
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/defaults"
- class CSS
- def initialize
- @vz=SiSU_Env::Get_init.instance.skin
- #@vz=SiSU_Viz::Skin.new
- end
- def fonts
- @vz.font_fonts
- end
- def html_tables #stylesheet for css table_pages
-<<WOK
-/* SiSU table output stylesheet */
- body {
- color: black;
- background: #{@vz.color_white};
- }
- p {
- display: block;
- line-height: 1.5;
- font-family: #{fonts};
- }
- a:link {
- color: #{@vz.color_blue_ink};
- text-decoration: none;
- }
- a:visited {
- color: #{@vz.color_blue_ink};
- text-decoration: none;
- /* background-color: #{@vz.color_blue_tinge}; */
- }
- a:hover {
- color: #{@vz.color_black};
- text-decoration: underline;
- background-color: #{@vz.color_yellow_light};
- }
- a:active {
- color: #{@vz.color_blue_ink};
- text-decoration: underline;
- }
-WOK
- end
- def harvest
- <<WOK
-/* SiSU harvest css default stylesheet */
- body {
- color: black;
- background: #ffffff;
- background-color: #ffffff;
- }
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- }
- a:hover {
- color: #000000;
- background-color: #f9f9aa;
- }
- a:hover img {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
-
- .norm, .bold {
- line-height: 150%;
- margin-left: 1em;
- margin-right: 2em;
- margin-top: 10px;
- margin-bottom: 0px;
- text-indent: 0mm;
- }
- p, h0, h1, h2, h3, h4, h5, h6 {
- display: block;
- font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- font-size: 100%;
- font-weight: normal;
- line-height: 150%;
- /* text-align: justify; */
- margin-left: 1em;
- text-indent: 0mm;
- margin-top: 2px;
- margin-bottom: 2px;
- margin-right: 6px;
- text-align: left;
- }
- h1 {
- font-size: 120%;
- font-weight: bold;
- color: white;
- background: #000088;
- margin-left: 0em;
- }
- p.work {
- font-size: 80%;
- margin-left: 5em;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 6px;
- text-align: left;
- }
- p.author {
- font-size: 100%;
- margin-left: 2em;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 6px;
- text-align: left;
- }
- p.publication {
- font-size: 80%;
- margin-left: 4em;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 6px;
- text-align: left;
- }
- p.letter {
- font-weight: bold;
- font-size: 60%;
- margin-left: 1em;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 6px;
- text-align: left;
- color: white;
- background: #880000;
- }
- p.lev0 {
- font-size: 120%;
- margin-left: 1em;
- color: white;
- background: #000000;
- }
-
- p.lev1 {
- font-size: 110%;
- margin-left: 2em;
- color: white;
- background: #444444;
- }
-
- p.lev2 {
- font-size: 100%;
- margin-left: 3em;
- background: #888888;
- }
-
- p.lev3 {
- font-size: 90%;
- margin-left: 4em;
- background: #bbbbbb;
- }
-
- p.lev4 {
- font-size: 80%;
- margin-left: 5em;
- background: #eeeeee;
- }
-
- p.lev5 {
- font-size: 80%;
- margin-left: 6em;
- }
-WOK
- end
- def html #stylesheet for css html pages== html.css
-<<WOK
-/* SiSU css default stylesheet */
- body {
- color: black;
- background: #ffffff;
- background-color: #ffffff;
- }
-/*
- table {
- margin-left: 5%;
- display: block;
- }
- tr {
- display: block;
- }
- th,td {
- display: inline;
- vertical-align: top;
- }
-*/
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- }
- a:hover {
- color: #000000;
- background-color: #f9f9aa;
- }
-/*
- a:hover {
- border-bottom: 2px solid #777777;
- background-color: #fff3b6;
- }
-*/
- a:hover img {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
- div {
- margin-left: 0;
- margin-right: 0;
- }
- div.p {
- margin-left: 5%;
- margin-right: 1%;
- }
-
- #top_band {
- position: absolute;
- top: 0;
- bottom: 80px;
- width: 100%;
- }
- #top_band_search {
- position: absolute;
- top: 0px;
- right: 0px;
- margin-left: 75%;
- width: 20%;
- }
- #column_left {
- position: absolute;
- top: 80px;
- left: 0;
- margin-left: 1%;
- width: 20%;
- }
- #column_center {
- position: absolute;
- top: 80px;
- margin-left: 20%;
- width: 55%;
- }
- #column_right {
- position: absolute;
- top: 80px;
- right: 0px;
- margin-left: 75%;
- width: 25%;
- }
- #pane_major {
- position: absolute;
- top: 0px;
- left: 0;
- margin-left: 0;
- width: 80%;
- }
- #pane_minor {
- position: absolute;
- top: 0px;
- right: 0px;
- margin-left: 75%;
- width: 20%;
- }
-
- .norm, .bold {
- line-height: 150%;
- margin-left: 0em;
- margin-right: 2em;
- margin-top: 10px;
- margin-bottom: 0px;
- text-indent: 0mm;
- }
- p, h0, h1, h2, h3, h4, h5, h6 {
- display: block;
- font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- font-size: 100%;
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 0em;
- margin-right: 2em;
- text-indent: 0mm;
- margin-top: 3px;
- margin-bottom: 3px;
- }
- p.norm { }
- p.i1 {margin-left: 1em;}
- p.i2 {margin-left: 2em;}
- p.i3 {margin-left: 3em;}
- p.i4 {margin-left: 4em;}
- p.i5 {margin-left: 5em;}
- p.i6 {margin-left: 6em;}
- p.i7 {margin-left: 7em;}
- p.i8 {margin-left: 8em;}
- p.i9 {margin-left: 9em;}
-
- p.it0 {
- margin-left: 0em;
- margin-top: 6px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it1 {
- margin-left: 1em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it2 {
- margin-left: 2em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it3 {
- margin-left: 3em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it4 {
- margin-left: 4em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it5 {
- margin-left: 5em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it6 {
- margin-left: 6em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it7 {
- margin-left: 7em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it8 {
- margin-left: 8em;
- margin-top: 0px;
- margin-bottom: 0px;
- line-height: 100%;
- }
- p.it9 {
- margin-left: 9em;
- margin-bottom: 0px;
- margin-top: 0px;
- line-height: 100%;
- }
-
- p.code {
- font-family: inconsolata, andale mono, courier new, courier, monospace;
- font-size: 90%;
- text-align: left;
- background-color: #eeeeee;
- }
-
- p.caption {
- text-align: left;
- font-size: 80%;
- display: inline;
- }
-
- p.endnote {
- font-size: 96%;
- line-height: 120%;
- text-align: left;
- margin-right: 15mm;
- }
- p.endnote_indent {
- font-size: 96%;
- line-height: 120%;
- text-align: left;
- margin-left: 2em;
- margin-right: 15mm;
- }
-
- p.center {
- text-align: center;
- }
- p.bold {
- font-weight: bold;
- }
- p.bold_left {
- font-weight: bold;
- text-align: left;
- }
- p.centerbold {
- text-align: center;
- font-weight: bold;
- }
- p.em {
- font-weight: bold;
- font-style: normal;
- background: #fff3b6;
- }
-
- p.small {
- font-size: 80%;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 6px;
- text-align: left;
- }
-
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size: 10px;
- margin-top: 0px;
- margin-bottom: 0px;
- color: #777777;
- margin-right: 6px;
- text-align: left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left: 0px;
- margin-right: 0px;
- text-align: left;
- }
- p.tiny_right {
- margin-right: 1em;
- text-align: right;
- }
- p.tiny_center {
- margin-left: 0px;
- margin-right: 0px;
- text-align: center;
- }
-
- p.pane, p.pane_title, p.pane_blurb, p.pane_link, p.pane_indent {
- font-size: 80%;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-left: 2mm;
- margin-right: 4px;
- text-align: left;
- }
- p.pane { }
- p.pane_title {
- font-weight: bold;
- margin-bottom: 0px;
- }
- p.pane_blurb {
- font-size: 10px;
- margin-bottom: 0px;
- }
- p.pane_link {
- font-size: 10px;
- margin-bottom: 0px;
- margin-left: 4mm;
- }
- p.pane_indent {
- font-size: 10px;
- margin-bottom: 0px;
- margin-left: 4mm;
- }
-
- p.concordance_word {
- line-height: 150%;
- font-weight: bold;
- display: inline;
- margin-top: 4px;
- margin-bottom: 1px;
- }
- p.concordance_count {
- font-size: 80%;
- color: #777777;
- display: inline;
- margin-left: 0em;
- }
- p.concordance_object {
- font-size: 80%;
- line-height: 120%;
- text-align: left;
- margin-left: 3em;
- margin-top: 1px;
- margin-bottom: 3px;
- }
- p.book_index_lev1 {
- line-height: 100%;
- margin-top: 4px;
- margin-bottom: 1px;
- }
- p.book_index_lev2 {
- line-height: 100%;
- text-align: left;
- margin-left: 3em;
- margin-top: 1px;
- margin-bottom: 3px;
- }
-
- p.quickref {
- font-size: 10px;
- font-style: italic;
- margin-top: 0px;
- margin-bottom: 0px;
- color: #777777;
- margin-right: 5px;
- text-align: left;
- }
- p.bigref {
- font-size: 11px;
- font-weight: bold;
- margin-top: 0px;
- margin-bottom: 0px;
- color: #777777;
- margin-right: 5px;
- text-align: center;
- }
-
- p.letter {
- font-weight: bold;
- font-size: 80%;
- margin-left: 0em;
- margin-top: 2px;
- margin-bottom: 2px;
- margin-right: 6px;
- text-align: left;
- color: white;
- background: #880000;
- }
-
- label.ocn {
- width: 2%;
- float: right;
- top: 0;
- font-size: 10px;
- margin-top: 0px;
- margin-bottom: 5px;
- color: #777777;
- margin-right: 5px;
- text-align: right;
- background-color: #ffffff;
- }
-
- table { }
- tr { }
- th, td { vertical-align: top; }
-
- p.left, th.left, td.left {
- text-align: left;
- }
- p.small_left, th.small_left, td.small_left {
- text-align: left;
- font-size: 80%;
- }
- p.right, th.right, td.right {
- text-align: right;
- }
-
- #horizontal_links {
- background: #eeeeee;
- margin-left: 5%;
- margin-right: 5%;
- }
- #horizontal {
- margin: 0;
- padding: 0 0 0 10px;
- border-top: 1px solid #000077;
- border-bottom: 1px solid #000077;
- }
- #horizontal li {
- margin: 0 0 0 0;
- padding: 0 16px 0 0;
- display: inline;
- list-style-type: none;
- text-align: left;
- background: none;
- }
- #horizontal a {
- line-height: 12px;
- margin: 0 0 0 0;
- text-decoration: none;
- color: #000077;
- }
- #horizontal a.active, #horizontal a:hover {
- border-bottom: 2px solid #777777;
- padding-bottom: 2px;
- color: #000077;
- }
- #horizontal a:hover {
- color: #000077;
- }
-
- #document_versions {
- position: absolute;
- top: 10mm;
- right: 2%;
- width: 12%;
- float: right;
- }
-
- #vertical_links {
- position: absolute;
- top: 10mm;
- right: 0px;
- width: 20%;
- background: #dddddd;
- float: right;
- }
- #vertical {
- padding: 0 12px 0px 0px;
- margin-left: 2%;
- margin-right: 2%;
- }
- #vertical li {
- display: block;
- list-style-type: none;
- }
- #vertical a {
- line-height: 12px;
- text-decoration: none;
- color: #000077;
- }
- #vertical a.active, #vertical a:hover {
- border-bottom: 2px solid #777777;
- padding-bottom: 2px;
- color: #000077;
- }
-
- ul, li {
- list-style-type: none;
- list-style: none;
- padding-left: 20px;
- display: block;
- font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- font-weight: normal;
- line-height: 150%;
- text-align: left;
- text-indent: 0mm;
- margin-left: 1em;
- margin-right: 2em;
- margin-top: 3px;
- margin-bottom: 3px;
- }
-
- li {
- background: url(../image/bullet_09.png) no-repeat 0px 6px;
- }
-
- ul {
- }
- li.bullet { margin-left: 1em; }
- li.i1 { margin-left: 2em; }
- li.i2 { margin-left: 3em; }
- li.i3 { margin-left: 4em; }
- li.i4 { margin-left: 5em; }
- li.i5 { margin-left: 6em; }
- li.i6 { margin-left: 7em; }
- li.i7 { margin-left: 8em; }
- li.i8 { margin-left: 9em; }
- li.i9 { margin-left: 10em; }
-
- li.doc, li.ref, li.refcenter {
- margin-top: 0px;
- margin-bottom: 0px;
- margin-right: 0px;
- font-size: 8px;
- font-style: normal;
- text-align: left;
- }
- li.doc {
- background: url(../image/bullet_09.png) no-repeat 0px 6px;
- padding-left: 16px;
- margin-left: 10px;
- margin-right: 0px;
- }
- li.ref {
- background: none;
- padding-left: 0;
- margin-left: 0;
- color: #777777;
- }
- li.refcenter {
- background: url(../image/bullet_09.png) no-repeat 0px 6px;
- padding-left: 20px;
- margin-left: 10%;
- font-size: 9px;
- color: #777777;
- text-align: center;
- }
- li.refbold {
- list-style-type: none;
- padding-left: 16px;
- margin-left: 0;
- margin-right: 10mm;
- font-weight: bold;
- }
-
- h0, h1, h2, h3, h4, h5, h6 {
- font-weight: bold;
- line-height: 120%;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- h4.norm, h5.norm, h6.norm {
- margin-top: 10px;
- margin-bottom: 0px;
- }
- h1.center, h2.center, h3.center, h4.center, h5.center, h6.center {
- text-align: center;
- }
- h1 { font-size: 120%; }
- h2 { font-size: 115%; }
- h3 { font-size: 110%; }
- h4 { font-size: 105%; }
- h5 { font-size: 100%; }
- h6 { font-size: 100%; }
- h0 { font-size: 80%; }
-
- h1.i {margin-left: 2em;}
- h2.i {margin-left: 3em;}
- h3.i {margin-left: 4em;}
- h4.i {margin-left: 5em;}
- h5.i {margin-left: 6em;}
- h6.i {margin-left: 7em;}
- h7.i {margin-left: 8em;}
- h8.i {margin-left: 9em;}
- h9.i {margin-left: 10em;}
- h1.top_band {
- display: inline;
- text-align: left;
- margin-top: 0;
- margin-left: 4mm;
- text-indent: 0mm;
- font-weight: bold;
- font-size: 120%;
- }
- h2.top_band_tiny {
- font-size: 10px;
- font-weight: normal;
- margin-top: 0px;
- margin-left: 4mm;
- text-indent: 0mm;
- margin-bottom: 0px;
- color: #777777;
- margin-left: 140px;
- margin-right: 0px;
- text-align: left;
- }
-
- p.top_band {
- display: inline;
- text-align: left;
- margin-top: 0;
- margin-left: 140px;
- text-indent: 0mm;
- font-weight: bold;
- font-size: 120%;
- }
- p.top_band_tiny {
- font-size: 10px;
- margin-top: 0px;
- margin-bottom: 0px;
- color: #777777;
- margin-left: 140px;
- margin-right: 0px;
- text-align: left;
- }
- p.top_band_image {
- float: left;
- display: inline;
- text-align: left;
- margin-top: 0;
- margin-left: 1mm;
- text-indent: 0mm;
- margin-right: 1mm;
- }
-
- .banner, .subbanner {
- font-weight: bold;
- text-align: center;
- margin-left: 10mm;
- margin-right: 15mm;
- margin-top: 20px;
- margin-bottom: 10px;
- }
-
- h1.banner {
- font-size: 120%;
- }
- h1.subbanner {
- font-size: 115%;
- }
- h2.banner {
- font-size: 110%;
- }
- h3.banner {
- color: #990000;
- font-size: 105%;
- }
- h4.banner {
- color: #ff0000;
- font-size: 100%;
- }
- h5.banner {
- }
- h6.banner {
- }
-
- .toc {
- font-weight: normal;
- margin-top: 6px;
- margin-bottom: 6px;
- }
- h1.toc {
- margin-left: 1em;
- font-size: 115%;
- line-height: 150%;
- }
- h2.toc {
- margin-left: 2em;
- font-size: 110%;
- line-height: 140%;
- }
- h3.toc {
- margin-left: 3em;
- font-size: 105%;
- line-height: 120%;
- }
- h4.toc {
- margin-left: 4em;
- font-size: 100%;
- line-height: 120%;
- }
- h5.toc {
- margin-left: 5em;
- font-size: 95%;
- line-height: 110%;
- }
- h6.toc {
- margin-left: 6em;
- font-size: 90%;
- line-height: 110%;
- }
-
- .microtoc {
- margin-top: 2px;
- margin-bottom: 2px;
- }
-
- h1.microtoc {
- margin-left: 0mm;
- font-size: 115%;
- }
- h2.microtoc {
- margin-left: 5mm;
- font-size: 110%;
- }
- h3.microtoc {
- margin-left: 10mm;
- font-size: 105%;
- }
- h4.microtoc {
- margin-left: 15mm;
- font-weight: normal;
- font-size: 100%;
- }
- h5.microtoc {
- margin-left: 20mm;
- font-weight: normal;
- font-size: 95%;
- }
- h6.microtoc {
- margin-left: 25mm;
- font-weight: normal;
- font-size: 90%;
- }
-
- .subtoc {
- margin-right: 34%;
- font-weight: normal;
- }
- h5.subtoc {
- margin-left: 2em;
- font-size: 80%;
- margin-top: 2px;
- margin-bottom: 2px;
- }
- h6.subtoc {
- margin-left: 3em;
- font-size: 75%;
- margin-top: 0px;
- margin-bottom: 0px;
- }
-
- div.substance {
- width: 100%;
- background-color: #ffffff;
- }
- div.ocn {
- width: 5%;
- float: right;
- top: 0;
- background-color: #ffffff;
- }
- div.endnote {
- width: 95%;
- background-color: #fffffff;
- }
- div.toc {
- position: absolute;
- float: left;
- margin: 0;
- padding: 0;
- padding-top: 0.5em;
- border: 0;
- width: 13em;
- background-color: #eeeeee;
- margin-right:1em;
- }
- div.summary {
- margin: 0;
- padding: 0;
- border-left: 13em solid #eeeeee;
- padding-left: 1em;
- background-color: #eeeeee;
- }
- div.content, div.main_column {
- margin: 0;
- padding: 0;
- border-left: 13em solid #ffffff;
- padding-left: 1em;
- padding-right: 1em;
- }
- div.scroll {
- margin: 0;
- padding: 0;
- padding-left: 1em;
- padding-right: 1em;
- }
- div.content:after {
- content:' ';
- clear:both;
- display:block;
- height:0;
- overflow:hidden
- }
- div.footer {
- clear:left;
- padding: 0.5em;
- font-size: 80%;
- margin: 0;
- }
- div.toc ul {
- list-style: none;
- padding: 0;
- margin: 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight: normal;
- font-size: 90%;
- padding-left: 2em;
- background-color: #eeeeee;
- }
- div.toc a, span.currentlink{
- display:block;
- text-decoration: none;
- padding-left: 0.5em;
- color: #0000aa;
- }
- hr {
- width: 90%;
- }
-
- span.currentlink {
- text-decoration: none;
- background-color: #aaaaf9;
- }
-
- div.toc a:visited {
- color: #0000aa;
- }
- div.toc a:hover {
- color: #000000;
- background-color: #f9f9aa;
- }
-
- .minitoc {
- font-weight: normal;
- margin-top: 2px;
- margin-bottom: 2px;
- }
- h1.minitoc, h2.minitoc, h3.minitoc {
- margin-left: 0em;
- font-weight: bold;
- text-align: left;
- font-size: 90%;
- margin-top: 4px;
- margin-bottom: 4px;
- }
- h4.minitoc {
- margin-left: 0em;
- font-size: 90%;
- }
- h5.minitoc {
- margin-left: 1em;
- font-size: 85%;
- }
- h6.minitoc {
- margin-left: 2em;
- font-size: 85%;
- }
- h0.minitoc {
- margin-left: 0em;
- font-size: 90%;
- }
-
- h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c {
- text-align: center
- }
- h1.red, h2.red, h3.red, h4.red, h5.red, h6.red {
- text-align: center;
- color: #ff0000;
- margin-left: 5mm;
- text-indent: 5mm;
- margin-top: 30px;
- margin-bottom: 20px;
- margin-right: 15mm;
- }
- h1.ruby, h2.ruby, h3.ruby, h4.ruby, h5.ruby, h6.ruby {
- text-align: center;
- color: #990000;
- margin-left: 5mm;
- text-indent: 5mm;
- margin-top: 30px;
- margin-bottom: 20px;
- margin-right: 15mm;
- }
-WOK
- end
- def homepage #stylesheet for index, home page
-<<WOK
- body {color: black; background: #{@vz.color_white}; margin:10px 10px 0px 10px; padding:0px;}
- p { line-height: 1.5 }
- a:link {color: #{@vz.color_blue_ink}; text-decoration: none; }
- a:visited {color: #{@vz.color_blue_ink}; text-decoration: none; }
- a:hover {color: #{@vz.color_black}; text-decoration: underline; background-color: #{@vz.color_yellow_light};}
- a:active {color: #{@vz.color_blue_ink}; text-decoration: underline;}
- #banner {
- background:#{@vz.color_white};
- }
- #column_left {
- width:25%;
- float:left;
- background:#b9d4dd;
- padding-bottom:10px;
- }
- #column_center {
- width:55%;
- float:left;
- background:#{@vz.color_white};
- padding-bottom:10px;
- }
- #column_right {
- width:20%;
- float:left;
- background:#b9d4dd;
- padding-bottom:10px;
- }
- p,h1,pre {
- font-family: #{fonts};
- margin:0px 10px 10px 10px;
- }
- h1 {
- font-size:14px;
- padding-top:10px;
- }
- #column_right p { font-size:12px}
- #banner h1 { margin:0px; padding:10px}
-WOK
- end
- def xhtml #stylesheet for xhtml
-<<WOK
-/* SiSU css xhtml & sax.xml default style */
- document {
- display: block;
- margin-left: 0mm;
- margin-right: 0mm;
- }
- head {
- display: block;
- margin-bottom: 20px;
- background-color: #dddddd;
- }
- meta {
- display: inline;
- line-height: 1;
- font-size: 10px;
- color: #990000;
- margin-right: 2mm;
- margin-top: 0px;
- margin-bottom: 0px;
-
- }
- title,subtitle,creator,author,translator,translated_by,illustrator,illustrated_by,prepared_by,digitized_by,type,subject,description,contributor,publisher,format,identifier,source,language,relation,coverage,rights,keywords,comment,comments,abastract,tags,catalogue,date,date_created,date_issued,date_available,date_modified,date_valid,structure,sc {
- display: inline;
- line-height: 1;
- font-size: 10px;
- color: #000099;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- source_control {
- display: block;
- }
- dc {
- display: block;
- font-family: #{fonts};
- color: blue;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- sc {
- display: inline;
- color: green;
- }
- keywords,copyright {
- display: block;
- font-family: #{fonts};
- color: red;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- table {
- margin-left: 5%;
- display: block;
- }
- tr {
- display: block;
- }
- th,td {
- display: inline;
- }
- body {
- color: black;
- background: #ffffff;
- }
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- /* background-color: #e3ecef; */
- }
- a:hover {
- color: #000000;
- text-decoration: underline;
- background-color: #fff3b6;
- }
- a:hover IMG {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
- object {
- display: block;
- margin-left: 2mm;
- margin-right: 2mm;
- margin-top: 4px;
- margin-bottom: 8px;
- }
- text,text[class|="norm"] {
- display: block;
- font-family: #{fonts};
- text-align: justify;
- font-weight: normal;
- font-size: 100%;
- line-height: 150%;
- margin-left: 5%;
- margin-right: 5%;
- margin-top: 2px;
- margin-bottom: 0px;
- }
- text[class|="h1"] {
- font-size: 120%;
- font-weight: bold;
- text-align: left;
- line-height: 120%;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- text[class|="h2"] {
- font-weight: bold;
- font-size: 110%;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- text[class|="h3"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h4"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h5"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h6"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="indent0"] {
- margin-left: 10%;
- }
- text[class|="indent1"] {
- margin-left: 15%;
- }
- text[class|="indent2"] {
- margin-left: 20%;
- }
- text[class|="indent3"] {
- margin-left: 25%;
- }
- text[class|="indent4"] {
- margin-left: 30%;
- }
- text[class|="indent5"] {
- margin-left: 35%;
- }
- text[class|="indent6"] {
- margin-left: 40%;
- }
- text[class|="indent7"] {
- margin-left: 45%;
- }
- text[class|="indent8"] {
- margin-left: 50%;
- }
- text[class|="indent9"] {
- margin-left: 55%;
- }
- text[class|="indent_bullet"] {
- text-indent: 0%;
- }
- text[class|="indent_bullet0"] {
- text-indent: 0%;
- }
- text[class|="indent_bullet1"] {
- text-indent: 10%;
- }
- text[class|="indent_bullet2"] {
- text-indent: 15%;
- }
- text[class|="indent_bullet3"] {
- text-indent: 20%;
- }
- text[class|="indent_bullet4"] {
- text-indent: 25%;
- }
- text[class|="indent_bullet5"] {
- text-indent: 30%;
- }
- text[class|="indent_bullet6"] {
- text-indent: 35%;
- }
- text[class|="indent_bullet7"] {
- text-indent: 40%;
- }
- text[class|="indent_bullet8"] {
- text-indent: 45%;
- }
- text[class|="indent_bullet9"] {
- text-indent: 50%;
- }
- text[class|="verse"], text[class|="group"], text[class|="code"] {
- text-align: left;
- }
- ocn {
- display: block;
- text-align: right;
- vertical-align: super;
- color: #990000;
- font-size: xx-small;
- margin-right: 0mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- endnote {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 10%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- endnote_indent {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 15%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- en {
- font-size: xx-small;
- vertical-align: super;
- }
- i { font-style: italic; }
- b { font-style: bold; }
- u { text-decoration: underline; }
- br { display: block; }
-WOK
- end
- def xml_sax #stylesheet for xml sax
- xhtml
- end
- def xml_dom #sylesheet for xml dom, work on, starts from copy of css_xhtml
-<<WOK
-/* SiSU css dom.xml default style */
- document {
- display: block;
- margin-left: 0mm;
- margin-right: 0mm;
- }
- head {
- display: block;
- margin-bottom: 20px;
- background-color: #dddddd;
- }
- header {
- display: block;
- }
- meta {
- display: inline;
- line-height: 1;
- font-size: 10px;
- color: #990000;
- margin-right: 2mm;
- margin-top: 0px;
- margin-bottom: 0px;
-
- }
- title,subtitle,creator,author,translator,translated_by,illustrator,illustrated_by,prepared_by,digitized_by,type,subject,description,contributor,publisher,format,identifier,source,language,relation,coverage,rights,keywords,comment,comments,abastract,tags,catalogue,date,date_created,date_issued,date_available,date_modified,date_valid,structure,sc {
- display: inline;
- line-height: 1;
- font-size: 10px;
- color: #000099;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- source_control {
- display: block;
- }
- dc {
- display: block;
- font-family: #{fonts};
- color: blue;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- sc {
- display: inline;
- color: green;
- }
- keywords,copyright {
- display: block;
- font-family: #{fonts};
- color: red;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- body {
- color: black;
- background: #ffffff;
- }
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- /* background-color: #e3ecef; */
- }
- a:hover {
- color: #000000;
- text-decoration: underline;
- background-color: #fff3b6;
- }
- a:hover IMG {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
- object {
- display: block;
- margin-left: 2mm;
- margin-right: 2mm;
- margin-top: 4px;
- margin-bottom: 8px;
- }
- heading {
- font-weight: bold;
- }
- contents {
- font-weight: normal;
- }
- text {
- display: block;
- font-family: #{fonts};
- text-align: justify;
- font-size: 100%;
- line-height: 150%;
- margin-left: 5%;
- margin-right: 5%;
- margin-top: 2px;
- margin-bottom: 0px;
- }
- text[class|="norm"] {
- font-weight: normal;
- }
- text[class|="h1"] {
- font-size: 120%;
- font-weight: bold;
- text-align: left;
- line-height: 120%;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- text[class|="h2"] {
- font-weight: bold;
- font-size: 110%;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- text[class|="h3"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h4"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h5"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="h6"] {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- text[class|="indent1"] {
- margin-left: 10%;
- }
- text[class|="indent2"] {
- margin-left: 15%;
- }
- text[class|="indent3"] {
- margin-left: 20%;
- }
- text[class|="indent4"] {
- margin-left: 25%;
- }
- text[class|="indent5"] {
- margin-left: 30%;
- }
- text[class|="indent6"] {
- margin-left: 35%;
- }
- text[class|="indent7"] {
- margin-left: 40%;
- }
- text[class|="indent8"] {
- margin-left: 45%;
- }
- text[class|="indent9"] {
- margin-left: 50%;
- }
- text[class|="indent_bullet1"] {
- margin-left: 10%;
- }
- text[class|="indent_bullet2"] {
- margin-left: 15%;
- }
- text[class|="indent_bullet3"] {
- margin-left: 20%;
- }
- text[class|="indent_bullet4"] {
- margin-left: 25%;
- }
- text[class|="indent_bullet5"] {
- margin-left: 30%;
- }
- text[class|="indent_bullet6"] {
- margin-left: 35%;
- }
- text[class|="indent_bullet7"] {
- margin-left: 40%;
- }
- text[class|="indent_bullet8"] {
- margin-left: 45%;
- }
- text[class|="indent_bullet9"] {
- margin-left: 50%;
- }
- text[class|="verse"], text[class|="group"], text[class|="code"] {
- text-align: left;
- }
- table {
- margin-left: 5%;
- display: block;
- }
- tr {
- display: block;
- }
- th, td {
- display: inline;
- }
- nametag {
- display: none;
- }
- number {
- padding-right: 4px;
- }
- ocn {
- font-weight: normal;
- display: block;
- text-align: right;
- vertical-align: super;
- color: #990000;
- font-size: xx-small;
- margin-right: 0mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- endnote {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 10%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- endnote_indent {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 15%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- en {
- font-size: xx-small;
- vertical-align: super;
- }
- i { font-style: italic; }
- b { font-style: bold; }
- u { text-decoration: underline; }
- br { display: block; }
-WOK
- end
- def docbook_xml #stylesheet for docbook
-<<WOK
-/* SiSU css docbook.xml default style */
- book {
- display: block;
- margin-left: 0mm;
- margin-right: 0mm;
- }
- bookinfo {
- display: block;
- margin-bottom: 20px;
- background-color: #dddddd;
- }
- source_control {
- display: block;
- }
- dc,sc {
- display: block;
- font-family: #{fonts};
- color: blue;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- sc {
- color: green;
- }
- keywords,copyright {
- display: block;
- font-family: #{fonts};
- color: red;
- background-color: #dddddd;
- font-weight: normal;
- text-align: justify;
- font-size: xx-small;
- line-height: 120%;
- margin-left: 5%;
- margin-right: 5mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- body {
- color: black;
- background: #ffffff;
- }
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- /* background-color: #e3ecef; */
- }
- a:hover {
- color: #000000;
- text-decoration: underline;
- background-color: #fff3b6;
- }
- a:hover IMG {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
- object {
- display: block;
- margin-left: 2mm;
- margin-right: 2mm;
- margin-top: 4px;
- margin-bottom: 8px;
- }
- part {
- display: block;
- /* font-weight: bold; */
- }
- contents {
- font-weight: normal;
- }
- para {
- display: block;
- font-family: #{fonts};
- /* font-weight: normal; */
- text-align: justify;
- font-size: 100%;
- line-height: 150%;
- margin-left: 5%;
- margin-right: 5%;
- margin-top: 2px;
- margin-bottom: 0px;
- }
- para.verse, para.group, para.code {
- text-align: left;
- }
- para.norm {
- font-family: #{fonts};
- font-weight: normal;
- }
- para.h1, title {
- display: block;
- font-family: #{fonts};
- font-size: 120%;
- font-weight: bold;
- text-align: left;
- line-height: 120%;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- para.h2 {
- font-weight: bold;
- font-size: 110%;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- para.h3 {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- para.h4 {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- para.h5 {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- para.h6 {
- font-size: 110%;
- font-weight: bold;
- text-align: left;
- }
- table {
- margin-left: 5%;
- display: block;
- }
- tr {
- display: block;
- }
- th, td {
- display: inline;
- }
- nametag {
- display: none;
- }
- number {
- padding-right: 4px;
- }
- ocn {
- font-weight: normal;
- display: block;
- text-align: right;
- vertical-align: super;
- color: #990000;
- font-size: xx-small;
- margin-right: 0mm;
- margin-top: 0px;
- margin-bottom: 0px;
- }
- endnote {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 10%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- endnote_indent {
- display: block;
- font-size: small;
- font-family: #{fonts};
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 15%;
- margin-right: 5%;
- margin-top: 4px;
- margin-bottom: 0px;
- }
- en {
- font-size: xx-small;
- vertical-align: super;
- }
- i { font-style: italic; }
- b { font-style: bold; }
- u { text-decoration: underline; }
- br { display: block; }
-WOK
- end
- def css_xhtml_p #stylesheet for ...
-<<WOK
- body {
- color: black;
- background: #ffffff;
- }
- a:link {
- color: #003399;
- text-decoration: none;
- }
- a:visited {
- color: #003399;
- text-decoration: none;
- /* background-color: #e3ecef; */
- }
- a:hover {
- color: #000000;
- text-decoration: underline;
- background-color: #fff3b6;
- }
- a:hover IMG {
- background-color: #ffffff;
- }
- a:active {
- color: #003399;
- text-decoration: underline;
- }
- object {
- display: block;
- margin-top: 3px;
- margin-bottom: 3px;
- margin-right: 5mm;
- }
- p {
- display: block;
- font-family: #{fonts};
- font-size: 100%;
- font-weight: normal;
- line-height: 150%;
- text-align: justify;
- margin-left: 10mm;
- margin-top: 3px;
- margin-bottom: 0px;
- margin-right: 5mm
- }
- p.norm { }
- p.endnote {
- font-size: 100%;
- margin-left: 20%;
- text-indent: 5%
- }
- p.endnote_indent {
- font-size: 100%;
- margin-left: 25%;
- text-indent: 5%
- }
- p.h1 {
- font-family: #{fonts};
- font-weight: bold;
- line-height: 120%;
- margin-left: 10mm;
- margin-right: 10mm;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- p.h2 {
- font-weight: bold;
- font-size: 110%;
- margin-left: 10mm;
- margin-right: 15mm;
- text-align: left;
- margin-top: 20px;
- margin-bottom: 10px;
- }
- p.h3 {
- font-size: 150%;
- font-weight: bold;
- text-align: left;
- }
- p.h4 {
- font-size: 150%;
- font-weight: bold;
- text-align: left;
- }
- p.h5 {
- font-size: 150%;
- font-weight: bold;
- text-align: left;
- }
- p.h6 {
- font-size: 150%;
- font-weight: bold;
- text-align: left;
- }
- ocn {
- display: block;
- text-align: right;
- vertical-align: super;
- color: #990000;
- font-size: xx-small;
- margin-top: 0px;
- margin-bottom: 6px;
- }
- en {
- font-size: xx-small;
- vertical-align: super;
- }
- i { font-style: italic; }
- b { font-style: bold; }
- u { text-decoration: underline; }
- br { display: block; }
-WOK
- end
- end
-end
-
-__END__
-
diff --git a/lib/sisu/v1/dal.rb b/lib/sisu/v1/dal.rb
deleted file mode 100644
index 8599964d..00000000
--- a/lib/sisu/v1/dal.rb
+++ /dev/null
@@ -1,272 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: preprocessing, (document abstraction), data abstraction used
- in subsequent processing
-
-=end
-module SiSU_DAL
- require "#{SiSU_lib}/defaults" # defaults.rb
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- require "#{SiSU_lib}/param" # param.rb
- require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb
- 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
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- include SiSU_Syntax
- class Instantiate < SiSU_Param::Parameters::Instructions
- def initialize
- @@flag_vocab=0
- @@line_mode=''
- end
- end
- class Source <Instantiate
- @@dal_array,@@html_idx_array=[],[]
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @@fns||@opt.fns
- @my_make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @fnm=@my_make_fns.marshal_meta
- @fnm_idx_html=@my_make_fns.marshal_meta_idx_html
- SiSU_Env::Create_system_link.new.images
- @env=SiSU_Env::Info_env.new
- end
- def read #creates dal
- begin
- dal=[]
- @@dal_array=[]
- @@fns=@opt.fns
- create_dal
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get #reads dal, unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@dal_array=[]
- end
- dal=if @@dal_array.empty?; read_fnm
- else @@dal_array.dup #check
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get_idx_html #reads dal idx.html, #unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@html_idx_array=[]
- end
- dal=if @@html_idx_array.empty?; read_fnm_idx_html
- else @@html_idx_array.dup #check
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- protected
- def create_dal
- dal_array=[]
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction')
- tell.green_title_hi unless @opt.cmd =~/q/
- file_array=@env.read_source_file(@opt.fns)
- file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
- end
- end
- meta=file_array.dup
- meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
- @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
- meta=nil
- dal=SiSU_DAL::Make.new(@md,file_array).song
- SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"~meta/#{@md.fns}.meta").output if @md.cmd =~/v/
- tell=SiSU_Screen::Ansi.new(@md.cmd,"dal -> #{@my_make_fns.meta}") if @md.cmd =~/M/
- tell.txt_grey unless @md.cmd =~/q/
- dal.each{|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}
- dal_array
- end
- def read_fnm
- dal=[]
- dal=if FileTest.file?(@fnm)
- if RUBY_VERSION < '1.9'
- File.open(@fnm){ |f| dal=Marshal.load(f)}
- else File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}
- end
- else SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- def read_fnm_idx_html
- dal=[]
- dal=if FileTest.file?(@fnm_idx_html)
- if RUBY_VERSION < '1.9'
- File.open(@fnm_idx_html){ |f| dal=Marshal.load(f)}
- else File.open(@fnm_idx_html,'r:utf-8'){ |f| dal=Marshal.load(f)}
- end
- else nil
- #SiSU_DAL::Source.new(@opt).create_dal
- end
- end
- end
- class Output
- def initialize(md,data)
- @md,@data=md,data
- @my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @dir=SiSU_Env::Info_env.new(@md.fns)
- end
- def hard_output
- if @md.cmd =~/M/
- filename_meta=@my_make.file_meta
- @data.each {|s| filename_meta.puts s.strip + "\n\n" unless s.strip.empty?}
- else
- hard="#{@dir.path.dal}/#{@md.fns}.meta"
- File.unlink(hard) if FileTest.file?(hard)
- end
- end
- def marshal
- marshal_meta=@my_make.marshal_meta
- File.open(marshal_meta,'w'){|f| Marshal.dump(@data.to_a,f)}
- end
- def idx_html_hard_output
- if @md.book_idx and @md.cmd =~/M/
- filename_meta=@my_make.file_meta_idx_html
- @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
- 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 idx_html_marshal
- marshal_meta=@my_make.marshal_meta_idx_html
- File.open(marshal_meta,'w'){|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Make
- @@dp=nil
- def initialize(md,data)
- @md,@data=md,data
- @env=SiSU_Env::Info_env.new(@md.fns)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def reset
- @@flag_vocab=0
- @@line_mode=''
- end
- def song
- reset
- data=@data
- @metafile="#{@env.path.dal}/#{@md.fns}.meta"
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- data=data.join.split("\n\n")
- data=SiSU_insertions::Insertions.new(data).expand_insertions?
- data=SiSU_document_structure::Code.new(@md,data).code
- data=SiSU_substitute_and_insert::SI.new(@md,data).substitutions_and_insertions?
- data_new=[]
- data.each do |x|
- data_new << if x =~ /\n\n/m; x.split(/\n\n+/)
- else x
- end
- end
- data=data_new.flatten
- data=SiSU_Syntax::Markup.new(@md,data).songsheet
- data,endnote_array=SiSU_character_check::Check.new(data).character_check_and_oldstyle_endnote_array
- data=SiSU_images::Images.new(@md,data).images
- data=SiSU_document_structure::Tables.new(@md,data).tables
- data=SiSU_numbering::Numbering.new(@md,data).numbering_song
- data,book_index,html_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx
- data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes
- data=SiSU_hash::Object_digest.new(@md,data,@env).object_digest
- meta=SiSU_metadata::Metadata.new(@md,data).metadata
- #meta=metadata(data)
- outputdata=data + meta
- if @md.cmd =~/[mM]/
- SiSU_DAL::Output.new(@md,outputdata).hard_output
- SiSU_DAL::Output.new(@md,outputdata).marshal
- SiSU_DAL::Output.new(@md,html_idx).idx_html_hard_output
- SiSU_DAL::Output.new(@md,html_idx).idx_html_marshal
- end
- reset
- outputdata
- end
- protected
- end
-end
-__END__
-dal output, rules to simplify parsing
-nodes === objects === paragraphs === text blocks separated by \n\n
-
-dal output:
-:verse :group and :code have -end
-:table is not used
diff --git a/lib/sisu/v1/dal_character_check.rb b/lib/sisu/v1/dal_character_check.rb
deleted file mode 100644
index bd5837ac..00000000
--- a/lib/sisu/v1/dal_character_check.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-
-module SiSU_character_check
- class Check
- def initialize(data)
- @data=data
- @comment='%'
- @endnote_array=[]
- end
- def character_check_and_oldstyle_endnote_array
- require 'iconv'
- data=@data
- #reset
- @tuned_file,@endnote_array=[],[]
- endnote_no=1
- data.each do |para|
- para.strip!
- para.gsub!(/^([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12
- para.gsub!(/^[{~}]\s*$/,'')
- para.gsub!(/^#{@comment}.*/,'') #remove comment and divider #%
- para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}")
- para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}")
- #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL
- para.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ')
- para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29
- para.gsub!(/<br>/,"#{Mx[:br_line]}") #needed by xml, xhtml etc.
- para.gsub!(/\t/,' ')
- para.gsub!(/\342\200\231/u,"'") #if para =~/’/ #Avoid #&lsquo; &rsquo; #&ldquo; &rdquo;
- para.gsub!(/�/u,' ') #watch, replace with char code
- para.gsub!(/·/u,'*')
- para.gsub!(/\\copy(?:right)?\b/,'&#169;')
- para.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
- #non_utf8(para)
- para=para + "\n"
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- case para
- when /\^~/ # endnotes
- #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
- sub_para=para.dup
- @endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip
- endnote_no+=1
- para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion
- end
- end
- @tuned_file << para unless para.nil?
- end
- @tuned_file=@tuned_file.flatten
- [@tuned_file,@endnote_array]
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_doc_str.rb b/lib/sisu/v1/dal_doc_str.rb
deleted file mode 100644
index e52210d1..00000000
--- a/lib/sisu/v1/dal_doc_str.rb
+++ /dev/null
@@ -1,266 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure
- require "#{SiSU_lib}/dal_doc_str_tables" # dal_doc_str_tables.rb
- require "#{SiSU_lib}/dal_doc_str_code" # dal_doc_str_code.rb
- class Structure
- def initialize(md,para)
- @md,@para=md,para
- end
- def structure
- structure_markup_normalize
- structure_markup
- @para
- end
- def structure_markup
- @para=unless @para =~/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/
- @para=case @para
- when /^\s*#{@md.lv1}/; @para.sub!(/(?:<[:!]1!?>\s*)?(.+)/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/
- when /^\s*#{@md.lv2}/; @para.sub!(/(?:<[:!]2!?>\s*)?(.+)/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}/
- when /^\s*#{@md.lv3}/; @para.sub!(/(?:<[:!]3!?>\s*)?(.+)/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}/
- when /^\s*#{@md.lv4}/; @para.sub!(/(?:<[:!]4!?>\s*)?(.+)/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}4:\S*?#{Mx[:lv_c]}/
- when /^\s*#{@md.lv5}/; @para.sub!(/(?:<[:!]5!?>\s*)?(.+)/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}/
- when /^\s*#{@md.lv6}/; @para.sub!(/(?:<[:!]6!?>\s*)?(.+)/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}/
- else @para
- end
- else @para
- end
- end
- def structure_markup_normalize
- para=if @md.markup_version.to_f >= 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes
- #keep and implement, requires downstream changes:
- #@para.gsub!(/^6~/,'9~')
- #@para.gsub!(/^5~/,'8~')
- #@para.gsub!(/^4~/,'7~')
- @para.gsub!(/^[456]~/,'!_')
- @para.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}")
- @para.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}")
- @para.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}")
- @para.gsub!(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}")
- @para.gsub!(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}")
- @para.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")
- @para.gsub!(/^:?A~\s*$/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]} @title @author")
- @para=if @para =~/^@(?:level|markup):\s/
- @para.gsub!(/3/,'6')
- @para.gsub!(/2/,'5')
- @para.gsub!(/1/,'4')
- @para.gsub!(/:?C/,'3')
- @para.gsub!(/:?B/,'2')
- @para.gsub!(/:?A/,'1')
- @para
- else @para
- end
- else @para
- end
- end
- def structure_marks
- para=if @md.markup_version.to_f < 0.38
- @para.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")
- @para.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}")
- @para.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}")
- @para.gsub!(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}")
- @para.gsub!(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}")
- @para.gsub!(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}")
- @para.gsub!(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}")
- @para.gsub!(/^[789]~/,'!_')
- @para
- else @para
- end
- end
- end
- class Struct
- def initialize(o)
- @o=o
- end
- def structure
- def txt
- @o[:txt]
- end
- def node
- @o[:node]
- end
- def ocn
- @o[:ocn]
- end
- def lv
- @o[:lv]
- end
- def type
- @o[:type]
- end
- self
- 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=0 # h heading, o other, t table, g group, i image
- node_count_flag=false
- headings='' #where headings omitted an alternative form of ocn heading numbering is required for html and other linking...
- #headings=if @md.ocn.inspect =~/skip=headings/; '^(?:[A-C]|[1-9])~\S* |'
- #else ''
- #end
- regex_exclude_ocn_and_node = /#{headings}^%{1,4}\s|#{Rx[:meta]}|^@\S+?:\s|^0~|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here #&nbsp; added with Tune.code #¡
- regex_exclude_ocn = /^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$/ #ocn here #&nbsp; added with Tune.code #¡
- data.each do |para|
- o={}
- if para =~/\w|\S|<|\(/
- if para !~ regex_exclude_ocn_and_node
- if node_count_flag \
- or para=~/^#{Mx[:lv_o]}1:/
- node_count_flag=true
- end
- node+=1 if node_count_flag
- if para !~ regex_exclude_ocn # regex_exclude_large previously excluded
- unless para=~/<:#>|~#|-#/ # |^\s*\*\s*\*\s*\*\s*$ <-consider leaving un-numbered
- ocn+=1
- if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/ \
- or para =~@md.lv1 \
- or para =~@md.lv2 \
- or para =~@md.lv3 \
- or para =~@md.lv4 \
- or para =~@md.lv5 \
- or para =~@md.lv6
- ocnh+=1
- if para=~/^#{Mx[:lv_o]}1:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv1
- ocnh1+=1 #heading
- ocn_dv,ocn_sp="1:#{ocnh1}","h#{ocnh}"
- elsif para=~/^#{Mx[:lv_o]}2:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv2; ocnh2+=1
- ocn_dv,ocn_sp="2:#{ocnh2}","h#{ocnh}"
- elsif para=~/^#{Mx[:lv_o]}3:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv3; ocnh3+=1
- ocn_dv,ocn_sp="3:#{ocnh3}","h#{ocnh}"
- elsif para=~/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv4; ocnh4+=1
- ocn_dv,ocn_sp="4:#{ocnh4}","h#{ocnh}"
- elsif para=~/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv5; ocnh5+=1
- ocn_dv,ocn_sp="5:#{ocnh5}","h#{ocnh}"
- elsif para=~/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv6; ocnh6+=1
- ocn_dv,ocn_sp="6:#{ocnh6}","h#{ocnh}"
- end
- else
- ocno+=1
- if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; ocnt+=1 #table
- ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}"
- elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; ocnc+=1 #code block
- ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}"
- elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/; ocng+=1 #group, poem
- ocn_dv,ocn_sp="o#{ocno}","g#{ocng}"
- elsif para=~/#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image
- ocn_dv,ocn_sp="o#{ocno}","i#{ocni}"
- else ocnp+=1 #paragraph
- ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}"
- end
- end
- o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,ocn,ocn_dv,ocn_sp
- else ocnu+=1
- #if para=~/-#/ #if implemented would remove need to keep <-#>
- # ocnk+=1
- # ocn_dv,ocn_sp="k#{ocnk}","u#{ocnu}"
- #else
- # ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- #end
- #para.gsub!(/<~#>|<-#>/,'') if para #get rid of need
- para.gsub!(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if para
- ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,0,ocn_dv,ocn_sp
- end
- else o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,nil,nil,nil
- end
- else
- para=if para !~/^%{1,4}\s/
- o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,nil,nil,nil
- else ''
- end
- end
- end
- para.gsub!(/\n\n/,"\n") if para =~/#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]}/ #newlines taken out
- para.gsub!(/(#{Mx[:gr_o]}(?:code-end)#{Mx[:gr_c]})/,"\n\\1") if para =~/#{Mx[:gr_o]}(?:code-end)#{Mx[:gr_c]}/ #newlines added check
- if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u; para.gsub!(/(#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?)#{Mx[:gr_c]}/u,"\\1#{Mx[:tc_p]}~#{o[:ocn]};#{o[:lv]};#{o[:type]}#{Mx[:gr_c]}")
- end
- @o_array << Struct.new(o).structure if o
- end
- @o_array
- end
- end
- class Code < SiSU_document_structure_code::Code
- end
- class Tables < SiSU_document_structure_tables::Tables
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_doc_str_code.rb b/lib/sisu/v1/dal_doc_str_code.rb
deleted file mode 100644
index 8ccd45e1..00000000
--- a/lib/sisu/v1/dal_doc_str_code.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure_code
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={} #Beware!!
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Code
- @@flag={} #Beware!!
- def initialize(md,data)
- @md,@data=md,data
- Instantiate.new
- end
- def code
- data=@data
- tuned_file=[]
- @tuned_group=[]
- @@counter=0
- @verse_count=0
- data.each do |para|
- para.gsub!(/(#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]})\s/,'\1') #double check
- para.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code']
- if para =~/^code\{/ and not @@flag['code']
- @@flag['code']=true
- @@counter=1
- para.gsub!(/^code\{.*/,"#{Mx[:gr_o]}code#{Mx[:gr_c]}")
- elsif para =~/^(?:poem)\{/ \
- and not @@flag['code']
- @@flag['poem']=true
- para.gsub!(/^(poem)\{.*/,"#{Mx[:gr_o]}verse#{Mx[:gr_c]}")
- elsif para =~/^(?:alt|group)\{/ \
- and not @@flag['code'] #group not tested, stub 2005
- @@flag['group']=true
- para.gsub!(/^(alt|group)\{.*/,"#{Mx[:gr_o]}\\1#{Mx[:gr_c]}")
- end
- if @@flag['code']
- if @@flag['code'] \
- and para =~/^\}code/
- para.gsub!(/^\}code.*/,"#{Mx[:gr_o]}code-end#{Mx[:gr_c]}")
- @@flag['code']=false
- end
- if @@flag['code'] \
- or para =~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/ #and para =~/\S/
- sub_array=if para !~/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/; para.dup + "#{Mx[:br_nl]}"
- else para.dup
- end
- @line_mode=sub_array.scan(/.+/)
- #@line_mode=[]
- #sub_array.scan(/.+/) {|w| @line_mode << w + '<:br>' if w =~/[\Ss]+/}
- SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines('code')
- para=@line_mode.join
- end
- elsif ( @@flag['poem'] \
- or @@flag['group'] ) \
- and not @@flag['code']
- if @@flag['poem'] \
- and para =~/^\}(?:poem)/
- para.gsub!(/^\}(poem).*/,"\n#{Mx[:gr_o]}verse-end#{Mx[:gr_c]}")
- @@flag['poem']=false
- elsif ( @@flag['group'] \
- and para =~/^\}(?:alt|group)/ ) \
- and not @@flag['code']
- para.gsub!(/^\}(alt|group).*/,"#{Mx[:gr_o]}\\1-end#{Mx[:gr_c]}")
- @@flag['group']=false
- end
- if @@flag['poem'] \
- or @@flag['group'] \
- and para =~/\S/ \
- and para !~/#{Mx[:gr_o]}(verse|code|alt|group)(-end)?#{Mx[:gr_c]}/ \
- and not @@flag['code']
- sub_array=para.dup
- @line_mode=sub_array.scan(/.+/)
- type=if @@flag['poem']; 'poem'
- else 'group'
- end
- SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines(type)
- div=if @@flag['poem'] \
- and @verse_count > 0
- "\n" + "#{Mx[:gr_o]}verse-end#{Mx[:gr_c]}" + "\n\n" + "#{Mx[:gr_o]}verse#{Mx[:gr_c]}"
- else ''
- end
- @verse_count+=1 if @@flag['poem']
- para = div + @line_mode.join
- else para
- end
- end
- if @@flag['code'] \
- or @@flag['poem'] \
- or @@flag['group']
- @tuned_group << para if para =~/\S+/
- elsif para =~/#{Mx[:gr_o]}(?:code|alt|group|verse)-end#{Mx[:gr_c]}/
- @verse_count=0
- @tuned_group << para
- tuned_file <<= if para =~/#{Mx[:gr_o]}group-end#{Mx[:gr_c]}/
- @tuned_group.join("\n")
- else @tuned_group=@tuned_group.join
- @tuned_group.gsub!(/#{Mx[:br_nl]}#{Mx[:br_nl]}(#{Mx[:gr_o]}code-end#{Mx[:gr_c]})/,'\1')
- @tuned_group
- end
- @tuned_group=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- def code_lines(type='')
- data=@data
- data.each do |line|
- if line =~/\S/ \
- and line !~/^code\{|^\}code|#{Mx[:gr_o]}code.+/
- line.gsub!(/\s\s/,"#{Mx[:nbsp]}#{Mx[:nbsp]}")
- line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # try sort for texpdf special case
- if line =~/(?:https?|file|ftp):\/\/\S+$/
- line.gsub!(/$/," #{Mx[:br_nl]}")
- else line.gsub!(/$/,"#{Mx[:br_nl]}") #unless type=='code'
- end
- if @@flag['code']; @@counter+=1
- else
- end
- elsif line =~/^\s*$/
- line.gsub!(/$/,"#{Mx[:br_nl]}")
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_doc_str_tables.rb b/lib/sisu/v1/dal_doc_str_tables.rb
deleted file mode 100644
index d9d39632..00000000
--- a/lib/sisu/v1/dal_doc_str_tables.rb
+++ /dev/null
@@ -1,198 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document abstraction tables
-
-=end
-module SiSU_document_structure_tables
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={}
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Tables
- @@flag={}
- def initialize(md,data)
- @md,@data=md,data
- Instantiate.new
- end
- def table_visual(para)
- count=0
- @row=[]
- table=[]
- @rows=para.split(/;;/)
- @rows.compact! #(c\d+?;.+?)
- @rows.each do |row|
- count +=1
- @row[count]=row.split(/\|/)
- end
- @row.compact!
- widths=if @row[0].join =~/^\{(?:t|table)(?:~h)?\s+\d+;/
- col_width=@row[0].join.scan(/\d+/)
- rem=(100 - col_width[0].to_i)
- col_w=rem/(@row[1].length - 1)
- "#{col_width[0].to_s};" + ("#{col_w};" * (@row[1].length-1))
- else
- col_w=100/@row[1].length
- "#{col_w};" * @row[1].length
- end
- @row.delete_if {|r| r[0] =~/\{(?:table|t)(?:~h)?(?:\s+c\d+;)?[\d; ]*\}/}
- w=widths.split(/;/)
- tuned_file=[]
- tuned_file << if para =~/\{(?:t|table)~h(?:\sc\d+;)?[\d; ]*\}/
- "#{Mx[:gr_o]}Th#{Mx[:tc_p]} c#{@row[2].length}; #{widths}#{Mx[:gr_c]}"
- elsif para =~/\{(?:t|table)(?:\sc\d+;)?[\d; ]*\}/
- "#{Mx[:gr_o]}T#{Mx[:tc_p]} c#{@row[2].length}; #{widths}#{Mx[:gr_c]}"
- end
- @row.each do |l|
- l << '' if l.length == (@row[1].length - 1)
- table=[]
- if l.length == @row[1].length
- table << Mx[:tc_o] #'<tr>'
- n= -1
- l.each do |c|
- n +=1 #'<td>' + c + '</td>'
- table << if c =~/\A(?:\n)?\s*\Z/
- "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + ' '
- else
- "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + c.strip
- end
- end
- table << Mx[:tc_c]
- tuned_file << table.join
- end
- end
- tuned_file << "#{Mx[:gr_o]}TZ#{Mx[:gr_c]}" #'</table>'
- tuned_file=tuned_file.compact.join("\n")
- end
- def tables
- data=@data
- count=0
- @row,@tuned_file,@tuned_table=[],[],[]
- data.each do |para|
- para.gsub!(/\n\s+\n/,"\n")
- para.gsub!(/\s+\n/,"\n")
- para.gsub!(/<:hi>/,'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- para.gsub!(/<:\/hi>/,%{</span>})
- table=[]
- if para =~/^\{(?:t|table)(?:~h)?(?:\sc\d+;)?[\d; ]*\}/
- @tuned_file << table_visual(para)
- @tuned_file=@tuned_file.flatten
- elsif @@flag['table_to'] \
- or para[/^table\{(?:~h)?/]
- if para[/table\{(?:~h)?\s+c(\d+;.+)/]
- instructions=$1
- @@column=instructions.split(/;\s*/)
- @@columns=@@column[0]
- para.gsub!(/^table\{~h\s+(c\d+?;.+?)$/,"#{Mx[:gr_o]}Th#{Mx[:tc_p]} \\1#{Mx[:gr_c]}")
- para.gsub!(/^table\{\s+(c\d+?;.+?)$/,"#{Mx[:gr_o]}T#{Mx[:tc_p]} \\1#{Mx[:gr_c]}")
- @@flag['table_to']=true
- end
- if @@flag['table_to'] \
- and para =~/\}table/
- para.gsub!(/^\}table\s*$/,"#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\n")
- para.gsub!(/\n/,' ') #newlines taken out
- para.strip!
- @tuned_table << para
- @tuned_table.delete('')
- @tuned_file << @tuned_table.compact.join("\n") #@tuned_table.compact.join =~/\S+/ #would be preferable
- para=''
- @tuned_table=[]
- @@flag['table_to']=false
- end
- if @@flag['table_to'] \
- and para =~/\S/
- @@counter=1
- sub_array=para.dup
- @@line_mode=sub_array.scan(/.+/u)
- Tables.new(@md,@@line_mode).tr_td
- para=@@line_mode.join
- para.gsub!(/(.*\S+.*)\Z/m,"#{Mx[:tc_o]}\\1#{Mx[:tc_c]}") unless para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- end
- para.gsub!(/\n/,' ')
- para.strip!
- @tuned_table << para
- else
- para.gsub!(/\n/,' ') unless para =~/#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]}/
- para.strip!
- @tuned_file << para
- end
- @tuned_file
- end
- @tuned_file
- end
- def tr_td
- data=@data
- data.each do |line|
- if @@counter <= @@columns.to_i \
- and line !~/(\}T\s*$|#{Mx[:gr_o]}:table[-_](close|end)#{Mx[:gr_c]}|#{Mx[:gr_o]}TZ#{Mx[:gr_c]})/
- #if line.encoding.inspect =~/Encoding:ASCII-8BIT/
- # line=line.force_encoding('utf-8')
- #end
- line.gsub!(/(.+)/,"#{Mx[:tc_p]}#{Mx[:tc_p]}#{@@column[@@counter]}#{Mx[:tc_p]}\\1") unless line =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- @@counter+=1
- end
- end
- data
- end
- end
-end
-__END__
-#p line.encoding
-@data.each {|x| p x.encoding }
-p para if para.encoding.inspect =~/Encoding:ASCII-8BIT/
diff --git a/lib/sisu/v1/dal_endnotes.rb b/lib/sisu/v1/dal_endnotes.rb
deleted file mode 100644
index 3d4bd148..00000000
--- a/lib/sisu/v1/dal_endnotes.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_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
- #% endnote work zone
- data.each do |para|
- # manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
- if @md.mod.inspect =~/--no-asterisk|--no-annotate/
- para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
- end
- if @md.mod.inspect =~/--no-dagger|--no-annotate/
- para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
- end
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- case para
- # auto-numbered endnotes <!e!> <!e_!> -->
- when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/
- para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31
- word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m)
- word_mode=endnote_call_number(word_mode)
- para=word_mode.join(' ')
- endnote_ref+=1
- when /~\^(?:\s|$)|<:e>/
- #%Note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
- word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m)
- word_mode=endnote_call_number(word_mode)
- para=word_mode.join(' ')
- endnote_ref+=1
- end
- end
- @tuned_file << para
- end
- @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1
- @tuned_file=@tuned_file.flatten
- end
- def endnote_call_number(data)
- data.each do |word|
- unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- 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
-__END__
-
diff --git a/lib/sisu/v1/dal_expand_insertions.rb b/lib/sisu/v1/dal_expand_insertions.rb
deleted file mode 100644
index 4f698f36..00000000
--- a/lib/sisu/v1/dal_expand_insertions.rb
+++ /dev/null
@@ -1,196 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_insertions
- class Insertions
- def initialize(data)
- @data=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 =~ /p/; ['landscape.pdf', 'portrait.pdf']
- end
- #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1'
- #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 /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 =~/^~\^ /
- "#{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 =~/^~\^ /
- "#{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 << 'group{' << tuned_file_tmp.join("\n").strip << '}group'
- tuned_file_tmp=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_hash_digest.rb b/lib/sisu/v1/dal_hash_digest.rb
deleted file mode 100644
index 734772ec..00000000
--- a/lib/sisu/v1/dal_hash_digest.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-
-module SiSU_hash
- 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]
- # vim==/<[0-9a-f]\{#{@@dl}\}\(:[0-9a-f]\{#{@@dl}\}\)\?>/
- require 'digest/md5'
- require 'digest/sha2'
- data=@data
- @tuned_file=[]
- data.compact!
- data.each do |para|
- para.strip!
- if para=~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ \
- and para !~/#{Rx[:meta]}/ #test should not be necessary remove
- if @env.digest.type =~/sha256/
- for hash_class in [ Digest::SHA256 ]
- @tuned_file << stamped(para,hash_class)
- end
- else
- for hash_class in [ Digest::MD5 ]
- @tuned_file << stamped(para,hash_class)
- end
- end
- else @tuned_file << para unless para.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)
- para_bit=[]
- data.each do |en_plus|
- para_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]}/
- para_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=strip_clean_of_markup(en_txt)
- digest_en_strip=if @env.digest.type =~/sha256/
- Digest::SHA256.hexdigest(stripped_en)
- else
- Digest::MD5.hexdigest(stripped_en)
- end
- para_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
- para_bit.join
- end
- def stamped(para,hash_class)
- @tuned=[]
- para=strip_clean_extra_spaces(para)
- digest_all=hash_class.hexdigest(para) # print "#{hash_class.name}: "; puts digest_all #length==32 or 64
- stripped=strip_clean_of_markup(para)
- digest_strip=hash_class.hexdigest(stripped)
- unless para =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/
- case para
- when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m
- en_and_para,en_and_para_digest=[],[]
- para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
- para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)
- para_tail=if para =~/(?:.*?#{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]})+(.*?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1]
- #/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1]
- else ''
- end
- para_plus_en << para_tail
- en_and_para_digest << endnote_digest(para_plus_en)
- para_new=en_and_para_digest.join(' ')
- @tuned << para_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
- else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
- end
- else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
- end
- @tuned.join
- 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
- def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean
- #consider: <\/?[ib]>|<(?:\/ )?br>|<del>(.+?)<\/del>
- s=s.dup
- s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^#{Mx[:lv_o]}[1-6]:\S+?#{Mx[:lv_c]}|#{Mx[:en_a_o]}\d+\s.+?#{Mx[:en_a_c]})/m,'') # markup and endnotes removed
- #% same as db clean -->
- s=s.gsub(/<del>(.+?)<\/del>/,'DELETED(\1)') # deletions
- s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]')
- s=s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- #s=s.gsub(/<!T[h]?¡.+?!>/,"[TABLE]\n") # tables
- #s=s.gsub(/<!¡¡\d+(.+?)!>/,'\1') # tables
- #s=s.gsub(/¡¡\d+¡/,' ') # tables
- #s=s.gsub(/¡/,' ') # tables tidy later
- #s=s.gsub(/<.+?>/,'')
- s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- s=s.gsub(/\s\s+/,' ')
- s=s.strip
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v1/dal_idx.rb b/lib/sisu/v1/dal_idx.rb
deleted file mode 100644
index 3033fdb9..00000000
--- a/lib/sisu/v1/dal_idx.rb
+++ /dev/null
@@ -1,323 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_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=/\s*#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
- @rgx_idx_ocn_init=/#{Mx[:idx_o]}(.+?)#{Mx[:idx_c]}\s*#{Mx[:id_o]}~(\d+)\S+?#{Mx[:id_c]}/
- @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
- @rgx_idx_ocn=/(.+?)~(\d+)/
- @rxp_lv1=/^#{Mx[:lv_o]}1:/
- @rxp_lv2=/^#{Mx[:lv_o]}2:/
- @rxp_lv3=/^#{Mx[:lv_o]}3:/
- @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/
- @rxp_to=Regexp.new("#{Mx[:id_o]}~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:id_o]}\S+?#{Mx[:id_c]}$")
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- end
- def indexing_song
- data=@data
- data,sisu_markup_idx,html_idx=extract_book_index(data)
- data=clean_and_insert_index(data,sisu_markup_idx)
- [data,sisu_markup_idx,html_idx]
- end
- def extract_book_index(data)
- tuned_file=[]
- idx_array=[]
- data.each do |para|
- if para =~@rxp_seg; @seg=para[@rxp_seg,1]
- end
- idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,"\\1~\\2~#{@seg}") if para =~ @rgx_idx_ocn_init
- tuned_file << para if para
- 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)
- #screen_print(the_idx) if @md.cmd.inspect =~/V/
- sisu_markup_idx,html_idx=nil,nil
- if @md.book_idx
- idx=index(the_idx)
- output_html_idx(idx[:html])
- html_idx=idx[:html]
- sisu_markup_idx=idx[:sst]
- end
- end
- [tuned_file,sisu_markup_idx,html_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
- #p the_idx; p '-----'
- the_idx
- end
- def index(the_idx)
- @x=1
- @idx={}
- @idx[:sst],@idx[:html]=[],[]
- @idx[:sst] << "\n\n#{Mx[:br_page_new]}"
- @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}"
- @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}"
- alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @idx[:html] << '<p>'
- alph.each do |x|
- @idx[:html] << if x =~/[0-9]/; ''
- else
- %{<a href="##{x}">#{x}</a>,&nbsp;}
- end
- end
- @idx[:html] << '</p>'
- letter=alph.shift
- @idx[:html] << %{\n<p class="book_index_lev1"><a name="numeral"></a></p>}
- 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<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>}
- else break
- end
- end
- end
- @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} }
- aname=x.gsub(/\s+/,'_')
- @idx[:html] << %{\n<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, }
- @o=@idx[:sst].index(@idx[:sst].last) #@o=@idx[:sst].length - 1
- @q=@idx[:html].index(@idx[:html].last) #@o=@idx[:html].length - 1
- 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][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:range]}</a>, }
- print a[:range] + ', ' if @md.cmd =~/V/
- elsif a[:ocn]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:ocn]}</a>, }
- print a[:ocn] + ', ' if @md.cmd =~/V/
- else p 'error'
- end
- end
- @idx[:html][@q]=@idx[:html][@q] + '</p>'
- 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][@o]=@idx[:sst][@o] + %{#{k}, }
- @idx[:html][@q]=@idx[:html][@q] + %{\n<p class="book_index_lev2">#{k}, }
- print "\n\t" + k + ', ' if @md.cmd =~/V/
- y.each do |z|
- if z[:range]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:range]}</a>, }
- print z[:range] + ', ' if @md.cmd =~/V/
- elsif z[:ocn]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:ocn]}</a>, }
- print z[:ocn] + ', ' if @md.cmd =~/V/
- else p 'error'
- end
- end
- @idx[:html][@q]=@idx[:html][@q] + '</p>'
- end
- end
- end
- @idx[:sst][@o]=@idx[:sst][@o] + " #{Mx[:id_o]}~0;0:0;x#{@x}#{Mx[:id_c]}"
- @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 + ', '
- #p y
- 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_html_idx(html_idx)
- if @md.book_idx
- path="#{@env.path.output}/#{@md.fnb}"
- Dir.mkdir(path) unless FileTest.directory?(path)
- html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
- html_idx.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 |para|
- para.gsub!(/\n*#{@rgx_idx}/m,'')
- tuned_file << para
- if para =~/#{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)
- 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/v1/dal_images.rb b/lib/sisu/v1/dal_images.rb
deleted file mode 100644
index 64d4bcef..00000000
--- a/lib/sisu/v1/dal_images.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_images
- class Images
- 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]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml')
- tell.warn
- end
- end
- data.each do |para|
- para.strip!
- if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/
- if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/
- m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
- if imagemagick_
- imgs=para.scan(m).flatten
- img_col=img_row=nil
- images=imgs.each do |image|
- dir=SiSU_Env::Info_env.new(@md.fns)
- path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex]
- 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]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly')
- tell.warn
- end
- imgsys=`identify #{image_path}/#{image}`.strip #system call
- 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
- 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 #480
- img_col=640 #480
- img_row=((1.00*img_col/col)*row).round
- end
- else #portrait
- if img_col> 640 #480
- img_col=640 #480
- 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
- para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}")
- else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]')
- end
- end
- else
- images=para.scan(m) do |image|
- tell=SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick is required',image)
- tell.warn #unless @opt.cmd =~/q/
- end
- end
- end
- end
- para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/
- tuned_file << para unless para.nil?
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_metadata.rb b/lib/sisu/v1/dal_metadata.rb
deleted file mode 100644
index 0981eb69..00000000
--- a/lib/sisu/v1/dal_metadata.rb
+++ /dev/null
@@ -1,225 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_metadata
- class Metadata
- def initialize(md,data)
- @md,@data=md,data
- l=SiSU_Env::Standardise_language.new.file_to_language(md.fns)
- language=l[:l]
- @tr=SiSU_Translate::Source.new(md,language)
- end
- def metadata
- data=@data
- meta,@dc,@rc,@cvs,dctitle,add=Array.new(6){[]}
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- ocnm=ocnd=ocnv=0
- ocnm+=1
- header1="\n#{Mx[:lv_o_1]}meta#{Mx[:lv_c]}Document Information (metadata) #{Mx[:id_o]}~0;0:0;m#{ocnm}#{Mx[:id_c]}"
- ocnm+=1
- header4="\n#{Mx[:lv_o_4]}metadata#{Mx[:lv_c]}Metadata #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}"
- ocnm+=1; ocnd+=1
- head_no_dc="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- ocnm+=1; ocnd+=1
- head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- data.each do |para|
- case para
- when /^#{Mx[:meta_o]}(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)#{Mx[:meta_c]}/i
- m=$1
- ocnm+=1; ocnd+=1
- @dc << case para
- when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/
- "\n#{@tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.full_title}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}(?:creator|author)#{Mx[:meta_c]}/
- "\n#{@tr.author}: #{Mx[:fa_underscore_o]}#{@md.author}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /#{Mx[:meta_o]}(?:translator|translated_by)#{Mx[:meta_c]}/
- "\n#{@tr.translator}: #{Mx[:fa_underscore_o]}#{@md.translator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}(?:illustrator|illustrated_by)#{Mx[:meta_c]}/
- "\n#{@tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.illustrator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}prepared_by#{Mx[:meta_c]}/
- "\n#{@tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.prepared_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}digitized_by#{Mx[:meta_c]}/
- "\n#{@tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.digitized_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}description#{Mx[:meta_c]}/
- "\n#{@tr.description}: #{Mx[:fa_underscore_o]}#{@md.description}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}subject#{Mx[:meta_c]}/
- "\n#{@tr.subject}: #{Mx[:fa_underscore_o]}#{@md.subject}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}abstract#{Mx[:meta_c]}/
- "\n#{@tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.abstract}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}publisher#{Mx[:meta_c]}/
- "\n#{@tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.publisher}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}contributor#{Mx[:meta_c]}/
- "\n#{@tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.contributor}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date.created#{Mx[:meta_c]}/
- "\n#{@tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.date_created}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date.issued#{Mx[:meta_c]}/
- "\n#{@tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.date_issued}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date.available#{Mx[:meta_c]}/
- "\n#{@tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.date_available}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date.modified#{Mx[:meta_c]}/
- "\n#{@tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.date_modified}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date.valid#{Mx[:meta_c]}/
- "\n#{@tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.date_valid}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}date#{Mx[:meta_c]}/
- "\n#{@tr.date}: #{Mx[:fa_underscore_o]}#{@md.date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}type#{Mx[:meta_c]}/
- "\n#{@tr.type}: #{Mx[:fa_underscore_o]}#{@md.type}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}format#{Mx[:meta_c]}/
- "\n#{@tr.format}: #{Mx[:fa_underscore_o]}#{@md.format}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}rights#{Mx[:meta_c]}/
- "\n#{@tr.rights}: #{Mx[:fa_underscore_o]}#{@md.rights}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}identifier#{Mx[:meta_c]}/
- "\n#{@tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.identifier}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}source#{Mx[:meta_c]}/
- "\n#{@tr.source}: #{Mx[:fa_underscore_o]}#{@md.source}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}language#{Mx[:meta_c]}/
- "\n#{@tr.language}: #{Mx[:fa_underscore_o]}#{@md.language}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}language.original#{Mx[:meta_c]}/
- "\n#{@tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.language_original}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}relation#{Mx[:meta_c]}/
- "\n#{@tr.relation}: #{Mx[:fa_underscore_o]}#{@md.relation}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}coverage#{Mx[:meta_c]}/
- "\n#{@tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.coverage}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}keywords#{Mx[:meta_c]}/
- "\n#{@tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.keywords}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}comments#{Mx[:meta_c]}/
- "\n#{@tr.comments}: #{Mx[:fa_underscore_o]}#{@md.comments}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/
- "\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/
- "\n#{@tr.cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}(?:cls_gutenberg|cls_pg)#{Mx[:meta_c]}/
- "\n#{@tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.cls_gutenberg}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- #"\n#{@tr.cls_gutenberg}: <u>#{@md.cls_pg}</u> #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}cls_isbn#{Mx[:meta_c]}/
- "\n#{@tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.cls_isbn}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}prefix(?:_a)?#{Mx[:meta_c]}/
- "\n#{@tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.prefix_a}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- when /^#{Mx[:meta_o]}prefix_b#{Mx[:meta_c]}/
- "\n#{@tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.prefix_b}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- else para.gsub(/^#{Mx[:meta_o]}(#{m})\s+(.+)/m,"\n#{m.capitalize}: #{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}")
- end
- end
- end
- ocnm+=1; ocnv+=1
- head_no_rc="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- head_no_rc_tag="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- data.each do |para|
- case para
- when /^0~(?:cvs|rcs)\+\s+/ #note the + sign to turn on use of cvs id
- ocnm+=1; ocnv+=1
- @cvs << "#{@tr.sc_number}: #{Mx[:fa_underscore_o]}#{@md.sc_number}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- @cvs << "#{@tr.sc_date}: #{Mx[:fa_underscore_o]}#{@md.sc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- @cvs << "CVS/RCS time: #{Mx[:fa_underscore_o]}#{@md.sc_time}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- when /^0~cvs[+\s]/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP
- when /^0~cvs\s+/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP
- end
- end
- if true #default version information
- ocnm+=1; ocnv+=1
- if @md.sc_filename \
- and @md.sc_filename.length > 3
- @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.sc_filename}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- else @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- end
- ocnm+=1; ocnv+=1
- if @md.file_encoding \
- and @md.file_encoding.length > 3 #translate
- @rc << "Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- end
- ocnm+=1; ocnv+=1
- if @md.dgst #change. enable by default
- @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- end
- if @md.dgst_skin #change. enable by default
- @rc << "Skin_Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- end
- @rc << "#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0
- @rc << "#{@tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- if @md.sisu_version[:version]
- @rc << "#{@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]}) #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- end
- @rc << "#{@tr.ruby_version}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- end
- meta << Mx[:br_page_new] << header1 << header4
- meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}"
- meta << "#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC) #{head_no_dc}" if @dc.length > 0
- meta << "#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]} #{head_no_dc_tag}" if @dc.length > 0
- @dc.each { |x| meta << x }
- meta << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0
- if @cvs.length > 0
- meta << "#{Mx[:fa_italics_o]}Note the version information provided here, is specific to the host site.#{Mx[:fa_italics_c]} #{head_no_rc_tag}"
- @cvs.each { |x| meta << x }
- end
- @rc.each { |x| meta << x }
- ## ENDNOTE RELATED endnote related
- meta << "\n#{Mx[:br_eof]}"
- meta=SiSU_hash::Object_digest.new(@md,meta,@env).object_digest
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_numbering.rb b/lib/sisu/v1/dal_numbering.rb
deleted file mode 100644
index 56a2999c..00000000
--- a/lib/sisu/v1/dal_numbering.rb
+++ /dev/null
@@ -1,368 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_numbering
- class Numbering
- def initialize(md,data)
- @md,@data=md,data
- end
- def numbering_song
- data=@data
- data=number_plaintext_para(data)
- data=name_endnote_seg(data) #tr issue
- data=auto_number_heading_ie_title(data) #tr issue
- data=ocn(data) #watch
- data=minor_numbering(data)
- data=name_para_seg_filename(data)
- data=set_heading_seg(data) unless @md.set_heading_seg
- data=set_heading_top(data) unless @md.set_heading_top
- data=set_header_title(data) unless @md.set_header_title
- data
- end
- def number_plaintext_para(data)
- @tuned_file=[]
- data.each do |para|
- if para !~/#{Mx[:gr_o]}(?:code|group|alt|poem|verse)#{Mx[:gr_c]}|#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/
- para.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
- end
- para.gsub!(/^/,"\n") unless para =~/#{Mx[:tc_p]}/u
- para.gsub!(/^\s+|\s$/,"\n")
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- def name_endnote_seg(data)
- tuned_file=data
- if @md.flag_auto_endnotes \
- and @md.flag_separate_endnotes_make
- tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}"
- end
- tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON
- tuned_file=tuned_file.flatten
- end
- def owner_details_seg
- data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details"
- end
- def number_sub_heading(para,num,title_no)
- case para
- when /#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/; para.gsub!(/#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/,"#{title_no} ")
- when /^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/; para.gsub!(/^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/,"#{title_no} ")
- when /^#{Mx[:lv_o]}#{num}:[a-z_\.]+#{Mx[:lv_c]}/
- para.gsub!(/^#{Mx[:lv_o]}#{num}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,%{#{Mx[:lv_o]}#{num}:\\1#{Mx[:lv_c]} #{title_no} \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}})
- when /^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}\s*#{title_no}/
- para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]}") #where title contains title number
- else para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]} #{title_no} ") #main, where title number is to be provided
- end
- if @md.toc_lev_limit \
- and @md.toc_lev_limit < num
- para.gsub!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch
- end
- para
- end
- def auto_number_heading_ie_title(data) #also does some segment naming
- @tuned_file=[]
- if @md.markup =~/num_top/ \
- or @md.num_top # watch, 2003w23
- input="#{@md.markup}"[/num_top\=([1-6])/,1] if @md.markup
- input||=@md.num_top if @md.num_top !~/^$/
- end
- num_top=input.to_i
- t_no1=t_no2=t_no3=t_no4=0
- no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3)
- t_not=0
- data.each do |para| #@md.seg_names << [additions to segment names]
- if (@md.markup =~/num_top/ \
- or (@md.num_top \
- and @md.num_top !~/^$/)) \
- and para !~/^#{Rx[:meta]}/
- if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \
- and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/)
- t_not+=1 #; t_no2=0; t_no3=0
- para.gsub!(/^(#{Mx[:lv_o]}(?:#{no1}|#{no2}|#{no3}|#{no4})):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
- end
- if para =~/#{Mx[:lv_o]}#{no1}:/
- @subnumber=1
- @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/
- end
- if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \
- and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s*[\d.]+)\s/ \
- and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/
- if para =~/^#{Mx[:lv_o]}#{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)
- para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*(\S+)#/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329)
- para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. })
- unless para =~/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
- para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]}#{title_no}. ")
- end
- @md.seg_names << title_no
- #else puts "warning segment name #{title_no} already exists"
- end
- unless para =~/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required
- para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,
- %{#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}#{title_no}. \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}})
- end
- para.gsub!(/^#{Mx[:lv_o]}#{no1}:##{Mx[:lv_c]}/,"#{title_no}. ") #watch
- para.gsub!(/^#{no1}~#\s*/,"#{title_no}. ")
- end
- if para =~/^#{Mx[:lv_o]}#{no2}:\S*?#{Mx[:lv_c]}/
- t_no2+=1; t_no3=0
- title_no="#{t_no1}.#{t_no2}"
- para=number_sub_heading(para,no2,title_no)
- end
- if para =~/^#{Mx[:lv_o]}#{no3}:\S*?#{Mx[:lv_c]}/
- t_no3+=1
- title_no="#{t_no1}.#{t_no2}.#{t_no3}"
- para=number_sub_heading(para,no3,title_no)
- end
- elsif para =~/^#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}/ # endnotes, watch2005
- para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}") #"#{no1}~\\1 ")
- para.gsub!(/^#{Mx[:lv_o]}#{no2}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no2}:\\1#{Mx[:lv_c]}")
- para.gsub!(/^#{Mx[:lv_o]}#{no3}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no3}:\\1#{Mx[:lv_c]}")
- end
- elsif @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
- if para =~/^#{Mx[:lv_o]}[1-9]:#{Mx[:lv_c]}([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d
- name_num=$1
- para.gsub!(/^#{Mx[:lv_o]}([1-9]:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{name_num}#{Mx[:lv_c]}")
- end
- if @md.toc_lev_limit
- end
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- def ocn(data) #and auto segment numbering increment
- @tuned_file=[]
- object_array=SiSU_document_structure::OCN.new(@md,data).ocn
- object_array.each do |o|
- @tuned_file <<= if o.ocn; "#{o.txt} #{Mx[:id_o]}~#{o.ocn};#{o.lv};#{o.type}#{Mx[:id_c]}" #main ocn descriptor
- else o.txt
- end
- end
- @tuned_file=@tuned_file.flatten
- 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 |para|
- if para =~/\w|\S|<|\(/
- if para !~/^%% |#{Rx[:meta]}|^0~|^#{Mx[:lv_o]}endnotes:|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}:p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|#{Mx[:gr_o]}(?:alt|code|group|poem|table)#{Mx[:gr_c]}|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here #&nbsp; added with Tune.code #¡
- if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/; number_small,letter_small=0,0 #% 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)
- end
- if para =~/^#[ 1]/
- letter_small=0
- number_small=0 if para =~ /^#1/
- number_small+=1
- para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004
- end
- if para =~/^_# /
- para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004
- letter_small+=1
- end
- end
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- def name_para_seg_filename(data)
- # 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=[]
- art_filename_auto=1
- @counter=1
- @unique_auto_name=[]
- if not @md.seg_autoname_safe and @md.cmd =~/[MV]/
- puts 'manual segment names, numbers used as names, risk warning (segmented html)'
- end
- data.each do |para|
- para=SiSU_document_structure::Structure.new(@md,para).structure_markup
- if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}/
- if para=~/^#{Mx[:lv_o]}[4]:#{Mx[:lv_c]}/ \
- and not @md.set_heading_seg
- @md.set_heading_seg=true
- end
- if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}(?:\s*\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
- pattern=$1
- pattern.gsub!(/(?:[:,-]|\W)/,'.')
- pattern.gsub!(/\.$/,'')
- if not @md.seg_names.nil? \
- and not @md.seg_names.include?(pattern)
- para.gsub!(/^#{Mx[:lv_o]}([456]):#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1:#{pattern}#{Mx[:lv_c]}")
- @md.seg_names << pattern
- else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/
- end
- end
- if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}.+?;4:(\d+);/m #extract segment name from embedded document structure info
- pattern=$1
- pattern.gsub!(/(?:[:,-]|\W)/,'.')
- pattern.gsub!(/\.$/,'')
- if not @md.seg_names.nil? \
- and not @md.seg_names.include?(pattern)
- para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}")
- @md.seg_names << pattern
- else
- para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1~#{pattern}#{Mx[:lv_c]}")
- @md.seg_names << "~#{pattern}"
- end
- end
- if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}/ #if still not segment name, provide a numerical one
- if not @md.seg_names.nil? \
- and not @md.seg_names.include?(art_filename_auto)
- para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,%{#{Mx[:lv_o]}\\1~#{art_filename_auto}#{Mx[:lv_c]}})
- @md.seg_names << art_filename_auto
- else puts 'segment name (numbering) error'
- end
- art_filename_auto+=1
- end
- end
- @tuned_file << if para =~/^#{Mx[:lv_o]}([1-6]):\S*?#{Mx[:lv_c]}/m \
- and (@md.pagenew or @md.pagebreak)
- m=$1 #watch ref~
- para_tmp=[]
- if @md.pagenew.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page_new]}\n" << para
- elsif @md.pagebreak.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page]}\n" << para
- end
- para_result=unless para_tmp.length > 0; para
- else para_tmp
- end
- else para
- end
- end
- if @md.seg_names.length > 0
- @md.set_heading_seg=true
- end
- @tuned_file=@tuned_file.flatten
- 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 |para|
- unless @md.set_heading_top
- if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \
- and para !~/\A\s*\Z/m
- @md.set_heading_top=true
- head=if @md.title ; "#{Mx[:lv_o]}1:#{Mx[:lv_c]} #{@md.title}"
- else "#{Mx[:lv_o]}1:#{Mx[:lv_c]} [no title provided]"
- end
- @tuned_file << head
- end
- end
- @tuned_file << para
- 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 |para|
- unless @md.set_heading_seg
- if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \
- and para !~/\A\s*\Z/m \
- and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/
- @md.set_heading_seg=true
- head=if @md.title ; "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [#{@md.title}]"
- else "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [segment]"
- end
- @tuned_file << head
- end
- end
- @tuned_file << para
- 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 |para|
- unless @md.set_header_title
- if para !~/^%{1,2}\s/m \
- and para !~/\A\s*\Z/m
- @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}"
- @md.title=@md.heading_seg_first
- @md.set_header_title=true
- end
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/dal_substitutions_and_insertions.rb b/lib/sisu/v1/dal_substitutions_and_insertions.rb
deleted file mode 100644
index 8733d764..00000000
--- a/lib/sisu/v1/dal_substitutions_and_insertions.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_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.to_f >= 0.38
- SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize
- else
- SiSU_document_structure::Structure.new(@md,para).structure_marks
- end
- #para.gsub!(/<url:(\S+?)>/,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate?
- 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/v1/dal_syntax.rb b/lib/sisu/v1/dal_syntax.rb
deleted file mode 100644
index 98886f51..00000000
--- a/lib/sisu/v1/dal_syntax.rb
+++ /dev/null
@@ -1,421 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: 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}"
- @http_m=%r{\{.+?\}(?:https?|file)://\S+|(?:https?|file):\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
- @manmkp_ital='[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_italic[:str] \
- and defined? @vz.markup_make_italic[:str]
- /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
- elsif defined? @md.make_italic[:str]
- /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|#{@md.make_italic[: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='^!_\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.each do |line|
- line=if @md.sem_tag then sem(line) else line end
- line=pre(line)
- line=wordlist_italics(line)
- line=wordlist_bold(line)
- line=bodymarkup(line)
- @data_new << line
- end
- @data_new
- end
- def sem(line)
- line=SiSU_sem::Tags.new(line,@md).rm.all
- end
- def pre(line)
- line=line.dup
- line.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- line.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- if line =~/\{(?:t|table)(?:~h)?\s*c?[\d; ]*\}/; line.gsub!(/(\n)/,';;\1') #markup for alternative tables
- end
- line
- end
- def wordlist_italics(line)
- line=line.dup
- if (defined? @md.make_italic[:str] \
- and @md.make_italic[:str]) \
- or (defined? @vz.markup_make_italic[:str] \
- and @vz.markup_make_italic[:str])
- line= if line !~/^(?:#{Rx[:meta]}|#{Mx[:gr_o]}code)/ #!~/^(?:[0-6]~|!_|%+\s)/
- word=line.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_italic[:regx] \
- and @md.make_italic[:regx]
- w.gsub!(@md.make_italic[: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]}")
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else line
- end
- end
- line
- end
- def embolden(given)
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*?)(<br>)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2")
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}")
- given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(<br>)/,"#{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*(.+?)(<br>)/,"#{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(line)
- line=line.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])
- line=if line !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}|%+\s|#{Mx[:gr_o]}code)/
- line_array=[]
- word=line.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: 0~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)
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else line
- end
- else
- if line !~/^(?:#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|%+\s)/ \
- and line =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
- embolden(line)
- end
- if line =~ /\/_\s+/
- italicise(line)
- end
- end
- line
- end
- def bodymarkup(line)
- # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
- # See: data/sisu/sample/document_samples_sisu_markup/
- # !{emphasis}! e{emphasis}e <strong>emphasis</strong>
- # *{bold text}* b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite> #blockquote?
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # !_ #bold/emphasise paragraph
- # _" #blockquote paragraph
- # _1 <:i1> #indent paragraph 1 step
- # _2 <:i2> #indent paragraph 2 steps
- # _3 <:i3> #indent paragraph 3 steps
- # _4 <:i4> #indent paragraph 4 steps
- # _* #bullet (list) ●
- # _1* #bullet (list) indented
- # _1* #bullet (list) indented
- # # #numbered (list) level 1
- # _# #numbered (list) level 2
- line=line.dup
- if line !~/^#{Mx[:meta_o]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/
- #special characters: ~ { } < > - _ / also used : ^ ! #
- line_array=[]
- line.gsub!(/^%{1,4} .+/mi,'') #remove comments
- word=line.scan(/\S+|\n/) unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|http:\/\/\S+/
- w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- #w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")
- 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
- line=line_array.join(' ')
- line=line.strip
- end
- line.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c])
- line.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify
- line.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
- if line =~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/
- if @md.subtitle and not @md.subtitle.empty?
- line.gsub!(/\s*@title\b/," #{@md.title} - #{@md.subtitle}")
- else line.gsub!(/\s*@title\b/," #{@md.title}")
- end
- line.gsub!(/\s+(?:@creator|@author)/,",<br />#{@md.author}")
- end
- line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") #
- line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.author}") #
- line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup
- line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here
- line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30
- line.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character
- line.gsub!(/&nbsp;/,"#{Mx[:nbsp]}") #escaped special character
- line.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #&amp; #escaped special character
- line.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- #ADD -->
- line.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/(?:^| )\*~([a-z0-9._-]+)/i," #{Mx[:mk_o]}:name#\\1#{Mx[:mk_c]}") #html name marker <a name="\\1"></a>
- line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}") #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only
- line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
- line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\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 line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m
- line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m,
- "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")
- #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas]
- #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde..
- end
- #line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch
- line.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- # depreciated -->#{Mx[:fa_c]}
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- # depreciated ^
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
- line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- line.gsub!(/(^|[^\\]),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{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!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url))
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch
- line.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
- line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested
- line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut
- line.gsub!(/=\{(.+?)\}/,"#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") #
- line.gsub!(/^\s*_([1-9])\*\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut
- #line.gsub!(/^\s*_([1-9])(\*+)\s*/,"#{Mx[:fa_o]}:i\\1#{Mx[:fa_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]}") #indent
- line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- ##added
- #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?([~-]#)$/i,'<b>\1</b> \2') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'<b>\1</b>') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'<b>\1</b> ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/^_" (.*)\n/i,'<blockquote>\1</blockquote> ') #blockquotes #introduce KEEP
- line.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- line.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>')
- #line.gsub!(/<:hi>/,
- #line.gsub!(/<:\/hi>/,'</span>')
- line.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n")
- line.gsub!(/[ ]+($)/,'\1')
- line.gsub!(/\{\s*(.+?)\s*\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image)
- line.gsub!(/\{\s*(.+?)\s*\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
- #line.gsub!(/(#{Mx[:lnk_c]})\s*((?:https?|file|ftp):\S+?)/m,'\1\2')
- ##semantic
- #line.gsub!(/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m,"\\1#{Mx[:sm_set_o]}\\2#{Mx[:sm_set_c]}\\1")
- #line.gsub!(/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/,"#{Mx[:sm_subset_o]}\\1#{Mx[:sm_subset_c]}\\2")
- if line =~/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/; line.gsub!(/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/i,"\\1\n") #cosmetic
- else line.gsub!(/<br \/>/i,"#{Mx[:br_line]}\n")
- end
- elsif line =~/^#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets
- line.gsub!(/([<>])/,'_\1')
- line.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy
- line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy
- line.gsub!(/(^|#{Mx[:gl_c]}|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
- line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
- line
- else # 0~
- end
- line
- end
- def tech #script markup planned to be more strict for technical documents
- # !{emphasis}! e{emphasis}e <strong>emphasis</strong>
- # *{bold text}* b{bold}b <b>bold text</b>
- # _{underline}_ u{underline}u <u>underline</u>
- # /{italics}/ i{italics}i <i>italics</i>
- # "{citation}" c{citation}c <cite>citation</cite>
- # ^{superscript}^ <sup>superscript</sup>
- # ,{subscript}, <sub>subscript</sub>
- # +{inserted text}+ <ins>inserted text</ins>
- # -{deleted text}- <del>deleted text</del>
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~ <!e endnote !>
- # +1 <!i1!>
- # +2 <!i2!>
- puts 'tech'
- @data.each do |line|
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_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]}") #emphasis
- 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#{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#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold 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>|<br \/>)\s*_[12]\s+/,"#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- end
- @data
- end
- end
-end
-__END__
-NOTE:
-downstream code blocks are not currently/yet honoured, e.g. stuff within angle brackets are removed
diff --git a/lib/sisu/v1/db_columns.rb b/lib/sisu/v1/db_columns.rb
deleted file mode 100644
index c580db5f..00000000
--- a/lib/sisu/v1/db_columns.rb
+++ /dev/null
@@ -1,229 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_columns
- class Column_size
- def lt_title
- 600
- end
- def lt_subtitle
- 600
- end
- def lt_author
- 600
- end
- def lt_author_title
- 100
- end
- def lt_author_nationality
- 100
- end
- def lt_illustrator
- 600
- end
- def lt_translator
- 600
- end
- def lt_prepared_by
- 600
- end
- def lt_digitized_by
- 600
- end
- def lt_subject
- 600
- end
- def lt_date
- 10
- end
- def lt_type
- 600
- end
- def lt_description
- 2000
- end
- def lt_publisher
- 600
- end
- def lt_contributor
- 600
- end
- def lt_format
- 600
- end
- def lt_identifier
- 256
- end
- def lt_source
- 200
- end
- def lt_language
- 30
- end
- def lt_language_char
- 3
- end
- def lt_language_original
- 30
- end
- def lt_language_original_char
- 3
- end
- def lt_relation
- 100
- end
- def lt_coverage
- 100
- end
- def lt_rights
- 2000
- end
- def lt_copyright
- 2000
- end
- def lt_owner
- 600
- end
- def lt_keywords
- 600
- end
- def lt_comment
- 600
- end
- def lt_loc
- 30
- end
- def lt_dewey
- 30
- end
- def lt_isbn
- 16
- end
- def lt_pg
- 10
- end
- def lt_abstract
- 600
- end
- def lt_skin
- 100
- end
- def lt_markup
- 100
- end
- def lt_links
- 100
- end
- def lt_information
- 100
- end
- def lt_contact
- 100
- end
- def lt_suffix
- 600
- end
- def lt_filename
- 256
- end
- def lt_types
- 1
- end
- def lt_subj
- 64
- end
- def lt_orig_pub
- 400
- end
- def lt_orig_pub_date
- 400
- end
- def lt_orig_pub_institution
- 200
- end
- def lt_orig_pub_nationality
- 200
- end
- def lt_writing_focus_nationality
- 100
- end
- def lt_topic_register
- 2000
- end
- def document_clean # restriction not necessary #12000 #2712
- 60000
- end
- def document_body
- 16000
- end
- def document_seg
- 120
- end
- def document_seg_full
- 120
- end
- def endnote_clean # restriction not necessary #12000 #2712
- 60000
- end
- def endnote_body
- 16000
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_create.rb b/lib/sisu/v1/db_create.rb
deleted file mode 100644
index 62d46cb7..00000000
--- a/lib/sisu/v1/db_create.rb
+++ /dev/null
@@ -1,597 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_create
- require "#{SiSU_lib}/db_columns"
- class Create < SiSU_DB_columns::Column_size
- require "#{SiSU_lib}/sysenv"
- @@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=Comment.new(@conn,@sql_type)
- @@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=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db:',%{"SiSU_#{@env.path.stub_pwd}"})
- tell.colorize unless @opt.cmd =~/q/
- SiSU_Env::System_call.new.create_pg_db(@env.path.stub_pwd) #watch use of path.stub_pwd instead of stub
- end
- def output_dir?
- dir=SiSU_Env::Info_env.new('')
- if @opt.cmd =~/d/
- #p dir.path.webserv_stub_ensure.inspect
- dir.path.webserv_stub_ensure
- end
- end
- def create_table
- def metadata
- print %{
- currently using sisu dbi module
- to be populated from documents files
- create tables metadata
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE metadata (
- tid BIGINT PRIMARY KEY,
- title VARCHAR(#{lt_title}) NULL,
- subtitle VARCHAR(#{lt_subtitle}) NULL,
- author VARCHAR(#{lt_author}) NULL,
-/* plan to replace creator field, currently used, with author field */
- creator VARCHAR(#{lt_author}) NULL,
- author_title VARCHAR(#{lt_author_title}) NULL,
- author_nationality VARCHAR(#{lt_author_nationality}) NULL,
- illustrator VARCHAR(#{lt_illustrator}) NULL,
- translator VARCHAR(#{lt_translator}) NULL,
- subject VARCHAR(#{lt_subject}) NULL,
- date VARCHAR(#{lt_date}) NULL,
- date_added_to_site VARCHAR(#{lt_date}) NULL,
- date_created VARCHAR(#{lt_date}) NULL,
- date_issued VARCHAR(#{lt_date}) NULL,
- date_available VARCHAR(#{lt_date}) NULL,
- date_valid VARCHAR(#{lt_date}) NULL,
- date_modified VARCHAR(#{lt_date}) NULL,
- date_translated VARCHAR(#{lt_date}) NULL,
-/* date DATE, */
-/* date_added_to_site DATE, */
-/* date_created DATE, */
-/* date_issued DATE, */
-/* date_available DATE, */
-/* date_valid DATE, */
-/* date_modified DATE, */
-/* date_translated DATE, */
- type VARCHAR(#{lt_type}) NULL,
- description VARCHAR(#{lt_description}) NULL,
- publisher VARCHAR(#{lt_publisher}) NULL,
- contributor VARCHAR(#{lt_contributor}) NULL,
- prepared_by VARCHAR(#{lt_prepared_by}) NULL,
- digitized_by VARCHAR(#{lt_digitized_by}) NULL,
- format VARCHAR(#{lt_format}) NULL,
- identifier VARCHAR(#{lt_identifier}) NULL,
- source VARCHAR(#{lt_source}) NULL,
- language VARCHAR(#{lt_language}) NULL,
- language_original VARCHAR(#{lt_language_original}) NULL,
- relation VARCHAR(#{lt_relation}) NULL,
- coverage VARCHAR(#{lt_coverage}) NULL,
- rights VARCHAR(#{lt_rights}) NULL,
- copyright VARCHAR(#{lt_copyright}) NULL,
- owner VARCHAR(#{lt_owner}) NULL,
- keywords VARCHAR(#{lt_keywords}) NULL,
- comment VARCHAR(#{lt_comment}) NULL,
- loc VARCHAR(#{lt_loc}) NULL,
- dewey VARCHAR(#{lt_dewey}) NULL,
- isbn VARCHAR(#{lt_isbn}) NULL,
- pg VARCHAR(#{lt_pg}) NULL,
- abstract VARCHAR(#{lt_abstract}) NULL,
- prefix_a TEXT NULL,
- prefix_b TEXT NULL,
- skin VARCHAR(#{lt_skin}) NULL,
- markup VARCHAR(#{lt_markup}) NULL,
- links VARCHAR(#{lt_links}) NULL,
- information VARCHAR(#{lt_information}) NULL,
- contact VARCHAR(#{lt_contact}) NULL,
- suffix VARCHAR(#{lt_suffix}) NULL,
- filename VARCHAR(#{lt_filename}) NULL UNIQUE,
- types CHAR(#{lt_types}) NULL,
- subj VARCHAR(#{lt_subj}) NULL,
- original_publication VARCHAR(#{lt_orig_pub}) NULL,
- original_publication_date VARCHAR(#{lt_orig_pub_date}) NULL,
- original_publication_institution VARCHAR(#{lt_orig_pub_institution}) NULL,
- original_publication_nationality VARCHAR(#{lt_orig_pub_nationality}) NULL,
- writing_focus_nationality VARCHAR(#{lt_writing_focus_nationality}) NULL,
- topic_register VARCHAR(#{lt_topic_register}) NULL
- );
- })
- @comment.metadata
- end
- def documents # create documents base
- print %{
- to be populated from documents files
- create tables documents document_trade document_env
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE documents (
- lid BIGINT PRIMARY KEY,
- metadata_tid BIGINT REFERENCES metadata,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- clean TEXT NULL,
- body TEXT NULL,
- seg VARCHAR(#{document_seg}) NULL,
- 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,
- digest_clean CHAR(#{@@dl}),
- digest_all CHAR(#{@@dl}),
- types CHAR(1) NULL
- );
- })
- @comment.documents
- 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 documents,
- 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
- );
- })
- @comment.endnotes
- 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 documents,
- 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
- );
- })
- @comment.endnotes_asterisk
- 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 documents,
- 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
- );
- })
- @comment.endnotes_plus
- end
- def urls # create documents file links mapping
- print %{
- currently using sisu dbi module
- to be populated from documents files
- create tables urls
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE urls (
- metadata_tid BIGINT REFERENCES metadata,
- 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.urls
- end
- self
- end
- end
- class Comment
- def initialize(conn,sql_type='pg')
- @conn=conn
- if sql_type =~ /pg/; psql
- else none
- 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 conn_execute_array(sql_arr)
- # sql_arr.each do |sql|
- # @conn.execute(sql)
- # end
- #end
- def metadata
- sql_arr=[
- %{COMMENT ON Table metadata
- IS 'contains SiSU documents metadata with metadata';},
- %{COMMENT ON COLUMN metadata.tid
- IS 'unique';},
- %{COMMENT ON COLUMN metadata.filename
- IS 'document filename';},
- %{COMMENT ON COLUMN metadata.title
- IS 'metadata title (dublin core element 1)';},
- %{COMMENT ON COLUMN metadata.subtitle
- IS 'document subtitle';},
- %{COMMENT ON COLUMN metadata.creator
- IS 'metadata creator (dublin core element 2)';},
- %{COMMENT ON COLUMN metadata.author
- IS 'metadata author (dublin core element 2)';},
- %{COMMENT ON COLUMN metadata.illustrator
- IS 'metadata illustrator';},
- %{COMMENT ON COLUMN metadata.translator
- IS 'metadata translator';},
- %{COMMENT ON COLUMN metadata.subject
- IS 'metadata subject (dublin core element 3)';},
- %{COMMENT ON COLUMN metadata.date
- IS 'metadata date (dublin core element 7)';},
- %{COMMENT ON COLUMN metadata.date_created
- IS 'metadata date created (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_issued
- IS 'metadata date of issue (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_available
- IS 'metadata date available (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_valid
- IS 'metadata date valid (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_modified
- IS 'metadata date modified (dublin core)';},
- %{COMMENT ON COLUMN metadata.type
- IS 'metadata type (dublin core element 8)';},
- %{COMMENT ON COLUMN metadata.description
- IS 'metadata description (dublin core element 4)';},
- %{COMMENT ON COLUMN metadata.publisher
- IS 'metadata publisher (dublin core element 5)';},
- %{COMMENT ON COLUMN metadata.contributor
- IS 'metadata contributor (dublin core element 6)';},
- %{COMMENT ON COLUMN metadata.prepared_by
- IS 'metadata markup prepared by';},
- %{COMMENT ON COLUMN metadata.digitized_by
- IS 'metadata digitized by';},
- %{COMMENT ON COLUMN metadata.format
- IS 'metadata format (dublin core element 9)';},
- %{COMMENT ON COLUMN metadata.identifier
- IS 'metadata identifier (dublin core element 10)';},
- %{COMMENT ON COLUMN metadata.source
- IS 'metadata source (dublin core element 11)';},
- %{COMMENT ON COLUMN metadata.language
- IS 'metadata language (dublin core element 12)';},
- %{COMMENT ON COLUMN metadata.language_original
- IS 'metadata original language';},
- %{COMMENT ON COLUMN metadata.relation
- IS 'metadata (dublin core element 13)';},
- %{COMMENT ON COLUMN metadata.coverage
- IS 'metadata coverage (dublin core element 14)';},
- %{COMMENT ON COLUMN metadata.rights
- IS 'metadata rights / copyright / license (dublin core element 15)';},
- %{COMMENT ON COLUMN metadata.owner
- IS 'metadata owner';},
- %{COMMENT ON COLUMN metadata.keywords
- IS 'metadata keywords';},
- %{COMMENT ON COLUMN metadata.comment
- IS 'metadata comment';},
- %{COMMENT ON COLUMN metadata.abstract
- IS 'metadata abstract';},
- %{COMMENT ON COLUMN metadata.loc
- IS 'metadata library of congress';},
- %{COMMENT ON COLUMN metadata.dewey
- IS 'metadata dewey';},
- %{COMMENT ON COLUMN metadata.isbn
- IS 'metadata isbn';},
- %{COMMENT ON COLUMN metadata.pg
- IS 'metadata project gutenberg number';},
- %{COMMENT ON COLUMN metadata.prefix_a
- IS 'metadata prefix';},
- %{COMMENT ON COLUMN metadata.prefix_b
- IS 'metadata prefix';},
- %{COMMENT ON COLUMN metadata.skin
- IS 'metadata sisu skin';},
- %{COMMENT ON COLUMN metadata.markup
- IS 'metadata markup source';},
- %{COMMENT ON COLUMN metadata.links
- IS 'metadata links';},
- %{COMMENT ON COLUMN metadata.information
- IS 'metadata information';},
- %{COMMENT ON COLUMN metadata.contact
- IS 'metadata contact';},
- %{COMMENT ON COLUMN metadata.suffix
- IS 'metadata sisu suffix (output related)';},
- %{COMMENT ON COLUMN metadata.filename
- IS 'metadata source filename';},
- %{COMMENT ON COLUMN metadata.types
- IS 'document types scroll 1, seg 2, both 3';},
- %{COMMENT ON COLUMN metadata.subj
- IS 'subject areas - no way to populate at present as not mapped';},
- ]
- conn_execute_array(sql_arr)
- end
- def documents
- sql_arr=[
- %{COMMENT ON Table documents
- IS 'contains searchable text of SiSU documents';},
- %{COMMENT ON COLUMN documents.lid
- IS 'unique';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata';},
- %{COMMENT ON COLUMN documents.lev
- IS 'doc level 1-6 \d\~';},
- %{COMMENT ON COLUMN documents.seg
- IS 'segment name from level 4';},
- %{COMMENT ON COLUMN documents.ocn
- IS 'object citation number';},
- %{COMMENT ON COLUMN documents.en_a
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z to create range)';},
- %{COMMENT ON COLUMN documents.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 documents.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 documents.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 documents.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 documents.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 documents.types
- IS 'document types seg scroll';},
- %{COMMENT ON COLUMN documents.clean
- IS 'text object - substantive text: clean, stripped of markup';},
- %{COMMENT ON COLUMN documents.body
- IS 'text object - substantive text: light html markup';},
- %{COMMENT ON COLUMN documents.lev1
- IS 'document structure, level 1';},
- %{COMMENT ON COLUMN documents.lev2
- IS 'document structure, level 2';},
- %{COMMENT ON COLUMN documents.lev3
- IS 'document structure, level 3';},
- %{COMMENT ON COLUMN documents.lev4
- IS 'document structure, level 4';},
- %{COMMENT ON COLUMN documents.lev5
- IS 'document structure, level 5';},
- %{COMMENT ON COLUMN documents.lev6
- IS 'document structure, level 6';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes
- sql_arr=[
- %{COMMENT ON Table endnotes
- IS 'contains searchable text of SiSU documents endnotes';},
- %{COMMENT ON COLUMN endnotes.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - 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 asterisk';},
- %{COMMENT ON COLUMN endnotes_asterisk.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_asterisk.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_asterisk.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes_asterisk.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_asterisk.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_asterisk.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - 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';},
- %{COMMENT ON COLUMN endnotes_plus.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_plus.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_plus.nr
- IS 'endnote number <!e_(\d+)!>';},
- %{COMMENT ON COLUMN endnotes_plus.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_plus.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_plus.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - 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 documents.metadata_tid
- IS 'tie to title in metadata - 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
- def none
- def metadata
- end
- def documents
- end
- def endnotes
- end
- def endnotes_asterisk
- end
- def endnotes_plus
- end
- def urls
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_dbi.rb b/lib/sisu/v1/db_dbi.rb
deleted file mode 100644
index 932dd440..00000000
--- a/lib/sisu/v1/db_dbi.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_DBI
- require "#{SiSU_lib}/db_columns"
- require "#{SiSU_lib}/db_tests"
- require "#{SiSU_lib}/db_create"
- require "#{SiSU_lib}/db_select"
- require "#{SiSU_lib}/db_indexes"
- require "#{SiSU_lib}/db_drop"
- require "#{SiSU_lib}/db_remove"
- require "#{SiSU_lib}/db_load_tuple"
- require "#{SiSU_lib}/db_import"
- class Column_size < SiSU_DB_columns::Column_size
- end
- class Test < SiSU_DB_tests::Test #% db_tests.rb
- end
- class Create <SiSU_DB_create::Create #<SiSU_DB::Column_size #% db_create.rb
- end
- class Case <SiSU_DB_select::Case #% db_select.rb
- end
- class Index <SiSU_DB_index::Index #% db_indexes.rb
- end
- class Drop <SiSU_DB_drop::Drop #% db_drop.rb
- end
- class Remove <SiSU_DB_remove::Remove #% db_remove.rb
- end
- class Load_documents <SiSU_DB_tuple::Load_documents #% db_load_tuple.rb
- end
- class Load_metadata <SiSU_DB_tuple::Load_metadata #% db_load_tuple.rb
- end
- class Load_urls <SiSU_DB_tuple::Load_urls #% db_update urls
- end
- class Import <SiSU_DB_import::Import #<SiSU_DB::Column_size #% db_import.rb
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_drop.rb b/lib/sisu/v1/db_drop.rb
deleted file mode 100644
index beec90a5..00000000
--- a/lib/sisu/v1/db_drop.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_drop
- class Drop
- require "#{SiSU_lib}/response"
- 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 #{cascade};",
- "DROP TABLE documents #{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/
- @conn.transaction
- @drop_table.each do |d|
- @conn.execute(d)
- end
- @conn.commit
- puts msg_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
- rescue
- case @sql_type
- when /sqlite/
- #system("rm -vi #{@db_info.sqlite.db}")
- 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
- #@conn.do(@drop_table.join(''))
- end
- ensure
- #commit
- end
- end
- def indexes #% drop all indexes
- #@conn.do(%{
- # DROP INDEX object_nr ON documents(ocn);
- # DROP INDEX body ON documents(body);
- # DROP INDEX clean ON documents(clean);
- # DROP INDEX lev1 ON documents(lev1);
- # DROP INDEX lev2 ON documents(lev2);
- # DROP INDEX lev3 ON documents(lev3);
- # DROP INDEX lev4 ON documents(lev4);
- # DROP INDEX lev5 ON documents(lev5);
- # DROP INDEX lev6 ON documents(lev6);
- # DROP INDEX endnote_nr ON endnotes(nr);
- # DROP INDEX endnote ON endnotes(body);
- # DROP INDEX title ON metadata(title);
- # DROP INDEX filename ON metadata(filename)
- # /*
- # DROP INDEX object_nr ON documents(ocn) CASCADE;
- # DROP INDEX body ON documents(body) CASCADE;
- # DROP INDEX clean ON documents(clean) CASCADE;
- # DROP INDEX lev1 ON documents(lev1) CASCADE;
- # DROP INDEX lev2 ON documents(lev2) CASCADE;
- # DROP INDEX lev3 ON documents(lev3) CASCADE;
- # DROP INDEX lev4 ON documents(lev4) CASCADE;
- # DROP INDEX lev5 ON documents(lev5) CASCADE;
- # DROP INDEX lev6 ON documents(lev6) CASCADE;
- # DROP INDEX endnote_nr ON endnotes(nr) CASCADE;
- # DROP INDEX endnote ON endnotes(body) CASCADE;
- # DROP INDEX title ON metadata(title) CASCADE;
- # DROP INDEX filename ON metadata(filename) CASCADE
- # */
- #})
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_import.rb b/lib/sisu/v1/db_import.rb
deleted file mode 100644
index 036f446e..00000000
--- a/lib/sisu/v1/db_import.rb
+++ /dev/null
@@ -1,924 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_import
- require "#{SiSU_lib}/db_columns"
- require "#{SiSU_lib}/db_load_tuple"
- require "#{SiSU_lib}/shared_html_lite"
- require 'sqlite3'
- class Import < SiSU_DB_columns::Column_size
- 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]
- @fnm="#@dal/#{@opt.fns}.meta.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
- @driver_sqlite3=false
- @driver_sqlite3=true if @conn.inspect.match(/^(.{10})/)[1] == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]
- sql='SELECT MAX(lid) FROM documents'
- begin
- @col[:lid] ||=0
- @col[:lid]=if @driver_sqlite3
- @conn.execute( sql ).join.to_i
- else @conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- end
- 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=if @driver_sqlite3
- @conn.execute( sql ).join.to_i
- else
- @id_n=@conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- end
- 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_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}")
- tell.puts_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnm)
- tell.print_grey if @opt.cmd =~/v/
- file_exist=if @sql_type=~/sqlite/; nil
- else
- @conn.select_one(%{ SELECT metadata.tid FROM metadata WHERE metadata.filename ~ '#{@opt.fns}'; })
- end
- if (@sql_type!~/sqlite/ and not file_exist) \
- or @sql_type=~/sqlite/
- 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
- #@conn.execute("COMMIT")
- end
- if @sql_type=~/sqlite/ \
- and @opt.cmd =~/[MV]/
- puts "\n" + @conn.inspect
- puts "\nat #{__FILE__}:#{__LINE__}"
- 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 special_character_escape(str)
- str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
- str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n")
- str.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'')
- str.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- 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]}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2')
- 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[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'')
- str.gsub!(/(?:&nbsp\\;|#{Mx[:nbsp]})+/,' ')
- str.gsub!(/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:gr_c]}/u,"[TABLE]\n") #tables #CHECK should take whole table
- 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]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- str.gsub!(/\s\s+/,' ')
- str.strip!
- end
- #% import into database tables
- 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} } unless @opt.cmd =~/q/
- @tp={}
- @md=SiSU_Param::Parameters.new(@opt).get
- if @md.title; @tp[:title]=@md.title
- special_character_escape(@tp[:title])
- @tp[:title_f],@tp[:title_i]='title, ',"'#{@tp[:title]}', "
- sql='SELECT MAX(tid) FROM metadata'
- 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 0~title
- puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} unless @opt.cmd =~/q/
- end
- if @md.full_title; @tp[:long_title]=@md.full_title #dc
- #sql='SELECT MAX(tid) FROM metadata'
- #id_t=@conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- #@@id_t=id_t if id_t
- #@@id_t ||=0
- #@@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 0~title
- #puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}}
- end
- if @md.subtitle; txt=@md.subtitle
- special_character_escape(txt)
- @tp[:subtitle_f],@tp[:subtitle_i]='subtitle, ',"'#{txt}', "
- end
- if @md.author; txt=@md.author #dc
- special_character_escape(txt)
- @tp[:creator_f],@tp[:creator_i]='creator, ',"'#{txt}', "
- end
- if @md.contributor; txt=@md.contributor #dc
- special_character_escape(txt)
- @tp[:contributor_f],@tp[:contributor_i]='contributor, ',"'#{txt}', "
- end
- if @md.translator; txt=@md.translator
- special_character_escape(txt)
- @tp[:translator_f],@tp[:translator_i]='translator, ',"'#{txt}', "
- end
- if @md.illustrator; txt=@md.illustrator
- special_character_escape(txt)
- @tp[:illustrator_f],@tp[:illustrator_i]='illustrator, ',"'#{txt}', "
- end
- if @md.publisher; txt=@md.publisher #dc
- special_character_escape(txt)
- @tp[:publisher_f],@tp[:publisher_i]='publisher, ',"'#{txt}', "
- end
- if @md.prepared_by; txt=@md.prepared_by
- special_character_escape(txt)
- @tp[:prepared_by_f],@tp[:prepared_by_i]='prepared_by, ',"'#{txt}', "
- end
- if @md.digitized_by; txt=@md.digitized_by
- special_character_escape(txt)
- @tp[:digitized_by_f],@tp[:digitized_by_i]='digitized_by, ',"'#{txt}', "
- end
- if @md.subject; txt=@md.subject #dc
- special_character_escape(txt)
- @tp[:subject_f],@tp[:subject_i]='subject, ',"'#{txt}', "
- end
- if @md.description; txt=@md.description #dc
- special_character_escape(txt)
- @tp[:description_f],@tp[:description_i]='description, ',"'#{txt}', "
- end
- if @md.abstract; txt=@md.abstract
- special_character_escape(txt)
- @tp[:abstract_f],@tp[:abstract_i]='abstract, ',"'#{txt}', "
- end
- if @md.type; txt=@md.type #dc
- special_character_escape(txt)
- @tp[:type_f],@tp[:type_i]='type, ',"'#{txt}', "
- end
- #if @md.owner; txt=@md.owner
- # special_character_escape(txt)
- # @tp[:owner_f],@tp[:owner_i]='owner, ',"'#{txt}', "
- #end
- #if @md.copyright; txt=@md.copyright
- # special_character_escape(txt)
- # @tp[:copyright_f],@tp[:copyright_i]='copyright, ',"'#{txt}', "
- #end
- if @md.rights; txt=@md.rights #dc
- special_character_escape(txt)
- @tp[:rights_f],@tp[:rights_i]='rights, ',"'#{txt}', "
- end
- if @md.date; txt=@md.date #dc
- special_character_escape(txt)
- @tp[:date_f],@tp[:date_i]='date, ',"'#{txt}', "
- end
- if @md.date_created; txt=@md.date_created #dc
- special_character_escape(txt)
- @tp[:date_created_f],@tp[:date_created_i]='date_created, ',"'#{txt}', "
- end
- if @md.date_issued; txt=@md.date_issued #dc
- special_character_escape(txt)
- @tp[:date_issued_f],@tp[:date_issued_i]='date_issued, ',"'#{txt}', "
- end
- if @md.date_available; txt=@md.date_available #dc
- special_character_escape(txt)
- @tp[:date_available_f],@tp[:date_available_i]='date_available, ',"'#{txt}', "
- end
- if @md.date_modified; txt=@md.date_modified #dc
- special_character_escape(txt)
- @tp[:date_modified_f],@tp[:date_modified_i]='date_modified, ',"'#{txt}', "
- end
- if @md.date_valid; txt=@md.date_valid #dc
- special_character_escape(txt)
- @tp[:date_valid_f],@tp[:date_valid_i]='date_valid, ',"'#{txt}', "
- end
- if @md.language[:name]; txt=@md.language[:name] #dc
- special_character_escape(txt)
- @tp[:language_f],@tp[:language_i]='language, ',"'#{txt}', "
- end
- if @md.language_original[:name]; txt=@md.language_original[:name]
- special_character_escape(txt)
- @tp[:language_original_f],@tp[:language_original_i]='language_original, ',"'#{txt}', "
- end
- if @md.format; txt=@md.format #dc
- special_character_escape(txt)
- @tp[:format_f],@tp[:format_i]='format, ',"'#{txt}', "
- end
- if @md.identifier; txt=@md.identifier #dc
- special_character_escape(txt)
- @tp[:identifier_f],@tp[:identifier_i]='identifier, ',"'#{txt}', "
- end
- if @md.source; txt=@md.source #dc
- special_character_escape(txt)
- @tp[:source_f],@tp[:source_i]='source, ',"'#{txt}', "
- end
- if @md.relation; txt=@md.relation #dc
- special_character_escape(txt)
- @tp[:relation_f],@tp[:relation_i]='relation, ',"'#{txt}', "
- end
- if @md.coverage; txt=@md.coverage #dc
- special_character_escape(txt)
- @tp[:coverage_f],@tp[:coverage_i]='coverage, ',"'#{txt}', "
- end
- if @md.keywords; txt=@md.keywords
- special_character_escape(txt)
- @tp[:keywords_f],@tp[:keywords_i]='keywords, ',"'#{txt}', "
- end
- if @md.comments; txt=@md.comments
- special_character_escape(txt)
- @tp[:comments_f],@tp[:comments_i]='comments, ',"'#{txt}', "
- end
- if @md.cls_loc; txt=@md.cls_loc
- special_character_escape(txt)
- @tp[:cls_loc_f],@tp[:cls_loc_i]='cls_loc, ',"'#{txt}', "
- end
- if @md.cls_dewey; txt=@md.cls_dewey
- special_character_escape(txt)
- @tp[:cls_dewey_f],@tp[:cls_dewey_i]='cls_dewey, ',"'#{txt}', "
- end
- if @md.cls_pg; txt=@md.cls_pg
- special_character_escape(txt)
- @tp[:cls_pg_f],@tp[:cls_pg_i]='cls_pg, ',"'#{txt}', "
- end
- if @md.cls_isbn; txt=@md.cls_isbn
- special_character_escape(txt)
- @tp[:cls_isbn_f],@tp[:cls_isbn_i]='cls_isbn, ',"'#{txt}', "
- end
- if @md.prefix_a; txt=@md.prefix_a
- special_character_escape(txt)
- @tp[:prefix_a_f],@tp[:prefix_a_i]='prefix_a, ',"'#{txt}', "
- end
- if @md.prefix_b; txt=@md.prefix_b
- special_character_escape(txt)
- @tp[:prefix_b_f],@tp[:prefix_b_i]='prefix_b, ',"'#{txt}', "
- end
- #if @md.suffix; txt=@md.suffix
- # special_character_escape(txt)
- # @tp[:suffix_f],@tp[:suffix_i]='suffix, ',"'#{txt}', "
- #end
- if @md.fns; txt=@md.fns
- special_character_escape(txt)
- @tp[:fns_f],@tp[:fns_i]="filename, ","'#{txt}', "
- end
- #if @md.en[:mismatch] > 0
- # id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- #end
- if @md.wc_words; txt=@md.wc_words
- @tp[:wc_words_f],@tp[:wc_words_i]='wc_words, ',"'#{txt}', "
- end
- if @md.dgst; txt=@md.dgst
- @tp[:dgst_f],@tp[:dgst_i]='dgst, ',"'#{txt}', "
- end
- if @md.sc_number; txt=@md.sc_number
- @tp[:sc_number_f],@tp[:sc_number_i]='sc_number, ',"'#{txt}', "
- end
- if @md.sc_date; txt=@md.sc_date
- @tp[:sc_date_f],@tp[:sc_date_i]='sc_date, ',"'#{txt}', "
- end
- if @md.generated; txt=@md.generated
- @tp[:generated_f],@tp[:generated_i]='generated, ',"'#{@txt}', "
- end
- #if @md.sisu_version; special_character_escape(@md.sisu_version)
- # #id,info='Generated by',"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- #end
- #if @md.ruby_version; special_character_escape(@md.ruby_version)
- SiSU_DB_DBI::Test.new(self,@opt).verify #% import title names, filenames (tuple)
- t=SiSU_DB_tuple::Load_metadata.new(@conn,@tp,@@id_t,@opt,@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=[],[],[]
- @col[:en_a]=nil
- @col[:en_z]=nil
- @tuple_array=[]
- dal_array.each do |data|
- #data.gsub!(/<[biu]>(.+?)<\/[biu]>/,'\1') # remove bold, italics, underscore
- data.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1')
- #data.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphaisis_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1')
- data.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1')
- data.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ')
- data.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- @col[:seg]=@@seg
- if data =~/#{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]}/m # regular text
- notedata=data.dup
- if data[/^#{Mx[:lv_o]}([123]):\S*?#{Mx[:lv_c]}\s*(.+?)#{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]}/m]
- @col[:lev],txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7
- @col[:lid]+=1
- if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_o]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_minus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@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[/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}\s*(.+?)#{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]}/]
- @@seg,txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7
- @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"
- if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@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
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data[/^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+?)#{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]}/] # header lev5 seg level
- txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6
- re=/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/
- @@seg_full=re.match(data)[1] if data=~re #create?
- @@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"
- if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@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
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data[/^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+?)#{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]}/] # header lev6 seg level
- txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6
- re=/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/
- @@seg_full=re.match(data)[1] if data=~re #create?
- @@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"
- if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@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
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- else #% regular text
- @col[:lid]+=1
- txt=''
- txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)#{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]}/m).match(data).captures
- @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"
- if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- if @sql_type=~/pg/ \
- and txt.size > (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
- 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
- @col[:body]=if txt=~/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/ #watch
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).html_table
- elsif txt=~/^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).indent($1)
- else
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).norm
- end
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@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]=''
- 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[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1
- if inf[/#{Mx[:en_a_o]}(\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1
- nr,txt,digest_clean=$1,$2,$3
- end
- @id_n+=1
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (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={}
- 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[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
- if inf[/#{Mx[:en_b_o]}[*](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
- nr,txt,digest_clean=$1,$2,$3
- end
- @id_n+=1
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (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
- #puts "'#{@id_n}', '#{@col[:lid]}', '#{en}', '#{txt}', '#{body}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@@id_t}'" #% endnotes
- en={}
- 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[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
- if inf[/#{Mx[:en_b_o]}[+](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
- nr,txt,digest_clean=$1,$2,$3
- end
- @id_n+=1
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (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={}
- 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 standard
- x=if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/)
- else nil
- end
- end
- def asterisk
- x=if @txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/)
- else nil
- end
- end
- def plus
- x=if @txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/)
- else nil
- end
- end
- def clean_text(base_url=nil)
- if base_url
- @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- else
- @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>')
- @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
- @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
- 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,meta) #% import documents OID - populate database
- begin
- @fnm=meta
- @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 @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true)
- f[:txt],u[:txt]='plaintext,', "'#{base}/#@fnb/#{@md.fn[:plain]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true)
- f[:html_toc],u[:html_toc]='html_toc,', "'#{base}/#@fnb/#{@md.fn[:toc]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true)
- f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#@fnb/#{@md.fn[:doc]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true)
- f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#@fnb/#{@md.fn[:xhtml]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true)
- f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#@fnb/#{@md.fn[:sax]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true)
- f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#@fnb/#{@md.fn[:dom]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true)
- f[:odf],u[:odf]='odf,', "'#{base}/#@fnb/#{@md.fn[:odf]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and 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 @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and 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 @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true)
- f[:concordance],u[:concordance]='concordance,', "'#{base}/#@fnb/#{@md.fn[:concordance]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true)
- f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#@fnb/#{@opt.fns}.tex',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and 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 @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true)
- f[:digest],u[:digest]='digest,', "'#{base}/#@fnb/#{@md.fn[:digest]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and 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 @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true)
- f[:markup],u[:markup]='markup,', "'#{base}/#@fnb/#{@opt.fns}.meta',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and 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/v1/db_indexes.rb b/lib/sisu/v1/db_indexes.rb
deleted file mode 100644
index cdbfc0a8..00000000
--- a/lib/sisu/v1/db_indexes.rb
+++ /dev/null
@@ -1,111 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_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 object_nr ON documents(ocn);},
- %{CREATE INDEX digest_clean ON documents(digest_clean);},
- %{CREATE INDEX digest_all ON documents(digest_all);},
- %{CREATE INDEX lev1 ON documents(lev1);},
- %{CREATE INDEX lev2 ON documents(lev2);},
- %{CREATE INDEX lev3 ON documents(lev3);},
- %{CREATE INDEX lev4 ON documents(lev4);},
- %{CREATE INDEX lev5 ON documents(lev5);},
- %{CREATE INDEX lev6 ON documents(lev6);},
- %{CREATE INDEX endnote_nr ON endnotes(nr);},
- %{CREATE INDEX digest_en ON endnotes(digest_clean);},
- %{CREATE INDEX endnote_nr_asterisk ON endnotes_asterisk(nr);},
- %{CREATE INDEX endnote_asterisk ON endnotes_asterisk(clean);},
- %{CREATE INDEX digest_en_asterisk ON endnotes_asterisk(digest_clean);},
- %{CREATE INDEX endnote_nr_plus ON endnotes_plus(nr);},
- %{CREATE INDEX endnote_plus ON endnotes_plus(clean);},
- %{CREATE INDEX digest_en_plus ON endnotes_plus(digest_clean);},
- %{CREATE INDEX title ON metadata(title);},
- %{CREATE INDEX filename ON metadata(filename)},
- ]
- conn_execute_array(sql_arr)
- end
- def text
- print "\n create documents text indexes\n" unless @opt.cmd =~/q/
- sql_arr=[
- %{CREATE INDEX clean ON documents(clean);},
- %{CREATE INDEX 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/v1/db_load_tuple.rb b/lib/sisu/v1/db_load_tuple.rb
deleted file mode 100644
index 64b6cd7b..00000000
--- a/lib/sisu/v1/db_load_tuple.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_tuple
- class Load_documents
- require "#{SiSU_lib}/param"
- 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]=~/\d+/
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- end
- def tuple #% import line
- sql_entry=if @col[:en_a]
- "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@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[:digest_clean]}', '#{@col[:digest_all]}');"
- else
- "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@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[: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
- @file.puts sql_entry if @opt.cmd =~/V/
- end
- if @opt.cmd =~/v/
- if @col[:lev].inspect =~/[1235678]/
- 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[:ocnd]}\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[:ocnd]}\t#{@col[:ocns]}\t#{@col[:seg]}}
- end
- end
- sql_entry
- end
- end
- class Load_metadata
- def initialize(conn,tp,id,opt,file)
- @conn,@tp,@id,@opt,@file=conn,tp,id,opt,file
- end
- def tuple
- sql_entry="INSERT INTO metadata (#{@tp[:fns_f]} #{@tp[:suffix_f]} #{@tp[:title_f]} #{@tp[:subtitle_f]} #{@tp[:creator_f]} #{@tp[:illustrator_f]} #{@tp[:translator_f]} #{@tp[:subject_f]} #{@tp[:description_f]} #{@tp[:publisher_f]} #{@tp[:contributor_f]} #{@tp[:prepared_by_f]} #{@tp[:digitized_by_f]} #{@tp[:date_f]} #{@tp[:date_created_f]} #{@tp[:date_issued_f]} #{@tp[:date_valid_f]} #{@tp[:date_available_f]} #{@tp[:date_modified_f]} #{@tp[:type_f]} #{@tp[:format_f]} #{@tp[:identifier_f]} #{@tp[:source_f]} #{@tp[:language_f]} #{@tp[:language_original_f]} #{@tp[:relation_f]} #{@tp[:coverage_f]} #{@tp[:rights_f]} #{@tp[:copyright_f]} #{@tp[:owner_f]} #{@tp[:keywords_f]} #{@tp[:abstract_f]} #{@tp[:comment_f]} #{@tp[:loc_f]} #{@tp[:dewey_f]} #{@tp[:isbn_f]} #{@tp[:pg_f]} #{@tp[:prefix_a_f]} #{@tp[:prefix_b_f]} tid) VALUES (#{@tp[:fns_i]} #{@tp[:suffix_i]} #{@tp[:title_i]} #{@tp[:subtitle_i]} #{@tp[:creator_i]} #{@tp[:illustrator_i]} #{@tp[:translator_i]} #{@tp[:subject_i]} #{@tp[:description_i]} #{@tp[:publisher_i]} #{@tp[:contributor_i]} #{@tp[:prepared_by_i]} #{@tp[:digitized_by_i]} #{@tp[:date_i]} #{@tp[:date_created_i]} #{@tp[:date_issued_i]} #{@tp[:date_valid_i]} #{@tp[:date_available_i]} #{@tp[:date_modified_i]} #{@tp[:type_i]} #{@tp[:format_i]} #{@tp[:identifier_i]} #{@tp[:source_i]} #{@tp[:language_i]} #{@tp[:language_original_i]} #{@tp[:relation_i]} #{@tp[:coverage_i]} #{@tp[:rights_i]} #{@tp[:copyright_i]} #{@tp[:owner_i]} #{@tp[:keywords_i]} #{@tp[:abstract_i]} #{@tp[:comment_i]} #{@tp[:loc_i]} #{@tp[:dewey_i]} #{@tp[:isbn_i]} #{@tp[:pg_i]} #{@tp[:prefix_a_i]} #{@tp[:prefix_b_i]} #{@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/v1/db_remove.rb b/lib/sisu/v1/db_remove.rb
deleted file mode 100644
index 2ab4b992..00000000
--- a/lib/sisu/v1/db_remove.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_remove
- class Remove
- def initialize(opt,conn,file)
- @opt,@conn,@file=opt,conn,file
- @md=SiSU_Param::Parameters.new(@opt).get
- @fnb=@md.fnb
- @db=SiSU_Env::Info_db.new
- end
- def remove
- driver_sqlite3 = true if @conn.inspect.match(/^(.{10})/)[1] == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]
- del_id=if driver_sqlite3
- @conn.get_first_value(%{ SELECT tid FROM metadata WHERE filename LIKE '#{@opt.fns}'; }).to_i
- else
- x=@conn.select_one(%{ SELECT tid FROM metadata WHERE filename LIKE '#{@opt.fns}'; })
- del=if x; x.join.to_i else nil
- end
- end
- if del_id
- sql_entry=[
- "DELETE FROM endnotes WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM endnotes_asterisk WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM endnotes_plus WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM documents WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM urls WHERE metadata_tid = '#{del_id}';",
- "DELETE FROM metadata WHERE 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
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}")
- tell.puts_grey unless @opt.cmd =~/q/ #if @opt.cmd.include? ?v
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_select.rb b/lib/sisu/v1/db_select.rb
deleted file mode 100644
index e902971c..00000000
--- a/lib/sisu/v1/db_select.rb
+++ /dev/null
@@ -1,193 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_select
- class Case
- def initialize(opt,conn='',sql_type='pg')
- @opt,@conn,@sql_type=opt,conn,sql_type
-#@conn.execute("BEGIN;")
- #@sdb=Create.new(@conn)
- @file=sql_maintenance_file
- @db=SiSU_Env::Info_db.new
- @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
- @sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@file,@sql_type) if @opt.mod.inspect =~/update|import/
- @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file) if @opt.mod.inspect =~/update|remove/
- 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?
- #@sdb.create_db
- begin
- #@sdb.create_db
- @sdb.create_table.metadata
- @sdb.create_table.documents
- @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 /^--createtable(s)?$/
- @sdb.output_dir?
- begin
- @sdb.create_table.metadata
- @sdb.create_table.documents
- @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
- @sdb.create_table.documents
- @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.documents
- rescue; @sdb.output_dir?
- end
- when /^--cr(eate)?metadata$/
- @sdb.output_dir?
- begin
- @sdb.create_table.metadata
- rescue; @sdb.output_dir?
- end
- when /^--import$/
- @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$/
- @sdb_remove_doc.remove
- @sdb_import.marshal_load
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
- tell.puts_grey if @opt.cmd =~/v/
- when /^--remove$/
- @sdb_remove_doc.remove
- when /^--index$/
- @sdb_index.create_indexes
- when /^droptable(s)?$/
- @sdb_no.drop.tables
- when /^--dropindex(es)?$/
- @sdb_no.drop.indexes
- when /^--(?:dropall|drop)$/
- @sdb_no.drop.tables
- #@sdb_no.drop.indexes
- when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/
- else
- help=SiSU_Help::Help.new
- help.summary
- help.commands
- end
- if @opt.cmd =~/M/
- #@conn.commit
- #@conn.disconnect
- puts @job
- #system(@job)
- end
- end
- begin
- #@conn.commit if @sql_type =~/sqlite/
- rescue; @sdb.output_dir?
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/db_tests.rb b/lib/sisu/v1/db_tests.rb
deleted file mode 100644
index 0b617aa9..00000000
--- a/lib/sisu/v1/db_tests.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_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[:language_char].length.to_s + ' checklength ' + @ck.tp[:language_char] if @ck.tp[:language_char] and @ck.tp[:language_char].length >@ck.lt_language_char
- #puts @ck.tp[:language_original_char].length.to_s + ' checklength ' + @ck.tp[:language_original_char] if @ck.tp[:language_original_char] and @ck.tp[:language_original_char].length >@ck.lt_language_original_char
- 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/v1/dbi.rb b/lib/sisu/v1/dbi.rb
deleted file mode 100644
index edd2e3ef..00000000
--- a/lib/sisu/v1/dbi.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: postgresql module, dbi import frame
-
-=end
-module SiSU_DBI #% database building
- require "#{SiSU_lib}/help"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- require "#{SiSU_lib}/param"
- include SiSU_Param
- require "#{SiSU_lib}/db_dbi" # db_dbi.rb
- include SiSU_DB_DBI
- require "#{SiSU_lib}/shared_html_lite"
- 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'
- #elsif @opt.cmd =~/d/ and @opt.mod.select =~/--my(?:sql)?/; 'mysql'
- 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}" 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
- #@conn=@db.sqlite.conn_dbi #issue with dbi sqlite api, when fixed revert to using, KEEP
- rescue
- ensure
- end
- end
- def connect
- case @sql_type
- when /pg/; read_psql
- when /sqlite/; read_sqlite
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#@sql_type) #{@opt.mod}")
- tell.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
- #@conn.disconnect if @sql_type =~/sqlite/ and @opt.mod.inspect !~/^--(?:re)?create/
- #@conn.disconnect if @sql_type =~/sqlite/
- rescue
- connect
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/defaults.rb b/lib/sisu/v1/defaults.rb
deleted file mode 100644
index 97736210..00000000
--- a/lib/sisu/v1/defaults.rb
+++ /dev/null
@@ -1,2225 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Default values (reset by skins)
-
-=end
-$latex_run=nil
-module SiSU_Viz
- require 'uri'
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/css"
- include SiSU_Style
- class Skin
- #attr_accessor :glyph,:html,:php,:javascript,:path,:text,:url,:color,:icon,:font,:markup,:paragraph,:table,:table_do,:indent,:margin,:png,:nav_txt,:nav_png,:banner,:widget
- def initialize
- #@css=SiSU_Env::CSS_default.new
- @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 # &bullet;
- '&#149;&nbsp;' # [&#149; flagged]
- end
- #% html
- def html_hardspace
- '&nbsp;'
- end
- #% php
- def php_persist
- end
- #% javascript #kxjs knxjs
- def js_home
- end
- def js_infobox
- end
- def js_knxjs
- end
- def js_head
- end
- def js_top
- end
- def js_sisu
- end
- def js_home
- end
- def js_sponsor
- end
- def js_books
- end
- def js_journals
- end
- def js_conferences
- end
- def js_services
- end
- def js_catalogue
- end
- def js_doc
- end
- def js_toc
- end
- def js_seg
- end
- def js_mail
- end
- def js_manifest
- end
- def js_status
- end
- def js_next
- end
- def js_prev
- end
- def js_portrait
- end
- def js_landscape
- end
- def js_pdf
- 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 js_old
- end
- def semantic_tags
- def default
- #:f => 'firstname',
- #:m => 'middlename',
- #:l => 'lastname',
- #:ed => 'editor', #editor?
- #:v => 'version', #edition
- {
- :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
- %{ <link rel="stylesheet" href="./#{@dir.path.style}/homepage.css" type="text/css" />}
- end
- #% text #changed from txt to avoid naming conflicts #FOLLOW
- def txt_generator
- %{ <meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" />
- <link rel="generator" href="http://www.jus.uio.no/sisu" />}
- end
- def txt_generator_comment
- %{ <!- #{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" http://www.jus.uio.no/sisu ->}
- end
- def txt_hp
- '&nbsp;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.jus.uio.no/sisu'
- end
- def url_sisudoc
- 'http://www.sisudoc.org'
- end
- def url_root
- '/sisu' #watch
- end
- def url_root_http
- 'http://www.jus.uio.no/sisu' #watch
- end
- def url_home
- 'http://www.jus.uio.no/sisu' # used in pdf header
- end
- def url_site #used as stub... where there are subdirectories and is different from home
- url_home
- #'http://www.jus.uio.no/sisu' # used in pdf header
- end
- def url_txt
- 'www.jus.uio.no/sisu'
- end
- def url_path_image_base #used for html image display
- '../_sisu/image'
- end
- def url_path_image #used for html image display
- '../_sisu/image'
- end
- def url_path_image_sys #used for html image display
- '../_sisu/image_sys'
- 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}{<}}'
- end
- def tex_close
- '{\UseTextSymbol{OML}{>}}'
- end
- def xml_open
- '&lt;'
- end
- def xml_close
- '&gt;'
- end
- def txt_open
- '<'
- end
- def txt_close
- '>'
- end
- self
- end
- #% color
- def color_shadow
- '"4"'
- end
- def color_body
- %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">}
- 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'
- #'#eff6ff' #light
- #'#c0d9d9' #light
- #'#0044cc' #pale
- #'#c0d9d9' #sky
- end
- def color_blue_ink
- '#003399'
- end
- def color_blue_tinge
- '#e3ecef'
- #'#d7dddd'
- #'#f2f5f7'
- end
- def color_blue_grey
- '#8faebf'
- end
- def color_blue_murky
- '#437389'
- end
- #def color_brown
- # '#423a27'
- #end
- def color_beige
- '#f1e8de'
- #'#fff3b6'#custard
- 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'
- # '#dddddd' #light
- 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}"}
- #'"#777777"'
- end
- def color_band2
- %{"#{color_white}"}
- #'"#cccccc"'
- end
- def color_body
- %{\n<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">\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_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=italics_list.split(/;\s+/).join('|').strip
- 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
- #make=bold_list.split(/;\s+/).join('|').strip
- 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
- %{<p class="normal">}
- end
- def paragraph_txt_00
- %{<p class="justify">}
- end
- def paragraph_font_citation
- %{<font #{font_size_txt} #{font_face}>}
- end
- def paragraph_endnote
- %{<p class="endnote">}
- end
- def paragraph_table
- %{<p align="left"><font #{font_small} #{font_color} #{font_face}>}
- end
- def paragraph_table_xml
- end
- def paragraph_tiny
- %{<p class="tiny">}
- end
- def paragraph_small
- %{<p class="small">} # keep but not used?
- end
- def paragraph_font_tiny
- %{<font #{font_tiny} #{font_face}>}
- end
- def paragraph_font_small
- %{<font #{font_small} #{font_face}>}
- end
- def paragraph_heading_1
- %{<h1>}
- end
- def paragraph_heading_1_center
- %{<h1 class="center">}
- end
- #% table
- def table_close
- '</td></tr>
-</table>'
- end
- def table_close_centered_table
- end
- def table_align_A
- end
- def table_align_B
- end
- def table_align_C
- end
- def table_width_1
- '"100%"'
- end
- def table_width_2
- '"99%"'
- end
- def table_width_3
- '"94%"'
- end
- def table_width_4
- '"90%"'
- end
- def table_width_txt
- '"94%"'
- end
- def table_width_txt_avgo
- '"100%"'
- end
- def table_width_txt_r
- '"96%"'
- end
- def table_cellpad_small_paper_margins
- '"6"'
- end
- def table_cellpad_paper_margins
- '"36"'
- end
- def table_cellpad_A
- '"0"'
- end
- def table_cellpad_B
- '"20"'
- end
- def table_cellpad_shadow
- '"4"'
- end
- def table_cellpad_band
- '"16"'
- end
- def table_cellpad_box
- '"20"'
- end
- def table_table_align_A
- '<center>'
- end
- def table_table_align_B
- '<center>'
- end
- def table_table_align_C
- ' '
- end
- #% table_do
- def table_do_table_paper
- %{#{table_align_C} <table summary="table paper" width=#{table_width_2} border="0" cellpadding=#{table_cellpad_paper_margins} bgcolor=#{color_paper} align="Justify"><tr><td>\n<font color="#000000"><p />\n}
- end
- def table_do_table_surround
- %{<table summary="table surround" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" align="center"><tr><td>\n}
- end
- #% indent
- def indent_level_0
- '"1%"'
- 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
- '</p> </td><td width="4%" align="right" valign="top">'
- end
- def margin_numless
- '</td><td width="4%" align="right" valign="top">'
- end
- def margin_num_css
- '</td>
-<td width="2%" align="right" valign="top"> '
- end
- def margin_num_header
- '</td>
-<td width="4%" align="right" valign="top">'
- end
- def margin_txt_00_1
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_1} align="right">
-</td>
-<td valign="top" align="left" width=#{indent_level_1_c2w100}>}
- end
- def margin_txt_w1
- %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width="6%" align="right">&nbsp;</td>
-<td width="90%" valign="top" align="justify">}
- end
- def margin_txt_w2
- %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width="10%" align="right">&nbsp;</td>
-<td width="86%" valign="top" align="justify">}
- end
- def margin_txt_0
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_0} align="right">
-</td><td valign="top" align="justify">}
- end
- def margin_txt_1
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">}
- end
- def margin_txt_2
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_2} align="right">
-</td>
-<td valign="top" align="justify">}
- end
- def margin_txt_3
- %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td width=#{indent_level_3} align="right">
-</td>
-<td valign="top" align="justify">}
- end
- def margin_css #unused, check
- '<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr><td valign="top" align="justify"> '
- end
- #% png
- def png_ico
- %{ <link rel="shortcut icon" href="../_sisu/image/#{icon_ico}" />}
- end
- def png_sisu #check url path
- %{ <a href="#{@url.sisu}">
- <img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" />
- </a>}
- end
- def png_hp
- dir=SiSU_Env::Info_env.new #(@fns)
- %{ <a href="#{url.site}">
- <img border="0" width="160" height="60" src="#{@dir.url.images_local}/#{icon_home_banner}" alt="#{txt_home}" />
- </a>}
- end
- def png_site
- #dir=SiSU_Env::Info_env.new #(@fns)
- %{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />}
- end
- def png_homepage
- png_site
- end
- def png_nav
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />}
- end
- def png_manifest
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />}
- end
- def png_doc
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />}
- end
- def png_toc
- %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />}
- end
- def png_odf
- %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />}
- end
- def png_pdf
- %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />}
- end
- def png_pdf_portrait
- %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />}
- end
- def png_pdf_landscape
- %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />}
- end
- def png_wmp
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_wmp}" alt="Concordance" />}
- end
- def png_para
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_para}" alt="Segment" />}
- end
- def png_status
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_status}" alt="Membership status" />}
- end
- def png_mark
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_rose}" alt="*" />}
- end
- def png_doc_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_doc}" alt="Doc" />}
- end
- def png_toc_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC" />}
- end
- def png_status_tiny
- %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_status}" alt="Status, Member States" />}
- end
- def png_ftp
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_ftp}" alt="FTP" />}
- end
- def png_gopher
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_gopher}" alt="Gopher" />}
- end
- def png_crosslink
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_crosslink_toc}" alt="lateral hop" />}
- end
- def png_crosslink_ext
- %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_external_toc}" alt="lateral hop" />}
- end
- def png_home
- dir=SiSU_Env::Info_env.new #(@fns)
- %{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
- end
- def png_home_button
- #dir=SiSU_Env::Info_env.new #(@fns)
- %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} --&gt;" />}
- end
- def png_book
- %{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />}
- end
- #% png_nav
- def png_nav_home
- end
- def png_nav_toc
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_up}" alt="TOC" />}
- end
- def png_nav_doc
- end
- def png_nav_previous
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_previous}" alt="&lt;&lt;&nbsp;previous" />}
- end
- def png_nav_next
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_next}" alt="next&nbsp;&gt;&gt;" />}
- end
- def png_nav_pre
- png_nav_previous
- end
- def png_nav_nxt
- png_nav_next
- end
- def png_nav_pdf
- %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />}
- end
- def png_nav_pdf_portrait
- %{<img border="0" width="15" height="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf portrait" />}
- end
- def png_nav_pdf_landscape
- %{<img border="0" width="18" height="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf landscape" />}
- end
- def png_nav_dot_toc
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&#094;" />}
- end
- def png_nav_dot_previous
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&lt;" />}
- end
- def png_nav_dot_next
- %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="&gt;" />}
- end
- def png_nav_dot_pre
- png_nav_dot_previous
- end
- def png_nav_dot_nxt
- png_nav_dot_next
- end
- #% nav_txt
- def nav_txt_home
- %{ <font face="#{font_fonts}" size="2">
- #{png_site}&nbsp;
- </font> }
- end
- def nav_txt_home_button
- %{ <font face="#{font_fonts}" size="2">
- #{png_home_button}&nbsp;
- </font> }
- end
- def nav_txt_homepage
- %{ <font face="#{font_fonts}" size="2">
- #{png_site}&nbsp;homepage&nbsp;
- </font> }
- end
- def nav_txt_toc_link
- %{ <font face="#{font_fonts}" size="2">
- #{png_toc}&nbsp;&nbsp;toc&nbsp;
- </font> }
- end
- def nav_txt_toc_link_verbose
- %{ <font face="#{font_fonts}" size="2">
- #{png_toc}&nbsp;&nbsp;segments'&nbsp;toc&nbsp;
- </font> }
- end
- def nav_txt_doc_link
- %{ <font face="#{font_fonts}" size="2">
- #{png_doc}&nbsp;&nbsp;scroll&nbsp;
- </font> }
- end
- def nav_txt_manifest
- %{ <font face="#{font_fonts}" size="2">
- #{png_manifest}&nbsp;
- </font> }
- end
- def nav_txt_concordance
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;&nbsp;A-Z&nbsp;
- </font> }
- end
- def nav_txt_previous
- ' <font face="" size="2">
- &nbsp;&nbsp;<b>&lt;&lt;</b>&nbsp;Previous&nbsp;&nbsp;
- </font>
- Full&nbsp;Text&nbsp;'
- end
- def nav_txt_next
- %{ <font face="#{font_fonts}" size="2">
- &nbsp;&nbsp;Next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>&gt;&gt;</b>&nbsp;&nbsp;
- </font> }
- end
- def nav_txt_odf
- %{ <font face="#{font_fonts}" size="2">
- #{png_odf}&nbsp;&nbsp;odt&nbsp;
- </font> }
- end
- def nav_txt_pdfs
- %{ <font face="#{font_fonts}" size="2">
- pdfs&nbsp;&nbsp;
- </font> }
- end
- def nav_txt_pdf_portrait
- %{ <font face="#{font_fonts}" size="2">
- #{png_pdf_portrait}
- &nbsp;&nbsp;pdf&nbsp;
- </font> }
- end
- def nav_txt_pdf_landscape
- %{ <font face="#{font_fonts}" size="2">
- #{png_pdf_landscape}
- &nbsp;&nbsp;pdf&nbsp;
- </font> }
- end
- #% banner
- def banner_home
- %{ <center>
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_site}
- </a>
- <br />
- <font size="2" color="#444444">
- an
- <br />
- (&nbsp;international&nbsp;|&nbsp;transnational&nbsp;)
- <br />
- commercial&nbsp;law&nbsp;&&nbsp;e-commerce
- <br />
- infrastructure monitor</font></center>}
- end
- def banner_home_guide
- %{ <br />
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_doc} LM toc
- </a>
- <a href="../treaties.and.organisations/lm.chronological" target="_top" #{js_instruments}>
- #{png_doc} LM 20**
- </a>
- <br />}
- end
- def banner_home_button_only
- %{<a href="#{url_site}/" #{js_home}>
- #{png_home_button}
- </a>}
- end
- def banner_home_button #yellow_dark now white
- %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center">
-<tr><td align="left" valign="middle" bgcolor="#{color_white}" width="10%">
- <a href="#{url_site}/" #{js_home}>
- #{png_home_button}
- </a>
-</td>
-<td width="90%">
-#{table_close}}
- end
- def banner_home_and_index_buttons #yellow_dark now white
- %{<table summary="home and index buttons" bgcolor=#{color_band1}>
-<tr><td width="20%">
-<table summary="home button" width="100%" border="0" cellpadding="3" align="center">
-<tr><td align="center" valign="middle" bgcolor="#{color_white}">
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_home}
- </a>
-</td></tr>
-</table>
-</td>
-<td width="60%">
-<table summary="other contents buttons" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="center" bgcolor=#{color_band2}>
- <font face="arial" size="2">
- <a href="toc" target="_top" #{js_toc}>
- &nbsp;This&nbsp;text's&nbsp;sub-&nbsp;
- <br />
- &nbsp;Table&nbsp;of&nbsp;Contents&nbsp;
- </a>
- </font>
-</td></tr>
-</table>
-</td>
-<td width="20%">
- &nbsp;
-#{table_close}}
- end
- def banner_url_txt_sisu
- %{<a href="#{url_sisu}/sisu" target="_top" #{js_home}>SiSU</a>}
- end
- def banner_band #yellow_dark now white
- %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center">
-<tr><td align="left" valign="middle" bgcolor="#{color_white}">
- <a href="#{url_site}/" target="_top" #{js_home}>
- #{png_home}
- </a>
-</td>
-<td width="90%">
-#{table_close}}
- end
- def banner_credit_band
- %{<table summary="credits table yellow" width="80%" border="1" cellpadding="0" bgcolor="#{color_yellow_dark}" align="center">
-<tr><td align="center">
-<table summary="salmon" width="100%" border="0" cellpadding="0" bgcolor="#ffdec9">
-<tr><td align="center">
-<table summary="credits white background" width="100%" border="0" cellpadding="6" bgcolor="#ffffff">
-<tr><td align="center">}
- end
- def banner_instrument_cover_band_scr
- '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center">
-<tr><td align="center">'
- end
- def banner_instrument_cover_band_seg
- '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center">
-<tr><td align="center">'
- 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
-<<WOK
-<tr align="center"><td align="center">
-<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="2">
- If you have problems viewing pages on this site please update your browser:
- </font>
- </p>
-#{table_close}
-<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/epiphany/" target="external">
- &nbsp;Epiphany
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://galeon.sourceforge.net/" target="external">
- &nbsp;Galeon
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.microsoft.com/windows/ie/default.asp" target="external">
- I-Explorer
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://kazehakase.sourceforge.jp/" target="external">
- Kazehakase</a>
- <sup>&reg;</sup>&nbsp;|</font></p></td>
-<td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.konqueror.org/" target="external">
- Konqueror</a>
- <sup>&reg;</sup>&nbsp;|</font></p></td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.mozilla.org/" target="external">
- Mozilla
- </a>
- <a href="http://www.mozilla.org/products/firefox/" target="external">
- <b>Firefox</b>
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://home.netscape.com/comprod/mirror/client_download.html" target="external">
- Netscape
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.opera.com/" target="external">
- Opera
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.apple.com/safari/" target="external">
- Safari
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-#{table_close}
-<table summary="lightweight browser and text browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- <p>
- <font color="#666666" size="1">
- for console/text viewing:
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://elinks.or.cz/" target="external">
- <b>elinks</b>
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external">
- <b>links2</b>
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://w3m.sourceforge.net/" target="external">
- <b>w3m</b>
- </a>
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- for lightweight gui (X) viewing try:
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.dillo.org/" target="external">
- Dillo
- </a>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/epiphany/" target="external">
- &nbsp;Epiphany
- </a>
- <sup>&reg;</sup>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://galeon.sourceforge.net/" target="external">
- &nbsp;Galeon
- </a>&nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p>
- <font color="#666666" size="1">
- <a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external">
- <b>links2 -g</b>
- </a>
- </font>
- </p>
-#{table_close}
-</td></tr>
-WOK
- end
- def widgets_open
-<<WOK
-<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0">
-WOK
- end
- def widget_pdfviewers
-<<WOK
-<tr align="center"><td align="center">
-<!-- pdf viewer suggestions -->
-<tr><td>
- <p class="center">
- <font color="#666666" size="1">
- &amp; for
- <a href="http://www.adobe.com/products/acrobat/adobepdf.html" target="external">
- pdf
- </a>
- viewings of this site we recommend stand alone viewers
- <br />
- (rather than web browser plugins):
- </font>
- </p>
-</td></tr>
-<tr align="center"><td align="center">
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="external">
- Acrobat Reader
- </a>
- <sup>&reg;</sup>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.gnome.org/projects/evince/" target="external">
- <b>Evince</b>
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-</td>
-<td>
- <p class="center"><font color="#666666" size="1">
- <a href="http://www.cs.wisc.edu/~ghost/gv/" target="external">
- &nbsp;GhostView<sup>&reg;</sup>&nbsp;</a>,
- <a href="http://wwwthep.physik.uni-mainz.de/~plass/gv/" target="external">
- GV<sup>&reg;</sup>
- </a>
- &amp;
- <a href="http://www.cs.wisc.edu/~ghost/gsview/" target="external">
- GSview<sup>&reg;</sup>
- </a>
- &nbsp;|
- </font>
- </p>
-</td>
-<td>
- <p class="center">
- <font color="#666666" size="1">
- <a href="http://www.foolabs.com/xpdf/" target="external">
- &nbsp;Xpdf
- </a>
- <sup>&reg;</sup>
- </font>
- </p>
-</td></tr>
-WOK
- end
- def widget_sisu
-<<WOK
-<!-- widget sisu -->
-<tr><td valign="top" width="10%">
- <p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
- <img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" />
- </a>
- </font></p>
-</td><td valign="top" width="45%">
-<!-- SiSU Rights -->
- <p class="tiny_left"><font color="#666666" size="2">
- Output generated by
- <a href="#{url_sisu}" #{js_sisu}>
- #{@v[:project]}
- </a>
- #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
- <br />
- <a href="#{url_sisu}" #{js_sisu}>
- <b>#{@v[:project]}</b>
- </a>
- Copyright <sup>&copy;</sup> Ralph Amissah
- 1997, current #{@date.year_static}.
- All Rights Reserved.
- <br />
- <a href="#{url_sisu}" #{js_sisu}>
- #{@v[:project]}
- </a>
- is software for document structuring, publishing and search,
- <br />
- <a href="#{url_sisu}" #{js_sisu}>
- www.jus.uio.no/sisu
- </a>
- and
- <a href="#{url_sisudoc}" #{js_sisu}>
- www.sisudoc.org
- </a>
- <br />
- <i>w3 since October 3 1993</i>
- <a href="mailto://ralph@amissah.com" #{js_mail}>
- ralph@amissah.com
- </a>
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- #{@v[:project]} using:
- <br />Standard SiSU markup syntax,
- <br />Standard SiSU meta-markup syntax, and the
- <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system)
- <br />
- Copyright <sup>&copy;</sup> Ralph Amissah 1997, current #{@date.year_static}.
- All Rights Reserved.
- </font></p>
-</td></tr>
-WOK
- end
- def widget_way_better
- <<WOK
-<!-- widget way better -->
-<tr><td valign="top" width="10%">
- <p class="tiny_left"><font color="#666666" size="2">
- <a href="http://www.gnu.org/licenses/gpl.html">
- <img border="0" src="../_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" />
- </a>
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
- #{@v[:project]}
- </a>
- is released under
- <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a>
- or later,
- #{url_decoration.xml_open}<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>#{url_decoration.xml_close}
- </font></p>
-</td><td valign="top" width="45%">
- <p class="tiny_left"><font color="#666666" size="2">
- #{@v[:project]}, developed using
- <a href="http://www.ruby-lang.org/en/">
- Ruby
- </a>
- on
- <a href="http://www.debian.org/">
- Debian/Gnu/Linux
- </a>
- software infrastructure,
- with the usual GPL (or OSS) suspects.
- <br />
- Better - "performance, reliability, scalability, security &amp; total cost of ownership"
- [not to mention flexibility &amp; choice] use of and adherence to open standards (where practical and fair) and it is software libré.
- <br />
- Get With the Future
- <a href="http://www.jus.uio.no/sisu/">
- Way Better!
- </a>
- </font></p>
-</td></tr>
-WOK
- end
- def widget_wayBetter
- widget_way_better
- end
- #% credits
- def credits_itl_cover_band
- %{<table summary="itl cover band" width="88%" border="0" cellpadding="0" bgcolor="blue">
-<tr><td>
-<table summary="" width="100%" border="0" cellpadding="8" bgcolor="#000099">
-<tr><td>
-<table summary="" width="99%" border="1" cellpadding="0" bgcolor="#ffcc00">
-<tr><td>
-<table summary="" width="100%" border="1" cellpadding="0" bgcolor="#ffffff">
-<tr><td align="center">
- <font #{font_face}>
- <br />
- \@
- <br />
- #{txt_home}
- <br />
- #{banner_url_txt_sisu}
- <br />
- </font>
-#{table_close*4}}
- end
- def credits_sisu
- %{<div class="substance">
-<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0">
-<tr><td>
- #{widget_sisu}
- #{widget_way_better}
-</table></div>}
- end
- def credits_splash
- end
- #% bottom
- def bottom_surround
- %{</td>
-<td align="center" valign="bottom">#{table_close}<table summary="" border="0" width="100%" valign="top">
-<tr><td valign="top" width="20%"><table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center">
-<tr><td valign="top">
-#{table_close}
-</td>
-<td align="center" valign="top">
- #{banner_band}
-#{table_close}
-<table summary="" border="0" width="100%" valign="top">
-<tr><td valign="top" width="20%">
-<table summary="" width="100%" border="0" cellpadding="0" bgcolor="#e3ecef" align="center">
-<tr><td valign="top">
- #{table_close}
-</td>
-<td align="center" valign="top">
- #{credits_splash}
-#{table_close}
-</body>
-</html>}
- end
- end
- class Home < Skin
- 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
- <<WOK
-<html><head>
-<title>SiSU</title>
-<meta http-equiv="refresh" content="0, url=http://www.jus.uio.no/sisu/SiSU/">
-</head>
-<body>
-SiSU informtion provided at <a href="http://www.jus.uio.no/sisu/SiSU/">www.jus.uio.no/sisu/SiSU</a><p />
-If your browser supports redirection, you will be escorted there shortly.
-</body>
-</html>
-WOK
- end
- def homepage
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>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</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content="SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" />
-<meta name="dc.author" content="Ralph Amissah" />
-<meta name="dc.subject" content=
-"document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="dc.publisher" content=
-"SiSU http://www.jus.uio.no/sisu" />
-<meta name="dc.language" content="en" />
-<meta name="dc.rights" content="Copyright Ralph Amissah" />
-<meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="./#{@dir.path.style}/html.css" type="text/css" />
-<link rel="shortcut icon" href="./_sisu/image/rb7.ico" />
-</head>
-<body>
-<div id="top_band">
-<p class="top_band_image">
- <a href="http://www.jus.uio.no/sisu/SiSU" target="_top" >
- <img border="0" src="./_sisu/image/sisu.png" alt="SiSU &gt;&gt;">
- </a>
-</p>
-<h1 class="top_band">
- SiSU information Structuring Universe
-</h1>
-<h2 class="top_band_tiny">
- Structured information, Serialized Units
-</h2>
-<h2 class="top_band_tiny">
-software for electronic texts, document collections, books, digital libraries, and search,
-</h2>
-<h2 class="top_band_tiny">
- with "atomic search" and text positioning system (shared text citation numbering: "<i>ocn</i>")
-</h2>
-<h2 class="top_band_tiny">
-outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite)
-</h2>
-</div>
-<div id="top_band_search">
-<!-- SiSU Search -->
-<a name="search"></a><form method="get" action="http://search.sisudoc.org" target="_top">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="submit" name="ignore" value="search" />
-<input type="hidden" name="db" value="SiSU_sisu" />
-<input type="radio" name="view" value="index" checked="checked" /> idx
-<input type="radio" name="view" value="text" /> txt
-</form>
-<!-- SiSU Search -->
-</div>
-<div id="column_left">
-<p class="bold">
- <a href="http://www.jus.uio.no/sisu/SiSU" target="_top" >
- SiSU
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_manual/" target="_top" >
- SiSU Manual
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/1.html#summary" target="_top" >
- What does SiSU do? Summary
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/2.html" target="_top" >
- Book Samples and Markup Examples
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/1.html#ocn" target="_top" >
- Object Citation Numbering - <i>ocn</i>
- </a>
-</p>
-<p class="tiny">(a text positioning system)</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/1.html#search" target="_top" >
- Search - "<i>granular</i>"
- </a>
-<p class="tiny">
- Of interest is the ease of streaming documents to a relational database, at an object (roughly paragraph) level and the potential for increased precision in the presentation of matches that results thereby. The ability to serialise html, LaTeX, XML, SQL, (whatever) is also inherent in / incidental to the design. For a description see the
- <a href="http://www.jus.uio.no/sisu/sisu_provisional_patent_application_200408" target="_top" >
- abandoned U.S. provisional patent application
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/download.html" target="_top" >
- <b>Download</b>
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/changelog.html" target="_top" >
- Changelog
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU/license.html" target="_top" >
- License
- </a>
-</p>
-<p class="tiny">
- Gnu / Linux / Unix
-</p>
-<p class="tiny">
- =============
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/man" target="_top" >
- sisu man pages
- </a>
-</p>
-<p class="tiny">
- ---
-</p>
-<p class="tiny">
- document preparation can be on any platform, in any editor:
- (syntax highlight support currently for: vim, kate, write, gedit, diakonos)
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/syntax_highlight" target="_top" >
- Syntax highlighting
- </a>
-</p>
-<p class="tiny">
- =============
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/SiSU" target="_top" >
- * Composite document
- </a>
-</p>
-<p class="tiny">
- the composite document is a superset of the following documents:
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_description" target="_top" >
- SiSU description
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_examples" target="_top" >
- SiSU examples
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_chronology" target="_top" >
- SiSU chronology
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_technical_info" target="_top" >
- SiSU technical
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_faq" target="_top" >
- SiSU FAQ
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_download" target="_top" >
- SiSU download
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_changelog" target="_top" >
- SiSU changelog
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_license" target="_top" >
- SiSU license
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_standard" target="_top" >
- SiSU standard
- </a>
-</p>
-<p class="small">
- <a href="http://www.jus.uio.no/sisu/sisu_provisional_patent_application_200408" target="_top" >
- SiSU abandoned provisional patent
- </a>
-</p>
-<p class="tiny">
- Note: the placement of SiSU documents on the Net predate the release of SiSU.
-</p>
-</div>
-<div id="column_center">
-<p class="bold">
- For less markup than the most elementary HTML you can have more.
-</p>
-<p><a href="http://www.jus.uio.no/sisu/SiSU" target="_top" ><b>SiSU</b> - Structured information, Serialized Units</a> for electronic documents, is an information structuring, transforming, publishing and search framework with the following features:</p>
-<p>
-<b>(i)</b> markup syntax:
-<b>(a)</b>
-simpler than html,
-<b>(b)</b>
-mnemonic, influenced by mail/messaging/wiki markup practices,
-<b>(c)</b> human readable, and easily writable,</p>
-<p><b>(ii)</b>
-<b>(a)</b>
-minimal markup requirement,
-<b>(b)</b>
-single file marked up for multiple outputs,</p>
-<p><b>
-notes
-</b></p>
-<p class="small">
-<b>*</b>
-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.
-</p>
-<p class="small">
-<b>*</b>
-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].
-</p>
-<p class="small">
-<b>*</b>
-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.
-</p>
-<p><b>(iii)</b>
-<b>(a)</b>
-multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; (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>(b)
-</b>
-takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))</p>
-<p><b>(iv)</b>
-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, sqlite, postgresql), this numbering system can be used to reference content.</p>
-<p>
-<b>(v)</b>
-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].</p>
-<p>
-<b>(vi)</b>
- use of semantic meta-tags in headers permit the addition of semantic information on documents, (the available fields are easily extended)</p>
-<p>
-<b>(vii)</b>
-creates organised directory/file structure for (file-system) output, easily mapped with its clearly defined structure, with all text objects numbered, you know in advance where in each document output type, a bit of text will be found (e.g. from an SQL search, you know where to go to find the prepared html output or PDF etc.)... there is more; easy directory management and document associations, the document preparation (sub-)directory may be used to determine output (sub-)directory, the skin used, and the SQL database used,</p>
-<p>
-<b>(viii)</b>
-"Concordance file" wordmap, consisting of all the words in a document and their (text/ object) locations within the text, (and the possibility of adding vocabularies),</p>
-<p>
-<b>(ix)</b>
-document content certification and comparison considerations:
-<b>(a)</b>
-the document and each object within it stamped with an md5 hash making it possible to easily check or guarantee that the substantive content of a document is unchanged,
-<b>(b)</b>
-version control, documents integrated with time based source control system, default RCS or CVS with use of $Id$ tag, which SiSU checks
-<p>
-<b>(x)</b>
-SiSU's minimalist markup makes for meaningful "diffing" of the substantive content of markup-files,</p>
-<p>
-<b>(xi)</b>
-easily skinnable, document appearance on a project/site wide, directory wide, or document instance level easily controlled/changed,</p>
-<p>
-<b>(xii)</b>
-in many cases a regular expression may be used (once in the document header) to define all or part of a documents structure obviating or reducing the need to provide structural markup within the document,</p>
-<p>
-<b>(xiii)</b>
-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)</p>
-<p>
-<b>(xiv)</b>
-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</p>
-<p>
-there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added.
-</p>
-<p>
-<b>(xv)</b>
-there is a considerable degree of future-proofing, output representations are "upgradeable", and new document formats may be added:
-<b>(a)</b>
-modular, (thanks in no small part to Ruby) another output format required, write another module....
-<b>(b)</b> easy to update output formats (eg html, XHTML, LaTeX/PDF produced can be updated in program and run against whole document set),
-<b>(c)</b> easy to add, modify, or have alternative syntax rules for input, should you need to,</p>
-<p>
-<b>(xvi)</b>
-scalability, dependent on your file-system (ext3, Reiserfs, XFS, whatever) and on the relational database used (currently Postgresql and SQLite), and your hardware,</p>
-<p>
-<b>(xvii)</b>
-only marked up files need be backed up, to secure the larger document set produced,</p>
-<p>
-<b>(xviii)</b>
-document management,</p>
-<p>
-<b>(xix)</b>
-Syntax highlighting for SiSU markup is available for a number of text editors.</p>
-<p><b>(xx)</b> remote operations:
-<b>(a)</b>
-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>(b)</b>
-generated document outputs may be posted by sisu to remote sites (using rsync/scp)
-<b>(c)</b>
-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.</p>
-<p>
-<b>(xxi)</b>
-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.
-</p>
-<p>
-<b>(xxii)</b>
-for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, html, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to PDF, a LaTeX processor like tetex or texlive.
-</p>
-<p>
-as a developers tool it is flexible and extensible
-</p>
-<br />
-<p class="small">
-More information on <a href="http://www.jus.uio.no/sisu/SiSU/"><b>SiSU</b></a> provided at <a href="http://www.jus.uio.no/sisu/SiSU/">www.jus.uio.no/sisu/SiSU</a></p>
-</div>
-<div id="column_right">
-<p class="tiny">
-SiSU ("SiSU information Structuring Universe" or "Structured information, Serialized Units"),<sup>1</sup> 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.
-</p>
-<p class="tiny">
- 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 objects<sup>2</sup> (equating generally to paragraph-sized chunks) so searches may be performed and matches returned with that degree of granularity (e.g. your search criteria is met by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for "published" works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed means of reference of content.
-</p>
-
-<p class="small">
-How it works
-</p>
-<p class="tiny">
-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,<sup>2</sup> which the program serializes (providing the object numbers) and which are assigned hash sum values based on their content. This abstraction of information about document structure, objects, (and hash sums), provides considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to create new ones).</p>
-<p class="tiny">
-<sup>1.</sup> also chosen for the meaning of the Finnish term "sisu".
-</p>
-<p class="tiny">
-<sup>2</sup> objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are numbered separately and tied to the object from which they are referenced.</p>
-<p class="small">
- More information on <a href="http://www.jus.uio.no/sisu/SiSU/"><b>SiSU</b></a> provided at:
- <a href="http://www.jus.uio.no/sisu/SiSU/">
- www.jus.uio.no/sisu/SiSU
- </a>
-<p class="tiny">
-SiSU was developed in relation to legal documents, and is strong across a wide variety of texts (law, literature...(humanities, law and part of the social sciences)). SiSU handles images but is not suitable for formulae/ statistics, or for technical writing at this time.</p>
-<p class="tiny">
-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.</p>
-<p class="small">
-<a href="mailto://ralph@amissah.com">
-ralph@amissah.com
-</a>
-</p>
-<p class="small">
-<a href="mailto://ralph.amissah@gmail.com">
-ralph.amissah@gmail.com
-</a>
-</p>
-<p class="small">
-#{@date.year_static}
-</p>
-<p class="tiny">
-w3 since October 3 1993
-</p>
-</div>
-</body>
-</html>
-WOK
- end
- def home_toc
- ' '
- end
- end
- class Inserts
- end
- class TeX < Skin
- def initialize(papersize='')
- @papersize=papersize
- #@vz=SiSU_Env::Get_init.instance.skin #used within skins, however pulls in much that is not otherwise needed
- 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
- 348
- 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
- 310
- 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
- 280
- 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
- 230
- 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/v1/digests.rb b/lib/sisu/v1/digests.rb
deleted file mode 100644
index c376e9c2..00000000
--- a/lib/sisu/v1/digests.rb
+++ /dev/null
@@ -1,377 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: document digests (md5|sha256) and structure processing
-
-=end
-module SiSU_Digest_view
- require "#{SiSU_lib}/particulars"
- require "#{SiSU_lib}/i18n"
- 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
- tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Document #@dg Digests",tool)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}")
- tell.flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- SiSU_Digest_view::Source::Scroll.new(@particulars).songsheet
- SiSU_Env::Info_skin.new(@md).select
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- @@dl=nil
- @@ds={}
- @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
- def initialize(particulars) #data='',md='')
- @particulars=particulars
- @data,@env,@md=@particulars.dal_array,@particulars.env,@particulars.md
- SiSU_Env::SiSU_file.new(@md).mkdir
- @@dg ||=@env.digest.type
- @@dl ||=@env.digest.length
- @dg,@dl=@@dg,@@dl
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
- @tr=SiSU_Translate::Source.new(@md,@language)
- end
- def songsheet
- #source parser, based on dal creation - dal parser ...
- @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
- message_digest
- dal_structure
- supplementary
- output
- end
- def description(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
- @@description << f << e
- end
- def digests(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
- @@ds[:digests] << f << e
- end
- def dal_structure_tree(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
- @@ds[:tree] << f << e
- end
- def dal_structure_summary(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
- @@ds[:summary] << f << e
- end
- def rcinfo(f,e='')
- puts f + e.to_s if @md.cmd =~/V/
- @@sc_info << f << e
- end
- def output
- filename_digest=SiSU_Env::SiSU_file.new(@md,@md.fn[:digest]).mkfile
- filename_digest << @@description.join << @@ds[:digests].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join
- end
- def rgx_txt(txt)
- txt=txt.gsub(/([()])/,"\\\\\\1")
- end
- def message_digest
- #there will be a docbook mapping header, fairly complex variations
- data=@data
- sys=SiSU_Env::System_call.new
- l=Hash.new(0)
- @p=[]
- @g,@v,@r='','',''
- data.each do |para|
- x=nil
- y,para_endnotes=[],[]
- if para =~/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#@dl}):([0-9a-f]{#@dl})#{Mx[:id_c]}/
- ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5
- @ocn=ocn unless ocn.to_i == 0
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- 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]}(?:(?:https?|file|ftp):\/\/\S+|image)/
- images=para.scan(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|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:/
- "\n" + ' '*2 +':A ' + ' '*6 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- when /^#{Mx[:lv_o]}2:/
- "\n" + ' '*3 +':B ' + ' '*5 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- when /^#{Mx[:lv_o]}3:/
- "\n" + ' '*4 +':C ' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- when /^#{Mx[:lv_o]}4:/
- "\n" + ' '*5 +'1' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- when /^#{Mx[:lv_o]}5:/
- "\n" + ' '*6 +'2' + ' '*3 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- when /^#{Mx[:lv_o]}6:/
- "\n" + ' '*7 +'3' + ' '*2 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all
- else
- if para =~/MD5\(\S+?\.sst\)=\s*<u>([0-9a-f]{#@dl})<\/u>/ #watch
- @n,@s=/MD5\((\S+?\.sst)\)=\s*<u>([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_local_tex}/#{i}")
- @env.path.image_source_local_tex
- elsif FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}")
- tell.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}.+?<u>/ #watch
- dgst_extra="\n" + ' '*21 +'source' +' '*4 + @md.dgst[1] + ' '*34 + @md.fns
- when /Skin_Digest: /
- dgst_extra="\n" + ' '*21 + 'skin' +' '*6 + @md.dgst_skin[1] + ' '*34 + /(skin_\S+?\.rb)/.match(@md.dgst_skin[0])[1]
- when /#{m_sisu_version}: /
- @v=/#{m_sisu_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip
- when /#{m_last_generated}: /
- @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
- # 'doc last generated'
- 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=%{level (if any), ocn: digest clean (no markup/notes), digest all (includes markup & endnotes)\n [endnote number] endnote digest clean\n}
- description("#@t\n")
- description("#@c\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: #@s\n")
- description(" source filename: #@n\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 Digest Tree (from dal):\n")
- description(a)
- #digests("------------\n")
- #digests("#@v\n")
- #digests("#@g\n")
- #digests("#@r\n")
- end
- def dal_structure
- #there will be a docubook mapping header, fairly complex variations
- data=@data
- l=Hash.new(0)
- dal_structure_tree("------------\n")
- dal_structure_tree("document structure[*]\n")
- ocn,endnotes=nil,nil
- data.each do |para|
- x=case para
- when /^#{Mx[:meta_o]}/; l[0] +=1
- if para =~/^#{Mx[:meta_o]}title#{Mx[:meta_c]}/; '' #' '*0 +'@ == headers' + "\n" + ' '*0 +'headings:'
- end
- when /^#{Mx[:lv_o]}1:/; l[1] +=1
- ' '*0 +':A'
- when /^#{Mx[:lv_o]}2:/; l[2] +=1
- ' '*1 +':B'
- when /^#{Mx[:lv_o]}3:/; l[3] +=1
- ' '*2 +':C'
- when /^#{Mx[:lv_o]}4:/; l[4] +=1
- ' '*3 +'1'
- when /^#{Mx[:lv_o]}5:/; l[5] +=1
- ' '*4 +'2'
- when /^#{Mx[:lv_o]}6:/; l[6] +=1
- ' '*5 +'3'
- else nil
- end
- if para =~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/
- ocn=$1 unless $1.to_i == 0
- end
- if para =~/(?:#{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]})/
- endnotes=$1 unless $1.to_i == 0
- end
- 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.to_s
- when /0/; '@ '
- 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/v1/embedded.rb b/lib/sisu/v1/embedded.rb
deleted file mode 100644
index 9152af2a..00000000
--- a/lib/sisu/v1/embedded.rb
+++ /dev/null
@@ -1,139 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: sitemap created from parameters extracted from input file(s)
-
-=end
-module SiSU_Embedded
- require "#{SiSU_lib}/param"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- 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/v1/errors.rb b/lib/sisu/v1/errors.rb
deleted file mode 100644
index d6dac5c3..00000000
--- a/lib/sisu/v1/errors.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, error screen reporting
-
-=end
-module SiSU_Errors
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- class Info_error <Create_file
- def initialize(error,errorlist,cmd,fns='')
- @fns,@cmd,@error,@errorlist=fns,cmd,error,errorlist
- @cmd=if cmd and cmd =~/c/; 'Vc'
- else 'V'
- end
- end
- def error #creates file errorlog.sisu in pwd of last error reported
- file=if @fns; SiSU_Env::Create_file.new(@cmd,@fns).file_error
- else File.new('/tmp/errorlog.sisu','w+')
- end
- file << @fns << "\n" << @error << "\n" << @errorlist
- file.close
- if @cmd=~/[vVM]/; STDERR.puts SiSU_Screen::Ansi.new('',$!,$@).rescue
- else SiSU_Screen::Ansi.new('',"rescued, exception reaised, silenced").puts_grey
- end
- end
- end
-end
-
diff --git a/lib/sisu/v1/harvest.rb b/lib/sisu/v1/harvest.rb
deleted file mode 100644
index 7722fb46..00000000
--- a/lib/sisu/v1/harvest.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- harvest metadata from document corpus (suitable for medium sized sites)
- (concept example, [to remove size constraint: implement SQL equivalent])
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-def help
- puts <<WOK
- harvest --harvest extracts document index metadata
-
-WOK
-end
-def css(opt)
- require "#{SiSU_lib}/css"
- css=SiSU_Style::CSS.new
- fn_css=SiSU_Env::CSS_default.new
- style=File.new("#{@env.path.pwd}/#{fn_css.harvest}",'w')
- #style=File.new("#{@env.path.pwd}/harvest.css",'w')
- style << css.harvest
- style.close
-end
-def cases(opt)
- case opt.mod.inspect
- when/--harvest/i
- css(opt) if opt.cmd.inspect =~/M/
- HARVEST_authors::Songsheet.new(opt).songsheet
- HARVEST_topics::Songsheet.new(opt).songsheet
- if opt.cmd.inspect =~/R/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(opt).rsync_harvest
- end
- else
- help
- end
-end
-require "#{SiSU_lib}/options"
-require "#{SiSU_lib}/harvest_topics"
-require "#{SiSU_lib}/harvest_authors"
-require "#{SiSU_lib}/sysenv"
-include SiSU_Env
-@env=SiSU_Env::Info_env.new
-@@the_idx_topics,@@the_idx_authors={},{}
-argv=$*
-opt=SiSU_commandline::Options.new(argv)
-argv.shift
-#instruct = 'help' if opt.mod.nil? or instruct == ''
-mkdir_p(@env.path.output_md_harvest) unless FileTest.directory?(@env.path.output_md_harvest)
-cases(opt)
-__END__
diff --git a/lib/sisu/v1/harvest_authors.rb b/lib/sisu/v1/harvest_authors.rb
deleted file mode 100644
index a276f333..00000000
--- a/lib/sisu/v1/harvest_authors.rb
+++ /dev/null
@@ -1,325 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract authors and their writings from document set
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_authors
- require "#{SiSU_lib}/author_format"
- @@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|
- if f =~/.+?\.ss[tm]$/
- files << f[/(.+?\.ss[tm])$/,1]
- else
- print "not .sst or .ssm ? << #{f} >> "
- end
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|subtitle|author|creator|date|original_publication):(?:\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(the_idx).screen_print.cycle
- 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
- @orig_pub,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
- @authors=[]
- rgx={}
- rgx[:author]=/^@(?:author|creator):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:\s+(.+)/
- rgx[:subtitle]=/^(?:@subtitle:\s+|@title:.+?:subtitle:[ ]+)(.+)/m
- rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m
- rgx[:orig_pub]=/^@original_publication:\s+(.+)/
- data.each do |para|
- if para=~ rgx[:orig_pub]
- @orig_pub=rgx[:orig_pub].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
- if para=~ rgx[:date]
- @date=rgx[:date].match(para)[1]
- end
- break if @title and @subtitle and @author and @date and @orig_pub
- end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
- if @title and @author_format #and @orig_pub (publication details)
- 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, :orig_pub => @orig_pub, :date => @date, :title => @fulltitle, :author => creator, :page => page }
- else
- #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}; idx: #{@orig_pub}"
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_authors=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def construct_book_author_index
- idx_array=@idx_array
- idx_array.each do |idx|
- idx[:author][:last_first_format_a].each do |author|
- author.strip!
- if @@the_idx_authors[author].class==NilClass
- @@the_idx_authors[author]={:md => []}
- end
- @@the_idx_authors[author][:md] << { :filename => idx[:filename], :file => idx[:file], :author => idx[:author], :title => idx[:title], :date => idx[:date], :page => idx[:page] }
- end
- end
- @the_idx=@@the_idx_authors
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @letter=@alph.shift
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w')
- @output[:html_mnt]= if @opt.cmd.inspect =~/-M/
- File.new("#{@env.path.pwd}/harvest_authors.html",'w')
- else nil
- 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=if type !~/maintenance/
- '../_sisu/css/harvest.css'
- else 'harvest.css'
- end
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Authors</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Authors</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_topics.html">SiSU Metadata Harvest - Topics</a></p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/-M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << (x =~/[0-9]/) ? '' : %{<a href="##{x}">#{x}</a>,&nbsp;}
- end
- @output[:html_mnt] << a.join if @output[:html_mnt].class==File
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- @output[:html] << html
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string[0])[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_string_name('',a)
- name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>}
- if @output[:html_mnt].class==File
- @output[:html_mnt] << x
- end
- @output[:html] << x
- works=[]
- a[1][:md].each do |x|
- work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
- works<<=if @output[:html_mnt].class==File
- work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])
- else work
- end
- 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/v1/harvest_topics.rb b/lib/sisu/v1/harvest_topics.rb
deleted file mode 100644
index 2ac181d0..00000000
--- a/lib/sisu/v1/harvest_topics.rb
+++ /dev/null
@@ -1,563 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- metadata harvest, extract topics and associated writings from document set
- (topics use topic_register header)
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module HARVEST_topics
- require "#{SiSU_lib}/author_format"
- 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|
- if f =~/.+?\.ss[tm]$/
- files << f[/(.+?\.ss[tm])$/,1]
- else
- print "not .sst or .ssm ? << #{f} >> "
- end
- end
- files.each do |filename|
- file_array=[]
- File.open(filename,'r') do |file|
- file.each_line("\n\n") do |line|
- if line =~/^@(?:title|subtitle|author|creator|classify|topic_register|date):(?:\s|$)/m
- file_array << line
- elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
- else break
- end
- end
- end
- #file_array=IO.readlines("#{filename}","\n\r")
- idx_array=HARVEST_topics::Harvest.new(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(data,filename,idx_array)
- @data,@filename,@idx_array=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]=/^@(?:author|creator):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
- rgx[:title]=/^@title:\s+(.+)/
- rgx[:subtitle]=/^(?:@subtitle:\s+|@title:.+?:subtitle:[ ]+)(.+)/m
- rgx[:idx]=/^(?:@topic_register:[ ]+|@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 author field: #@filename title: #@title; author: #@author_format; idx: #@idx_list"
- end
- idx_array.flatten!
- idx_array
- end
- end
- class Index
- def initialize(idx_array,the_idx)
- @idx_array,@the_idx=idx_array,the_idx
- @@the_idx_topics=@the_idx
- end
- def capital(txt)
- txt[0].chr.capitalize + txt[1,txt.length]
- end
- def contents(hash,idx)
- names=''
- idx[:author][:last_first_format_a].each do |n|
- s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- names += %{<a href="harvest_authors.html##{s}">#{n}</a>, }
- end
- hash << { :filename =>idx[:filename],:file =>idx[:file],:author =>names,:title =>idx[:title],:page =>idx[:page]}
- end
- def construct_book_topic_index
- idx_array=@idx_array
- idx_array.each do |idx|
- @lv0,@lv1,@lv2,@lv3,@lv4={},{},{},{},{}
- if idx[:rough_idx]
- idx_lst=idx[:rough_idx].scan(/[^:]+/)
- else
- puts "no topic register in: << #{idx[:filename]} >>"
- next
- end
- idx_lst_alt=[]
- idx_lst.each {|lev| idx_lst_alt << lev.scan(/[^|]+/)}
- depth = idx_lst_alt.length - 1
- range = 0..depth
- range.each do |t|
- if idx_lst_alt[t]
- case t
- when 0
- lev0=idx_lst_alt[t]
- lev0.each do |lv0|
- lv0=capital(lv0)
- if @@the_idx_topics[lv0].class==NilClass
- @@the_idx_topics[lv0]={:md => []}
- end
- @lv0=lv0 if lev0.length==1
- j=@@the_idx_topics[lv0][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 1
- lev1=idx_lst_alt[t]
- lev1.each do |lv1|
- lv1=capital(lv1)
- if @@the_idx_topics[@lv0][lv1].class==NilClass
- @@the_idx_topics[@lv0][lv1]={:md => []}
- end
- @lv1=lv1 if lev1.length==1
- j=@@the_idx_topics[@lv0][lv1][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 2
- lev2=idx_lst_alt[t]
- lev2.each do |lv2|
- lv2=capital(lv2)
- if @@the_idx_topics[@lv0][@lv1][lv2].class==NilClass
- @@the_idx_topics[@lv0][@lv1][lv2]={:md => []}
- end
- @lv2=lv2 if lev2.length==1
- j=@@the_idx_topics[@lv0][@lv1][lv2][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 3
- lev3=idx_lst_alt[t]
- lev3.each do |lv3|
- lv3=capital(lv3)
- if @@the_idx_topics[@lv0][@lv1][@lv2][lv3].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][lv3]={:md => []}
- end
- @lv3=lv3 if lev3.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][lv3][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- when 4
- lev4=idx_lst_alt[t]
- lev4.each do |lv4|
- lv4=capital(lv4)
- if @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass
- @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4]={:md => []}
- end
- @lv4=lv4 if lev4.length==1
- j=@@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4][:md]
- contents(j,idx) if idx_lst_alt.length - 1 == t
- end
- end
- end
- end
- end
- @the_idx
- end
- end
- class Output_index
- def initialize(opt,the_idx)
- @opt,@the_idx=opt,the_idx
- @env=SiSU_Env::Info_env.new
- @rc=Get_init.instance.yamlrc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
- @letter=@alph.shift
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def html_file_open
- @output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_topics.html",'w')
- if @opt.cmd.inspect =~/-M/
- @output[:html_mnt]=File.new("#{@env.path.pwd}/harvest_topics.html",'w')
- end
- end
- def html_file_close
- @output[:html].close
- @output[:html_mnt].close if @output[:html_mnt].class==File
- end
- def html_print
- def html_songsheet
- html_file_open
- html_head
- html_alph
- html_body
- html_tail
- html_file_close
- end
- def html_head_adjust(type='')
- css_path=if type !~/maintenance/
- '../_sisu/css/harvest.css'
- else 'harvest.css'
- end
- sv=SiSU_Env::Info_version.instance.get_version
- <<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>SiSU Metadata Harvest - Topics</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="dc.title" content= "SiSU metadata harvest, Topics - SiSU information Structuring Universe, Structured information Serialised Units" />
-<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
-<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
-<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
-<link rel="stylesheet" href="#{css_path}" type="text/css" />
-<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-<h1>SiSU Metadata Harvest - Topics</h1>
-<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_authors.html">SiSU Metadata Harvest - Authors</a></p>
-<hr />
-WOK
- end
- def html_head
- @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/-M/
- @output[:html] << html_head_adjust
- end
- def html_alph
- a=[]
- a << '<p>'
- @alph.each do |x|
- a << if x =~/[0-9]/; ''
- else
- %{<a href="##{x}">#{x}</a>,&nbsp;}
- end
- end
- @output[:html_mnt] << a if @opt.cmd.inspect =~/-M/
- @output[:html] << a.join
- end
- def html_tail
- a=[]
- a <<<<WOK
-<hr />
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-#{@vz.credits_sisu}
-</body>
-</html>
-WOK
- @output[:html_mnt] << a if @output[:html_mnt].class==File
- @output[:html] << a
- end
- def do_html(html)
- @output[:html] << html
- end
- def do_html_maintenance(html)
- @output[:html_mnt] << html if @output[:html_mnt].class==File
- end
- def do_string(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_default(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html(html)
- end
- def do_string_maintenance(attrib,string)
- html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_string_name(attrib,string)
- f=/^(\S)/.match(string)[1]
- if @letter < f
- while @letter < f
- if @alph.length > 0
- @letter=@alph.shift
- if @output[:html_mnt].class==File
- @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- end
- @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
- else break
- end
- end
- end
- name=string.strip.gsub(/\s+/,'_')
- html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>}
- do_html(html)
- do_html_maintenance(html) if @output[:html_mnt].class==File
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(attrib,hash)
- html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_default(attrib,html)
- end
- def do_hash_md_maintenance(attrib,hash)
- if @output[:html_mnt].class==File #should not be run for presentation output
- html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
- do_string_maintenance(attrib,html)
- end
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md('work',hash)
- do_hash_md_maintenance('work',hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,m) : do_string(attrib,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- y = a.class
- case
- when y==String
- attrib="lev#{lv}"
- lv==0 ? do_string_name(attrib,a) : do_string(attrib,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.sort.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- key << m
- elsif m == :title
- do_hash_md(lv,hash)
- end
- end
- if key.length > 0
- key.sort.each do |m|
- do_string(lv,m)
- do_case(lv,hash[m])
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- def screen_print_unsorted
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lv,array)
- lv+=1
- array.each do |b|
- do_case(lv,b)
- end
- end
- def do_hash_md(lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lv,string)
- end
- def do_hash(lv,hash)
- lv+=1
- hash.each_key do |m|
- if m == :md
- do_case(lv,hash[m])
- else
- if m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page
- do_string(lv,m)
- do_case(lv,hash[m])
- elsif m == :title
- do_hash_md(lv,hash)
- else
- end
- end
- end
- end
- def do_case(lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lv,a)
- when y==Array
- do_array(lv,a)
- when y==Hash
- do_hash(lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.each do |a|
- do_case(-1,a)
- end
- end
- self
- end
- end
-end
-__END__
-terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details}
- | |_ {tl2} -|_ {fa}[fa]{filenames and other details}
- | | |_{tl3} -|_ {fa}[fa]{filenames and other details}
- | | | |_{tl4} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4a} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_{tl4b} - {fa}[fa]{filenames and other details}
- | | | |
- | | | |_ ...
- | | |
- | | |_{tl3a} - {fa}[fa]{filenames and other details}
- | |
- | |_{tl2a} - {fa}[fa]{filenames and other details}
- |
- |_ t{tl1a} -|_ {fa}[fa]{filenames and other details}
- |_ ...
diff --git a/lib/sisu/v1/help.rb b/lib/sisu/v1/help.rb
deleted file mode 100644
index 2d6e4a1e..00000000
--- a/lib/sisu/v1/help.rb
+++ /dev/null
@@ -1,2035 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: interactive infomation/help
-
-=end
-module SiSU_Help
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/param"
- include SiSU_Screen
- 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(?:37|38)?|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|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|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, external_programs, dublincore, termsheet, search, sql, hyper(est)raier, features, external_programs, 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
- when /example37/; @help.example37
- when /example38/; @help.example38
- 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|ascii|-[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 /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?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 <<WOK
- SiSU, Copyright (C) 1997 - 2010, Ralph Amissah
- License GPL version 3 or Later. This program comes with ABSOLUTELY NO WARRANTY;
- This is free software, and you are welcome to redistribute it under the conditions of the GPL3 or later.
- For more license detail type/enter: "sisu --help license"
-
-for help type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation)
-
-typing "sisu" on its own or "sisu --help", should give you this sisu help summary and the sisu (interactive help mode) help prompt, from which help on each keyword can be obtained.
-
-alternatively typing #{@cX.orange}sisu --help#{@cX.off} #{@cX.green}[keyword]#{@cX.off} at the command prompt will provide the sisu help page requested and return to the command prompt (if nothing is found it will print this page and return to the command prompt)
-
- Keywords (related to using SiSU)
- #{@cX.green}help#{@cX.off} or #{@cX.green}list#{@cX.off} this sisu help summary
- #{@cX.green}commands#{@cX.off} sisu --help commands
- #{@cX.green}environment#{@cX.off} sisu --help env
- ------------------------------------------
- Preparing Documents for SiSU
- #{@cX.green}markup#{@cX.off} sisu --help markup (an incomplete overview)
- #{@cX.green}headers#{@cX.off} sisu --help headers (document-wide instructions, meta-data)
- #{@cX.green}structure#{@cX.off} sisu --help structure (document structure, headings, tables of contents)
- #{@cX.green}endnotes#{@cX.off} sisu --help endnotes
- #{@cX.green}tables#{@cX.off} sisu --help tables
- #{@cX.green}example 0.37#{@cX.off} sisu --help example37
- #{@cX.green}example 0.38#{@cX.off} sisu --help example
- ------------------------------------------
- #{@cX.green}search#{@cX.off} sisu --help search
- ------------------------------------------
- #{@cX.green}customise#{@cX.off} sisu --help customise
- ------------------------------------------
- SiSU's License
- #{@cX.green}license#{@cX.off} sisu --help license
-
-for help type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation)
-WOK
- # #{@cX.cyan}sisu_convert#{@cX.off} program for initial (very basic and partial) conversion to sisu file format (html and word97 supported)
- end
- def abstract
- print <<WOK
-Features:
-#{@cX.cyan}(i)#{@cX.off} minimal markup requirement
-#{@cX.cyan}(ii)#{@cX.off} single file marked up for multiple outputs
-#{@cX.cyan}(iii)#{@cX.off} markup is simpler than html
-#{@cX.cyan}(iv)#{@cX.off} the simple syntax is mnemonic, influenced by mail/messaging/wiki markup practices
-#{@cX.cyan}(v)#{@cX.off} human readable, and easily writable
-#{@cX.cyan}(vi)#{@cX.off} multiple outputs include amongst others: html; pdf via LaTeX; (structured) XML; sql - currently PostgreSQL and sqlite; plaintext, (also texinfo)
-#{@cX.cyan}(vii)#{@cX.off} all text objects (headings and paragraphs) are numbered identically, for citation purposes, in all outputs (html, pdf, sql etc.)
-#{@cX.cyan}(viii)#{@cX.off} creates organised directory/file structure for output
-#{@cX.cyan}(ix)#{@cX.off} 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
-#{@cX.cyan}(x)#{@cX.off} 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.
-#{@cX.cyan}(xi)#{@cX.off} very easily skinnable, document appearance on a project/site wide, or document instance level easily controlled/changed
-#{@cX.cyan}(xii)#{@cX.off} 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
-#{@cX.cyan}(xiii)#{@cX.off} 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
-#{@cX.cyan}(xiv)#{@cX.off} possible to pre-process, which permits the easy creation of standard form documents, and templates/term-sheets
-#{@cX.cyan}(xv)#{@cX.off} extremely modular, (thanks in no small part to Ruby) another output format required, write another module....
-#{@cX.cyan}(xvi)#{@cX.off} easy to update output formats (eg html, xhtml, latex/pdf produced can be updated in program and run against whole document set)
-#{@cX.cyan}(xvii)#{@cX.off} easy to add, modify, or have alternative syntax rules for input, should you need to
-#{@cX.cyan}(xviii)#{@cX.off} "Concordance" wordmap, consisting of all the words in a document and their (text object) locations within the text
-#{@cX.cyan}(xix)#{@cX.off} tied to revision control system, only code and marked up file need be backed up, to be sure of the much larger document set
-#{@cX.cyan}(xx)#{@cX.off} syntax highlighting files for markup, primarily (g)vim so far.
-
-SiSU was developed in relation to legal documents, and so is strong across a wide variety of texts (law, literature...), though weak on formulae/statistics, it does handle images. An assumption has been document sets that are to be preserved and maintained over time (also a result of the legal text origin). SiSU has been developed and used over a number of years, and the requirements to cover a wide range of documents have been thoroughly explored.
-
-There is more detailed information available on it from:
- #{@cX.blue}http://www.jus.uio.no/sisu#{@cX.off}
- * plaintext
- * html
- * XML (structured)
- * LaTeX/pdf
- * texinfo
- * sql (at present postgresql & sqlite)
-
-A couple of sample inputs and outputs:
-
-The markup for "War and Peace" (chosen because it is a large text & to test the use of SiSU on Project Gutenberg's plaintext), this is the markup, very little after the headers (there is an insert of their legal notices). Took no time at all, it is a particularly simple text to markup though
-A simple document and a more demanding document
- #{@cX.blue}http://www.jus.uio.no/sisu/sample/war.and.peace.leo.tolstoy.er20 http://www.jus.uio.no/sisu/sample/autonomy.markup1.er30#{@cX.off}
-Some resulting outputs:
- html #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/ http://www.jus.uio.no/sisu/autonomy.markup1/#{@cX.off}
- #{@cX.blue}http://www.jus.uio.no/sisu/autonomy.markup1/doc#{@cX.off}
- pdf #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/portrait http://www.jus.uio.no/sisu/autonomy.markup1/portrait
- #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/landscape http://www.jus.uio.no/sisu/autonomy.markup1/landscape#{@cX.off}
- plaintext #{@cX.blue}http://www.jus.uio.no/sisu/war.and.peace.leo.tolstoy/doc.txt http://www.jus.uio.no/sisu/autonomy.markup1/doc.txt#{@cX.off}
-WOK
- end
- def commands
- print <<WOK
-
- #{@cX.ruby}-a#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces plaintext with Unix linefeeds. Without markup, (object numbers are omitted), has footnotes at end of each para‐ graph that contains them. Modifier options available: --footnotes (default) or --endnotes and for linefeeds --unix (default) or --msdos
-
- #{@cX.ruby}-b#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces xhtml/XML output for browser viewing (sax parsing)
-
- #{@cX.ruby}-C#{@cX.off} initialise shared output directory (config files such as css and dtd files are not updated if they already exist unless modifier is used) #{@cX.ruby}-C --init=site#{@cX.off} 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. in a new markup document working directory should initialise the corresponding output directory, though SiSU will automatically do this, the first time it is run (for processing) in a given directory.
-
- #{@cX.ruby}-c#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} 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)
-
- #{@cX.ruby}-D#{@cX.off} #{@cX.green}[instruction]#{@cX.off} #{@cX.green}[filename]#{@cX.off} database instruction, see database section below
-
- #{@cX.ruby}-d#{@cX.off} #{@cX.green}[instruction]#{@cX.off} #{@cX.green}[filename]#{@cX.off} database instruction, see database section below [only -D currently available]
-
- #{@cX.ruby}-F#{@cX.off} 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 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).
-
- #{@cX.ruby}-H#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces html (css version) (creates html (using css)), with url link suffixes (.html .pdf etc.) omitted ("Hide"). For web servers that are confireud so as not to require file extensions to locate and serve files. [behaviour switched see -h]
-
- #{@cX.ruby}-h#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces html (hardlinks i.e. with name suffixes in links/local urls). html, with internal document links that include the document suffix, ie whether it is .html or .pdf (required for browsing directly off a file system, and works with most web servers). [behaviour switched see -H]
-
- #{@cX.ruby}-I#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces texinfo file with its myriad of possibilities
-
- #{@cX.ruby}-L#{@cX.off} prints license information
-
- #{@cX.ruby}-M#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} maintenance mode, files created for processing are not deleted, and their locations are indicated (also see -V)
-
- #{@cX.ruby}-m#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} 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
-
- #{@cX.ruby}-N#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} document content certificate as md5 digest tree of document produced (as digest.txt), the digest for the document, and digests for each object contained within the document (together with information on software versions that produced it). Try -mNV for verbose digest output to screen
-
- #{@cX.ruby}-n#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} 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.
-
- #{@cX.ruby}-p#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces LaTeX pdf (portrait & landscape). 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).
-
- #{@cX.ruby}-q#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} quiet, less output to screen
-
- #{@cX.ruby}-r#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} copies sisu output files to remote host using scp (default). This requires that sisurc.yml has been provided with information on hostname and user name, and that you have your "keys" and ssh agent in place.
-
- #{@cX.ruby}-S#{@cX.off} #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 The resulting tar gzip file has a .zip suffix added to the markup source directory name. To tar and gzip individual files see the -Z [filename/wildcard] option. Note: (this option is tested only with zsh)
-
- #{@cX.ruby}-S#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces a sisupod a zipped sisu of the content assocated with the specified sisu markup documnt, i.e. including sisu markup source file, (and associated documents if a master file, or available in multilingual versions), together with related images and skin. The resulting zipped file has a .zip suffix added to the markup source file name by default, though a .ssp suffix is also recognised. The directory structure of the unzipped file is understood by sisu, and sisu commands can be run within it. SiSU commands can be run 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. This provides a convenient way of packing documents files for sending Note: if you wish to send multiple files, it quickly becomes more space efficient to tar and gzip the sisu markup directory, (without the _sisu_processing subdirectory) rather than the individual files for sending). See the -S option without [filename/wildcard]
-
- #{@cX.ruby}-t#{@cX.off} #{@cX.green}[filename/wildcard (*.termsheet.rb)]#{@cX.off} standard form document builder, preprocessing feature
-
- #{@cX.ruby}-U#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} prints url 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 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
-
- #{@cX.ruby}-u#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} provides url mapping of output files for the flags requested for processing, also see -U
-
- #{@cX.ruby}-V#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} on its own provides SiSU version and environment information (sisu --help env)
-
- #{@cX.ruby}-V#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} even more verbose than -v the -V flag provides some additional information, also see -M
-
- #{@cX.ruby}-v#{@cX.off} on its own, provides SiSU version information.
-
- #{@cX.ruby}-v#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} provides more verbose output of what is being built, where it is being built (and error messages if any), as with -u flag provides a url mapping of files created for each of the processing flag requests
-
- #{@cX.ruby}-X#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces XML output with deep document structure, in the nature of dom
-
- #{@cX.ruby}-x#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces XML output (sax parsing)
-
- #{@cX.ruby}-W#{@cX.off} #{@cX.green}[port]#{@cX.off} starts ruby´s webrick webserver, points at sisu output directories (default port is set)
-
- #{@cX.ruby}-w#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces concordance, a rudimentary index of all the words in a document
-
- #{@cX.ruby}-Z#{@cX.off} Zap, if used with other processing flags #{@cX.green}deletes output files#{@cX.off} 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.
-
- #{@cX.ruby}-z#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces php (zend) [feature disabled, depreciated]
-
- #{@cX.ruby}--harvest#{@cX.off} #{@cX.green}*.ss[tm]#{@cX.off} 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 -M and -R flags.
-
- #{@cX.ruby}databases#{@cX.off}
-
- #{@cX.ruby}dbi - database interface -D or --pgsql set for postgresql -d or --sqlite set for sqlite#{@cX.off}
-
- #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--create#{@cX.off} creates empty postgresql db and required tables & indexes (rb.dbi) [#{@cX.ruby}-d --create#{@cX.off} sqlite equivalent] it may be necessary to first run sisu #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--createdb#{@cX.off}
-
- #{@cX.ruby}-Di#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} or #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--import#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} imports data specified to postgresql db (rb.dbi) [#{@cX.ruby}-d --import#{@cX.off} sqlite equivalent]
-
- #{@cX.ruby}-Du#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} or #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--update#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} updates/imports specified data to postgresql db (rb.dbi) [#{@cX.ruby}-d --update#{@cX.off} sqlite equivalent]
-
- #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--remove#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} removes specified data to postgresql db (rb.dbi) [#{@cX.ruby}-d --remove#{@cX.off} sqlite equivalent]
-
- #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--dropall#{@cX.off} kills data" and drops (postgresql) db, tables & indexes [#{@cX.ruby}-d --dropall#{@cX.off} sqlite equivalent]
-
- #{@cX.ruby}-D#{@cX.off} #{@cX.ruby}--recreate#{@cX.off} kills data" and drops (postgresql or sqlite) db, tables & indexes, then creates an empty db with tables and indexes [#{@cX.ruby}-d --recreate#{@cX.off} sqlite equivalent]
-
- also see command #{@cX.green}shortcuts#{@cX.off}, and shorthand mappings for multiple flags
-WOK
- end
- def shortcuts
- cf_defaults=SiSU_Env::Info_processing_flag.new
- print <<WOK
-
- #{@cX.ruby}Shorthand for multiple flags#{@cX.off}
-
- #{@cX.ruby}--update#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} 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.
-
- #{@cX.ruby}-1#{@cX.off} to #{@cX.ruby}-5#{@cX.off} #{@cX.green}[filename or wildcard]#{@cX.off}
- #{@cX.green}Default shorthand mappings#{@cX.off} (note that the defaults can be changed in the #{@cX.green}sisurc.yml#{@cX.off} file):
-
- (these can be turned off if unavailable in sisurc.yml under program_set:)
- #{@cX.green}processing shortcut defaults set to:#{@cX.off}
- color defaut set (on==true) #{@cX.blue}#{cf_defaults.color}#{@cX.off}
- sisu -1 #{@cX.blue}#{cf_defaults.cf_1}#{@cX.off}
- sisu -2 #{@cX.blue}#{cf_defaults.cf_2}#{@cX.off}
- sisu -3 #{@cX.blue}#{cf_defaults.cf_3}#{@cX.off}
- sisu -4 #{@cX.blue}#{cf_defaults.cf_4}#{@cX.off}
- sisu -5 #{@cX.blue}#{cf_defaults.cf_5}#{@cX.off}
- defaults may be changed in active sisurc.yml file under 'flag:'
-
- add -v for verbose mode and -c (color toggle), e.g.
- sisu -2vc [filename or wildcard]
-WOK
- end
- def modifiers
- print <<WOK
-
- #{@cX.ruby}Command flag modifiers#{@cX.off}
-
- #{@cX.ruby}--no-ocn#{@cX.off} [with -h -H or -p] switches off object citation numbering. Produce output without identifying numbers in margins of html or LaTeX/pdf output.
-
- #{@cX.ruby}--no-annotate#{@cX.off} strips output text of editor endnotes~[* square brackets ]~ denoted by asterisk or dagger/plus sign
-
- #{@cX.ruby}--no-asterisk#{@cX.off} strips output text of editor endnotes~[* square brackets ]~ denoted by asterisk
-
- #{@cX.ruby}--no-dagger#{@cX.off} strips output text of editor endnotes~[+ square brackets ]~ denoted by dagger/plus sign
-
-WOK
- end
- def misccom
- <<WOK
- #{@cX.cyan}misc#{@cX.off}
- #{@cX.green}-s#{@cX.off} [filename or wildcard] #{@cX.green}spellcheck#{@cX.off} (aspell previously ispell
- \t#{@cX.green}mailer examples#{@cX.off}
- from vim mail.er10 (not gvim) issue command
- \t:! ruby -S mailer.rb instruction/landscape|a4l|portrait|a4p/ email@address/alias subject line
- \t:! ruby -S mailer.rb a4l ralph@amissah.com testing continues
- from vim mail.er10 use your vim alias \\mail or \\mutt (modify command line as required)
- #{@cX.green}feeds rss/rdf#{@cX.off}
- #{@cX.blue}-R #{@cX.off} (yaml|rss) extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf) #{@cX.fuschia}[work area]#{@cX.off}
- #{@cX.green}-R #{@cX.off} yaml extraction of semantic data into yaml file for auto build of xml feeds (rss, rdf)
- #{@cX.green}-R #{@cX.off} rss creates rss2.0 feed
-WOK
- end
- def markup
- print <<WOK
-sisu
- Note: files for SiSU should be in UTF-8 character encoding.
-
- #{@cX.cyan}Data text markup#{@cX.off} (alternative to available html subset)
- #{@cX.green}% SiSU 0.38#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document, markup used is version 0.38]
- #{@cX.green}:A~#{@cX.off} heading/title [levels :A to :C available (and beneath that 1 to 6)]
- #{@cX.green}1~#{@cX.off}filename heading [segmentation level, levels 1 to 6 available]
- #{@cX.green}!{#{@cX.off}emphasis#{@cX.green}}!#{@cX.off}
- #{@cX.green}*{#{@cX.off}bold text#{@cX.green}}*#{@cX.off}
- #{@cX.green}_{#{@cX.off}underscore#{@cX.green}}_#{@cX.off}
- #{@cX.green}/{#{@cX.off}italics#{@cX.green}}/#{@cX.off}
- #{@cX.green}"{#{@cX.off}citation#{@cX.green}}"#{@cX.off}
- #{@cX.green}^{#{@cX.off}superscript#{@cX.green}}^#{@cX.off}
- #{@cX.green},{#{@cX.off}subscript#{@cX.green}},#{@cX.off}
- #{@cX.green}+{#{@cX.off}inserted text#{@cX.green}}+#{@cX.off}
- #{@cX.green}-{#{@cX.off}strikethrough#{@cX.green}}-#{@cX.off}
- ------------------------------------------
- #{@cX.cyan}Indentation and bullets#{@cX.off}
- #{@cX.green}_1#{@cX.off} indent paragraph one level
- #{@cX.green}_2#{@cX.off} indent paragraph two steps
- #{@cX.green}_*#{@cX.off} bullet text
- #{@cX.green}_1*#{@cX.off} bullet text, first indent
- ------------------------------------------
- #{@cX.cyan}Numbered List#{@cX.off} (not to be confused with headings/titles, (document structure))
- #{@cX.green}##{@cX.off} numbered list numbered list 1., 2., 3, etc.
- #{@cX.green}_##{@cX.off} numbered list numbered list indented second level a., b., c., d., etc.
- ------------------------------------------
- #{@cX.cyan}Endnotes#{@cX.off}
- #{@cX.green}~{#{@cX.off}footnote/endnote#{@cX.green}}~#{@cX.off} endnote#{@cX.green}~{#{@cX.off}self contained endnote marker & endnote in one#{@cX.green}}~#{@cX.off}
- #{@cX.green}~{*#{@cX.off}asterisk footnote/endnote#{@cX.green}}~#{@cX.off}
- editor's annotations, square bracket notes
- #{@cX.green}~[*#{@cX.off}numbered asterisk footnote/endnote series#{@cX.green}]~#{@cX.off}
- #{@cX.green}~[+#{@cX.off}numbered dagger/plus sign footnote/endnote series#{@cX.green}]~#{@cX.off}
- ---
- alternative endnote pair notation
- #{@cX.green}~^#{@cX.off} endnote marker
- #{@cX.green}^~#{@cX.off} endnote text following the paragraph in which the marker occurs
- ------------------------------------------
- #{@cX.cyan}Links#{@cX.off}
- http://url.org on its own would be automatically marked up and hyperlinked to itself
- #{@cX.green}{#{@cX.off} [text to link] #{@cX.green}}#{@cX.off}http://url.org
- #{@cX.green}{#{@cX.off}image.png#{@cX.green}}#{@cX.off}http://url.org
- #{@cX.green}{#{@cX.off}image.png#{@cX.green}}#{@cX.off}image #{@cX.green}{#{@cX.off}tux.png 64#{@cX.green}x#{@cX.off}80#{@cX.green}}#{@cX.off}image
- Linked image example
- #{@cX.green}{#{@cX.off} SiSU Geek Writer #{@cX.green}}#{@cX.off}http://www.jus.uio.no/sisu/ url example
- #{@cX.green}{#{@cX.off}tux.png 64#{@cX.green}x#{@cX.off}80 "a better way" #{@cX.green}}#{@cX.off}http://www.jus.uio.no/sisu/ image example with all options (width x height)
- Note: png and jpg support only (no gif support)
-
- shortcut - hyper-linked text with endnote providing the url information
- #{@cX.green}{~^#{@cX.off} [text to link] #{@cX.green}}#{@cX.off}http://url.org maps to #{@cX.green}{#{@cX.off} [text to link] #{@cX.green}}#{@cX.off}http://url.org #{@cX.green}~{#{@cX.off} http://url.org #{@cX.green}}~#{@cX.off}
- produces hyper-linked text within a document/paragraph, with an endnote providing the url for the text location used in the hyperlink
-
- shortcut:
- #{@cX.green}{#{@cX.off} [text to link] #{@cX.green}[3sS]}#{@cX.off}markup_source_filename.sst
- if a server host name has been provided/configured, will provide a list of available output types that would be generated using the shortcut command and the markup file provided, i.e. output generated using the command (as configured):
- "sisu -3sS markup_source_filename.sst"
- using server host, directory stub, filename to compose the link.
- ------------------------------------------
- adding fixed names in html, manual location marker/tagging
- #{@cX.green}*~[name]#{@cX.off} <a name="[name]">
- ------------------------------------------
- #{@cX.green}~##{@cX.off} unnumbered paragraph (place marker at end of paragraph)
- #{@cX.green}-##{@cX.off} unnumbered paragraph, delete when not required (place marker at end of paragraph) [used in dummy headings, eg. for segmented html]
- ------------------------------------------
- manual page breaks (LaTeX/pdf)
- #{@cX.green}<:pb>#{@cX.off} page break, which breaks a page, starting a new page in single column text and a new column in double column text
- #{@cX.green}<:pn>#{@cX.off} page new, which starts a new page, in both single and double column text (leaving an empty column in double column text if necessary).
- Note: page breaks are usually introduced to pdfs either as header instructions, indicating that pages should break at given levels
- ------------------------------------------
- #{@cX.cyan}Composite documents#{@cX.off}
- It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}.ssm.sst#{@cX.off}
-
- #{@cX.cyan}#basic sisu markup alternatives#{@cX.off}
- #{@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}<url:#{@cX.off}filename.ssi#{@cX.green}>require#{@cX.off}
- #{@cX.green}<< <url:#{@cX.off}filename.ssi#{@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
-# <!image http://www.jus.uio.no/sisu/ ../_sisu/image/tux.png width=\"64\" height=\"80\" !> old form
- end
- def example
- help_markup
- end
- def example37
- print <<WOK
-% SiSU 0.16 - 0.37
-
-0~title Working Sample Document
-
-0~subtitle Demonstrating markup
-
-0~creator Ralph Amissah
-
-0~date
-
-0~markup num_top=4
-
-0~bold [regular expression of words/phrases to be made bold]
-
-0~italics [regular expression of words/phrases to italicise]
-
-0~links { SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-
-1~ A Sample Document
-
-2~ just for fun
-
-4~ This is Chapter One or Article One
-
-Ordinary Text follows here. The Title would be a Chapter or Article depending on the type of document you were working to produce.
-
-4~ This would be Chapter Two or Article Two
-
-And so on.
-
-Assuming sisu is configured properly so it has been instructed where to put the work files and ouput files, you would generate this text once saved, with the suffix .sst if saved as example.sst, by typing sisu -mhwxp example.sst while in the directory in which the file is saved.
-
-_1 -m initial processing, -h html (css based), -w concordance for html, -x xml, -p pdf output, generated via latex, there are of course additional options
-
-_1 for a listing type: sisu ~ commands
-
-_1 for an outline of sisu markup type: sisu ~ markup
-
-The example ends here.
-WOK
- help_markup
- end
- def example38
- print <<WOK
-% SiSU 0.38
-
-@title: Working Sample Document
-
-@subtitle: Demonstrating markup
-
-@creator: Ralph Amissah
-
-@date:
-
-@markup: num_top=4
-
-@bold: [regular expression of words/phrases to be made bold]
-
-@italics: [regular expression of words/phrases to italicise]
-
-@links: { SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-
-:A~ A Sample Document
-
-:B~ just for fun
-
-1~ This is Chapter One or Article One
-
-Ordinary Text follows here. The Title would be a Chapter or Article depending on the type of document you were working to produce.
-
-1~ This would be Chapter Two or Article Two
-
-And so on.
-
-Assuming sisu is configured properly so it has been instructed where to put the work files and ouput files, you would generate this text once saved, with the suffix .sst if saved as example.sst, by typing sisu -mhwxp example.sst while in the directory in which the file is saved.
-
-_1 -m initial processing, -h html (css based), -w concordance for html, -x xml, -p pdf output, generated via latex, there are of course additional options
-
-_1 for a listing type: sisu ~ commands
-
-_1 for an outline of sisu markup type: sisu ~ markup
-
-The example ends here.
-WOK
- help_markup
- end
- def headers
- print <<WOK
-Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed.
-All header instructions take either the form #{@cX.green}@headername:#{@cX.off} or #{@cX.green}0~headername#{@cX.off}. All Dublin Core meta tags are available
-#{@cX.green}@indentifier:#{@cX.off} information or instructions
-or
-#{@cX.green}0~indentifier#{@cX.off} information or instructions
-where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, and the #{@cX.green}"information"#{@cX.off} or #{@cX.green}"instructions"#{@cX.off} belong to the tag/indentifier specified
- Note: a header where used should only be used once; all headers apart from 0~title are optional; the @structure: or 0~toc header is used to describe document structure, and can be useful to know.
-This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.cyan}other information headers in cyan,#{@cX.off} #{@cX.ruby}markup instructions in red#{@cX.off}):
-
-#{@cX.fuschia}@title:#{@cX.off} My Title - This is now the Title of the Document and used as such
-
-#{@cX.cyan}@subtitle:#{@cX.off} The Subtitle if any
-
-#{@cX.fuschia}@creator:#{@cX.off} [or @author:] Surname, Other names (if more than one author separate author names with a semi colon, if name is of an institution just write name or the name contains a comma enclose in quotation marks)
-
-#{@cX.fuschia}@topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql
-
-#{@cX.fuschia}@subject:#{@cX.off} (whatever your subject)
-
-#{@cX.fuschia}@description:#{@cX.off}
-
-#{@cX.fuschia}@publisher:#{@cX.off}
-
-#{@cX.fuschia}@contributor:#{@cX.off}
-
-#{@cX.fuschia}@translator:#{@cX.off} [or @translated_by:]
-
-#{@cX.fuschia}@illustrator:#{@cX.off} [or @illustrated_by:]
-
-#{@cX.fuschia}@prepared_by:#{@cX.off} [or @digitized_by:]
-
-#{@cX.fuschia}@date:#{@cX.off} 2000-08-27
-\t[ also #{@cX.fuschia}@date.created:#{@cX.off} #{@cX.fuschia}@date.issued:#{@cX.off} #{@cX.fuschia}@date.available:#{@cX.off} #{@cX.fuschia}@date.valid:#{@cX.off} #{@cX.fuschia}@date.modified:#{@cX.off} ]
-
-#{@cX.fuschia}@type:#{@cX.off} article
-
-#{@cX.fuschia}@format:#{@cX.off}
-
-#{@cX.fuschia}@identifier:#{@cX.off}
-
-#{@cX.fuschia}@source:#{@cX.off}
-
-#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings are not available for all of the languages listed.]
-
-#{@cX.fuschia}@language.original:#{@cX.off}
-original language in which the work was published
-
-#{@cX.fuschia}@papersize:#{@cX.off}
-(A4|US_letter|book_B5|book_A5|US_legal)
-
-#{@cX.fuschia}@relation:#{@cX.off}
-
-#{@cX.fuschia}@coverage:#{@cX.off}
-
-#{@cX.fuschia}@rights:#{@cX.off} copyright, all rights reserved, public domain, copyleft, creative commons variant, etc.
-
-#{@cX.cyan}@owner:#{@cX.off}
-
-#{@cX.cyan}@keywords:#{@cX.off} text document generation processing management latex pdf structured xml citation [your keywords here, used for example by rss feeds, and in sql searches]
-
-#{@cX.cyan}@abstract:#{@cX.off} [paper abstract, placed after table of contents]
-
-#{@cX.cyan}@comment:#{@cX.off} [...]
-
-#{@cX.cyan}@catalogue:#{@cX.off} #{@cX.green}loc=#{@cX.off}[Library of Congress classification]; #{@cX.green}dewey=#{@cX.off}[Dewey classification]; #{@cX.green}isbn=#{@cX.off}[ISBN]; #{@cX.green}pg=#{@cX.off}[Project Gutenberg text number]
-
-#{@cX.cyan}@classify_loc:#{@cX.off} [Library of Congress classification]
-
-#{@cX.cyan}@classify_dewey:#{@cX.off} [Dewey classification]
-
-#{@cX.cyan}@classify_isbn:#{@cX.off} [ISBN]
-
-#{@cX.cyan}@classify_pg:#{@cX.off} [Project Gutenberg text number]
-
-#{@cX.cyan}@prefix_a:#{@cX.off} [prefix is placed just before table of contents - not implemented]
-
-#{@cX.cyan}@prefix_b:#{@cX.off} or #{@cX.cyan}@prefix:#{@cX.off} [prefix is placed just after table of contents]
-
-#{@cX.cyan}@rcs:#{@cX.off} $Id$ [used by rcs or cvs to embed version (revision control) information into document, rcs or cvs can usefully provide a history of updates to a document ]
-
-#{@cX.ruby}@structure:#{@cX.off} PART; CHAPTER; SECTION; ARTICLE; none; none;
-optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers :A~ to :C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided (@structure: is a synonym for @toc:)
-
-#{@cX.ruby}@level:#{@cX.off} newpage=3; breakpage=4 [paragraph level, used by latex to breakpages, the page is optional eg. in newpage]
-
-#{@cX.ruby}@markup:#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
-
-#{@cX.ruby}@bold:#{@cX.off} [regular expression of words/phrases to be made bold]
-
-#{@cX.ruby}@italics:#{@cX.off} [regular expression of words/phrases to italize]
-
-#{@cX.ruby}@vocabulary:#{@cX.off} name of taxonomy/vocabulary/wordlist to use against document
-
-#{@cX.ruby}@skin:#{@cX.off} skin_doc_[name_of_desired_document_skin]
-
-#{@cX.ruby}@links:#{@cX.off} { SiSU }http://www.jus.uio.no/sisu/; { FSF }http://www.fsf.org
-
-#{@cX.ruby}@@promo:#{@cX.off} sisu, ruby, search_libre_docs, open_society [places content in right pane in html, makes use of list.yml and promo.yml, commented out sample in document sample: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst]
-
-#{@cX.grey}% header ends here, NB only @title: is mandatory [this would be a comment]#{@cX.off}
-#{@cX.grey}% NOTE: headings/levels below refer to 0.38 expermental markup
- (a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)#{@cX.off}
-
-#{@cX.blue}:A~#{@cX.off} Top level heading [this is usually the same as the title @title: ]
-
-#{@cX.blue}:B~#{@cX.off} Second level heading [this is a heading level divider]
-
-#{@cX.blue}:C~#{@cX.off} Third level heading [this is a heading level divider]
-
-#{@cX.blue}1~#{@cX.off} Top level heading preceding substantive text of document or sub-heading 5, the heading level that would normally be marked 1. or 2. or 3. etc. in a document
-
-#{@cX.blue}2~#{@cX.off} Second level heading preceding substantive text of document or sub-heading 6, the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc in a document
-
-#{@cX.blue}3~#{@cX.off} Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
-
-WOK
- help_markup
- end
- def headers37
- print <<WOK
-Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed.
-All header instructions take either the form #{@cX.green}@headername:#{@cX.off} or #{@cX.green}0~headername#{@cX.off}. All Dublin Core meta tags are available
-#{@cX.green}@indentifier:#{@cX.off} information or instructions
-or
-#{@cX.green}0~indentifier#{@cX.off} information or instructions
-where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, and the #{@cX.green}"information"#{@cX.off} or #{@cX.green}"instructions"#{@cX.off} belong to the tag/indentifier specified
- Note: a header where used should only be used once; all headers apart from 0~title are optional; the 0~toc header is used to describe document structure, and can be useful to know.
-This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.cyan}other information headers in cyan,#{@cX.off} #{@cX.ruby}markup instructions in red#{@cX.off}):
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}title#{@cX.off} My Title - This is now the Title of the Document and used as such
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}subtitle#{@cX.off} The Subtitle if any
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}creator#{@cX.off} [or ~author] Ralph Amissah
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}subject#{@cX.off} (whatever your subject)
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}description#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}publisher#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}contributor#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}translator#{@cX.off} [or ~translated_by]
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}illustrator#{@cX.off} [or ~illustrated_by]
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}prepared_by#{@cX.off} [or ~digitized_by]
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}date#{@cX.off} 2000-08-27
-\t[ also #{@cX.green}0~#{@cX.off}#{@cX.fuschia}date.created#{@cX.off} #{@cX.green}0~#{@cX.off}#{@cX.fuschia}date.issued#{@cX.off} #{@cX.green}0~#{@cX.off}#{@cX.fuschia}date.available#{@cX.off} #{@cX.green}0~#{@cX.off}#{@cX.fuschia}date.valid#{@cX.off} #{@cX.green}0~#{@cX.off}#{@cX.fuschia}date.modified#{@cX.off} ]
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}type#{@cX.off} article
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}format#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}identifier#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}source#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}language#{@cX.off} [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings are not available for all of the languages listed.]
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}relation#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}coverage#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.fuschia}rights#{@cX.off} copyright, all rights reserved, public domain, copyleft, creative commons variant, etc.
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}owner#{@cX.off}
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}keywords#{@cX.off} text document generation processing management latex pdf structured xml citation [your keywords here, used for example by rss feeds, and in sql searches]
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}abstract#{@cX.off} [paper abstract, placed after table of contents]
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}comment#{@cX.off} [...]
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}classify_loc#{@cX.off} Library of Congress classification
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}classify_dewey#{@cX.off} Dewey classification system
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}classify_isbn#{@cX.off} ISBN
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}classify_pg#{@cX.off} Project Gutenberg text number
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}prefix_a#{@cX.off} [prefix is placed just before table of contents - not implemented]
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}prefix_b#{@cX.off} or #{@cX.green}0~#{@cX.off}#{@cX.cyan}prefix#{@cX.off} [prefix is placed just after table of contents]
-
-#{@cX.green}0~#{@cX.off}#{@cX.cyan}rcs#{@cX.off} $Id$ [used by rcs or cvs to embed version (revision control) information into document, rcs or cvs can usefully provide a history of updates to a document ]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}toc#{@cX.off} PART; CHAPTER; SECTION; ARTICLE; none; none;
-optional, where document structure can be defined by a match words or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^)
-default markers 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}level#{@cX.off} newpage=3; breakpage=4 [paragraph level, used by latex to breakpages, the page is optional eg. in newpage]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}markup#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}bold#{@cX.off} [list of words to make bold with semi colon separator]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}italics#{@cX.off} [list of words to italize with semi colon separator]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}vocabulary#{@cX.off} name of taxonomy/vocabulary/wordlist to use against document
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}skin#{@cX.off} skin_doc_[name_of_desired_document_skin]
-
-#{@cX.green}0~#{@cX.off}#{@cX.ruby}links#{@cX.off} { Google }http://google.com;
-
-#{@cX.grey}% header ends here, NB only 0~title is mandatory [this would be a comment]#{@cX.off}
-
-#{@cX.blue}1~#{@cX.off} Top level heading [this is usually the same as the title 0~title ]
-
-#{@cX.blue}2~#{@cX.off} Second level heading [this is a heading level divider]
-
-#{@cX.blue}3~#{@cX.off} Third level heading [this is a heading level divider]
-
-#{@cX.blue}4~#{@cX.off} Top level heading preceding substantive text of document or sub-heading 5, the heading level that would normally be marked 1. or 2. or 3. etc. in a document
-
-#{@cX.blue}5~#{@cX.off} Second level heading preceding substantive text of document or sub-heading 6, the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc in a document
-
-#{@cX.blue}6~#{@cX.off} Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document
-
-WOK
- help_markup
- end
- def customise
- print <<WOK
- There are a number of files that control the appearance of a site or a document i.e.
-
- #{@cX.blue}(i)#{@cX.off} files that control #{@cX.green}site-wide appearance#{@cX.off}:
-
- #{@cX.green}defaults.rb#{@cX.off} initial values used by program, not necessary to change
-
- skins are placed in a configuration directory beneath the markup directory ./_sisu/skin/doc or in ~/.sisu/skin/doc
- if a skin is also to be used for a directory or site wide presentations, rather than being called for a single document then a softlink is placed from ~/.sisu/skin/dir or ~/.sisu/skin/site respectively to the relevant skin within ~/.sisu/skin/doc
-
- rules for skin loading are in #{@cX.green}sysenv.rb#{@cX.off}
- the skin loading heuristics / hierarchy is currently as follows:
-
- a. if there is a skin requested within a document, thent that skin is used
- 0~skin skin_lm (would load skin ~/.sisu/skin/doc/skin_lm.rb)
-
- b. use it if there is a "dir" skin with the same name as the source directory "stub" i.e.
- if working in a directory called /home/myhome/workdir/lm
- then if ~/.sisu/skin/dir/skin_lm.rb were found it would be used and skin_lm.rb would be a softlink to the relevant skin in the document skin directory (where all the actual skins are kept)
-
- x. [additionally though discouraged a special rule can be set up in sysenv AddSkin.select (which could override b if desired)]
-
- #{@cX.green}skin_site_#{@cX.off}#{@cX.cyan}[name of site skin in use]#{@cX.off}#{@cX.green}.rb#{@cX.off} this file is called by skin.rb
- if there are several such files, site appearance may be changed by
- requesting the skin_site desired from skin.rb
- and
-
- #{@cX.blue}(ii)#{@cX.off} presentation maintenance:
- if you have a body of documents the easiest way to give them a particular appearance/skin, is to associate that directory with a skin, all files in that directory take on the specified appearance, changing appearance of documents once directories are set up is as simple as copying the files from one directory to another (or renaming the directory); or associating the directory with a different skin.
-
- see also directories
-WOK
- end
- def configure
- print <<WOK
- see the following topics
- install
- setup
- and note for initial configuration it is necessary to run:
- sisu -C
- (this places the default CSS files and DTDs in place)
-WOK
- end
- def path
- help_env
- puts <<WOK
-
-If you have problems check permissions (and if in home directory ownership).
-
-#{@cX.green}directory paths as currently set#{@cX.off}:
- output docs: #{@cX.blue}#{@env.path.webserv}#{@cX.off}
- cgi scripts: #{@cX.blue}#{@env.path.cgi}#{@cX.off}
- processing: #{@cX.blue}#{@env.path.processing}#{@cX.off}
- sisu meta markup: #{@cX.blue}#{@env.path.dal}#{@cX.off}
- html tuning: #{@cX.blue}#{@env.path.tune}#{@cX.off}
- latex: #{@cX.blue}#{@env.path.tex}#{@cX.off}
- texinfo: #{@cX.blue}#{@env.path.texi}#{@cX.off}
- images:
- source: #{@cX.blue}#{@env.path.image_source}#{@cX.off}
- latex source: #{@cX.blue}#{@env.path.image_source_tex}#{@cX.off}
- note images are also sourced from within your pwd - #{@cX.blue}#{Dir.pwd}/_sisu/image#{@cX.off} if it exists
- #{@cX.grey}[ texinfo: #{@env.path.texinfo} - check duplication ]#{@cX.off}
-
- #{@cX.green}resource configuraton files#{@cX.off} to change the paths specified above, are searched for in the following order:
- under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/sisurc.yml#{@cX.off}
- under the home directory ~/.sisu: #{@cX.blue}#{@env.path.home}/.sisu/sisurc.yml#{@cX.off}
- in the "/etc" directory: #{@cX.blue}#{@env.path.etc}/sisurc.yml#{@cX.off}
- default file paths are set by the program SiSU
-
- #{@cX.green}skins#{@cX.off} for document appearances on a site, directory or per document basis are located in subdirectories #{@cX.blue}doc/#{@cX.off} #{@cX.blue}dir/#{@cX.off} and #{@cX.blue}site/#{@cX.off} within:
- #{@cX.blue}#{Dir.pwd}/_sisu/skin#{@cX.off}
- #{@cX.blue}#{@env.path.home}/.sisu/skin#{@cX.off}
- #{@cX.blue}#{@env.path.etc}/skin#{@cX.off}
- default appearances are set by the program SiSU in the absence of skins
-
- #{@cX.green}Note on subdirectories for output documents#{@cX.off}
- The last part of the name of the directory you choose to work from is used as the major sub-directory in which output files are placed,
- i.e. if you are working in a directory called #{@cX.blue}#{@env.path.home}/ebook#{@cX.off}
- the output files will be placed in a sub-directory named after the processed text within #{@cX.blue}#{@env.path.webserv}/ebook#{@cX.off}
- ( Within this major sub-directory, a sub-directory is made with the name of each document processed, into which output files - html, pdf, xml, plaintext etc. are placed (texinfo being an exception at present) )
-
- #{@cX.green}sisu -C#{@cX.off} [#{@cX.green}--init=site#{@cX.off}] 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. in a new markup document working directory should initialise the corresponding output directory, though SiSU will automatically do this, the first time it is run (for processing) in a given directory.
-
- There are additional details, ... this should get you started.
-
- See also
- sisu --help directory
-WOK
- help_env
- end
- def directories
- help_env
- print <<WOK
-
- the directory structure used by sisu is controlled by the configuration files #{@cX.blue}sisurc.yml#{@cX.off}
-
- there are separate directories for the following:
-
- (a) #{@cX.green}data directories#{@cX.off}
- the directories in which you place the SiSU marked-up data files that are to be processed
- there may be as many directories and files as you choose to have,
- you are currently in: #{@cX.blue}#{Dir.pwd}#{@cX.off}
-
- (b) #{@cX.green}output directory#{@cX.off}
- by default files in the data directory are output to
- a sub-directory within the output directory (usually the web document directory), or to an sql database
- of the same name as the stub or last portion of the data directory name
- by way of example
- you are currently in: #{@cX.blue}#{Dir.pwd}#{@cX.off}
- the document output directory is set to: #{@cX.blue}#{@env.path.webserv}#{@cX.off}
- documents from your current directory will be placed in: #{@cX.blue}#{@env.path.output}#{@cX.off}
-
- the final output is placed in subdirectories either as configured by default in the program or as modified by SiSU configuration files
- subdirectories are created within the main output directory, based on the name of the data directory
- subsubdirectories are created the sub-directory contained in the main output directory based on the name of the file
- (subdirectories are created in this (output) sub-directory named after the data file)
- for this reason it is a convention to give descriptive names to the data file.
- The default output directory is #{@cX.green}~/sisu_www#{@cX.off}
- The output directory is currently set to:
- #{@cX.blue}#{@env.path.webserv}#{@cX.off}
- Output files, are currently set to be produced in:
- processed document output: #{@cX.blue}#{@env.path.output}#{@cX.off}
- a document in the current directory #{@cX.blue}#{Dir.pwd}#{@cX.off}
- will have its output placed in: #{@cX.blue}#{@env.path.output}/#@output_stub#{@cX.off}
-
- NB: the verbose flag v included in the generate command string, should
- result in a list of output filenames together with their paths.
- The flag U on its own (e.g. sisu -U gpl3.fsf.sst) should provide a list
- of output files that could be generated together with their paths.
-
- (c) #{@cX.green}configuration files#{@cX.off}
- SiSU program defaults are set within the program, and may be adjusted in the yml file #{@cX.blue}sisurc.yml#{@cX.off} which is searched for in the following paths, which are prioritized as listed (the first one found is loaded):
-###
- under the current SiSU markup data directory: #{@cX.blue}#{@env.path.pwd}/_sisu/sisurc.yml#{@cX.off}
- under the home directory ~/.sisu: #{@cX.blue}#{@env.path.home}/.sisu/sisurc.yml#{@cX.off}
- in the "/etc" directory: #{@cX.blue}#{@env.path.etc}/sisurc.yml#{@cX.off}
-
- (d) #{@cX.green}processing directories#{@cX.off} sisu creates a number of processing directories,
- where these should be located can be modified in #{@cX.green}~/.sisu/sisurc.yml#{@cX.off}
- work directories include the following:
- root working directory #{@cX.blue}#{@env.path.processing}#{@cX.off}
- metaverse intermediate markup #{@cX.blue}#{@env.path.dal}#{@cX.off}
- tune html (for special html/navigation pages) #{@cX.blue}#{@env.path.tune}#{@cX.off}
- tex for latex and pdf #{@cX.blue}#{@env.path.tex}#{@cX.off}
- texinfo for texinfo and info files #{@cX.blue}#{@env.path.texi}#{@cX.off}
-
- These files are usually used only for processing and removed. There is a maintenance flag to keep them.
-
- (e) #{@cX.green}images#{@cX.off}
- there are a number of categories of images,
- NB the document markup directory is initialised by issuing the command
- sisu -C --init=site
- this creates the output sub-directory, and makes necessary image links, and
- copies images specific to the markup directory if there are any.
-
- general images for the sisu program that come with the package,
- that are the defaults used by sisu, these are installed with the program
-
- images that the author wishes to include within documents,
- these should be placed in a sub-directory
- within the current document markup directory called #{@cX.green}_sisu/image#{@cX.off}
-
- if an instruction is given to process a remote document which contains
- downloadable images, they are included in a sub-directory of the current
- markup directory #{@cX.green}_sisu/sisu/image_external#{@cX.off} that is created
- if necessary for the purpose.
-
- finally skins may specify/indicate other image directories. see sisu --help skin
- any site images required by the skin instruction must be copied in to the
- site image directory (it may be necessary to do manual configuration depending
- on what you are trying to achieve).
-
- (f) #{@cX.green}program directories#{@cX.off}
- sisu --help install
- sisu ~ install
-
- See also
- sisu --help path
-WOK
- help_env
- end
- def program_found?(program)
- if program
- rc=if SiSU_Env::Info_settings.new.program?(program)
- SiSU_Env::Info_settings.new.program?(program)
- else ''
- end
- if program =='rmagick'; program='identify' #rmagick is ruby lib uses imagemagick's identify
- end
- bin=if SiSU_Env::System_call.new.program_found?(program)
- SiSU_Env::System_call.new.program_found?(program)
- else 'false'
- end
- else bin,rc='false','false'
- end
- if program; "#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- else "bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- end
- end
- def sisu_version
- version=SiSU_Env::Info_version.instance.get_version
- rb_ver=SiSU_Env::Info_version.instance.rbversion
- if version[:version]
- tell=SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver)
- tell.version
- else puts 'SiSU version information not available'
- end
- end
- def rhost
- @ls=leading_spaces=' '*49
- @rhost=SiSU_Env::Info_remote_host.new.rhost
- def r1
- if @rhost.r1; @rhost.r1 + "\n"
- else ''
- end
- end
- def r2
- if @rhost.r2; @ls + @rhost.r2 + "\n"
- else ''
- end
- end
- def r3
- if @rhost.r3; @ls + @rhost.r3 + "\n"
- else ''
- end
- end
- def r4
- if @rhost.r4; @ls + @rhost.r4 + "\n"
- else ''
- end
- end
- def r5
- if @rhost.r5; @ls + @rhost.r5 + "\n"
- else ''
- end
- end
- def r6
- if @rhost.r6; @ls + @rhost.r6 + "\n"
- else ''
- end
- end
- def note
- msg='(remote settings user and host set in sisurc.yml under remote:)'
- if @rhost.r1; @ls + msg
- else msg
- end
- end
- self
- end
- def environment
- cf_defaults=SiSU_Env::Info_processing_flag.new
- sisu_version
- x =<<WOK
- #{@cX.green}current and output directories#{@cX.off}
- user: #{@cX.blue}#{@env.user}#{@cX.off}
- home: #{@cX.blue}#{@env.path.home}#{@cX.off}
- remote set [remote user]@[remote host]: #{@cX.blue}#{rhost.r1}#{rhost.r2}#{rhost.r3}#{rhost.r4}#{rhost.r5}#{rhost.r6}#{@cX.off}#{rhost.note}
- locale (encoding, UTF-8 desired): #{@cX.blue}#{@env.locale}#{@cX.off}
- current directory: #{@cX.blue}#{@env.path.pwd}#{@cX.off}
- document output root directory set to: #{@cX.blue}#{@env.path.webserv}#{@cX.off}
- documents from current directory placed in: #{@cX.blue}#{@env.path.output}#{@cX.off}
- webrick url: #{@cX.blue}#{@env.url.webserv_base_cgi}#{@cX.off}
- (to start webrick server 'sisu -W')
- sqlite db for present directory: #{@cX.blue}sqlite #{@env.path.output}/sisu_sqlite.db#{@cX.off}
- postgresql port set to: #{@cX.blue}#{@db.psql.port}#{@cX.off}
- postgresql db for present directory: #{@cX.blue}#{@db.psql.db}#{@cX.off}
- [first create manually if necessary: 'createdb #{@db.psql.db}']
-
- [generated sqlite cgi search form]: #{@cX.blue}#{@env.url.webserv_base_cgi}/cgi-bin/sisu_sqlite.cgi#{@cX.off}
- [generated postgresql cgi search form]: #{@cX.blue}#{@env.url.webserv_base_cgi}/cgi-bin/sisu_pgsql.cgi#{@cX.off}
- (to generate 'sisu -F' or 'sisu -F webrick')
- #{@cX.green}configuration files#{@cX.off}
- sisurc.yml used: #{@cX.blue}#{@env.path.yamlrc}#{@cX.off}
- configuration information search path: #{@cX.blue}#{@env.path.rc.join(', ')}#{@cX.off}
- (directory also relevant for skins and images)
- digest (md5 or sha256): #{@cX.blue}#{@env.digest.type}#{@cX.off}
- papersize set (LaTeX/pdf): #{@cX.blue}#{@env.papersize}#{@cX.off}
- (digest and papersize can be changed in sisurc.yml under default:)
- #{@cX.green}intermediate processing#{@cX.off}
- processing directory: #{@cX.blue}#{@env.path.processing}#{@cX.off}
- (to keep processing output, use -M flag)
- #{@cX.green}programs selected for viewing output#{@cX.off}
- text editor: #{@cX.blue}#{@env.program.text_editor}#{@cX.off}
- web browser: #{@cX.blue}#{@env.program.web_browser}#{@cX.off}
- console web browser: #{@cX.blue}#{@env.program.console_web_browser}#{@cX.off}
- pdf viewer: #{@cX.blue}#{@env.program.pdf_viewer}#{@cX.off}
- xml viewer: #{@cX.blue}#{@env.program.xml_editor}#{@cX.off}
- odf viewer: #{@cX.blue}#{@env.program.odf_viewer}#{@cX.off}
- (default selections can be changed in sisurc.yml under program_select:)
- #{@cX.green}programs used if available#{@cX.off}
- word count: #{program_found?(@env.program.wc)}
- imagemagick/rmagick: #{program_found?(@env.program.rmagick)}
- tidy: #{program_found?(@env.program.tidy)}
- rexml: #{program_found?(@env.program.rexml)}
- latex to pdf: #{program_found?(@env.program.pdflatex)}
- postgresql: #{program_found?(@env.program.postgresql)}
- sqlite: #{program_found?(@env.program.sqlite)}
- (these can be turned off if unavailable in sisurc.yml under program_set:)
- #{@cX.green}processing shortcut defaults set to:#{@cX.off}
- color defaut set (on==true) #{@cX.blue}#{cf_defaults.color}#{@cX.off}
- sisu -0 #{@cX.blue}#{cf_defaults.cf_0}#{@cX.off} [default]
- sisu -1 #{@cX.blue}#{cf_defaults.cf_1}#{@cX.off}
- sisu -2 #{@cX.blue}#{cf_defaults.cf_2}#{@cX.off}
- sisu -3 #{@cX.blue}#{cf_defaults.cf_3}#{@cX.off}
- sisu -4 #{@cX.blue}#{cf_defaults.cf_4}#{@cX.off}
- sisu -5 #{@cX.blue}#{cf_defaults.cf_5}#{@cX.off}
- (defaults may be changed in active sisurc.yml file under flag:)
- #{@cX.green}special powers, risky operations set:#{@cX.off}
- zap (delete output directories) #{@cX.blue}#{SiSU_Env::Info_settings.new.permission?('zap')}#{@cX.off}
- css copy (copy over css files) #{@cX.blue}#{SiSU_Env::Info_settings.new.permission?('css_modify')}#{@cX.off}
- (true/false defaults may be changed in active sisurc.yml file under permissions_set:)
-
-NOTE: for HELP type 'sisu --help', 'sisu --help [help request]', 'man sisu', (or see the system or online documentation)
-WOK
-print x
- end
- def dublin_core
- print <<WOK
-@title:
-
-@subtitle: [is added to title for purposes of Dublin Core description]
-
-@creator:
-
-@type:
-
-@subject:
-
-@date: [ccyy-mm-dd]
-
-@date.created:
-
-@date.issued:
-
-@date.available:
-
-@date.valid:
-
-@date.modified:
-
-@source:
-
-@language: en
-
-@papersize: A4
-
-@relation:
-
-@coverage:
-
-@rights:
-
-WOK
- end
- def headings
- print <<WOK
-These are not required, a header is quicker to prepare if a documents structure can be defined by matching words or a regular expression, see headers).
-
-@structure: PART; CHAPTER; SECTION; ARTICLE; none; none;
-
-structure can be defined by a match words or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^)
-
-The following heading or level (structuring) defaults are available (for use instead of or together with @structure: header):
-
- 1~ 2~ 3~ 4~ 5~ 6~
-
-or, [0.38]
-
- :A~ :B~ :C~ 1~ 2~ 3~
-
-Heading tags take either of the forms above, ranging from 1-6
-
-They appear at the beginning of the line on which a heading appears,
-the number indicates the level of the heading with level 1 being a title,
-
-segments (in html output) are by default created on level 4
-(segmented text is split/segmented on level 4, and
-assigned a file name automatically according to the title number,
-unless you explicitly specify otherwise)
-
-eg.
-
-% SiSU 0.16 - 0.37
-
-1~ Document Title
-
-2~ Document Subtitle whatever it is
-
-3~ Part
-
-4~ Chapter
-
-5~ Heading
-
-6~ sub-heading
-
-in the 0.38 notation this maps to:
-
-% SiSU 0.38
-
-:A~ Document Title
-
-:B~ Document Subtitle whatever it is
-
-:C~ Part
-
-1~ Chapter
-
-2~ Heading
-
-3~ sub-heading
-
-(a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)
-
-Normal text would follow each heading level as appropriate, though it is most usual to start with ordinary writing beneath level 4 as it is at this level that segments are created.
-
-Automatic numbering of paragraphs is usually set to start at level 4 trough level 6 and takes the form 1. then 1.1 then 1.1.1 this being given as a Header tag 0~ There may be up to 6 levels in a document,
-
-If auto-numbering is on, then for html output the segments created (on level 4 headings) are automatically assigned the name of the title number.
-However, you may indicate an alternative set of key/title words, with one of the following instructions:
-4~filename This is a Section or Subject Heading
-
-If there is a strictly discernable word appearing at the beginning of the line in a document that identifies the level,
-the words can be used to identify the levels in a header tag:
-0~toc Part; Chapter; Section; Article; none; none
-instead of providing individual heading tags
-
-sisu structure, (0.38) alternative notation, A,B,C,1,2,3 mapping to 1,2,3,4,5,6
-
- SiSU has in effect two sets of levels to be considered
-
- 1-3 headings/levels, (A-C [0.38]) pre-ordinary paragraphs /pre-substantive text, and
-
- 4-6 headings/levels, (1-3 [0.38]) 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 follow in the sequence
-
- 1 must exist, optional 2 and 3 follow in the sequence
-
- i.e. there are two independent heading level sequences A,B,C and 1,2,3 or using the standard notation 1,2,3 and 4,5,6
-
-on the positive side: (a) the A,B,C,1,2,3 alternative makes explicit an aspect of structuring documents in SiSU that is not otherwise obvious to the newcomer (though it appears more complicated, is more in your face and likely to be understood fairly quickly); (b) the substantive text follows levels 1,2,3 and it is 'nice' to do most work in those levels
-
-
-WOK
- end
- def languages
- puts <<WOK
-
- Multi-language Document File Naming and Directory Mapping
-
- If the same document exists in different language versions, and it is desired that the published language versions should reside in the same output directory, the following filenaming convention should be observed, using Spannish as the sample language code (es) [it is very likley the use of country codes as language codes will be changed or extended in future] [filename]~[language code].sst
-
- filename~es.sst
-
- within sisurc.yml under the heading
- default:
- language file: [at 1, 2 or 3]
-
- determines the output filenaming convention used, as follows:
-
- (1) [output directory path]/filename/es.index.html
-
- (2) [output directory path]/filename/index.es.html
-
- (3) [output directory path]/filename/index.html.es (which Apache for example can be configured to use to automatically serve each users preference)
-
- filename~fr.sst
- filename~de.sst
-
- etc. would be placed in the same directory using the same convention as indeed would:
- filename.sst
- using the default convention mapping convention.
-
- Selecting this form of filename will overide other language settings including the language header within a document.
-
-WOK
- end
- def endnotes
- print <<WOK
-
-(1) Footnote/endnotes tags take a number of possible forms, the simplest being to embed an endnote within your text~{ this would appear as an endnote, and would have an automatically assigned number }~ Embedded endnotes~{this is an endnote}~ and at the end of the paragraph~{* an asterisk marked note }~ writing the endnote:~{another endnote}~
-
- ------------------------------------------
-#{@cX.ruby}All you need to know about endnotes appears above this line...#{@cX.off} apart from the fact that you cannot mix endnote markup styles
-
-(2) The other ways of inserting an endnote involve placing a tag within the text as to where the endnote reference number should appear like so~^ and at the end of the paragraph writing the endnote:~^
-
-^~ like so, this is an endnote
-
-^~ another endnote
-
-WOK
- end
- def tables
- print <<WOK
-
-#{@cX.green}table{ [number of columns] [column width %];[column width %]#{@cX.off}
-
-[table content, line breaks are important see example below]
-
-#{@cX.green}}table#{@cX.off}
-#{@cX.grey}----#{@cX.off}
-This is a sample table:
------------------------
-
-#{@cX.green}table{ c3; 40; 30; 30;#{@cX.off}
-
-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
-
-#{@cX.green}}table#{@cX.off}
-
-there is an alternative way to markup tables, a sample document is provided in the file
-#{@cX.green}sisu_output_overview.sst#{@cX.off} located in
-#{@cX.green}/usr/share/doc/sisu#{@cX.off} or equivalent directory
-
-preformatted text
------------------
-
-#{@cX.green}poem{#{@cX.off}
-
- [Text here]
-
-#{@cX.green}}poem#{@cX.off}
-#{@cX.grey}----#{@cX.off}
-
-#{@cX.green}group{#{@cX.off}
-
- [Text here]
-
-#{@cX.green}}group#{@cX.off}
-#{@cX.grey}----#{@cX.off}
-
-#{@cX.green}code{#{@cX.off}
-
- [Text here]
-
-#{@cX.green}}code#{@cX.off}
-
-WOK
- end
- def modules
- print <<WOK
-
- #{@cX.ruby}IGNORE#{@cX.off}
-
-WOK
- end
- def modules_old
- print <<WOK
-
- #{@cX.ruby}DATED NOT CURRENT - IGNORE#{@cX.off}
-
- This file is to contain some information the different programs that form sisu:
-
- their inter-relationship (for which see sisu-chart.pdf)
-
- and
-
- what they do
-
- sisu\ttui/command line program that when run with flags against files produces requested output
-
- ~/.sisu\tconfiguration directory, contains sisu configuration, and skins for alternative appearances
- param\tgathers parameters from the sourcefile, when called by metaverse parameters are saved to pstore file
- sysenv\tgets system information, and builds directory structure
-
- init\tintialised defaults for appearance
- skin\tsite wide skin
- format\tformatting instructions assosciated with and used by calling module
-
- metaverse\tinitial processing stage, preliminary file on which subsequent processing is done is created [-m]
-
- plaintext\tplaintext creating module [-a]
- html\thtml creating modules [-h]
- texpdf\tlatex and pdf creating modules [-p]
- xml & xml_dom\txml creating modules [-x -X]
- concordance\tword map creating module [-w]
-
- termsheet\tcreation of documents from termsheet and standard forms [-t]
-
- dbi\tdbi database build and populating module, default postgresql [-D]
- dbi_sqlite\tdbi database build and populating module, for sqlite [-d]
-
- #{@cX.ruby}DATED NOT CURRENT - IGNORE#{@cX.off}
-
-WOK
- end
- def install
- #% system configuration
- print <<WOK
- #{@cX.green}Install SiSU#{@cX.off}
-
- Presumably if you are reading this interactively you have a copy of SiSU already installed, nevertheless here are a few notes.
-
- SiSU does require setup, the executable file #{@cX.blue}sisu#{@cX.off} is placed in #{@cX.blue}#{Config::CONFIG['bindir']}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}#{@cX.off} and the library files, in #{@cX.blue}#{Config::CONFIG['rubylibdir']}/#{SiSU_lib}#{@cX.off}
- or in #{@cX.blue}#{Config::CONFIG['sitelibdir']}/#{SiSU_lib}#{@cX.off}
-
- SiSU comes with a number of installers, including #{@cX.blue}setup.rb#{@cX.off}, #{@cX.blue}install#{@cX.off} and a #{@cX.blue}Rantfile#{@cX.off} if rant is installed on your system, you may need to be root to install sisu on your system. After unpacking the tarball, in the top directory of the tarball which contains the named files type, one of:
- sudo ./sisu-install base
- sudo ./sisu-install setup
- if that does not work try
- sudo ruby ./sisu-install setup
- if rant is installed on your system you may instead run:
- sudo rant base
-
- for further options:
- ./sisu-install -T
-
- SiSU is pre-packaged for some GNU/Linux distributions such as Debian.
-
- For information on download and installation, see #{@cX.blue}http://www.jus.uio.no/sisu/SiSU/download#{@cX.off}
-
- For post installation help it is best you refer to '#{@cX.blue}man 8 sisu#{@cX.off}'
-
- Host
- host: #{@cX.blue}#{@env.hostname}#{@cX.off}
- arch: #{@cX.blue}#{@env.arch}#{@cX.off}
-
- Directories for installation
- bin: #{@cX.blue}#{Config::CONFIG['bindir']}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}#{@cX.off}
- lib (site-ruby): #{@cX.blue}#{Config::CONFIG['rubylibdir']}/#{SiSU_lib}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}/#{SiSU_lib}#{@cX.off}
- conf [etc]: #{@cX.blue}#{@env.path.etc}/sisu#{@cX.off}
- data (document samples, images, README): #{@cX.blue}#{@env.path.sample_data}#{@cX.off}
- processing: #{@cX.blue}#{@env.path.processing}#{@cX.off}
- output www: #{@cX.blue}#{@env.path.output}#{@cX.off}
-
- Output files, are currently set to be produced in:
- processed document output: #{@cX.blue}#{@env.path.output}#{@cX.off}
- a document in the current directory #{@cX.blue}#{Dir.pwd}#{@cX.off}
- will have its output placed in: #{@cX.blue}#{@env.path.output}/#@output_stub#{@cX.off}
-
- Install any additional programs of interest (that SiSU makes use of, that are not already on your system)
-
- Programs SiSU makes use of include:
- LaTeX
- texinfo
- pdfetex aka. pdflatex
- sqlite
- postgresql
-
- Again, refer to '#{@cX.blue}man 8 sisu#{@cX.off}'
-
- For additional help on using SiSU once installed type:
-
- sisu --help
-
-WOK
- end
- def setup
- print <<WOK
-
- #{@cX.green}configuration files#{@cX.off}
- sisurc.yml used:
- #{@cX.blue}#{@env.path.yamlrc}#{@cX.off}
- configuration information search path:
- #{@cX.blue}#{@env.path.rc.join(', ')}#{@cX.off}
- (directory also relevant for skins and images)
-
- to initialise the mapped output directory, from within the markup document directory type:
- #{@cX.blue}sisu -CC#{@cX.off}
-
- for information on your current sisu configuration settings, type:
- #{@cX.blue}sisu --help env#{@cX.off}
- or
- #{@cX.blue}sisu -V#{@cX.off}
-
- see also
- #{@cX.blue}man 8 sisu#{@cX.off}
- and
- #{@cX.blue}http://www.jus.uio.no/sisu/SiSU#{@cX.off}
-WOK
- end
- def termsheet
- print <<WOK
-
- #{@cX.green}sisu -t [termsheetname].termsheet.rb#{@cX.off}
- will produce the collection of documents associated with [termsheetname.termsheet.rb]
-
- #{@cX.green}termsheet.rb#{@cX.off} files:
- (i) are named after the facility
- (ii) contain instructions as to which standard forms to use for the agreement (standard_form.rb)
- there may be several, eg. the termsheet, and the resulting:
- main agreement; collection account charge; and deed of assignment
- (iii) contain the variable terms of the agreement, borrower, interest etc.
-
- for a new loan agreement fill out a new termsheet specifying
- what standard forms are to be used,
- and the terms of the agreement.
-
- #{@cX.green}standard_form.rb#{@cX.off} files:
- contain the standard terms of the agreement
- there is a standard form for each variation of agreement
- (so eg. there are as many facility agreements as there are variations in standard facility)
- these may be prepared for any agreement that is to be reused.
- (preparation takes the form of formating and
- placing variable holders for the variables that are to be provided by the termsheet.rb file)
-
- it is necessary to purge the directory ~facilityData when old files are removed
-
-WOK
- end
- def help_commands
- print <<WOK
-
- also see:
- sisu --help commands
- man sisu
-WOK
- end
- def help_env
- print <<WOK
-
- for sisu environment information see:
- sisu --help env
-WOK
- end
- def help_general
- help_env
- help_commands
- end
- def help_markup
- print <<WOK
-
- for help with sisu markup see:
- sisu --help markup
- sisu --help header
- sisu --help structure [sisu --help heading]
-
- to check markup version in 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
-
- for markup:
- sisu --help example38
-
- sample marked up documents are provided in directory:
- #{@cX.green}sisu-examples/sample/document_samples_sisu_markup/#{@cX.off}
- and online
- #{@cX.green}www.jus.uio.no/sisu#{@cX.off}
-WOK
- end
- def convert
- print <<WOK
-
- for information on the markup version used within a sisu markup file:
- sisu --inspect [filename]
-
- to convert between sst markup versions 0.37 and 0.38:
- sisu --to-current
- sisu --to-38 [filename/wildcard]
- sisu --to-37 [filename/wildcard]
-
- convert an sst file with footnotes following text to (preferred) inline footnotes
- sisu --convert-footnotes [filename/wildcard]
-
- to convert from sst to simple xml representations (sax, dom and node):
- sisu --to-sax [filename/wildcard]
- sisu --to-sxs [filename/wildcard]
-
- sisu --to-dom [filename/wildcard]
- sisu --to-sxd [filename/wildcard]
-
- sisu --to-node [filename/wildcard]
- sisu --to-sxn [filename/wildcard]
-
- to convert to sst from simple xml representations (sax, dom and node):
- sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
- sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]
-
- to attempt to convert a kdissert (.kdi) file to sisu markup:
- sisu --from-kdi [kdissert filename]
- (very basic and experimental)
-WOK
- end
- def dal
- print <<WOK
-
- sisu -m [filename/wildcard] creates the metaverse, used by all other modules for downstream processing
-WOK
- help_commands
- end
- def utf8
- print <<WOK
-
- documents prepared for sisu processing should be stored in utf8
-WOK
- end
- def plaintext
- print <<WOK
-
- sisu -A [filename/wildcard] plaintext with dos linefeeds (footnotes follow paragraphs)
- sisu -a [filename/wildcard] plaintext with Unix linefeeds (footnotes follow paragraphs)
-
- sisu -E [filename/wildcard] plaintext with dos linefeeds (endnotes follow document)
- sisu -e [filename/wildcard] plaintext with Unix linefeeds (endnotes follow document)
-
- sisu -ho [filename/wildcard] exclude ocn, object numbers
-WOK
- help_commands
- end
- def html
- print <<WOK
-
- sisu -h [filename/wildcard] html document type suffixes included
- sisu -H [filename/wildcard] html without document type suffixes
-
- sisu -ho [filename/wildcard] exclude ocn, object numbers
-WOK
- help_commands
- end
- def xhtml
- print <<WOK
-
- sisu -b [filename/wildcard] xhtml document
-WOK
- help_commands
- end
- def xml
- print <<WOK
-
- sisu -x [filename/wildcard] xml document (sax type parsing)
- sisu -X [filename/wildcard] xml document (dom type parsing)
-
- sisu -o [filename/wildcard] odt document, (odf open document format)
-WOK
- help_commands
- end
- def odf
- print <<WOK
-
- sisu -o [filename/wildcard] odt document, (odf open document format)
-WOK
- help_commands
- end
- def php
- print <<WOK
-
- not supported
- [php output has been removed]
-WOK
- help_commands
- end
- def pdf
- print <<WOK
-
- sisu -p [filename/wildcard] produces pdf files from LaTeX output
-WOK
- help_commands
- end
- def latex
- print <<WOK
-
- sisu -p [filename/wildcard] produces pdf files from LaTeX output
-WOK
- help_commands
- end
- def texinfo
- print <<WOK
-
- sisu -I [filename] produces texinfo and info files
-
- info and texinfo files are currently left in a separate work/output directory... have not decided what to do with them
-
- on my system info works fine point at file with info command
-
- pinfo, requires you to be within the work/output directory
- cd [work/output directory]
-
- and then to point at the file using
- pinfo ./[filename]
-WOK
- help_commands
- end
- def lout
- print <<WOK
-
- sisu -l [filename/wildcard]
-
- not currently supported, revisit someday?
-WOK
- help_commands
- end
- def concordance
- print <<WOK
-
- sisu -W starts the sisu webrick server, default port 8081
-WOK
- help_commands
- end
- def help_search
- print <<WOK
-
- SiSU searches,
- depending on how you wish to implement search,
- the following may bre of interest:
- sisu --help sql
- sisu --help searchform (or 'sisu --help cgi')
- sisu --help hyperestraier (or 'sisu --help est')
- sisu --help webrick
-WOK
- end
- def cgi
- print <<WOK
-
- sisu -F generates a sample search form
-
- sisu -F --webserv=webrick generates a sample search form for use with the webrick server
- sisu -Fv as above, and provides some information on setting up hyperestraier
- sisu -W starts the webrick server
-
- the generated search form must be copied to the webserver directory as instructed
-WOK
- help_search
- help_general
- end
- def sql
- print <<WOK
-
- 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
- the examples here will used -d (lowercase)
- alternatively --sqlite or --pgsql may be used
-
- 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)!!
- sisu -d --recreate destroys existing database and builds a new empty database structure
-
- sisu -d --import [filename/wildcard] populates database with the contents of the file
- sisu -d --update [filename/wildcard] updates file contents in database
-
- sisu -F --webserv=webrick builds a cgi web search frontend for the database created
-
- Postgresql
- user: #{@cX.blue}#{@db.user}#{@cX.off}
- current db set: #{@cX.blue}#{@db.psql.db}#{@cX.off}
- port: #{@cX.blue}#{@db.psql.port}#{@cX.off}
- dbi connect: #{@cX.blue}#{@db.psql.dbi}#{@cX.off}
-
- sqlite
- current db set: #{@cX.blue}#{@db.sqlite.db}#{@cX.off}
- dbi connect #{@cX.blue}#{@db.sqlite.dbi} #{@cX.off}
-
- 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 #{@cX.blue}#{@env.path.home}/ebook#{@cX.off} the database #{@cX.blue}SiSU_ebook#{@cX.off} is used. [otherwise a manual mapping for the collection is necessary]
-WOK
- help_search
- help_general
- end
- def webrick
- print <<WOK
-
- sisu -W starts the sisu webrick server, default port 8081
-WOK
- help_commands
- end
- def hyperestraier
- out_dir='(' + `ls #{@env.path.webserv}`.split("\n").join('|') + ')'
- print <<WOK
- See the documentation for hyperestraier
- #{@cX.blue}
- http://hyperestraier.sourceforge.net/
-
- file:///usr/share/doc/hyperestraier/index.html
- #{@cX.off} #{@cX.orange}
- man estcmd
- #{@cX.off}
-
- on sisu_hyperestraier:
-
- #{@cX.blue}
- man sisu_hyperestraier
-
- #{@cX.off}
-
- 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:
- #{@cX.orange}estcmd gather -sd [index name] [directory path to index]#{@cX.off}
- the following are examples that will need to be tailored according to your needs:
- #{@cX.green}
- cd #{@env.path.webserv}
- estcmd gather -sd casket #{@env.path.webserv}
- #{@cX.off}
- you may use the 'find' command together with 'egrep' to limit
- indexing to particular document collection directories within
- the web server directory:#{@cX.green}
-
- find /home/ralph/sisu_www -type f | egrep '#{@env.path.output}/.+?\.html$' |estcmd gather -sd casket - #{@cX.off}
-
- check which directories in the webserver/output directory #{@cX.green}#{@env.path.webserv}#{@cX.off}
- you wish to include in the search index, these appear to be:
-
- #{@env.path.webserv}/#{@cX.green}#{out_dir}#{@cX.off}
-
- 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 'doc.html' and 'concordance.html', as these
- duplicate information held in other html output e.g. #{@cX.green}
-
- find /home/ralph/sisu_www -type f | egrep '/sisu_www/(sisu|bookmarks)/.+?\.html$' | egrep -v '(doc|concordance)\.html$' |estcmd gather -sd casket - #{@cX.off}
-
- from your current document preparation/markup directory, you would construct a rune along the following lines: #{@cX.green}
-
- find /home/ralph/sisu_www -type f | egrep '#{@env.path.webserv}/([specify first directory for inclusion]|[specify second directory for inclusion]|[another directory for inclusion? ...])/.+?\.html$' | egrep -v '(doc|concordance)\.html$' |estcmd gather -sd #{@env.path.webserv}/casket - #{@cX.off}
-
- (B) to set up the search form
- (i) copy #{@cX.green}estseek.cgi#{@cX.off} to your cgi directory and set file permissions to 755: #{@cX.green}
-
- 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 #{@cX.off}
- [see estraier documentation for paths]
-
- (ii) edit #{@cX.green}estseek.conf#{@cX.off}, with attention to the lines starting 'indexname:' and 'replace:': #{@cX.green}
-
- indexname: #{@env.path.webserv}/casket
- replace: ^file://#{@env.path.webserv}{{!}}#{@env.url.webserv_host_base}
- replace: /index\.html?${{!}}/ #{@cX.off}
-
- (C) to test using webrick, start webrick: #{@cX.green}
- sisu -W #{@cX.off}
-
- and try open the url: #{@cX.blue}
- #{@env.url.webserv_host_base}/cgi-bin/estseek.cgi #{@cX.off}
-
-WOK
- end
- def yaml
- print <<WOK
- Yaml sisurc files may be used to configure sisu, these are searched for in the following locations:
-
- under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/sisurc.yml#{@cX.off}
- under the home directory ~/.sisu: #{@cX.blue}#{@env.path.home}/.sisu/sisurc.yml#{@cX.off}
- in the "/etc" directory: #{@cX.blue}#{@env.path.etc}/sisurc.yml#{@cX.off}
-
- The Yaml files #{@cX.blue}promo.yml#{@cX.off} and #{@cX.blue}list.yml#{@cX.off} may be used to build a minor right pane in html, they may be placed in the following locations:
-
- under the current SiSU markup data directory: #{@cX.blue}#{Dir.pwd}/_sisu/skin/yml/#{@cX.off}
- under the home directory ~/.sisu: #{@cX.blue}#{@env.path.home}/.sisu/skin/yml/#{@cX.off}
- in the "/etc" directory: #{@cX.blue}#{@env.path.etc}/skin/yml/#{@cX.off}
-
- these may be called by the sisurc.yml, skins for document, directory or site, or from individual document headers in the header @@promo: [a commented out example header may be found in document sample: free_as_in_freedom.richard_stallman_cru‐ sade_for_free_software.sam_williams.sst, it calls for the specified lists in list.yml, which in turn calls the widgets named in promo.yml which are used to build content in the right pane of html output]
-
-WOK
- end
- def sitemap
- print <<WOK
-
- SiSU sitemaps,
- an experimental feature (following g,y,m announcement to use them this week)
- sisu -Y [filename/wildcard]
- it may be necessary run -m first (generate the the metaverse)
- sisu -mY [filename/wildcard]
-
- to generate/update the index of sitemaps
- sisu --sitemaps
-WOK
- end
- def license
-
- print <<WOK
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008 Ralph Amissah
-
- 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 <#{@cX.blue}http://www.gnu.org/licenses/#{@cX.off}>.
-
- 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 <<WOK
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-© Ralph Amissah 1997, current 2005.
-All Rights Reserved.
-
-Information on these may be obtained from:
- http://www.jus.uio.no/sisu
-
-More information to be provided later.
-
-* however note also the License section
-
-* Ralph Amissah ralph@amissah.com
- Ralph Amissah ralph.amissah@gmail.com
-
-WOK
- end
- def conversion
- print <<WOK
-sisu_convert does the initial conversion from a couple of file formats to SiSU file format, currently only html and word97
- #{@cX.cyan}sisu_convert#{@cX.off} [keyword]
- sisu [keyword]
- #{@cX.green}--html#{@cX.off} convert from html
- #{@cX.green}--pace#{@cX.off} convert from html does some initial headers...
- ------------------------------------------
- Preparing Documents for SiSU
- #{@cX.green}--word97#{@cX.off} sisu --help markup (an incomplete overview)
-WOK
- end
- def external_programs
- puts <<WOK
-
- external ruby programs
-
- external programs
- #{@cX.cyan}pdf output - tex/latex#{@cX.off}
- #{@cX.orange}required#{@cX.off}
- tex-base/latex
- pdfetex aka. pdflatex
- #{@cX.brown}suggested/recommended#{@cX.off}
- #{@cX.cyan}db/sql output#{@cX.off}
- #{@cX.orange}required#{@cX.off}
- postgresql
- #{@cX.brown}suggested/recommended#{@cX.off}
- sqlite
- #{@cX.cyan}xml/xhtml/html output#{@cX.off}
- #{@cX.orange}required#{@cX.off}
- #{@cX.brown}suggested/recommended#{@cX.off}
- tidy (xml, xhtml well formed check)
- trang (relaxng, rnc to dtd conversion)
-WOK
- end
- def scratch
- print <<WOK
-Types of tag,
-
-then there are various tags which occur within the document.
-Structural tags, which consist of:
- heading tags that identify headings within text, and;
- footnote/endnote tags ...
-
-Markup instructions: giving information as to what is to be done to the presentation of the text
-
-Markup tags
-
-These have been kept to a minimum. A number of text html markup tags can be used <b>to bold</b> <i>to indent</i> <sup>for superscript</sup> <sub>for subscript text</sub>
-
-_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/v1/html.rb b/lib/sisu/v1/html.rb
deleted file mode 100644
index 04676f51..00000000
--- a/lib/sisu/v1/html.rb
+++ /dev/null
@@ -1,703 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html generation, processing
-
-=end
-module SiSU_HTML
- require 'pstore'
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/html_table"
- require "#{SiSU_lib}/html_format"
- include SiSU_HTML_Format
- require "#{SiSU_lib}/html_segments"
- require "#{SiSU_lib}/html_scroll"
- include SiSU_HTML_seg
- require "#{SiSU_lib}/html_promo"
- include SiSU_HTML_promo
- require "#{SiSU_lib}/html_tune"
- include SiSU_HTML_Tune
- require "#{SiSU_lib}/shared_xml"
- require "#{SiSU_lib}/shared_structure"
- 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
- 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 ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#@fnb/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/
- SiSU_Env::Info_skin.new(@md).select
- data=nil
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary
- SiSU_Env::SiSU_file.new(@md).mkdir
- @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions
- data=@tuned_file_array
- scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll
- toc=SiSU_HTML::Source::Toc.new(data,@md).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(data,@md).songsheet
- data=@tuned_file_array
- scr=SiSU_HTML::Source::Scroll.new(data,@md).songsheet
- scroll=SiSU_HTML::Source::Scroll_output.new(scr_toc,scr[:body],scr_endnotes,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::Create_file.new(@opt.cmd,@opt.fns).param_instantiate
- @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
- @@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
- @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
- @@filename_seg,@@seg_url,@@fn,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','','','',''
- @@is4=@@is3=@@is2=@@is1=@@header1=@@header2=@@header3=@@header4=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 suffix_linkname #not used at present
- sfx=if @md.cmd =~/h/; '.html'
- else ''
- end
- end
- def link_images
- @symlnk.images
- end
- def directories
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @path={ :root=>my_make.html_root }
- title=File.basename(@md.fns,'.rb')
- SiSU_Env::SiSU_file.new(@md).mkdir
- end
- def tuned_file_instructions
- @tell=SiSU_Screen::Ansi.new(@md.cmd)
- @md.cmd=@md.cmd.gsub(/H/,'h')
- @md.file_type='html' if @md.cmd =~/[hon]/
- directories
- newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/
- dal_array=@particulars.dal_array # dal file drawn here
- @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet
- @tuned_file_array
- end
- end
- class Split_text_object <SiSU_Structure::Split_text_object
- end
- class Links_guide
- @links_guide_toc=[]
- def initialize(data,md)
- @data,@md=data,md
- end
- def toc
- @links_guide_toc=[]
- 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_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- @links_guide_toc << lev_para_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
- 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)
- @scr_endnotes << format_head_scroll.title_endnote
- @data.each do |para|
- pg=para.dup
- unless pg =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- if pg =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \
- and not pg =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- endnote_array=[] #(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})
- if pg=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m
- endnote_array << pg.scan(/#{Mx[:en_a_o]}[\d*+]+(.+?)#{Mx[:en_a_c]}/m)
- end
- if pg=~/#{Mx[:en_b_o]}[\d*]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d*]+(.+?)#{Mx[:en_b_c]}/m)
- end
- if pg=~/#{Mx[:en_b_o]}[\d+]+\s.+?#{Mx[:en_b_c]}/m
- endnote_array << pg.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 <Links_guide
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }
- @@seg_url=''
- @@dp,@@firstseg=nil,nil
- def initialize(data='',md=nil)
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @pat_heading=/^(?:#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*)?(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/
- @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 unless @md.cmd =~/q/
- toc=nil
- @@firstseg=nil
- @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }
- @data.each do |para|
- if para =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/
- para_toc=para.dup
- para_toc.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>\s*(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc
- toc=case para_toc
- when /^\s*#{Mx[:lv_o]}1:\S*/; Toc.new(para_toc,@md).level_1
- when /^\s*#{Mx[:lv_o]}2:\S*/; Toc.new(para_toc,@md).level_2
- when /^\s*#{Mx[:lv_o]}3:\S*/; Toc.new(para_toc,@md).level_3
- when /^\s*#{Mx[:lv_o]}4:\S+/; Toc.new(para_toc,@md).level_4
- when /^\s*#{Mx[:lv_o]}5:\S*/; Toc.new(para_toc,@md).level_5
- when /^\s*#{Mx[:lv_o]}6:\S*/; Toc.new(para_toc,@md).level_6
- when /^\s*4~!/; Toc.new(para_toc).level_crosslink
- else
- end
- if @@firstseg.nil? \
- and para=~/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}/
- @@firstseg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/.match(para)[1]
- 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")
- '<div class="toc">' + minitoc + '</div>'
- end
- protected
- def rss #sort all wrong, disabled but kept
- @@toc[:seg] <<<<WOK
-<center>
-<table><tr><td>
-<p><font color="#222222" #{@font.face} size="2">
-(relatively static) RSS feeds for DOCUMENTS:<br />
-<a href="../rssfeed/documents.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/documents.xml<br />
-<a href="../rssfeed/tradelaw.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/tradelaw.xml<br />
-<a href="../rssfeed/environmental.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a>&nbsp;http://www.jus.uio.no/lm/rssfeed/environmental.xml<br />
-<center><a href="mailto:info@address.com" target="_top">info@address.com</a></center>
-</font></p>
-</td></tr></table>
-WOK
- end
- def level_doc_owner_details
- if @md.stmp =~/\w\w/
- format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md)
- @@toc[:scr] << format_head_scroll.toc_owner_details
- end
- 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
- para=@data
- unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(@pat_strip_heading_name,'\1')
- end
- para[@pat_heading]
- linkname,link=$1.strip,$2 if $&
- if link \
- and link !~/#/ #% keep eye on link
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link)
- end
- title=unless para =~/Document Information/; linkname
- else
- link='metadata'
- %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{linkname}</a></b>}
- end
- toc={}
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:seg]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/
- format_toc.lev0
- else format_toc.lev1
- end
- toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*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 para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/
- m=/#{$1}/
- para.gsub!(m,'')
- if para=~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/
- %{<a href="#docinfo">#{linkname}</a>}
- else linkname
- end
- else
- @@toc[:scr] << '<br />'
- link=if para =~/#{Mx[:id_o]}~[1-9];([0-6]):\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/; $1
- else ''
- end
- %{<b><a href="##{link}">#{linkname}</a></b>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/
- format_toc.lev0
- else format_toc.lev1
- end
- toc
- end
- def level_2
- para=@data
- unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(@pat_strip_heading_name,'\1')
- end
- para[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- 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 para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/
- m=/#{$1}/
- para.gsub!(m,'')
- title=linkname
- else title=%{#{p_num.goto}#{linkname}</a>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev2
- toc
- end
- def level_3
- para=@data
- para.gsub!(@pat_strip_heading_name,'\1')
- para.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect
- para[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- 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 para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/
- m=/#{$1}/
- para.gsub!(m,'')
- title=linkname
- else title=%{#{p_num.goto}#{linkname}</a>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev3
- toc
- end
- def level_4
- para=@data
- unless para =~/~metadata/
- unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(@pat_strip_heading_name,'\1')
- para[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
- end
- para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'')
- if para =~/^#{Mx[:lv_o]}4:/
- seg_link=para.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/,
- %{ <a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top">
- \\2
- </a> })
- if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m
- m=/#{$1}/m
- seg_link.gsub!(m,'')
- end
- @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1]
- elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } +
- %{target="_top">\\1 \\2 \\3</a> })
- end
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
- txt_obj={:txt =>seg_link}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc={}
- toc[:seg]=format_toc.lev4
- toc[:seg_mini]=format_toc.mini_lev4
- if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- m=/#{$1}/
- para.gsub!(m,'')
- title=linkname
- else title=%{#{p_num.goto}#{linkname}</a>} if p_num
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev4
- toc
- end
- end
- def level_5
- para=@data
- if para !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(@pat_strip_heading_name,'\1')
- end
- para[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- toc={}
- if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- m=/#{$1}/
- para.gsub!(m,'')
- title=linkname
- else
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
- #{linkname}
- </a>}
- 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}</a>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev5
- toc
- end
- def level_6
- para=@data
- if para !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(@pat_strip_heading_name,'\1')
- end
- para[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- toc={}
- if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- m=/#{$1}/
- para.gsub!(m,'')
- title=linkname
- else
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
- #{linkname}
- </a>}
- 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}</a>}
- end
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev6
- toc
- end
- def level_crosslink
- para=@data
- if para !~/^4~!/
- para.gsub!(/^4~!\s+(\S+)\s+(.+)/,
- %{<table><tr><td width =\"80\"></td>
- <td><a href="http://\\1" target="_top">
- #{@png.crosslink_ext}
- &nbsp;&nbsp;\\2
- <\/a>
- </td></tr></table>
-})
- else
- para.gsub!(/^4~!\s+(\S+)\s+(.+)/,
- %{<table><tr><td width ="80">
- </td><td>
- <a href="\\1" target="_top">
- #{@png.crosslink}
- &nbsp;&nbsp;\\2
- <\/a>
- </td></tr></table>
-})
- end
- end
- end
- class 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 unless @md.cmd =~/q/
- 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 @md.rights
- rights=format_head_toc.rights
- rights=SiSU_HTML_Tune::Clean_html.new(rights).clean
- end
- if @md.prefix_b
- prefix_b=format_head_toc.prefix_b
- prefix_b=SiSU_HTML_Tune::Clean_html.new(prefix_b).clean
- end
- @seg_toc_band=format_head_toc.seg_head_navigation_band('pdf') #bug, vary depending on type of doc !! examine
- @seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom('pdf') #bug, vary depending on type of doc !! examine
- @segtoc << @seg_toc_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.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>')
- tmp_head=doc_title_endnote + "\n"
- txt_obj={:txt =>tmp_head}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- @segtoc << format_txt_obj.center_bold
- if not @md.subtitle.nil? \
- and not @md.subtitle.empty?
- tmp_head=@md.subtitle + "\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
- if @md.author
- creator_endnote=@md.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
- tmp_head=creator_endnote + "\n"
- txt_obj={:txt =>tmp_head}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- toc_shared << format_txt_obj.center_bold
- @segtoc << format_txt_obj.center_bold
- end
- toc_shared << format_head_toc.copyat
- @segtoc << format_head_toc.copyat
- toc_shared << "#{@vz.table_close*1}\n"
- @segtoc << "#{@vz.table_close*1}\n"
- tmp_head=nil
- if @md.prefix_a
- tmp_head ||= %{<p />#{@md.prefix_a}\n}
- toc_shared << tmp_head.dup
- @segtoc << tmp_head.dup
- end
- tmp_head=nil
- toc_shared << @links_guide_toc
- toc_shared << rights if @md.rights
- toc_shared << prefix_b if @md.prefix_b
- #Table of Contents added/appended here
- toc_shared << @toc[:scr]
- @segtoc << @links_guide_toc
- @segtoc << @toc[:seg]
- @segtoc << rights if @md.rights
- @segtoc << prefix_b if @md.prefix_b
- #Segtoc tail added here
- @segtoc << "</p>\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
- end
- class Scroll < SiSU_HTML_scroll::Scroll
- end
- class Scroll_output
- def initialize(scr_toc,scr_body,scr_endnotes,scr_metadata,scr_owner_details,scr_tails,md)
- @scr_toc,@scr_body,@scr_endnotes,@scr_metadata,@scr_owner_details,@scr_tails,@md=scr_toc,scr_body,scr_endnotes,scr_metadata,scr_owner_details,scr_tails,md
- end
- def publish
- scroll=[]
- hr='<center><hr width=90% /></center>'
- scroll << @scr_toc << '<div class="scroll">' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '</div>' << @scr_tails
- scroll.flatten!.compact!
- end
- end
- class Seg < SiSU_HTML_seg::Seg
- end
- class Output
- @@dp=nil
- def initialize(data='',md='')
- @data,@md=data,md
- @my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns,@md)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def scroll
- begin
- @filename_html_scroll=@my_make.file_html_scroll(@md)
- @data.each do |para|
- para.strip!
- para.gsub!(/<:.+?>/,'')
- 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=@my_make.file_html_segtoc(@md)
- @filename_html_index=@my_make.file_html_index(@md)
- @data.each do |para|
- para.strip!
- para.gsub!(/<!.+?!>|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|#{Mx[:id_o]}~\d+;(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- 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/v1/html_format.rb b/lib/sisu/v1/html_format.rb
deleted file mode 100644
index 18d6ff0d..00000000
--- a/lib/sisu/v1/html_format.rb
+++ /dev/null
@@ -1,1405 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html formating, css template
-
-=end
-module SiSU_HTML_Format
- include SiSU_Viz
- class Paragraph_number
- def initialize(md,ocn)
- @md,@ocn=md,ocn[/(\d+)/m,1]
- @ocn ||=''
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off == true
- true
- else false
- end
- end
- def ocn_display
- if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- ocn_class='ocn_off'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}">&nbsp;</label>})
- elsif @ocn.to_i == 0
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
- else
- ocn_class='ocn'
- @ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>})
- end
- end
- def name
- %{<a name="#{@ocn}"></a>}
- end
- def id #w3c? "tidy" complains about numbers as identifiers ! annoying
- %{id="o#{@ocn}"}
- end
- def goto
- %{<a href="##{@ocn}">}
- end
- end
- class Head_information
- include SiSU_Viz
- attr_reader :md,:pdf,:rdf,:vz
- def initialize(md)
- @md=md
- @rdf=SiSU_XML_tags::RDF.new(md)
- # DublinCore 1 - title
- @vz=SiSU_Env::Get_init.instance.skin
- @css=SiSU_Env::CSS_stylesheet.new(md)
- @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
- @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
- case @md.file_type
- when /php/; @index='index' # @index="index.php"
- else @index='index'
- end
- @metalink='#metadata'
- @tocband_scroll,@tocband_segtoc=nil,nil
- end
- def doc_type
- %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">\n}
- end
- def toc_head_escript #embedded script in this case PHP
- # %{<p>PHP or other embedded script for object persistence may go HERE</p>}
- end
- def seg_head_escript #embedded script in this case PHP
- # %{<p>PHP or other embedded script for object persistence may go HERE</p>}
- end
- def table_close
- %{ </font>
-#{@vz.table_close}}
- end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{#{@vz.paragraph_font_tiny}copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></h1>}
- end
- def html_close #moved
- %{</body>
-</html>}
- end
- end
- class Widget < Head_information
- def initialize(md)
- super(md)
- @md=md
- @cf_defaults=SiSU_Env::Info_processing_flag.new
- end
- def home
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="../index.html" target="_top">
- #{@vz.png_homepage}</a>
-</td>
-}
- end
- def scroll(text)
- if @md.fns =~ /\.(?:-|ssm\.)?sst$/
- scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- end
- def seg(text)
- %{<td align="center" bgcolor="#99CC66">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}>
- #{text}
- </a>
-</td>
-}
- end
- def search
- env=SiSU_Env::Info_env.new(@md.fns,@md)
- env.widget.search_form('sisusearch',nil,nil,true)
- end
- def manifest
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{@vz.nav_txt_manifest}
- </a>
-</td>}
- end
- def pdf
- pdf=if @md.programs[:pdf] \
- and @cf_defaults.cf_0 =~/p/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}>
- #{@vz.nav_txt_pdf_portrait}
- </a>
-</td>
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}>
- #{@vz.nav_txt_pdf_landscape}
- </a>
-</td>
-}
- else ''
- end
- end
- def odf
- odf=if @cf_defaults.cf_0 =~/o/
- %{
-<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}>
- #{@vz.nav_txt_odf}
- </a>
-</td>}
- else ''
- end
- end
- def concordance(text)
- if @md.concord_make \
- and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </td>}
- else ''
- end
- end
- end
- class XML
- end
- class Head_toc < Head_information
- def initialize(md)
- super(md)
- @md=md
- @tocband_scroll,@tocband_segtoc=make_scroll,make_seg
- end
- def scroll_head_navigation_band
- pdf=if @md.programs[:pdf]
- <<WOK
-<td align="center" width="60%">
- #{make_seg_scroll_pdf}
-</td>
-WOK
- else ''
- end
- %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- #{@vz.banner_band}
-</td>#{pdf}
-<td width="20%">
- &nbsp;
-#{@vz.table_close}
-<p />}
- end
- def concordance_navigation_band(type='')
- if type=~/pdf/
- @tocband_concordance=make_concordance
- end
- %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- #{@vz.banner_band}
-</td>
-<td width="60%" align="center">
- #@tocband_concordance
-</td>
-<td width="20%" align="right">
- &nbsp;<a href="index.html" target="_top" alt="-&gt;">
- #{@vz.png_nav_toc}
- </a>&nbsp;
-#{@vz.table_close}
-<p />}
- end
- def seg_head_navigation_band(type='')
- if type=~/pdf/
- @tocband_segtoc=make_scroll_seg_pdf
- end
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- #{@vz.banner_band}
-</td>
-<td width="75%" align="center">
- #@tocband_segtoc
-</td>
-<td width="5%" align="right">
- &nbsp;#{firstseg}&nbsp;
-#{@vz.table_close}
-<p />}
- end
- def seg_head_navigation_band_bottom(type='')
- if type=~/pdf/
- @tocband_segtoc=make_scroll_seg_pdf
- end
- firstseg=%{<a href="#{@md.fnl[:pre]}#{@md.firstseg}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- &nbsp;
-</td>
-<td width="75%" align="center">
- #@tocband_segtoc
-</td>
-<td width="5%" align="right">
- &nbsp;#{firstseg}&nbsp;
-#{@vz.table_close}
-<p />}
- end
- def manifest_link(text)
- %{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>
- </font>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </font>}
- else ''
- end
- end
- def make_seg_scroll_pdf
- wgt=Widget.new(@md)
- scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- #{@vz.nav_txt_doc_link}
-</td>
-}
- %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{scroll}
- #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf}
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
- def make_scroll_seg_pdf
- manifest=scroll=seg=''
- wgt=Widget.new(@md)
- seg=%{<td align="center" bgcolor=#{@vz.color_band2}>
- #{@vz.nav_txt_toc_link}
-</td>
-}
- %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{seg}
- #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
- def make_concordance
- manifest=scroll=seg=''
- wgt=Widget.new(@md)
- %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
- def head
- %{#{doc_type}
-<head>
- <title>
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@rdf.rdftoc}
-#{@rdf.metatag_html}
-#{@css.html}
-</head>
-#{@vz.color_body}
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def concordance
- if @md.concord_make
- %{#{@vz.margin_css}
- <h4 class="toc">
- <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
- <i>Concordance</i>
- </a>
- </h4>
-#{@vz.table_close}}
- else
- %{#{@vz.margin_css}
-#{@vz.table_close}}
- end
- end
- def links_guide_vertical_open #???
- url=(defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home
- %{
-<div id="vertical_links">
- <ul id="vertical">
- <li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
- #{@vz.txt_hp}
- </a>
- </li>
- <li class="ref">
- Quick Ref.:
- </li>
- <li class="ref">
- <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top">
- Manifest
- </a>
- </li>
-<!- quick ref -!>}
- end
- def links_guide_horizontal_open #???
- url=(defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home
- %{
-<div id="horizontal_links">
- <ul id="horizontal">
- <li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
- #{@vz.txt_hp}
- </a>
- </li>
- <li class="ref">
- Quick Ref.:
- </li>
- <li class="ref">
- <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top">
- Manifest
- </a>
- </li>
-<!- quick ref -!>}
- end
- def links_guide_open(type='horizontal')
- if type=='vertical'; links_guide_vertical_open
- else links_guide_horizontal_open
- end
- end
- def links_guide_close #(type='horizontal')
- insert=''
- insert=@vz.banner_home_guide if @md.sfx_src =~/lm?/
- #insert=@vz.banner_home_guide if @md.sfx_src =~/s?/
- insert=if @md.sfx_src =~/s?/
- link='http://www.jus.uio.no/sisu' #get from defaults
- url='www.jus.uio.no/sisu'
- name='SiSU electronic documents' #get from defaults
- #name='SiSU electronic documents/books' #get from defaults
- insert= %{ <li class="refbold">
- <a href="#{link}" alt="#{name}" target="_top">
- #{name}
- </a>
- </li>
- <li class="ref">
- <a href="#{link}" alt="#{name}" target="_top">
- #{url}
- </a>
- </li>
- </ul>
-</div>
-}
- end
- %{ #{insert}
-<!- quick ref -!>}
- end
- def prefix_a
- end
- def rights
- rights=@md.rights.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>&copy;</sup>&nbsp;')
- %{<p class="small_left">Rights: #{rights}</p>
-<p />}
- end
- def prefix_b
- %{<p class="small_left">Prefix: #{@md.prefix_b}<p />}
- end
- def scroll_head_title_banner_open
- %{<center>
-#{@md.icon}
-</center>
-#{@vz.banner_instrument_cover_band_scr}}
- end
- def seg_head_title_banner_open
- %{<center>
- #{@md.icon}
-</center>
-#{@vz.banner_instrument_cover_band_seg}}
- end
- def make_scroll
- concord=concordance_link(@vz.nav_txt_concordance)
- %{<table summary="toc scroll" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="center" bgcolor="white" border="0">
- #{@vz.nav_txt_doc_link}
-</td>
-<td align="center" bgcolor="white">
- #{concord}
-#{@vz.table_close}}
- end
- def make_seg
- concord=concordance_link(@vz.nav_txt_concordance)
- %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="center" bgcolor="white">
- #{@vz.nav_txt_toc_link}
-</td>
-<td align="center" bgcolor="white">
- <font size=2>
- #{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}
- </font>
-#{@vz.table_close}}
- end
- def concordance #check structure
- concord=concordance_link(@vz.nav_txt_concordance)
- %{#{@vz.margin_txt_3}
- #{@vz.paragraph_font_small}
- #{concord}
- </font>
-#{@vz.table_close}}
- end
- def metadata
- %{#{@vz.margin_css}
- <h4 class="toc">
- <a href="#@metalink" #{@vz.js_metalink}>
- <i>MetaData</i>
- </a>
- </h4>
-#{@vz.table_close}}
- end
- def seg_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- metadata
- end
- def seg_tail
- %{
-<div class="main_column">
-<p>&nbsp;<p>
-<table summary="toc segment tail" bgcolor=#{@vz.color_band1}>
-<tr><td width="20%">
- #{@vz.banner_band}
-</td>
-<td width="60%">
- <center>
- #{@tocband_segtoc}
- </center>
-</td></tr>
-</table>
-<p>&nbsp;</p>
-#{@vz.credits_splash}
-#{@vz.credits_sisu}
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-</div>
-</div>
-</div>
-}
- end
- def scroll_tail #debug
- nav=scroll_head_navigation_band
- %{
-<div class="main_column">
-#{nav}
-#{@vz.credits_splash}
-#{@vz.credits_sisu}
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-</div>
-</div>
-</div>
-}
- end
- def seg_navigation_tail #this is a bug area, look up and "tidy"
- #nav=scroll_head_navigation_band
- %{
-<div class="main_column">
-<p>&nbsp;</p>
-#{@vz.credits_splash}
-#{@vz.credits_sisu}
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits"></a>
-</div>
-</div>
-</div>
-}
- end
- end
- class Head_seg < Head_information
- def initialize(md) #(md='')
- super(md)
- end
- def head
- %{#{doc_type}
-<head>
- <title>
- #{@seg_name_html[@seg_name_html_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@rdf.rdfseg}
-#{@rdf.metatag_html}
-#{@vz.font_css_table_file}
-</head>
-#{@vz.color_body}
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def title_banner(title,subtitle,creator)
- end
- def dot_control_pre_next
- %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@md.fnl[:pre]}#@index#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def dot_control_pre
- %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@md.fnl[:pre]}#@index#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def toc_nav(f_pre=false,f_nxt=false,use=1)
- pre=nxt=''
- toc=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#@index#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_toc}
- </a>
-</td>}
- pre=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_pre}
- </a>
-</td>} if f_pre==true
- nxt=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_nxt}
- </a>
-</td>} if f_nxt==true
- %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
-<tr>
-#{pre}
-#{toc}
-#{nxt}
-<td>
-#{@vz.table_close}}
- 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,2).dup
- end
- def manifest_link(text)
- %{<font size=2>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{text}
- </a>
- </font>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<font size=2>
- <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>
- </font>}
- else ''
- end
- end
- def doc_types #used in seg_nav_band ###
- scroll=seg=''
- wgt=Widget.new(@md)
- #dir=SiSU_Env::Info_env.new(@md.fns)
- x=if @md.concord_make
- %{
-<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}
- #{wgt.scroll(@vz.nav_txt_doc_link)}
- #{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.concordance(@vz.nav_txt_concordance)}
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- else
- %{
-<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
-<tr>
- #{wgt.seg(@vz.nav_txt_toc_link)}
- #{wgt.scroll(@vz.nav_txt_doc_link)}
- #{wgt.pdf}#{wgt.odf}
-<td align="center" bgcolor=#{@vz.color_band2}>
- #{wgt.manifest}
- #{wgt.search}
- #{wgt.home}
-</tr></table>}
- end
- end
- def title_endnote(title,subtitle,creator,table_top_control)
-# %{#{@vz.banner_instrument_cover_band_seg}
-# <h1 class="banner">
-# #{title}
-# </h1>
-# <h1 class="subbanner">
-# #{subtitle}
-# </h1>
-# <h1 class="subbanner">
-# #{creator}
-# </h1>
-# <h4 class="banner">
-# Endnotes
-# </h4>
-##{@vz.table_close}
-#<h1>Endnotes</h1>}
- end
- def navigation_table
- %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0">
-<tr><th width="#{@@indent['leve_1']}" align="right">
-</td>
-<td valign="top">
- <font size=2>}
- end
- def navigation_table1
- %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left">
-<tr><td valign="top">
- <font size="2">}
- end
- def navigation_table2
- %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left">
-<tr><td valign="top">
- <font size="2">}
- end
- def header_advert_local_1
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="http://#{@md.ad_url}#{Sfx[:html]}" target="_top">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
- def header_advert_local_2
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:html]}" target="_top">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
- def header_advert_external
- dir=SiSU_Env::Info_env.new(@fns)
- %{ <center>
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:html]}" target="external">
- <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}">
- </a>
- <p />
-#{@vz.table_close}
-</center>}
- end
- def credit
- %{
-<div class="main_column">
-#{@vz.credits_splash}
-#{@vz.credits_sisu}
-<a name="bottom" id="bottom"></a>
-<a name="down" id="down"></a>
-<a name="end" id="end"></a>
-<a name="finish" id="finish"></a>
-<a name="stop" id="stop"></a>
-<a name="credits" id="credits"></a>
-</div></div>
-}
- end
- def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner
- %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr>
-<td width="20%" align="left">
-#{@vz.banner_band}
-</td>
-<td width="75%" align="center">
- #{doc_types}
-</td>
-<td width="5%" align="right">
- #{segtocband}
-</td></tr>
-</table>
-#{seg_table_top_control}}
- end
- def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless
- %{
-<div class="main_column">
- <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr>
- <td width="70%" align="center">
- #{doc_types}
- </td>
- <td width="5%" align="right">
- #{segtocband}
- </td></tr>
- </table>
- #{seg_table_top_control}
-</div>
-}
- end
- def endnote_mark
-%{
-<p class="center" id="endnotes">
- <hr class="endnote" />
-</p>}
- end
- def endnote_section_open
-%{
-<div class="endnote">
-}
- end
- def endnote_section_close
-%{
-</div>
-} #revisit
- end
- def head
- %{#{doc_type}
-<head>
- <title>
- #{@seg_name_html[@seg_name_html_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@rdf.rdfseg}
-#{@rdf.metatag_html}
-#{@css.html}
-</head>
-#{@vz.color_body}
-<a name="top" id="top"></a>
-<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
- end
- def toc_metadata
- @metalink=%{./#{@md.fn[:meatadata]}}
- toc_metadata
- end
- def title_banner(title,subtitle,creator)
- %{
-<div class="summary">
- <p class="tiny">
- #{title}
- </p>
- <p class="tiny">
- #{subtitle}
- </p>
- <p class="tiny">
- #{creator}
- </p>
- <p class="tiny">
- copy @
- <a href="#{@vz.url_home}">
- #{@vz.txt_home}
- </a>
- </p>
-</div>
-}
- end
- end
- class Head_scroll < Head_toc
- def initialize(md) #(md='')
- super(md)
- end
- def toc_owner_details
- %{#{@vz.margin_txt_3}
-#{@vz.paragraph_font_small}
- <a href="#owner.details">
- Owner Details
- <font size="1" color="#777777">
- &nbsp;&nbsp;&nbsp;
- </font>
- </a>
- </font>
-#{@vz.table_close}}
- end
- def table
- %{<table summary="scroll table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0">
-<tr><th width=#{@@indent['level_1']} align="right">
-</th>
-<td valign="top">
-#{@vz.paragraph_txt}}
- end
- def table1
- %{<table summary="scroll table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table1} align="justify">
-<tr><td valign="top">
-#{@vz.paragraph_txt}}
- end
- def table2
- %{<table summary="scroll table2" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table2} align="justify">
-<tr><td valign="top">
-#{@vz.paragraph_txt}}
- end
- def title_endnote #revisit
-# %{#{@vz.margin_txt_0}
-# #{@vz.paragraph_txt}
-# <a name="endnotes" id="endnotes"></a>
-##{@vz.margin_num}
-# &nbsp;
-##{@vz.table_close}}
- end
- end
- class Format_text_object
- @vz=SiSU_Env::Get_init.instance.skin
- @@dp=nil
- 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
- else
- if @md.cmd =~/M/
- p t_o.class
- p caller
- end
- end
- if @txt and not @txt.empty?
- @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
- end
- if @ocn and @ocn=~/\d+/ #WATCH FIX
- @p_num=Paragraph_number.new(@md,@ocn)
- end
- 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]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname}
- else %{<a name="h#{headname}" id="h#{headname}"></a>}
- end
- end
- end
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def endnote_body
- %{
-<p class="endnote">
- #{@txt}
-</p>
-}
- end
- def endnote_body_indent
- %{
- <p class="endnote_indent">
- #{@txt}
- </p>
-}
- end
- def no_paranum
- %{
-<div class="substance">
- <label class="ocn">&nbsp;</label>
- <p class="norm">
- #{@txt}
- </p>
-</div>
-}
- end
- def para_form_css(tag,attrib) # regular paragraphs shaped here
- ul=ulc=''
- ul,ulc="<ul>\n ","\n </ul>" if @tag =~/li/
- %{
-<div class="substance">
- #{@p_num.ocn_display}
- #{ul}<#{tag} class="#{attrib}" #{@p_num.id}>
- #{@txt}
- </#{tag}>#{ulc}
-</div>
-}
- end
- def para
- para_form_css('p','norm')
- 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 format(tag,attrib)
- para_form_css(tag,attrib)
- end
-
- def header_normal(tag,attrib)
- %{
-<div class="substance">
- #{@p_num.ocn_display}
- <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}
- #{@headname}#{@txt}
- </#{tag}>
-</div>
-}
- end
- def heading_body
- header_normal('p','norm')
- end
- def heading_body1
- header_normal('h1','norm')
- end
- def heading_body2
- header_normal('h2','norm')
- end
- def heading_body3
- header_normal('h3','norm')
- end
- def heading_body4
- header_normal('h4','norm')
- end
- def heading_body5
- header_normal('h5','norm')
- end
- def heading_body6
- header_normal('h6','norm')
- end
- def title_header(tag,attrib)
- %{
-<div class="content">
-<#{tag} class="#{attrib}">
- #{@txt}
- </#{tag}>
-</div>
-}
- end
- def title_header1
- title_header('h1','tiny')
- end
- def title_header2
- title_header('h2','tiny')
- end
- def title_header3
- title_header('h3','tiny')
- end
- def title_header4
- ''
- end
- def title_header4_old
- %{
-<div class="substance">
- <label class="ocn">&nbsp;</label>
- <h4 class="banner">
- #{@txt}
- </h4>
-</div>
-}
- end
- def dl #check :trailer
- "<dl><b>#{@txt}</b> #{@trailer}</dl>"
- end
- def table_css_end #<!TZ!>
- '</table>
- </p>
- </div>'
- 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+)\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')
- when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/
- @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
- @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')
- when /^\s*\d{1,3}\.\s/
- @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>')
- when /^\s*[A-Z]\.\s/
- @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>')
- end
- end
- def bold_para
- %{#{@vz.margin_txt_0}
- <p class="bold">
- #{@txt}
- </p>
-#{@vz.margin_num_css}
- &nbsp;&nbsp;&nbsp;
-#{@vz.table_close}}
- end
- def bold_header
- @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>')
- @txt.gsub!(/[1-9]~/,'')
- @txt.gsub!(/#{Mx[:id_o]}~0;[um]\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*$/i,'') #watch & do differently
- %{<p class="bold">
- #{@txt}
- </p>
-#{@vz.margin_num_css}
- &nbsp;&nbsp;&nbsp;
-#{@vz.table_close}}
- end
- def toc_head_copy_at
- %{<p class="center">#{@txt}</p>\n}
- end
- def center
- %{<p class="center">#{@txt}</p>\n}
- end
- def bold
- %{<p class="bold">#{@txt}</p>\n}
- end
- def center_bold
- %{<p class="centerbold">#{@txt}</p>\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
-<center>
-#{@txt}
-#@two
-</a></center><p />}
- end
- def navigation_toc_lev1
- %{#{@banner.nav_toc}}
- end
- def navigation_toc_lev2 #change bold use css
- %{<p />
-<table summary="navigation segment level 2">
-<tr><td width ="20">
-</td>
-<td>
- <font size="3" #{@vz.font_face}>
- <b>#{@txt}</b>
- </font>
- </p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev3 #change bold use css
- %{<p />
-<table summary="navigation segment level 3">
-<tr><td width ="20">
-</td>
-<td>
- <font size="3" #{@vz.font_face}>
- <b>#{@txt}</b>
- </font>
- </p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev4
- %{<table summary="navigation segment level 4">
-<tr><td width ="80">
-</td>
-<td>
-<p>
- #{@txt}
-</p>
-#{@vz.table_close}}
- end
- def navigation_toc_lev5
- end
- def navigation_toc_lev6
- end
- def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408
- fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info
- %{
- <p class="endnote">
- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b}
- </p>
-}
- end
- def subtoc_lev(tag,attrib)
- txt=if @txt \
- and @txt =~/<\/?i>|<a\s+name="\S+?">/mi
- @txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
- else @txt
- end
- note=''
- if txt =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream
- note=$1
- note.gsub!(/[\n\s]+/m,' ')
- txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
- txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
- end
- %{<#{tag} class="#{attrib}">
- <a href="##{@ocn}"><i>#{txt}</i></a> #{note}
- </#{tag}>}
- end
- def subtoc_lev5
- subtoc_lev('h5','subtoc') if @txt
- end
- def subtoc_lev6
- subtoc_lev('h6','subtoc') if @txt
- end
- #% para sisu
- def header_sub(tag,attrib)
- @txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
- %{
-<div class="substance">
- #{@p_num.ocn_display}
- <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@headname}
- #{@txt}
- </#{tag}>
-</div>
-}
- end
- def header5
- header_sub('p','bold')
- end
- def header6
- header_sub('p','bold')
- end
- def header4
- %{
-<div class="substance">
- #{@p_num.ocn_display}
- <h1 class="norm" #{@p_num.id}>#{@p_num.name}
- #{@t_o[:format]}
- #{@txt}
- </h1>
-</div>
-}
- end
- def navigation_header4
- %{<table summary="navigation segment header 4" width=100% bgcolor="#08163f" border="0">
-<tr><td align="center">
-<p class="bold">
- #{@txt}
-</p>
-#{@vz.table_close}}
- end
- def navigation_header5
- %{<p class="bold">
- #{@txt}
-</p>}
- end
- def navigation_header6
- %{<p class="bold">
- #{@txt}
-</p>}
- end
- def navigation_center
- "<center>#{@txt}</center>"
- end
- end
- class Format_toc < Format_text_object
- def initialize(md,txt)
- super(md,txt)
- end
- def links_guide
- %{ <li class="doc">
- <a href="#{@lnk_url}" target="_top">
- #{@lnk_txt}
- </a>
- </li>
-}
- end
- def lev(tag,attrib)
- if @txt
- %{<#{tag} class="#{attrib}">
- #{@txt}
- </#{tag}>
-}
- 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
- %{
- <h4 class="minitoc">
- <a href="sisu_manifest.html">Manifest (alternative outputs)</a>
- </h4>
-}
- end
- def mini_concord_tail
- %{
- <h4 class="minitoc">
- <a href="concordance.html">Concordance (wordlist)</a>
- </h4>
- <h4 class="minitoc">
- <a href="sisu_manifest.html">Manifest (alternative outputs)</a>
- </h4>
-}
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/html_minitoc.rb b/lib/sisu/v1/html_minitoc.rb
deleted file mode 100644
index 06503ece..00000000
--- a/lib/sisu/v1/html_minitoc.rb
+++ /dev/null
@@ -1,239 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- minitoc
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
- module SiSU_HTML_minitoc
- require "#{SiSU_lib}/html_tune"
- include SiSU_HTML_Tune
- class Toc_mini
- @@seg_mini=nil
- @@seg_url=''
- @@dp,@@firstseg=nil,nil
- def initialize(md,data)
- @md,@data=md,data
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @pat_heading=/^#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/
- @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md
- end
- def songsheet
- SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/
- toc=nil
- @toc=[]
- @data.each do |txt|
- if txt =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/
- txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc
- txt.gsub!(/<a name="-\d+" href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;<\/a>/,'')
- txt.gsub!(@pat_strip_heading_name,'\1')
- txt.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect
- toc=case txt
- when /^\s*#{Mx[:lv_o]}1:\S*/; Toc_mini.new(@md,txt).level_1
- when /^\s*#{Mx[:lv_o]}2:\S*/; Toc_mini.new(@md,txt).level_2
- when /^\s*#{Mx[:lv_o]}3:\S*/; Toc_mini.new(@md,txt).level_3
- when /^\s*#{Mx[:lv_o]}4:\S+/; Toc_mini.new(@md,txt).level_4
- when /^\s*#{Mx[:lv_o]}5:\S*/; Toc_mini.new(@md,txt).level_5
- when /^\s*#{Mx[:lv_o]}6:\S*/; Toc_mini.new(@md,txt).level_6
- when /^\s*4~!/; Toc.new(txt).level_crosslink
- else
- end
- @toc << toc
- end
- end
- @toc
- end
- protected
- def level_concordance
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
- @@seg_mini << format_head_toc.mini_seg_concordance
- end
- def level_metadata
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
- @@seg_mini << format_head_toc.mini_seg_metadata
- end
- def level_word_index
- format_head_toc=SiSU_HTML_Format::Head_toc.new(@d0c)
- @@seg_mini << format_head_toc.mini_concordance
- end
- def level_1
- txt=@data
- unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt.gsub!(@pat_strip_heading_name,'\1')
- end
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- title=unless txt =~/Document Information/; linkname
- else
- link='metadata'
- %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}">#{linkname}</a></b>}
- end
- toc={}
- txt_obj={:txt =>title}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=if txt =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/
- format_toc.mini_tail
- else format_toc.mini_lev1
- end
- toc_mini
- end
- def level_2
- txt=@data
- unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt.gsub!(@pat_strip_heading_name,'\1')
- end
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- txt_obj={:txt =>linkname}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev2
- toc_mini
- end
- def level_3
- txt=@data
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- txt_obj={:txt =>linkname}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev3
- toc_mini
- end
- def level_4
- txt=@data
- unless txt =~/~metadata/
- unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt.gsub!(@pat_strip_heading_name,'\1')
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- end
- txt.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'')
- if txt =~/^#{Mx[:lv_o]}4:/
- seg_link=txt.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/,
- %{ <a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" target="_top">
- \\2
- </a> })
- if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m
- m=/#{$1}/m
- seg_link.gsub!(m,'')
- end
- @@seg_url=txt[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1]
- elsif txt =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- seg_link=txt.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" } +
- %{target="_top">\\1 \\2 \\3</a> })
- end
- txt_obj={:txt =>seg_link}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev4
- toc_mini
- end
- end
- def level_5
- txt=@data
- if txt !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt.gsub!(@pat_strip_heading_name,'\1')
- end
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- toc={}
- if txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- m=/#{$1}/
- txt.gsub!(m,'')
- title=linkname
- else
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
- #{linkname}
- </a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev5
- end
- toc_mini
- end
- def level_6
- txt=@data
- if txt !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt.gsub!(@pat_strip_heading_name,'\1')
- end
- txt[@pat_heading]
- linkname,ocn=$1.strip,$2 if $&
- if ocn \
- and ocn !~/#/
- p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- toc={}
- if txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- m=/#{$1}/
- txt.gsub!(m,'')
- title=linkname
- else
- lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}##{ocn}">
- #{linkname}
- </a>}
- txt_obj={:txt =>lnk_n_txt}
- format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
- toc_mini=format_toc.mini_lev6
- end
- toc_mini
- end
- end
- end
-__END__
-
diff --git a/lib/sisu/v1/html_promo.rb b/lib/sisu/v1/html_promo.rb
deleted file mode 100644
index ceb3eee5..00000000
--- a/lib/sisu/v1/html_promo.rb
+++ /dev/null
@@ -1,442 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html advertising component, build here, mockup
-
-=end
-module SiSU_HTML_promo
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- class Ad
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new(@md.fns,@md)
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @ad=SiSU_Env::Get_init.instance.ads
- @vz=SiSU_Env::Get_init.instance.skin
- @flag=@env.widget.promo?
- end
- def div
- def major
- @flag[:ad] ? '<div id="pane_major">' : ''
- end
- def minor
- @flag[:ad] ? '<div id="pane_minor">' : ''
- end
- def close
- @flag[:ad] ? '</div>' : ''
- end
- self
- end
- def display #(type=nil,id=nil)
- ads_array,promo_array=[],[]
- if @flag[:ad]
- ads=if @md.promo && @md.promo.length > 0 #promo set in document
- promo_array=@md.promo
- elsif @flag[:sk] #promo set in associated skin
- promo_array=@vz.widget_promo
- elsif @flag[:rc] #promo set in rc file
- promo_array=if @rc['promo'].class == String
- @rc['promo'].split(/[,;]\s*/)
- else @rc['promo']
- end
- else advert_extract_all
- end
- ads=if promo_array.length > 0
- promo_array.each do |x|
- ads_array << advert_extract_subject(x)
- end
- ads_array
- end
- adverts(ads.join)
- #else no_adverts
- end
- end
- def cell(prod,id)
- @prod,@id=prod,id
- def title
- @prod['title'] ? %{<b>#{@prod['title']}</b>} : ''
- end
- def subtitle
- @prod['subtitle'] ? %{ - #{@prod['subtitle']}} : ''
- end
- def author
- @prod['author'] ? %{<p class="pane">#{@prod['author']}</p>} : ''
- end
- def editor
- @prod['editor'] ? %{<p class="pane">#{@prod['editor']}</p>} : ''
- end
- def year
- @prod['year'] ? %{<p class="pane">#{@prod['year']}</p>} : ''
- end
- def date
- @prod['date'] ? %{<p class="pane">On: #{@prod['date']}</p>} : ''
- end
- def location
- @prod['at'] ? %{<p class="pane">At: #{@prod['at']}</p>} : ''
- end
- def pages
- @prod['pages'] ? %{<p class="pane">Pages: #{@prod['pages']} pages</p>} : ''
- end
- def form
- @prod['form'] ? %{<p class="pane">#{@prod['form']}</p>} : ''
- end
- def nick
- @prod['nick'] ? %{(#{@prod['nick']})<br />} : ''
- end
- def update
- @prod['update'] ? %{<p class="pane">Updated: #{@prod['update']}</p>} : ''
- end
- def issn
- @prod['issn'] ? %{<p class="pane">issn: #{@prod['issn']}</p>} : ''
- end
- def blurb
- @prod['blurb'] ? %{<p class="pane_blurb">#{@prod['blurb']}</p>} : ''
- end
- def search_form_sisu(table=true)
- db=if @prod['db']=~/\S+/
- @prod['db']=~/^SiSU_\S+/ ? @prod['db'] : "SiSU_#{@prod['db']}"
- elsif defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- @rc['search']['sisu']['db']=~/^SiSU_\S+/ ? @prod['search']['sisu']['db'] : "SiSU_#{@prod['db']}"
- else nil
- end
- action=if @prod['action']=~/^http:\/\//
- @prod['action']
- elsif defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/^http:\/\//
- @rc['search']['sisu']['action']
- else nil
- end
- form=if action \
- and db
- '<br />' + @env.widget.search_form('sisusearch',action,db,table)
- else ''
- end
- end
- def search_form_hyperestraier(table=true)
- action=if defined? @rc['search']['hyperestraier']['action'] \
- and @rc['search']['hyperestraier']['action'] =~/^http:\/\//
- @rc['search']['hyperestraier']['action']
- else nil
- end
- form=if action
- '<br />' + @env.widget.search_form('hyperestraier',action,'',table)
- else ''
- end
- form
- end
- def links
- if @prod['links'] #and @prod['links'] == Array
- links_a=[]
- @prod['links'].each do |x|
- if x \
- and x['url'] \
- and x['title']
- subtitle=x['subtitle'] ? %{ - #{x['subtitle']}} : ''
- url_=x['url'] =~/http:/ ? x['url'] : "../#{x['url']}"
- #url_=x['url'] =~/http:/ ? x['url'] : "#{@env.url.root}/#{x['url']}"
- links_a << %{<p class="pane_link"><a href="#{url_}">#{x['title']}#{subtitle}</a></p>\n}
- end
- end
- links_a.join
- else ''
- end
- end
- def image
- @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br />} : ''
- end
- def url_link
- @url_=if @prod['url'] =~/http:/
- "#{@prod['url']}"
- else "../#{@prod['url']}" # "#{@env.url.root}/#{@prod['url']}"
- end
- def show
- @prod['url'] ? %{<p class="pane_link"><a href="#@url_">#@url_</a></p>} : ''
- end
- def url
- @prod['url'] ? %{<a href="#@url_">} : ''
- end
- def url_relative
- @prod['url'] ? %{<a href="../#{@prod['url']}/toc.html">} : ''
- end
- self
- end
- def flyer
- if @prod['flyer']
- %{<p class="pane"><a href="../man/pdf/#@id.pdf"><img border="0" height="18" width="15" src="../_sisu/image/b_pdf.png">&nbsp;PDF&nbsp;flyer</a></p>}
- else ''
- end
- end
- def price
- def gbp
- if defined? @prod['price']['gbp'] \
- and @prod['price']['gbp']
- " &nbsp;&pound;&nbsp;#{@prod['price']['gbp']}&nbsp;(GBP)&nbsp;"
- else ''
- end
- end
- def euro
- if defined? @prod['price']['euro'] \
- and @prod['price']['euro']
- " &nbsp;&euro;&nbsp;#{@prod['price']['euro']}&nbsp;(Euro)&nbsp;"
- else ''
- end
- end
- def usd
- if defined? @prod['price']['usd'] \
- and @prod['price']['usd']
- " &nbsp;$&nbsp;#{@prod['price']['usd']}&nbsp;(USD)&nbsp;"
- else ''
- end
- end
- %{<p class="pane">Price:#{gbp}#{euro}#{usd}</p>}
- end
- def adsense #draw content from a configuration file
- def column_right
- if defined? @ad[:promo]['ad']['adsense']['column_right']
- @ad[:promo]['ad']['adsense']['column_right'].join("\n")
- else ''
- end
- end
- def line_single
- if defined? @ad[:promo]['ad']['adsense']['line_single']
- @ad[:promo]['ad']['adsense']['line_single'].join("\n")
- else ''
- end
- end
- self
- end
- def site_link #Work area
- if url_link.url
- <<WOK
-<p class="pane">
-#{url_link.url}
-#{image}
-#{title}
-#{subtitle}
-</a>#{nick}</p>
-WOK
- else
- <<WOK
-<p class="pane">
-#{image}
-#{title}
-#{subtitle}
-</p>
-WOK
- end
- end
- self
- end
- def output_form_sponsor(type,id)
- cell=cell(@ad[:promo][type][id],prod_id)
- prod_type=id=~/id_(?:[0-9x]){10,13}/i ? 'isbn' : 'id'
- id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>}
- <<WOK
-<br />
-#{cell.site_link}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_link(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- <<WOK
-<br />
-#{cell.site_link}
-#{cell.author}
-#{cell.year}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_search_sisu(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- cell.search_form_sisu(false)
- end
- def output_form_search_hyperestraier(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- cell.search_form_hyperestraier(false)
- end
- def output_form_book(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- prod_type=id=~/id_(?:[0-9x]){10,13}/i ? 'isbn' : 'id'
- id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>}
- <<WOK
-<br />
-#{cell.site_link}
-#{cell.author}
-#{cell.year}
-#{id_detail}
-#{cell.pages}#{cell.form}
-#{cell.price}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_journal(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
- <<WOK
-<br />
-#{cell.site_link}
-#{cell.editor}
-#{cell.issn}
-#{cell.update}
-#{cell.form}
-#{cell.price.gsub(/Price:/,'Subscription:')}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_conference(type,id)
- prod_id=id.gsub(/id_/,'')
- cell=cell(@ad[:promo][type][id],prod_id)
-#translate date (dd month yyyy) from 2007-03-04 and ruby conversion
- <<WOK
-<br />
-#{cell.site_link}
-#{cell.date}
-#{cell.location}
-#{cell.price}
-#{cell.flyer}
-#{cell.blurb}
-#{cell.links}
-WOK
- end
- def output_form_select(type,id)
- case type
- when /site/
- output_form_link(type,id)
- when /sponsor/
- output_form_sponsor(type,id)
- when /search/
- if id=~/hyperestraier/
- output_form_search_hyperestraier(type,id)
- else output_form_search_sisu(type,id)
- end
- when /book/
- output_form_book(type,id)
- when /journal/
- output_form_journal(type,id)
- when /conference/
- output_form_conference(type,id)
- end
- end
- #def advert_extract_single(type,id) #extracts single item of type with id
- # #type === book,journal,conference,sponsor
- # id=id.to_s.gsub(/^(\d)/,'id_\1')
- # if defined? @ad[:promo][type][id] and @ad[:promo][type][id]
- # output_form_select(type,id)
- # end
- #end
- def advert_extract_subject(category) #extracts products from category/subject list
- adverts=[]
- if defined? @ad[:promo_list][category] \
- and @ad[:promo_list][category]
- @ad[:promo_list][category].keys.each do |type|
- @ad[:promo_list][category][type].each do |i|
- if i
- id=i.inspect =~/^\d/ ? "id_#{i.to_s.strip}" : i.to_s.strip #watch remove .to_s ?
- gbp=usd=euro=nil
- if defined? @ad[:promo][type][id] \
- and not @ad[:promo][type][id].nil?
- adverts << output_form_select(type,id)
- else
- if defined? @ad[:promo][category][type][id] \
- and @ad[:promo][category][type][id].class==Array \
- and @ad[:promo][category][type][id].length > 0
- adverts << @ad[:promo][category][type][id].join("\n")
- end
- end
- end
- end
- end
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}")
- tell.warn unless @md.cmd =~/q/
- end
- adverts.join
- end
- def advert_extract_all #extracts all products from list (which is broken down into categories)
- adverts=[]
- @ad[:promo_list].keys.each do |category|
- adverts << advert_extract_subject(category)
- end
- adverts.flatten
- end
- def adverts(ads)
- <<WOK
-#{div.minor}
-#{ads}
-#{div.close}
-WOK
- end
- def no_adverts
- <<WOK
-#{div.minor}
-#{div.close}
-WOK
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/html_scroll.rb b/lib/sisu/v1/html_scroll.rb
deleted file mode 100644
index be866f5a..00000000
--- a/lib/sisu/v1/html_scroll.rb
+++ /dev/null
@@ -1,200 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html scroll generation, processing
-
-=end
-module SiSU_HTML_scroll
- require "#{SiSU_lib}/shared_html"
- require "#{SiSU_lib}/html"
- require "#{SiSU_lib}/html_promo"
- class Scroll
- @@dp=nil
- def initialize(data='',md='')
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def songsheet
- begin
- scr=Scroll.new(@data,@md).markup
- scr[:tails]=Scroll.new('',@md).tails
- scr
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- protected
- def markup
- data=@data
- @rcdc=false
- @scr={ :body=>[],:metadata=>[],:owner_details=>[] }
- data.each do |para|
- #if para =~/^#{Mx[:lv_o]}\d:endnotes#{Mx[:lv_c]}\s*Endnotes/
- ## para.gsub!(/Endnotes.+/,'')
- #end
- para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/
- if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/
- para.gsub!(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>')
- end
- if para =~/^#{Mx[:lv_o]}\d:metadata#{Mx[:lv_c]}\s*Metadata/
- para.gsub!(/(Metadata)/,'\1<a name="metadata"></a>')
- end
- if @rcdc==false \
- and (para =~/^#{Mx[:lv_o]}:metadata#{Mx[:lv_c]}/ or para =~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/)
- @rcdc=true
- end
- para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>')
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
- end
- if para =~/.+?#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- ocn=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1]
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll
- m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m
- if @sto.format =~/i[1-9]|ordinary/ #watch
- txt_obj={:txt =>@sto.text}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- end
- para=case @sto.format
- when /^1:\S*?/; @sto.scroll_lev_para_ocn.heading_body1
- when /^2:\S*?/; @sto.scroll_lev_para_ocn.heading_body2
- when /^3:\S*?/; @sto.scroll_lev_para_ocn.heading_body3
- when /^4:\S+?/; @sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4
- when /^5:\S*?/; @sto.scroll_lev_para_ocn.heading_body5
- when /^6:\S*?/; @sto.scroll_lev_para_ocn.heading_body6
- when /^#{Mx[:gl_bullet]}/
- if para =~/#{Mx[:gr_o]}group#{Mx[:gr_c]}/
- para.gsub!(/#{Mx[:gl_bullet]}/,'●&nbsp;&nbsp;') #watch
- else
- @sto.scroll_lev_para_ocn.bullet
- end
- when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}#{Mx[:gl_bullet]}/ #indent with bullet
- format_txt_obj.gsub_body
- @sto.scroll_lev_para_ocn.format('li',"i#{$1}")
- when /^i([1-9])$/ #indent
- format_txt_obj.gsub_body
- @sto.scroll_lev_para_ocn.format('p',"i#{$1}")
- when /^center$/; @sto.scroll_lev_para_ocn.center
- when /^(?:b|bold)$/; @sto.scroll_lev_para_ocn.bold
- when /^(?:verse|group|alt)$/; @sto.scroll_lev_para_ocn.para
- when /^code$/; @sto.scroll_lev_para_ocn.code
- when /ordinary/ # see whether u can improve
- para=if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- format_txt_obj.gsub_body
- para=if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block
- #@sto=nil
- table=SiSU_HTML_shared::Table.new(para)
- table.table_split
- else @sto.scroll_lev_para_ocn.para
- end
- else para
- end
- else
- para.gsub!(/#{Mx[:gl_bullet]}/,'●&nbsp;&nbsp;') #watch
- para
- end
- elsif para =~/^#{Mx[:lv_o]}[1-9]:/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>para}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- para=format_txt_obj.bold_header
- elsif para =~/Endnotes?/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>'<br /><a name="notes">Note</a>'}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- para=format_txt_obj.bold_para
- elsif para =~/Owner Details/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>'<br /><a name="owner.details">Owner Details</a>'}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- @scr[:owner_details]=format_txt_obj.bold_para
- para=''
- elsif para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ #watch
- cont=if $2.empty?
- $1
- else "#{$1} #{$2}" #watch, check desired where $2 is other than space
- end
- txt_obj={:txt =>cont}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- para=format_seg.no_paranum
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though
- para=''
- end
- para.gsub!(/^#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/^<:\S?>/,'')
- para.gsub!(/#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/<:\S?>/,' '); para.gsub!(/<!.+!>/,' ')
- para.strip!
- unless @rcdc; @scr[:body] << para unless para =~/\A\s*\Z/
- else @scr[:metadata] << para
- end
- end
- end
- @scr
- end
- def tails
- scr_tail=[]
- format_head_scroll=SiSU_HTML_Format::Head_toc.new(@md)
- ads=SiSU_HTML_promo::Ad.new(@md)
- scr_tail << format_head_scroll.scroll_tail << ads.div.close << ads.display << format_head_scroll.html_close
- scr_tail
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/html_segments.rb b/lib/sisu/v1/html_segments.rb
deleted file mode 100644
index a3f6b7cb..00000000
--- a/lib/sisu/v1/html_segments.rb
+++ /dev/null
@@ -1,540 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html segment generation, processing
-
-=end
-module SiSU_HTML_seg
- require "#{SiSU_lib}/shared_html"
- require "#{SiSU_lib}/html"
- require "#{SiSU_lib}/html_promo"
- class Seg_output
- def initialize(md,outputfile,seg,minitoc,type='')
- @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type
- end
- def output #CONSIDER
- if @seg[:title] =~/\S/
- filename_seg=[]
- filename_seg << @seg[:title] << @seg[:tocband_banner]
- if @type =~/endnote/
- @seg[:headers]=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- @seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@author)
- txt_obj={:txt =>'Endnotes',:ocn_display =>''}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @seg[:headers] << format_seg.title_header1
- filename_seg << @seg[:header_endnotes] << @minitoc << @seg[:headers] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>' # << '</div>'
- elsif @type =~/idx/
- @seg[:headers]=[]
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- @seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@author)
- txt_obj={:txt =>'Index',:ocn_display =>''}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @seg[:headers] << format_seg.title_header1
- filename_seg << @seg[:header_idx] << @minitoc << @seg[:headers] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' # << '</div>'
- else
- filename_seg << @minitoc << @seg[:headers] << @seg[:main] << "\n</div>\n"
- end
- filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits]
- filename_seg.flatten!.compact!
- filename_seg.each do |para|
- unless para =~/\A\s*\Z/
- para.strip!
- @output_seg_file << para
- end
- end
- @output_seg_file.close
- end
- end
- end
- class Seg
- @@seg,@@seg_subtoc,@@seg_endnotes,@@seg_ad={},{},{},{}
- @@seg_name,@@seg_name_html=[],[]
- @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn=''
- @@loop_count=@@seg_total=@@tracker=0
- @@is4=@@is3=@@is2=@@is1=0
- @@header1=@@header2=@@header3=@@header4=0
- @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(11){[]}
- @@seg[:header_endnotes]=''
- @@tablehead,@@number_of_cols=0,0
- @@flag_alt=false
- @@dp,@@segtocband=nil,nil
- @@fns_previous=''
- attr_reader :seg_name_html,:seg_name_html_tracker
- def initialize(data='',md='')
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @seg_name_html=@@seg_name_html || nil
- @seg_name_html_tracker=@@tracker || nil
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def songsheet
- begin
- @minitoc=SiSU_HTML::Source::Toc.new(@data,@md).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_html=nil
- if @md.book_idx
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- idx_html=SiSU_Particulars::Combined_singleton.instance.get_html_idx(@md.opt).html_idx
- idx_html.each {|x| @@seg[:idx] << x }
- @@seg[:header_idx]=''
- end
- data.each do |para|
- if para =~/^#{Mx[:lv_o]}4:/
- @@seg_name << para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/,1]
- seg_name=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/,1]
- @@seg_ad[seg_name]=para[/.+?<:\d\s+(.+)\s*?>/,1] #watch
- end
- end
- @@seg_name_html=@@seg_name
- @@seg_total=@@seg_name.length
- testforartnum=@@seg_name_html
- tell=SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length)
- tell.segmented unless @md.cmd =~/q/
- flagend='y'
- data.each do |para|
- if para =~/^#{Mx[:lv_o]}4:/ #watch
- if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @@header4=para.to_s[/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}(.+?)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1]
- else @@header4=para.to_s[/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}(.+)/,1]
- end
- @@is4=newfile=1
- end
- if para =~/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}/
- @@header3=para.to_s[/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*?(.+)/,1]
- @@is4,@@is3=0,1
- end
- if para =~/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}/
- @@header2=para.to_s[/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*?(.+)/,1]
- @@is4,@@is3,@@is2=0,0,1
- end
- if para =~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/
- @@header1=para.to_s[/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*?(.+)/,1]
- @@is4,@@is3,@@is2,@@is1=0,0,0,1
- end
- if (@@is1 && !@@is2 && !@@is3 && !@@is4)
- unless para =~/^#{Mx[:lv_o]}1:/; head1=$_ #;
- end
- end
- if @@is4 == 1 \
- or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ \
- or para =~/^#{Mx[:mk_o]}4:metadata#{Mx[:mk_c]}/
- m=para[/^#{Mx[:lv_o]}4:(metadata)#{Mx[:lv_c]}/]; @@get_hash_fn=$1 if m
- if newfile == 1 \
- or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/
- newfile=0
- if para =~/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}/ \
- or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ # @@level4
- if tracking != 0
- mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!!
- Seg.new('',@md).tail
- segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
- @output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1]
- if @@seg_name_html[tracking-1] !~/endnotes|idx/
- Seg_output.new(@md,@output_seg_file,@@seg,@minitoc).output
- elsif @@seg_name_html[tracking-1] =~/endnotes/
- Seg_output.new(@md,@output_seg_file,@@seg,@minitoc,'endnotes').output
- elsif @@seg_name_html[tracking-1] =~/idx/
- Seg_output.new(@md,@output_seg_file,@@seg,@minitoc,'idx').output
- @@seg[:idx]=[]
- else p 'check'
- end
- Seg.new.reinitialise
- header_art(para)
- head(para)
- if @@seg_name_html[tracking] =~/metadata/ # this is for metadata
- segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
- @output_seg_file=File.new(segfilename,'w')
- Seg.new.reinitialise #BUG with items following endnote, and occurring before metadata, this becomes a bug ... work area for book index, FIX
- flagend='x'
- @output_seg_file.close #%(((( EOF )))) -->
- end
- end
- if tracking == 0
- header_art(para)
- head(para)
- end
- end
- tracking=tracking + 1
- end
- m=para[/.+?<a name="(\d+)">.*/]; @@get_hash_to=$1 if m # changed 2002w42, again w44 ! & again 2003w16
- m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/]; @@get_hash_fn=$1 if m
- para=if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s*c|#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/um; para.split(/\n/)
- else para
- end
- if para.class == String
- markup(para)
- elsif para.class == Array
- para.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 header_art(para)
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if para =~/^#{Mx[:lv_o]}[1-6]:/ #2004w27/5
- 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
- ads=SiSU_HTML_promo::Ad.new(@md)
- @@seg[:title]=format_head_seg.head << ads.div.major
- end
- def head(para)
- clean=/<!.*?!>|#{Mx[:gr_o]}:.*?#{Mx[:gr_c]}|<:.*?>|#{Mx[:id_o]}~\d+;(?:[ohum]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if @@tracker < @@seg_total-1
- if @@tracker == 0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2
- else @@segtocband=format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2
- end
- else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2
- end
- @p_num ||= ''
- if @@is1 == 1
- @author=%{<b>#{@md.author}</b>\n} if @md.author.to_s =~/\S/
- @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav])
- conditional_div_close=if @@get_hash_fn =~/metadata/ #watch
- ''
- else ''
- end
- @@seg[:tocband_bannerless] << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
- @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug
- @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@author).gsub(clean,'')
- ocn=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>@@header1,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @@seg[:headers] << format_seg.title_header1.gsub(clean,'')
- @@header1.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @@is2 == 1
- header2=@@header2
- ocn=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>header2,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @@seg[:headers] << format_seg.title_header2.gsub(clean,'')
- @@header2.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @@is3 == 1
- header3=@@header3
- ocn=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>header3,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @@seg[:headers] << format_seg.title_header3.gsub(clean,'')
- @@header3.gsub!(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
- end
- if @@is4 == 1
- header4=@@header4
- ocn=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1
- else ''
- end
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- txt_obj={:txt =>header4,:ocn_display =>@p_num.ocn_display}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- @@seg[:headers] << format_seg.title_header4.gsub(clean,'')
- end
- @@seg[:header_endnotes]=format_head_seg.title_endnote(@md.title,@md.subtitle,@author,@@seg[:dot_nav])
- @@tracker=@@tracker+1
- end
- def markup(para)
- @debug=[]
- para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'')
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if para !~/^#{Rx[:meta]}/
- m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]
- if m
- ocn=m[1].to_s
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn)
- end
- if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m \
- or @@flag_alt==true
- if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m
- @group_collect=[] #unless @group_collect.class == Array
- @group_collect << @vz.margin_txt_0 + para.gsub(/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m,'') #watch !
- @@flag_alt=true
- elsif @@flag_alt==true
- @group_collect << if para !~/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m # neither ideal nor necessary sort later
- para
- else
- para.gsub(/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m,'')
- end
- end
- if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m
- para=@group_collect.flatten.join
- @@flag_alt=false
- @group_collect=[]
- end
- end
- if para !~/^#{Mx[:lv_o]}[1-9]:|#{Rx[:meta]}/
- if para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/
- cont="#{$1} #{$2}" #check where $2 is other than space
- txt_obj={:txt =>cont}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- para=format_seg.no_paranum
- end
- end
- m=/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/
- if para =~m
- @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg
- if @sto.format =~/i[1-9]|ordinary/ #watch
- txt_obj={:txt =>@sto.text}
- format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
- end
- para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn|
- when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object
- when /^5:/; @sto.seg_lev_para_ocn.header5
- when /^6:/; @sto.seg_lev_para_ocn.header6
- when /^#{Mx[:gl_bullet]}/
- @sto.seg_lev_para_ocn.bullet
- when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}#{Mx[:gl_bullet]}/ #indent levels 1-9 with bullet
- format_txt_obj.gsub_body
- para=@sto.seg_lev_para_ocn.format('li',"i#{$1}")
- when /^i([1-9])$/ #indent levels 1-9
- format_txt_obj.gsub_body
- para=@sto.seg_lev_para_ocn.format('p',"i#{$1}")
- when /^(?:verse|group|alt)$/m
- @sto.seg_lev_para_ocn.para
- when /^code$/
- @sto.seg_lev_para_ocn.code
- when /ordinary/
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \
- and para !~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- format_txt_obj.gsub_body
- @sto.seg_lev_para_ocn.para
- elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \
- and para =~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- format_txt_obj.gsub_body
- @sto.seg_lev_para_ocn.table_css_end
- else para
- end
- else para
- end
- elsif para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T[hZ]?/u
- @sto=nil
- table=SiSU_HTML_shared::Table.new(para)
- para=table.table
- else
- para.gsub!(/#{Mx[:gl_bullet]}/,'●&nbsp;&nbsp;') #watch
- @sto=nil
- end
- if @md.flag_separate_endnotes
- para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
- end
- if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/
- if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m?
- one,two=$1,$2
- txt_obj={:txt =>$1.strip,:trailing =>$2.strip}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- end
- para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint
- if para =~/<a name="_\d+" href="#-\d+">&nbsp;<sup>/ #endnote- note-
- txt_obj={:txt =>para}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- para=format_seg.no_paranum
- end
- end
- if @sto and @sto.format=~/4:\S+/
- para.gsub!(/^\s*4:\S+\s*|<:[-_\w\d]?(-.+?-)?>|4~!.+/m,'') #sort seg headers
- @@seg[:main] << %{\n<div class="content">\n}
- @@seg[:main] << para
- @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
- else
- para.gsub!(/<:[-_\w\d]?(-.+?-)?>|4~!.+/,'')
- @@seg[:main] << para unless @@flag_alt==true
- end
- end
- end
- def tail
- format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
- if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn]
- @@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n}
- if @@seg_endnotes[@@get_hash_fn].flatten.length > 0
- @@seg[:tail] << format_head_seg.endnote_mark
- @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
- end
- @@seg[:tail] << '</div>'
- @@seg[:tail] << '</div>' #this div closes div class content
- end
- #@@seg[:tail] << '</div><table summary="whitespace"><tr><td>&nbsp;</td></tr></table>'
- ads=SiSU_HTML_promo::Ad.new(@md)
- @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close
- end
- def reinitialise
- @@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headers],@@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 |para|
- para.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')
- if @md.flag_auto_endnotes
- if para =~/^#{Mx[:lv_o]}[1234]:/ \
- and not @@fn.empty?
- @@seg_endnotes[@@fn]=[]
- @@seg_endnotes[@@fn] << @@seg_endnotes_array
- @@seg_endnotes_array=[] if para=~/^#{Mx[:lv_o]}4:/
- @@fns_previous=@md.fns if para=~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}/
- end
- if para =~/^#{Mx[:lv_o]}4:/ #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
- @@seg_subtoc[@@fn]=@@seg_subtoc_array
- @@seg_subtoc_array=[]
- if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/
- m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?#{Mx[:id_o]}~(\d+);(?:[oh]|4:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]
- end
- if m; @@fn=$1 if m # changed 2004w07 #endnotes and sub-tocs
- else
- if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/
- m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/]
- @@fn=$1 if m # changed 2005w13
- else @@fn=''
- end
- end
- end
- end
- if para =~/^#{Mx[:lv_o]}[56]:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- para.gsub!(/&nbsp;<\/a>/,'&nbsp;')
- case para # series changed 2002w42
- when /^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #remove [u]? req by pg texts, revist
- txt_obj={:txt =>$1.strip,:ocn =>$2}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- para=format_seg.subtoc_lev5
- when /^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>$1.strip,:ocn =>$2}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- para=format_seg.subtoc_lev6
- end
- @@seg_subtoc_array << para
- end
- if @md.flag_auto_endnotes
- if para =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \
- and not para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ # endnote-
- endnote_array=[]
- if para=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
- endnote_array << para.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m)
- end
- if para=~/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m
- endnote_array << para.scan(/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m)
- end
- if para=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m
- endnote_array << para.scan(/#{Mx[:en_b_o]}[+]\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*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1]
- try=e_n.split(/<br \/>/)
- try.each do |e|
- txt_obj={:txt =>e}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- 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('<br \/>')
- #% creation of separate end segment/page of all endnotes referenced back to reference segment
- m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
- endnote_part_a=note_match_seg[m,1]
- endnote_part_b=note_match_seg[m,2]
- txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b}
- format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
- @@seg[:endnote_all] << note_match_all_seg
- end
- para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/html_table.rb b/lib/sisu/v1/html_table.rb
deleted file mode 100644
index 04fee220..00000000
--- a/lib/sisu/v1/html_table.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: shared html parts
-
-=end
-module SiSU_HTML_table
- require "#{SiSU_lib}/defaults"
- class Table
- @@tablehead=0
- @@tablefoot=[] #watch
- def initialize(one)
- @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin
- end
- def table_head(inf)
- %{
-<div class="substance">
-<label class="ocn">#{inf}</label>
-<p class="norm" id="o#{inf}"><a name="#{inf}"></a>
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}
- end
- def table_end(tablefoot='')
- %{</p>
-#{tablefoot}
-</div>
-<div class="substance">
-}
- end
- def table_row(inf,h=false)
- bold=if h; '<b>'
- else ''
- end
- %{
-<tr>
- <td width="#{inf}%" valign="top">#{@vz.paragraph_table}#{bold}}
- end
- def table_cell(inf,h=false)
- if h; %{</b></font></td><td width="#{inf}%" valign="top">#{@vz.paragraph_table}<b>}
- else %{</font></td><td width="#{inf}%" valign="top">#{@vz.paragraph_table}}
- end
- end
- def table_row_close(h=false)
- bold_close=if h; '</b>'
- else ''
- end
- "#{bold_close}</font></td></tr>"
- end
- def table
- m=@parablock[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- @parablock.gsub!(/<!f.+?!>/,'')
- @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1)
- end
- if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- tablefoot=[]
- @@tablefoot.each {|x| tablefoot << ''}
- @@tablefoot=[]
- if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock="</table></p>\n</div>" #table_end
- end
- end
- if @@tablehead == 1
- if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- while @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u
- @parablock.sub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u,table_row($1,true))
- end
- while @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u
- @parablock.sub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u,table_cell($1,true))
- end
- if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true))
- end
- @@tablehead=0
- end
- @parablock
- else
- while @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u
- @parablock.sub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u,table_row($1))
- end
- while @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u
- @parablock.sub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+)#{Mx[:tc_p]}/u,table_cell($1))
- end
- if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close)
- end
- @parablock
- end
- @parablock
- end
- def table_split
- content=[]
- @one.split(/\n/).each do |parablock|
- table=Table.new("#{parablock}\n")
- content << table.table
- end
- content.join
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/html_tune.rb b/lib/sisu/v1/html_tune.rb
deleted file mode 100644
index 37a2e5f6..00000000
--- a/lib/sisu/v1/html_tune.rb
+++ /dev/null
@@ -1,383 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html generation, html pre-processing
-
-=end
-require "#{SiSU_lib}/param"
-module SiSU_HTML_Tune
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/html_format" #watch
- include SiSU_Env
- include SiSU_Screen
- @@line_mode=''
- @@endnote_array=[]
- @@endnote_call_counter=1
- @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3">
-<tr ...><td width="2%" align="right">
-&nbsp\;</td>
-<td width="94%" valign="top" align="justify">'
- @@table_align_close='</td>
-<td width="4%" align="right" valign="top">
-<font size="1" color="#777777">
-&nbsp;&nbsp;&nbsp;</font> </td></tr></table>'
- @@counter,@@column,@columns=0,0,0
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- end
- def hard_output
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @filename_tune=my_make.file_tune
- data=[]
- @data.each{|x| x.strip; data << x if not x.empty?} #1.9 array?
- data.each do |para|
- @filename_tune.puts para, "\n" #if para !~/¡/u
- end
- end
- def marshal
- my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- @marshal_tune=my_make.marshal_tune
- File.open(@marshal_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
- end
- end
- class Clean_html
- def initialize(html='')
- @html=html
- end
- def clean
- @html.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- @html.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- @html.gsub!(/¢/u,'&cent;') # &#162;
- @html.gsub!(/£/u,'&pound;') # &#163;
- @html.gsub!(/¥/u,'&yen;') # &#165;
- @html.gsub!(/§/u,'&sect;') # &#167;
- @html.gsub!(/©/u,'&copy;') # &#169;
- @html.gsub!(/ª/u,'&ordf;') # &#170;
- @html.gsub!(/«/u,'&laquo;') # &#171;
- @html.gsub!(/®/u,'&reg;') # &#174;
- @html.gsub!(/°/u,'&deg;') # &#176;
- @html.gsub!(/±/u,'&plusmn;') # &#177;
- @html.gsub!(/²/u,'&sup2;') # &#178;
- @html.gsub!(/³/u,'&sup3;') # &#179;
- @html.gsub!(/µ/u,'&micro;') # &#181;
- @html.gsub!(/¶/u,'&para;') # &#182;
- @html.gsub!(/¹/u,'&sup1;') # &#185;
- @html.gsub!(/º/u,'&ordm;') # &#186;
- @html.gsub!(/»/u,'&raquo;') # &#187;
- @html.gsub!(/¼/u,'&frac14;') # &#188;
- @html.gsub!(/½/u,'&frac12;') # &#189;
- @html.gsub!(/¾/u,'&frac34;') # &#190;
- @html.gsub!(/×/u,'&times;') # &#215;
- @html.gsub!(/÷/u,'&divide;') # &#247;
- @html.gsub!(/¿/u,'&iquest;') # &#191;
- @html.gsub!(/À/u,'&Agrave;') # &#192;
- @html.gsub!(/Á/u,'&Aacute;') # &#193;
- @html.gsub!(/Â/u,'&Acirc;') # &#194;
- @html.gsub!(/Ã/u,'&Atilde;') # &#195;
- @html.gsub!(/Ä/u,'&Auml;') # &#196;
- @html.gsub!(/Å/u,'&Aring;') # &#197;
- @html.gsub!(/Æ/u,'&AElig;') # &#198;
- @html.gsub!(/Ç/u,'&Ccedil;') # &#199;
- @html.gsub!(/È/u,'&Egrave;') # &#200;
- @html.gsub!(/É/u,'&Eacute;') # &#201;
- @html.gsub!(/Ê/u,'&Ecirc;') # &#202;
- @html.gsub!(/Ë/u,'&Euml;') # &#203;
- @html.gsub!(/Ì/u,'&Igrave;') # &#204;
- @html.gsub!(/Í/u,'&Iacute;') # &#205;
- @html.gsub!(/Î/u,'&Icirc;') # &#206;
- @html.gsub!(/Ï/u,'&Iuml;') # &#207;
- @html.gsub!(/Ð/u,'&ETH;') # &#208;
- @html.gsub!(/Ñ/u,'&Ntilde;') # &#209;
- @html.gsub!(/Ò/u,'&Ograve;') # &#210;
- @html.gsub!(/Ó/u,'&Oacute;') # &#211;
- @html.gsub!(/Ô/u,'&Ocirc;') # &#212;
- @html.gsub!(/Õ/u,'&Otilde;') # &#213;
- @html.gsub!(/Ö/u,'&Ouml;') # &#214;
- @html.gsub!(/Ø/u,'&Oslash;') # &#216;
- @html.gsub!(/Ù/u,'&Ugrave;') # &#217;
- @html.gsub!(/Ú/u,'&Uacute;') # &#218;
- @html.gsub!(/Û/u,'&Ucirc;') # &#219;
- @html.gsub!(/Ü/u,'&Uuml;') # &#220;
- @html.gsub!(/Ý/u,'&Yacute;') # &#221;
- @html.gsub!(/Þ/u,'&THORN;') # &#222;
- @html.gsub!(/ß/u,'&szlig;') # &#223;
- @html.gsub!(/à/u,'&agrave;') # &#224;
- @html.gsub!(/á/u,'&aacute;') # &#225;
- @html.gsub!(/â/u,'&acirc;') # &#226;
- @html.gsub!(/ã/u,'&atilde;') # &#227;
- @html.gsub!(/ä/u,'&auml;') # &#228;
- @html.gsub!(/å/u,'&aring;') # &#229;
- @html.gsub!(/æ/u,'&aelig;') # &#230;
- @html.gsub!(/ç/u,'&ccedil;') # &#231;
- @html.gsub!(/è/u,'&egrave;') # &#232;
- @html.gsub!(/é/u,'&eacute;') # &#233;
- @html.gsub!(/ê/u,'&ecirc;') # &#234;
- @html.gsub!(/ë/u,'&euml;') # &#235;
- @html.gsub!(/ì/u,'&igrave;') # &#236;
- @html.gsub!(/í/u,'&iacute;') # &#237;
- @html.gsub!(/î/u,'&icirc;') # &#238;
- @html.gsub!(/ï/u,'&iuml;') # &#239;
- @html.gsub!(/ð/u,'&eth;') # &#240;
- @html.gsub!(/ñ/u,'&ntilde;') # &#241;
- @html.gsub!(/ò/u,'&ograve;') # &#242;
- @html.gsub!(/ó/u,'&oacute;') # &#243;
- @html.gsub!(/ô/u,'&ocirc;') # &#244;
- @html.gsub!(/õ/u,'&otilde;') # &#245;
- @html.gsub!(/ö/u,'&ouml;') # &#246;
- @html.gsub!(/ø/u,'&oslash;') # &#248;
- @html.gsub!(/ù/u,'&ugrave;') # &#250;
- @html.gsub!(/ú/u,'&uacute;') # &#251;
- @html.gsub!(/û/u,'&ucirc;') # &#252;
- @html.gsub!(/ü/u,'&uuml;') # &#253;
- @html.gsub!(/þ/u,'&thorn;') # &#254;
- @html.gsub!(/ÿ/u,'&yuml;') # &#255;
- @html.gsub!(/ý/u,'&yacute;')
- @html
- end
- end
- class Tune
- @@dp=nil
- 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
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @env=SiSU_Env::Info_env.new(@md.fns)
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- #@utf8=SiSU_character_encode::UTF8 #.new
- end
- def songsheet
- begin
- @cX=SiSU_Screen::Ansi.new(@md.cmd).cX
- tell=SiSU_Screen::Ansi.new(@md.cmd,'Tune')
- tell.txt_grey unless @md.cmd =~/q/
- 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 |para|
- para.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0<a name="H#\1">#\1.</a>&nbsp;')
- @tuned_file << para
- end
- end
- def markup
- @tuned_file=[]
- @data.each do |para|
- #@utf8.new(para).html
- #@utf8.html(@para)
- para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>')
- para.gsub!(/#{Mx[:nbsp]}/,'&nbsp;')
- para.gsub!(/<(p|br)>/,'<\1 />')
- para=SiSU_HTML_Tune::Clean_html.new(para).clean
- @tuned_file << para
- end
- end
- def urls(data)
- @words=[]
- data.each do |word|
- @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/
- if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/
- m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures
- else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures
- d=''
- end
- case m
- when /\.png|\.jpg|\.gif|c=|\d+x\d+/
- w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external
- else @env.url.images_local
- end
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
- else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
- end
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/,ins)
- else
- link=m[/(.+)/m]
- png=m.scan(/\S+/)[0].strip
- link=link.strip
- ins=%{<a href="#{u}">#{link}</a>#{d}}
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins)
- end
- word
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def url_markup
- data=@data
- @tuned_file=[]
- data.each do |para|
- #para.gsub!(/#{Mx[:mk_o]}name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>')
- para.gsub!(/<-#>/,'')
- #para.gsub!(/<(p|br)>/,'<\1 />')
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- if para =~/<::\s+/ #watch
- para.gsub!(/<::\s+(\S+?)\s+!>/,
- %{<img src="#{@env.url.images}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0">})
- end
- if para =~/<:image\s+/
- para.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_local}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0"></a>})
- para.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/,
- %{<a href="\\1"><img src="#{@env.url.images_local}/\\2" naturalsizeflag="0" align="bottom" border="0"></a>})
- para.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_local}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0">})
- para.gsub!(/<:image\s+(\S+)\s+>/,
- %{<img src="#{@env.url.images_local}/\\1" naturalsizeflag="0" align="bottom" border="0">})
- end
- if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/
- @word_mode=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u)
- words=urls(@word_mode)
- para.gsub!(/.+/m,words)
- end
- if (para !~/^#{Mx[:meta_o]}|^#{Mx[:gr_o]}code#{Mx[:gr_c]}/)
- para.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
- if (para !~/\<:ad\s+\.\.\//)
- para.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
- %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- else
- para.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
- %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
- end
- para.gsub!(/!pick/, %{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">})
- para.gsub!(/!new/, %{&nbsp;<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">})
- para.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>')
- para.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to&nbsp;{&nbsp;\1&nbsp;}</a> ')
- if para =~/\b\S+\@\S+?\.\S+/ \
- and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/
- para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'&lt;<a href="mailto:\1">\1</a>&gt;')
- end
- para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
- para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
- if para =~/..\/\S+/ \
- and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
- para.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
- end
- para.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
- end
- else
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- @tuned_file << para
- end
- end
- def endnotes_html
- data=@data
- @tuned_file=[]
- data.each do |para|
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- para.gsub!(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched)
- para.gsub!(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
- end
- @tuned_file << para
- end
- end
- def output
- data=@data
- @tuned_file=[]
- data.each do |para|
- para.strip!
- para.chomp!
- @tuned_file << para
- end
- @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
- @tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/hub.rb b/lib/sisu/v1/hub.rb
deleted file mode 100644
index 39d06605..00000000
--- a/lib/sisu/v1/hub.rb
+++ /dev/null
@@ -1,590 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, text structuring,
- processing, publishing, search
-
-=end
-module SiSU
- require "#{SiSU_lib}/sysenv"
- include SiSU_Screen
- @@pwd=Dir.pwd
- class Op
- @@env=SiSU_Env::Info_env.new
- def initialize(opt,req,message)
- @opt,@req,@message=opt,req,message
- @n_do=0
- end
- def pod_output(fns_pod)
- dir_pwd=@@env.path.pwd
- dir_pod=@@env.sisupod_gen(fns_pod)
- Dir.chdir(dir_pod)
- content=Dir.glob("*.ss[mt]").join(' ')
- if content =~/\.ss[mt]/
- Dir.chdir(dir_pwd)
- @opt.fns=content #check
- system("cd #{dir_pod}
- sisu -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content}
- cd -
- ")
- end
- @pwd=`pwd`.strip
- Dir.chdir(@pwd)
- end
- def select
- require "#{SiSU_lib}/#@req"
- if @req =~/^conf$/ # -C
- SiSU_Initialize::Source.new(@opt).read
- end
- if not @opt.files.empty?
- @opt.files.each do |fns|
- env=SiSU_Env::Info_env.new(fns)
- if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/
- require "#{SiSU_lib}/remote" #check
- pod_name=SiSU_Remote::Remote_download.new(fns).pod.name
- tell=SiSU_Screen::Ansi.new(@opt.cmd,pod_name)
- tell.puts_blue unless @opt.cmd =~/q/
- @opt.files.shift
- pod_output(pod_name)
- break
- else
- put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
- @opt.fns=fns
- if @req !~/(?:urls|remote)$/
- if @req=~/^dal$/ \
- and FileTest.file?(@opt.fns) \
- and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- elsif FileTest.file?(env.source_file_with_path)
- case @opt.fns
- when /\.(?:(?:-|ssm\.)?sst|ssm)$/
- case @req
- when /^dal$/
- if fns =~ /\.ssm$/
- require "#{SiSU_lib}/composite" #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
- end
- SiSU_DAL::Source.new(@opt).read # -m
- when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w
- when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s
- when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read ## -S
- when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N
- when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -T
- #when /^air$/; SiSU_Air::Source.new(@opt).read # -A
- when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -a
- #when /^git$/; SiSU_Git::Source.new(@opt).read # -g
- #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g
- when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o
- when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O
- when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p
- when /^manpage$/; SiSU_manpage::Source.new(@opt).read # -i
- when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I
- #when /^plaintext_exp$/; SiSU_Plaintext_exp::Source.new(@opt).read # -j
- #when /^manpage_exp$/; SiSU_manpage_exp::Source.new(@opt).read # -J
- #when /^docbook$/; SiSU_Docbook::Source.new(@opt).read # -B
- when /^html$/; SiSU_HTML::Source.new(@opt).read # -h -H
- when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x
- when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X
- when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
- when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b
- when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m (image and other content)
- when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y
- when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y
- when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z
- when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- end
- @n_do=@n_do+1
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed")
- tell.files_processed unless @opt.cmd =~/q/
- ObjectSpace.garbage_collect
- else #print "not processed --> ", fns, "\n"
- end
- else
- Operations.new(@opt).not_found unless @req =~/^conf$/
- end
- elsif FileTest.file?(put)
- if @opt.mod.inspect !~/harvest/ #decide whether should permit harvest in single operation
- case @req
- when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
- when /^remote$/
- case @message
- when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
- when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R
- else #SiSU_Remote::Put.new(put,@opt.cmd).scp
- end
- end
- @n_do=@n_do+1
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed")
- tell.files_processed unless @opt.cmd =~/q/
- end
- else Operations.new(@opt).not_found
- end
- end
- end
- #SiSU_Remote::Put.new(@opt).rsync_harvest if @opt.cmd.inspect =~/R/ and @opt.mod.inspect =~/harvest/
- elsif @req =~/^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
- elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
- end
- Operations.new.counter
- end
- end
- class Operations
- @@n_do=0
- def initialize(opt='')
- @opt=opt
- @cX=SiSU_Screen::Ansi.new(@opt).cX
- end
- def counter
- @@n_do=0
- end
- def remote_put_base_site_rsync # -CR
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(@opt).rsync_base
- end
- def remote_put_base_site_rsync_match # -CCRZ
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(@opt).rsync_base_sync
- end
- def remote_put_base_site # -Cr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(@opt).scp_base
- end
- def remote_put_base_site_all # -CCr
-p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(@opt).scp_base_all
- end
- def cgi # -F
- require "#{SiSU_lib}/cgi"
- SiSU_CGI::SiSU_search.new(@opt).read
- end
- def encoding # -K build character encoding db (uses KirbyBase)
- require "#{SiSU_lib}/character_encoding"
- SiSU_character_encode::Create.new.db
- end
- def termsheet # -t
- system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
- @@n_do=@@n_do+1
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed')
- tell.term_sheet_title unless @opt.cmd =~/q/
- end
- def webrick # -W
- port=prt=@fns
- prt=if prt !~/\d+/
- 'webrick default (sysenv)'
- else "webrick port set to #{prt}"
- end
- puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
- system("sisu_webrick #{port}&\n")
- end
- def not_found
- puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
- end
- def convert_name_message(fns,type,i,o,rune)
- %{\nIn filename: "#{@cX.fuschia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuschia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.cmd} processing skipped\n}
- end
- def not_recognised
- case @opt.fns
- when /(\.s[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
- when /(\.r[123])$/
- type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
- rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
- puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
- puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.cmd} processing skipped\n}
- when /(\.ssi)$/
- puts "\n#{@cX.fuschia}component filetype:#{@cX.off} << #{@opt.fns} >> - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.cmd} processing skipped\n"
- else
- puts "\n#{@cX.fuschia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.cmd} processing skipped\n"
- end
- end
- end
- class Processing
- require 'fileutils'
- include FileUtils
- @@env=SiSU_Env::Info_env.new
- attr_accessor :op
- def initialize(opt)
- @opt=opt
- @msg,@msgs='',nil
- @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
- end
- def op(req,msg)
- Op.new(@opt,req,msg).select if req and msg
- end
- def actions
- if @opt.mod.inspect =~/--harvest/
- require "#{SiSU_lib}/harvest"
- end
- if @opt.mod.inspect =~/--convert|--to|--from/
- require "#{SiSU_lib}/sst_convert_markup"
- end
- if @opt.cmd =~/([AabCcDdFfGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \
- and @opt.cmd =~/^-/ \
- and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and
- @@tell=SiSU_Screen::Ansi.new(@opt.cmd)
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- flag=SiSU_Env::Info_processing_flag.new
- extra=''
- if @opt.cmd !~/[mn]/
- extra+=if @opt.cmd =~/[abghHhIiJjNOoptTwXxz]/ \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- elsif ((@opt.cmd =~/[Dd]/ \
- or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
- and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- else ''
- end
- end
- if @opt.cmd !~/y/
- extra+=if @opt.cmd =~/[abehHhIiJjNopsSstwXxz]/ \
- and @opt.cmd !~/y/
- 'y' #% add manifest
- elsif (@opt.cmd =~/[Dd]/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
- and @opt.files[0] !~/^remove$/ \
- and @opt.cmd !~/y/
- 'y' #% add manifest
- else ''
- end
- end
- @opt.cmd=@opt.cmd + extra
- if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
- SiSU_Help::Help.new('env',@opt).environment
- else SiSU_Help::Help.new('env',@opt).sisu_version
- end
- end
- if @opt.cmd =~/^-L$/ #% version information
- SiSU_Help::Help.new('license',@opt).help_request
- end
- if @opt.cmd =~/m/i #% -m for -C
- path={}
- path[:css]=@@env.path.output + '/_sisu/css'
- path[:xml]=@@env.path.output + '/_sisu/xml'
- path[:xsd]=path[:xml] + '/xsd'
- path[:xsd]=path[:xml] + '/rnc'
- path[:xsd]=path[:xml] + '/rng'
- #path_dtd="#{@@env.path.output}/_sisu/xml/dtd"
- re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip|[^\/]+?\.ssp)$/
- unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line
- unless ( FileTest.directory?(path[:css]) \
- and FileTest.directory?(path[:xsd]) )
- @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
- end
- if @opt.cmd =~/M/
- $VERBOSE=false #debug $VERBOSE=true
- # -M test other expected directories including images
- end
- end
- end
- if @opt.cmd =~/C/ #% -C initialize/configure
- op('conf','configure site')
- if @opt.cmd =~/R/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/RZ/
- Operations.new(@opt).remote_put_base_site_rsync_match
- else Operations.new(@opt).remote_put_base_site_rsync
- end
- elsif @opt.cmd =~/r/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/CCr/
- Operations.new(@opt).remote_put_base_site_all
- else Operations.new(@opt).remote_put_base_site
- end
- end
- end
- if @opt.cmd =~/F/ #% -F cgi sample search form
- Operations.new(@opt).cgi
- end
- if @opt.cmd =~/W/ #% -W webrick #@argv==port
- Operations.new(@opt).webrick
- end
- if @opt.cmd =~/k/ #% -k dummy, build character encoding table
- #Operations.new(@opt.cmd).encoding
- end
- if @opt.cmd =~/Z/ #% -Z wipe previous output clean
- op('zap','Zap, deletions')
- end
- if @opt.cmd =~/s/ #% -s sisu source
- op('share_src','SiSU markup source')
- end
- if @opt.cmd =~/m/ #% -m is remote url requested? (download if)
- @retry_count= -1
- begin
- path_image='./_sisu/processing/external_document/image'
- path_skin='./_sisu/processing/external_document/skin/doc'
- @get_s,@get_p=[],[]
- re_s=/((?:https?|file):\/\/\S+?\.sst)$/
- re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/
- @opt.files.each do |fns|
- if fns =~re_s
- @get_s << re_s.match(fns)[1] if re_s
- end
- if fns =~re_p
- @get_p << re_p.match(fns)[1] if re_p
- end
- end
- if @get_s.length > 0 #% remote markup file .sst
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Get.new(@opt,@get_s).fns
- Operations.new.counter
- end
- if @get_p.length > 0 #% remote sisupod
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Get.new(@opt,@get_p).sisupod
- end
- rescue
- SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok
- @retry_count +=1
- retry unless @retry_count > 1
- ensure
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
- end
- if @opt.cmd=~/m/ #% -m dal
- op('dal','dal')
- end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
- if @opt.cmd =~/S/
- op('sisupod_make','sisupod (zip)') #% -S make sisupod
- if @opt.fns=~/\.kdi._sst/
- op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source
- end
- end
- if @opt.cmd =~/N/; op('digests','digests') #% -N digest tree
- end
- if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css
- end
- #if @opt.cmd =~/A/; op('air','air') #% #-A
- #end
- if @opt.cmd =~/a/; op('plaintext','plaintext') #% -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
- end
- #if @opt.cmd =~/g/; op('git','git') #% -g git
- #end
- #if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki
- #end
- if @opt.cmd =~/o/; op('odf','OpenDocument') #% -o opendocument
- end
- if @opt.cmd =~/x/; op('xml','xml sax') #% -x xml sax type
- end
- if @opt.cmd =~/X/; op('xml_dom','xml dom') #% -X xml dom type
- end
- if @opt.cmd =~/f/; op('xml_fictionbook','xml fictionbook') #% -f xml fictionbook
- end
- if @opt.cmd =~/b/; op('xhtml','xhtml sax') #% -b xhtml sax type
- end
- #if @opt.cmd =~/B/; op('docbook','docbook xml') #% -B docbook xml
- #end
- if @opt.cmd =~/w/; op('concordance','Concordance') #% -w concordance
- end
- if @opt.cmd =~/O/; op('xml_md_oai_pmh_dc','OAI PMH') #% -O open archive initiative, metadata harvesting
- end
- if @opt.cmd =~/t/ #% -t termsheet/standard form
- SiSU_Help::Help.new('termsheet').help_request
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- case @opt.fns
- when /\.(termsheet.rb)$/; Operations.new(@opt).termsheet
- else #print "not processed --> ", fns, "\n"
- end
- else Operations.new(@opt).not_found
- end
- end
- Operations.new.counter
- end
- if @opt.cmd =~/T/; op('xml_scaffold','XML scaffold') #% -T temporary tests
- end
- if @opt.cmd =~/p/; op('texpdf','LaTeX pdf') #% -p latex/ texpdf
- end
- if @opt.cmd =~/i/; op('manpage','manpage') #% -i manpage
- end
- if @opt.cmd =~/I/; op('texinfo','TeX Info') #% -I texinfo (i taken by db import)
- end
- #if @opt.cmd =~/j/; op('plaintext_exp','plaintext exp') #% -j plaintext
- #end
- #if @opt.cmd =~/J/; op('manpage_exp','manpage exp') #% -J manpage
- #end
- if @opt.cmd =~/D/ \
- or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
- end
- if @opt.cmd =~/d/ \
- or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
- end
- if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
- end
- if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
- end
- if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
- end
- if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
- end
- if @opt.mod.inspect !~/--harvest/
- if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
- end
- if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
- end
- else
- #if @opt.cmd =~/R/; op('remote','rsync_harvest') #% -R copy to remote server
- #end
- end
- if @opt.cmd =~/[QuUvVM]/; op('urls','urls') #% -Q -u -v -V -M urls
- end
- @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil
- @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
- if defined? @@env.path.processing \
- and FileTest.directory?(@@env.path.processing) \
- and @@env.path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
- cd(@@env.path.processing_base_tmp) do
- rm_rf(@@env.user) unless @opt.cmd =~/M/
- end end
- elsif @opt.mod.inspect =~/--query/
- require "#{SiSU_lib}/sst_identify_markup"
- puts SiSU_Markup::Markup_history.new(@opt).query
- elsif @opt.mod.inspect =~/--identify/
- require "#{SiSU_lib}/sst_identify_markup"
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
- elsif @opt.mod.inspect =~/--about/ #% help instructions
- if @opt.mod.inspect =~/--about/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what,'color_off').help_request
- else SiSU_Help::Help.new('list','color_off').help_request
- end
- elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
- require "#{SiSU_lib}/sitemaps"
- SiSU_Sitemaps::Source.new(@opt).read
- if @opt.cmd =~/R/
- require "#{SiSU_lib}/remote"
- SiSU_Remote::Put.new(@opt).rsync_sitemaps
- end
- else #% help instructions
- unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/
- if @opt.mod.inspect =~/--help/ \
- and not @opt.what.empty?
- SiSU_Help::Help.new(@opt.what).help_request
- elsif @opt.mod.inspect =~/--help/; SiSU_Help::Help.new('list').help_request
- else SiSU_Help::Help.new('env',@opt).sisu_version
- tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n <http://www.jus.uio.no/sisu/>\n <http://sisudoc.org/>"); tell.puts_grey
- end
- end
- end
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\S+?\.ssp)$/
- if @opt.fns=~/\.kdi$/ \
- and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
- elsif @opt.fns=~/\.sx[sdn]\.xml$/ \
- and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
- elsif @opt.fns=~/\.ssi$/ \
- and @opt.mod.inspect =~/--identify/
- else Operations.new(@opt).not_recognised
- end
- end
- if @opt.fns =~/\.ssm\.sst$/ \
- and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
- @msg,@msgs='temporary file removed',nil
- @tell.call.warn unless @opt.cmd =~/V/
- File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
- end
- else #Operations.new(fns,'html').not_found
- end
- end
- end
- end
- begin #% select what to do
- if RUBY_VERSION < '1.9'
- require 'jcode'
- $KCODE='UTF8'
- end
- require "#{SiSU_lib}/constants"
- require "#{SiSU_lib}/options"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- require "#{SiSU_lib}/param"
- include SiSU_Param
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/help"
- include SiSU_Help
- require 'uri'
- home=ENV['HOME']
- argv=$*
- @opt=SiSU_commandline::Options.new(argv)
- Processing.new(@opt).actions
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix
- ensure
- Dir.chdir(@@pwd)
- end
-end
-__END__
diff --git a/lib/sisu/v1/i18n.rb b/lib/sisu/v1/i18n.rb
deleted file mode 100644
index a41561fb..00000000
--- a/lib/sisu/v1/i18n.rb
+++ /dev/null
@@ -1,1605 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: internationalisation
-
-=end
-module SiSU_Translate
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- class Source
- def initialize(md,doc_lang,trans_str='')
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- @lang_class=case @doc_lang
- when /American/i; English.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2
- when /English/i; English.new(md,doc_lang,trans_str)
- when /French/i; French.new(md,doc_lang,trans_str)
- when /German/i; German.new(md,doc_lang,trans_str)
- when /Italian/i; Italian.new(md,doc_lang,trans_str)
- when /Spanish/i; Spanish.new(md,doc_lang,trans_str)
- when /Brazilian(?: Portuguese)?/i; Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2
- when /Portuguese/i; Portuguese.new(md,doc_lang,trans_str)
- when /Swedish/i; Swedish.new(md,doc_lang,trans_str)
- when /Danish/i; Danish.new(md,doc_lang,trans_str)
- when /Finnish/i; Finnish.new(md,doc_lang,trans_str)
- when /Norwegian/i; Norwegian.new(md,doc_lang,trans_str)
- when /Icelandic/i; Icelandic.new(md,doc_lang,trans_str)
- when /Dutch/i; Dutch.new(md,doc_lang,trans_str)
- when /Estonian/i; Estonian.new(md,doc_lang,trans_str)
- when /Hungarian/i; Hungarian.new(md,doc_lang,trans_str)
- when /Polish/i; Polish.new(md,doc_lang,trans_str)
- when /Romanian/i; Romanian.new(md,doc_lang,trans_str)
- when /Russian/i; Russian.new(md,doc_lang,trans_str)
- when /Greek/i; Greek.new(md,doc_lang,trans_str)
- when /Ukranian/i; Ukranian.new(md,doc_lang,trans_str)
- when /Turkish/i; Turkish.new(md,doc_lang,trans_str)
- when /Slovenian/i; Slovenian.new(md,doc_lang,trans_str)
- when /Croatian/i; Croatian.new(md,doc_lang,trans_str)
- when /Slovak(?:ian)?/i; Slovak.new(md,doc_lang,trans_str)
- when /Czech/i; Czech.new(md,doc_lang,trans_str)
- when /Bulgarian/i; Bulgarian.new(md,doc_lang,trans_str)
- else English.new(md,doc_lang,trans_str)
- end
- end
- def filename
- @lang_class.filename
- end
- def description
- @lang_class.description
- end
- def metadata
- @lang_class.metadata
- end
- def filetype_description
- @lang_class.filetype_description
- end
- def file_size
- @lang_class.file_size
- end
- def sourcefile
- @lang_class.sourcefile
- end
- def sourcefile_digest
- @lang_class.sourcefile_digest
- end
- def full_title #dc
- @lang_class.full_title
- end
- def title
- @lang_class.title
- end
- def subtitle
- @lang_class.subtitle
- end
- def author
- @lang_class.author
- end
- def contributor
- @lang_class.contributor
- end
- def translator
- @lang_class.translator
- end
- def illustrator
- @lang_class.illustrator
- end
- def publisher
- @lang_class.publisher
- end
- def prepared_by
- @lang_class.prepared_by
- end
- def digitized_by
- @lang_class.digitized_by
- end
- def subject
- @lang_class.subject
- end
- def description #dc (watch)
- @lang_class.description
- end
- def abstract
- @lang_class.abstract
- end
- def type
- @lang_class.type
- end
- def rights
- @lang_class.rights
- end
- def digitized_by
- @lang_class.digitized_by
- end
- def date
- @lang_class.date
- end
- def date_created
- @lang_class.date_created
- end
- def date_available
- @lang_class.date_available
- end
- def date_valid
- @lang_class.date_valid
- end
- def date_modified
- @lang_class.date_modified
- end
- def date_issued
- @lang_class.date_issued
- end
- def language
- @lang_class.language
- end
- def language_original
- @lang_class.language_original
- end
- def format
- @lang_class.format
- end
- def identifier
- @lang_class.identifier
- end
- def source
- @lang_class.source
- end
- def relation
- @lang_class.relation
- end
- def coverage
- @lang_class.coverage
- end
- def keywords
- @lang_class.keywords
- end
- def comments
- @lang_class.comments
- end
- def cls_loc
- @lang_class.cls_loc
- end
- def cls_dewey
- @lang_class.cls_dewey
- end
- def cls_gutenberg
- @lang_class.cls_gutenberg
- end
- def cls_isbn
- @lang_class.cls_isbn
- end
- def prefix_a
- @lang_class.prefix_a
- end
- def prefix_b
- @lang_class.prefix_b
- end
- def topic_register
- @lang_class.topic_register
- end
- def fns
- @lang_class.fns
- end
- def word_count
- @lang_class.word_count
- end
- def dgst
- @lang_class.dgst
- end
- def sc_number
- @lang_class.sc_number
- end
- def sc_date
- @lang_class.sc_date
- end
- def last_generated
- @lang_class.last_generated
- end
- def sisu_version
- @lang_class.sisu_version
- end
- def ruby_version
- @lang_class.ruby_version
- end
- def suggested_links
- @lang_class.suggested_links
- end
- def language_version_list
- @lang_class.language_version_list
- end
- def language
- @lang_class.language
- end
- def manifest_description
- @lang_class.manifest_description
- end
- def manifest_description_output
- @lang_class.manifest_description_output
- end
- def manifest_description_metadata
- @lang_class.manifest_description_metadata
- end
- def language_list_translated
- @lang_class.language_list
- end
- def language_list
- lang=case @trans_str
- when /American/i; 'American English' # tag depreciated, see iso 639-2
- when /English/i; 'English'
- when /French/i; 'français'
- when /German/i; 'Deutsch'
- when /Italian/i; 'Italiano'
- when /Spanish/i; 'español'
- when /Brazilian(?: Portuguese)?/i; 'Brazilian Português' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Português'
- when /Swedish/i; 'svenska'
- when /Danish/i; 'dansk'
- when /Finnish/i; 'suomi'
- when /Norwegian/i; 'norsk'
- when /Icelandic/i; 'Icelandic'
- when /Dutch/i; 'Nederlands'
- when /Estonian/i; 'Estonian'
- when /Hungarian/i; 'Hungarian'
- when /Polish/i; 'polski'
- when /Romanian/i; 'română'
- when /Russian/i; 'Русский (Russkij)'
- when /Greek/i; 'Ελληνικά (Ellinika)'
- when /Ukranian/i; 'українська (ukrajins\'ka)'
- when /Turkish/i; 'Türkçe'
- when /Slovenian/i; 'Slovenian'
- when /Croatian/i; 'Croatian'
- when /Slovak(?:ian)?/i; 'slovensky' #slovensky ?
- when /Czech/i; 'česky'
- when /Bulgarian/i; 'Български (Bəlgarski)'
- when /Japanese/i; '日本語 (Nihongo)'
- when /Korean/i; '한국어 (Hangul)'
- #when /Catalan/i; 'català'
- else 'English'
- end
- #check on 中文 and عربي
- end
- end
- class English
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'filename'
- end
- def description
- 'description'
- end
- def filetype_description
- 'filetype description'
- end
- def metadata
- 'metadata'
- end
- def file_size
- 'file size'
- end
- def full_title #dc
- 'Title'
- end
- def title
- 'Title'
- end
- def subtitle
- 'Subtitle'
- end
- def author
- 'Author'
- end
- def author #dc
- 'Creator'
- end
- def contributor #dc
- 'Contributor'
- end
- def translator
- 'Translator'
- end
- def illustrator
- 'Illustrator'
- end
- def publisher #dc
- 'Publisher'
- end
- def prepared_by
- 'Prepared by'
- end
- def digitized_by
- 'Digitized by'
- end
- def subject #dc
- 'Subject'
- end
- def description #dc (watch)
- 'Description'
- end
- def abstract #dc
- 'Abstract'
- end
- def type #dc
- 'Type'
- end
- def rights #dc
- 'Rights'
- end
- def date #dc
- 'Date'
- end
- def date_created #dc
- 'Date created'
- end
- def date_issued #dc
- 'Date issued'
- end
- def date_available #dc
- 'Date available'
- end
- def date_modified #dc
- 'Date modified'
- end
- def date_valid #dc
- 'Date valid'
- end
- def language #dc
- 'Language'
- end
- def language_original
- 'Original Language'
- end
- def format #dc
- 'Format'
- end
- def identifier #dc
- 'Identifier'
- end
- def source #dc
- 'Source'
- end
- def relation #dc
- 'Relation'
- end
- def coverage #dc
- 'Coverage'
- end
- def keywords
- 'Keywords'
- end
- def comments
- 'Comments'
- end
- def cls_loc
- 'Classify Library of Congress'
- end
- def cls_dewey
- 'Classify Dewey'
- end
- def cls_gutenberg
- 'Classify Project Gutenberg'
- end
- def cls_isbn
- 'Classify ISBN'
- end
- def prefix_a
- 'Prefix (a)'
- end
- def prefix_b
- 'Prefix (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Sourcefile'
- end
- def word_count
- 'Word Count approximate'
- end
- def sourcefile_digest
- 'Sourcefile Digest'
- end
- def digest_md5
- 'Sourcefile Digest (md5)'
- end
- def digest_sha256
- 'Sourcefile Digest (sha256)'
- end
- def sc_number
- 'Document (RCS/CVS) number'
- end
- def sc_date
- 'Document (RCS/CVS) number'
- end
- def last_generated
- 'Document (metaverse) last generated'
- end
- def sisu_version
- 'Generated by'
- end
- def ruby_version
- 'Ruby version'
- end
- def suggested_links
- 'metadata suggested links'
- end
- def language_version_list
- 'Document Language Versions, manifests'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'Available document filetypes'
- end
- def manifest_description_metadata
- 'Document Metadata'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'American English' # tag depreciated, see iso 639-2
- when /English/i; 'English'
- when /French/i; 'French'
- when /German/i; 'German'
- when /Italian/i; 'Italian'
- when /Spanish/i; 'Spanish'
- when /Brazilian(?: Portuguese)?/i; 'Brazilian Portuguese' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portuguese'
- when /Swedish/i; 'Swedish'
- when /Danish/i; 'Danish'
- when /Finnish/i; 'Finnish'
- when /Norwegian/i; 'Norwegian'
- when /Icelandic/i; 'Icelandic'
- when /Dutch/i; 'Dutch'
- when /Estonian/i; 'Estonian'
- when /Hungarian/i; 'Hungarian'
- when /Polish/i; 'Polish'
- when /Romanian/i; 'Romanian'
- when /Russian/i; 'Russian'
- when /Greek/i; 'Greek'
- when /Ukranian/i; 'Ukranian'
- when /Turkish/i; 'Turkish'
- when /Slovenian/i; 'Slovenian'
- when /Croatian/i; 'Croatian'
- when /Slovak(?:ian)?/i; 'Slovakian'
- when /Czech/i; 'Czech'
- when /Bulgarian/i; 'Bulgarian'
- else @trans_str
- end
- end
- end
- class French
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'nom de fichier'
- end
- def description
- 'description'
- end
- def filetype_description
- description
- end
- def metadata
- 'metadonnées'
- end
- def file_size
- 'taille'
- end
- def full_title #dc
- 'Titre'
- end
- def title
- 'Titre'
- end
- def subtitle
- 'Sous titre'
- end
- def author
- 'Auteur'
- end
- def author #dc
- 'Auteur'
- end
- def contributor #dc
- 'Contributeur'
- end
- def translator
- 'Traducteur'
- end
- def illustrator
- 'Illustrateur'
- end
- def publisher #dc
- 'Éditeur'
- end
- def prepared_by
- 'Préparé par'
- end
- def digitized_by
- 'Numérisé par'
- end
- def subject #dc
- 'Sujet'
- end
- def description #dc (watch)
- 'Description'
- end
- def abstract #dc
- 'Résumé'
- end
- def type #dc
- 'Type'
- end
- def rights #dc
- 'Droits relatifs à la ressource'
- end
- def date #dc
- 'Date'
- end
- def date_created #dc
- 'Date de création'
- end
- def date_issued #dc
- 'Date de publication'
- end
- def date_available #dc
- 'Date de mise à disposition'
- end
- def date_modified #dc
- 'Date de modification'
- end
- def date_valid #dc
- 'Date de validité'
- end
- def language #dc
- 'Langue'
- end
- def language_original
- 'Langue originale'
- end
- def format #dc
- 'Format'
- end
- def identifier #dc
- 'Identifiant'
- end
- def source #dc
- 'Source'
- end
- def relation #dc
- 'Lien'
- end
- def coverage #dc
- 'Portée du document'
- end
- def keywords
- 'Mots clef'
- end
- def comments
- 'Commentaires'
- end
- def cls_loc
- 'Classification de la bibliothèque du congres'
- end
- def cls_dewey
- 'Classification Dewey'
- end
- def cls_gutenberg
- 'Classification du project Gutenberg'
- end
- def cls_isbn
- 'Classification ISBN'
- end
- def prefix_a
- 'Préfixe (a)'
- end
- def prefix_b
- 'Préfixe (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Fichier source'
- end
- def word_count
- 'Nombre approximatif de mots'
- end
- def sourcefile_digest
- 'Condensé du fichier source'
- end
- def digest_md5
- 'Condensé du fichier source (md5)'
- end
- def digest_sha256
- 'Condensé du fichier source (sha256)'
- end
- def sc_number
- 'Numéro (RCS/CVS) du document'
- end
- def sc_date
- 'Numéro (RCS/CVS) du document'
- end
- def last_generated
- 'Dernière production du document (metaverse)'
- end
- def sisu_version
- 'Généré par'
- end
- def ruby_version
- 'Version de Ruby'
- end
- def suggested_links
- 'Liens suggérés'
- end
- def language_version_list
- 'Versions des langues du document, manifestes'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'Manifeste SiSU du document généré'
- end
- def manifest_description_metadata
- 'Manifeste SiSU des métadonnées du document'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Anglais americain' # tag depreciated, see iso 639-2
- when /English/i; 'Anglais'
- when /French/i; 'Français'
- when /German/i; 'Allemand'
- when /Italian/i; 'Italien'
- when /Spanish/i; 'Espagnol'
- when /Brazilian(?: Portuguese)?/i; 'Portugais brésilien' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portugais'
- when /Swedish/i; 'Suédois'
- when /Danish/i; 'Danois'
- when /Finnish/i; 'Finnois'
- when /Norwegian/i; 'Norvégien'
- when /Icelandic/i; 'Islandais'
- when /Dutch/i; 'Néerlandais'
- when /Estonian/i; 'Estonien'
- when /Hungarian/i; 'Hongrois'
- when /Polish/i; 'Polonais'
- when /Romanian/i; 'Roumain'
- when /Russian/i; 'Russe'
- when /Greek/i; 'Grec'
- when /Ukranian/i; 'Ukrainien'
- when /Turkish/i; 'Turc'
- when /Slovenian/i; 'Slovène'
- when /Croatian/i; 'Croate'
- when /Slovak(?:ian)?/i; 'Slovaque'
- when /Czech/i; 'Tcheque'
- when /Bulgarian/i; 'Bulgare'
- else @trans_str
- end
- end
- end
- class German
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'Dateiname'
- end
- def description
- 'Beschreibung'
- end
- def filetype_description
- description
- end
- def metadata
- 'Metadata'
- end
- def file_size
- 'Dateigrösse'
- end
- def full_title #dc
- 'Titel'
- end
- def title
- 'Titel'
- end
- def subtitle
- 'Untertitel'
- end
- def author
- 'Autor'
- end
- def contributor #dc
- 'Mitautor'
- end
- def translator
- 'Übersetzung'
- end
- def illustrator
- 'Illustrator'
- end
- def publisher
- 'Herausgeber'
- end
- def prepared_by
- 'gesetzt von'
- end
- def digitized_by
- 'digitalisiert von'
- end
- def subject
- 'Titel'
- end
- def description #dc (watch)
- 'Beschreibung'
- end
- def abstract #dc
- 'Abstract'
- end
- def type
- 'Typ'
- end
- def rights
- 'Rechte'
- end
- def date
- 'Datum'
- end
- def date_created
- 'Erstellung'
- end
- def date_issued
- 'Herausgabe'
- end
- def date_available
- 'Veröffentlichung'
- end
- def date_modified
- 'Modifikation'
- end
- def date_valid
- 'Gültigkeit'
- end
- def language
- 'Sprache'
- end
- def language_original
- 'Ursprungssprache'
- end
- def format #dc
- 'Format'
- end
- def identifier #dc
- 'Bezeichnung'
- end
- def source #dc
- 'Quelle'
- end
- def relation #dc
- 'Beziehung'
- end
- def coverage #dc
- 'Eingrenzung'
- end
- def keywords
- 'Schlüsselwörter'
- end
- def comments
- 'Kommentare'
- end
- def cls_loc
- 'Klassifikation nach Library of Congress'
- end
- def cls_dewey
- 'Klassifikation nach Dewey'
- end
- def cls_gutenberg
- 'Klassifikation nach Projekt Gutenberg'
- end
- def cls_isbn
- 'Klassifikation nach ISBN'
- end
- def prefix_a
- 'Präfix (a)'
- end
- def prefix_b
- 'Präfix (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Quelldatei'
- end
- def word_count
- 'Anzahl Wörter'
- end
- def sourcefile_digest
- 'Quelldatei Digest'
- end
- def digest_md5
- 'Prüfsumme der Quelldatei (MD5)'
- end
- def digest_sha256
- 'Prüfsumme der Quelldatei (SHA256)'
- end
- def sc_number
- 'Dokumentversion (RCS/CVS)'
- end
- def sc_date
- 'Dokumentdatum (RCS/CVS)'
- end
- def last_generated
- 'Letzte Erstellung (metaverse)'
- end
- def sisu_version
- 'erstellt bei'
- end
- def ruby_version
- 'Ruby Version'
- end
- def suggested_links
- 'empfohlene Links'
- end
- def language_version_list
- 'verfügbare Sprachen'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'SiSU Zusammenfassung des Dokumentes'
- end
- def manifest_description_metadata
- 'SiSU Zusammenfassung der Metadaten'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Amerikanisch-Englisch' # tag depreciated, see iso 639-2
- when /English/i; 'Englisch'
- when /French/i; 'Französisch'
- when /German/i; 'Deutsch'
- when /Italian/i; 'Italienisch'
- when /Spanish/i; 'Spanisch'
- when /Brazilian(?: Portuguese)?/i; 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portugiesisch'
- when /Swedish/i; 'Schwedisch'
- when /Danish/i; 'Dänisch'
- when /Finnish/i; 'Finnisch'
- when /Norwegian/i; 'Norwegisch'
- when /Icelandic/i; 'Isländisch'
- when /Dutch/i; 'Niederländisch'
- when /Estonian/i; 'Estnisch'
- when /Hungarian/i; 'Ungarisch'
- when /Polish/i; 'Polnisch'
- when /Romanian/i; 'Rumänisch'
- when /Russian/i; 'Russisch'
- when /Greek/i; 'Griechisch'
- when /Ukranian/i; 'Ukrainisch'
- when /Turkish/i; 'Türkisch'
- when /Slovenian/i; 'Slovenisch'
- when /Croatian/i; 'Kroatisch'
- when /Slovak(?:ian)?/i; 'Slovakisch'
- when /Czech/i; 'Tschechisch'
- when /Bulgarian/i; 'Bulgarisch'
- else @trans_str
- end
- end
- end
- class Spanish
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'nombre del fichero'
- end
- def description
- 'descripción'
- end
- def filetype_description
- description
- end
- def metadata
- 'metadatos'
- end
- def file_size
- 'tamaño del fichero'
- end
- def full_title #dc
- 'Título'
- end
- def title
- 'Título'
- end
- def subtitle
- 'Subtítulo'
- end
- def author #dc
- 'Creador'
- end
- def contributor #dc
- 'Contribuidor'
- end
- def translator
- 'Traductor'
- end
- def illustrator
- 'Ilustrador'
- end
- def publisher #dc
- 'Editor'
- end
- def prepared_by
- 'Preparado por'
- end
- def digitized_by
- 'Digitalizado por'
- end
- def subject #dc
- 'Asunto'
- end
- def description #dc (watch)
- 'Descripción'
- end
- def abstract #dc
- 'Resumen'
- end
- def type #dc
- 'Tipo'
- end
- def rights #dc
- 'Derechos'
- end
- def date #dc
- 'Fecha'
- end
- def date_created #dc
- 'Fecha de creación'
- end
- def date_issued #dc
- 'Fecha de publicación'
- end
- def date_available #dc
- 'Fecha de disponibilidad'
- end
- def date_modified #dc
- 'Fecha de modificación'
- end
- def date_valid #dc
- 'Fecha de valided'
- end
- def language #dc
- 'Idioma'
- end
- def language_original
- 'Lenguaje original'
- end
- def format #dc
- 'Formato'
- end
- def identifier #dc
- 'Identificador'
- end
- def source #dc
- 'Fuente'
- end
- def relation #dc
- 'Relación'
- end
- def coverage #dc
- 'Cobertura'
- end
- def keywords
- 'Palabras claves'
- end
- def comments
- 'Comentarios'
- end
- def cls_loc
- 'Clasificación Biblioteca del Congreso'
- end
- def cls_dewey
- 'Clasificación Dewey'
- end
- def cls_gutenberg
- 'Clasificación Proyecto Gutenberg'
- end
- def cls_isbn
- 'Clasificación ISBN'
- end
- def prefix_a
- 'Prefijo (a)'
- end
- def prefix_b
- 'Prefijo (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Fichero fuente'
- end
- def word_count
- 'Número de palabras apróximado'
- end
- def sourcefile_digest
- 'Resumen del fichero fuente'
- end
- def digest_md5
- 'Resumen del fichero fuente (md5)'
- end
- def digest_sha256
- 'Resumen del fichero fuente (sha256)'
- end
- def sc_number
- 'Versión (RCS/CVS) del documento'
- end
- def sc_date
- 'Versión (RCS/CVS) del documento'
- end
- def last_generated
- 'Última generación (metaverse) del documento'
- end
- def sisu_version
- 'Generado por'
- end
- def ruby_version
- 'Versión de Ruby'
- end
- def suggested_links
- 'enlaces sugeridos de metadatos'
- end
- def language_version_list
- 'Document Language Versions, manifests'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'Manifiesto SiSU de salida generada'
- end
- def manifest_description_metadata
- 'Manifiesto SiSU de metadatos de documento'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2
- when /English/i; 'Inglés'
- when /French/i; 'Francés'
- when /German/i; 'Alemán'
- when /Italian/i; 'Italiano'
- when /Spanish/i; 'Español'
- when /Brazilian(?: Portuguese)?/i; 'Portugués de Brasil' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portugués'
- when /Swedish/i; 'Sueco'
- when /Danish/i; 'Danés'
- when /Finnish/i; 'Finés'
- when /Norwegian/i; 'Noruego'
- when /Icelandic/i; 'Islandés'
- when /Dutch/i; 'Holandés'
- when /Estonian/i; 'Estonio'
- when /Hungarian/i; 'Húngaro'
- when /Polish/i; 'Polaco'
- when /Romanian/i; 'Rumano'
- when /Russian/i; 'Ruso'
- when /Greek/i; 'Griego'
- when /Ukranian/i; 'Ucraniano'
- when /Turkish/i; 'Turco'
- when /Slovenian/i; 'Eslovaco'
- when /Croatian/i; 'Croata'
- when /Slovak(?:ian)?/i; 'Eslovaco'
- when /Czech/i; 'Checo'
- when /Bulgarian/i; 'Búlgaro'
- else @trans_str
- end
- end
- end
- class Italian
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'nome del file'
- end
- def description
- 'descrizione'
- end
- def filetype_description
- description
- end
- def metadata
- 'metadati'
- end
- def file_size
- 'dimensione'
- end
- def full_title #dc
- 'Titolo'
- end
- def title
- 'Titolo'
- end
- def subtitle
- 'Sottotitolo'
- end
- def author #dc
- 'Autore'
- end
- def contributor #dc
- 'Contributore'
- end
- def translator
- 'Traduttore'
- end
- def illustrator
- 'Illustratore'
- end
- def publisher #dc
- 'Casa editrice'
- end
- def prepared_by
- 'Preparato da'
- end
- def digitized_by
- 'Convertito in digitale da'
- end
- def subject #dc
- 'Oggetto'
- end
- def description #dc (watch)
- 'Descrizione'
- end
- def abstract #dc
- 'Abstract'
- end
- def type #dc
- 'Tipo'
- end
- def rights #dc
- 'Diritti del lettore'
- end
- def date #dc
- 'Data'
- end
- def date_created #dc
- 'Data di creazione'
- end
- def date_issued #dc
- 'Data di pubblicazione'
- end
- def date_available #dc
- 'Data di effettiva disponibilità'
- end
- def date_modified #dc
- 'Data di ultima modifica'
- end
- def date_valid #dc
- 'Data di inizo validità'
- end
- def language #dc
- 'Lingua'
- end
- def language_original
- 'Lingua originale'
- end
- def format #dc
- 'Formato'
- end
- def identifier #dc
- 'Indentificatore'
- end
- def source #dc
- 'Fonte'
- end
- def relation #dc
- 'Collegamento'
- end
- def coverage #dc
- 'Ambito'
- end
- def keywords
- 'Parole chiave'
- end
- def comments
- 'Commenti'
- end
- def cls_loc
- 'Classificazione della Library of Congress'
- end
- def cls_dewey
- 'Classificazione Dewey'
- end
- def cls_gutenberg
- 'Classificazione del Progetto Gutenberg'
- end
- def cls_isbn
- 'Numero ISBN'
- end
- def prefix_a
- 'Premessa (a)'
- end
- def prefix_b
- 'Premessa (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Sorgente'
- end
- def word_count
- 'Numero approssimativo di parole'
- end
- def sourcefile_digest
- 'Checksum file sorgente'
- end
- def digest_md5
- 'Checksum file sorgente (md5)'
- end
- def digest_sha256
- 'Checksum file sorgente (sha256)'
- end
- def sc_number
- 'Numero di revisione (RCS/CVS)'
- end
- def sc_date
- 'Numero di revisione (RCS/CVS)'
- end
- def last_generated
- 'Data di ultima generazione (dal metaverse)'
- end
- def sisu_version
- 'Generato da'
- end
- def ruby_version
- 'Ruby versione'
- end
- def suggested_links
- 'Link suggeriti'
- end
- def language_version_list
- 'Traduzioni disponibili'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'Inventario SiSU dell\'output generato'
- end
- def manifest_description_metadata
- 'Inventario SiSU dei metadati'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Inglese USA' # tag depreciated, see iso 639-2
- when /English/i; 'Inglese'
- when /French/i; 'Francese'
- when /German/i; 'Tedesco'
- when /Italian/i; 'Italiano'
- when /Spanish/i; 'Spagnolo'
- when /Brazilian(?: Portuguese)?/i; 'Portoguese (Brasile)' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portoguese'
- when /Swedish/i; 'Svedese'
- when /Danish/i; 'Danese'
- when /Finnish/i; 'Finlandese'
- when /Norwegian/i; 'Norvegese'
- when /Icelandic/i; 'Islandese'
- when /Dutch/i; 'Olandese'
- when /Estonian/i; 'Estone'
- when /Hungarian/i; 'Ungherese'
- when /Polish/i; 'Polacco'
- when /Romanian/i; 'Romeno'
- when /Russian/i; 'Russo'
- when /Greek/i; 'Greco'
- when /Ukranian/i; 'Ucraino'
- when /Turkish/i; 'Turco'
- when /Slovenian/i; 'Sloveno'
- when /Croatian/i; 'Croato'
- when /Slovak(?:ian)?/i; 'Slovacco'
- when /Czech/i; 'Ceco'
- when /Bulgarian/i; 'Bulgaro'
- else @trans_str
- end
- end
- end
- class Finnish
- def initialize(md,doc_lang,trans_str)
- @md,@doc_lang,@trans_str=md,doc_lang,trans_str
- end
- def filename
- 'tiedostonimi'
- end
- def description
- 'kuvaus'
- end
- def filetype_description
- description
- end
- def metadata
- 'metadata'
- end
- def file_size
- 'tiedoston koko'
- end
- def full_title #dc
- 'otsikko'
- end
- def title
- 'Otsikko'
- end
- def subtitle
- 'Alaotsikko'
- end
- def author #dc
- 'tekijä'
- end
- def contributor #dc
- 'osallistuja'
- end
- def translator
- 'Kääntäjä'
- end
- def illustrator
- 'Kuvittaja'
- end
- def publisher #dc
- 'julkaisija'
- end
- def prepared_by
- 'Valmistaja'
- end
- def digitized_by
- 'Digitalisoinut'
- end
- def subject #dc
- 'aihe'
- end
- def description #dc (watch)
- 'kuvaus'
- end
- def abstract #dc
- 'tiivistelmä'
- end
- def type #dc
- 'tyyppi'
- end
- def rights #dc
- 'oikeudet'
- end
- def date #dc
- 'päiväys'
- end
- def date_created #dc
- 'luontipäivä'
- end
- def date_issued #dc
- 'julkaisupäivä'
- end
- def date_available #dc
- 'saantipäivä'
- end
- def date_modified #dc
- 'muokkauspäivä'
- end
- def date_valid #dc
- 'kelpoisuuspäivä'
- end
- def language #dc
- 'kieli'
- end
- def language_original
- 'Alkuperäiskieli'
- end
- def format #dc
- 'muoto'
- end
- def identifier #dc
- 'tunnus'
- end
- def source #dc
- 'lähde'
- end
- def relation #dc
- 'suhde'
- end
- def coverage #dc
- 'kattavuus'
- end
- def keywords
- 'Avainsanat'
- end
- def comments
- 'Kommentit'
- end
- def cls_loc
- 'Classify Library of Congress'
- end
- def cls_dewey
- 'Classify Dewey'
- end
- def cls_gutenberg
- 'Classify Project Gutenberg'
- end
- def cls_isbn
- 'Classify ISBN'
- end
- def prefix_a
- 'Prefix (a)'
- end
- def prefix_b
- 'Prefix (b)'
- end
- def topic_register
- 'Topics Registered'
- end
- def sourcefile
- 'Lähdetiedosto'
- end
- def word_count
- 'Arvioitu sanamäärä'
- end
- def sourcefile_digest
- 'Lähdetiedoston tiiviste'
- end
- def digest_md5
- 'Lähdetiedoston tiiviste (md5)'
- end
- def digest_sha256
- 'Lähdetiedoston tiiviste (sha256)'
- end
- def sc_number
- 'Dokumentin RCS/CVS-numero'
- end
- def sc_date
- 'Dokumentin RCS/CVS-päiväys'
- end
- def last_generated
- 'Viimeksi tuotettu dokumentti (metaverse)'
- end
- def sisu_version
- 'Generoinut'
- end
- def ruby_version
- 'Ruby-versio'
- end
- def suggested_links
- 'metadatan ehdottamat linkit'
- end
- def language_version_list
- 'Dokumentin kieliversiot, manifestit'
- end
- def manifest_description
- 'SiSU manifest of document filetypes and metadata'
- end
- def manifest_description_output
- 'Tuotetun tuloksen SISU-manifesti'
- end
- def manifest_description_metadata
- 'Dokumenttimetadatan SISU-manifesti'
- end
- def language_list_translated
- lang=case @trans_str
- when /American/i; 'Amerikanenglanti' # tag depreciated, see iso 639-2
- when /English/i; 'Englanti'
- when /French/i; 'Ranska'
- when /German/i; 'Saksa'
- when /Italian/i; 'Italia'
- when /Spanish/i; 'Espanja'
- when /Brazilian(?: Portuguese)?/i; 'Brasilian portugali' # tag depreciated, see iso 639-2
- when /Portuguese/i; 'Portugali'
- when /Swedish/i; 'Ruotsi'
- when /Danish/i; 'Tanska'
- when /Finnish/i; 'Suomi'
- when /Norwegian/i; 'Norja'
- when /Icelandic/i; 'Islanti'
- when /Dutch/i; 'Hollanti'
- when /Estonian/i; 'Viro'
- when /Hungarian/i; 'Unkari'
- when /Polish/i; 'Puola'
- when /Romanian/i; 'Romania'
- when /Russian/i; 'Venäjä'
- when /Greek/i; 'Kreikka'
- when /Ukranian/i; 'Ukraina'
- when /Turkish/i; 'Turkki'
- when /Slovenian/i; 'Slovenia'
- when /Croatian/i; 'Kroatia'
- when /Slovak(?:ian)?/i; 'Slovakki'
- when /Czech/i; 'Tsekki'
- when /Bulgarian/i; 'Bulgaria'
- else @trans_str
- end
- end
- end
- class Porguguese < English
- end
- class Swedish < English
- end
- class Danish < English
- end
- class Norwegian < English
- end
- class Icelandic < English
- end
- class Dutch < English
- end
- class Estonian < English
- end
- class Hungarian < English
- end
- class Polish < English
- end
- class Romanian < English
- end
- class Russian < English
- end
- class Greek < English
- end
- class Ukranian < English
- end
- class Turkish < English
- end
- class Croatian < English
- end
- class Slovakian < English
- end
- class Czech < English
- end
- class Bulgarian < English
- end
-end
-__END__
diff --git a/lib/sisu/v1/manifest.rb b/lib/sisu/v1/manifest.rb
deleted file mode 100644
index 42f68c94..00000000
--- a/lib/sisu/v1/manifest.rb
+++ /dev/null
@@ -1,648 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: summary of generated outputs and metadata
-
-=end
-module SiSU_Manifest
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/i18n"
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/html_minitoc"
- #require "#{SiSU_lib}/html_format"
- require "#{SiSU_lib}/html"
- include SiSU_HTML_Format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @doc_language=l[:l]
- end
- def read
- begin
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @md=SiSU_Param::Parameters.new(@opt).get
- SiSU_Env::Info_skin.new(@md).select
- xbrowser=@env.program.web_browser
- browser=@env.program.console_web_browser
- webserv_url=@env.path.url.output_tell
- url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}"
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}")
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}")
- tell.grey_tab if @opt.cmd =~/v/i
- Output_Info.new(@md,@data).check_output
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Output_Info <Source
- def initialize(md,data)
- @manifest={ :txt=>[],:html=>[] }
- @md,@fns,@data=md,md.fns,data
- @env=SiSU_Env::Info_env.new(@md.fns)
- @fnb=@md.fnb
- @base_url,@base_url_src,@base_url_pod="#{@env.url.root}/#@fnb","#{@env.url.src_txt}","#{@env.url.src_pod}"
- @base_path,@base_path_src,@base_path_pod="#{@env.path.output}/#@fnb","#{@env.path.output_src}","#{@env.path.output_pod}"
- @@dg ||=SiSU_Env::Info_env.new.digest.type
- @dg=@@dg
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
- @translate=SiSU_Translate::Source.new(@md,@language)
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- end
- def output
- SiSU_Env::SiSU_file.new(@md).mkdir
- manifest=SiSU_Env::SiSU_file.new(@md,@md.fn[:manifest]).mkfile
- @manifest[:html].each do |x|
- manifest << x
- end
- end
- def summarize(id,file,img='● ')
- size=(File.size("#{@base_path}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{file}">#{file}</a></p><p class="tiny">#{@url_brace.xml_open}<a href="#@base_url/#{file}">#@base_url/#{file}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
- end
- def summarize_source(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_src}/#{file}")
- else sys.md5("#{@base_path_src}/#{file}")
- end
- tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}")
- tell.warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_src}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../src/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../src/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@url_brace.xml_open}<a href="#@base_url_src/#{file}">#@base_url_src/#{file}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def summarize_pod(id,file)
- sys=SiSU_Env::System_call.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_pod}/#{file}")
- else sys.md5("#{@base_path_pod}/#{file}")
- end
- tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}")
- tell.warn if @md.cmd =~/[vVM]/
- size=(File.size("#{@base_path_pod}/#{file}")/1024.00).to_s
- kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
- @manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../pod/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../pod/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@url_brace.xml_open}<a href="#@base_url_pod/#{file}">#@base_url_pod/#{file}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>
- </td></tr>\n} if kb and kb =~/\d+/
- end
- def languages(id,file)
- flv=@env.published_manifests?(@base_path)
- @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<li class="norm"><a href="#{l[:m]}">#{lang}</a>&nbsp;&nbsp;&nbsp;</li>}
- end
- @manifest[:html] << %{</ul></div></th></tr>\n}
- end
- def published_languages(id,file)
- flv=@env.published_manifests?(@base_path)
- flv.each do |l|
- lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list
- @manifest[:txt] << "#{l[:m]} #{lang}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:m]}">#{lang}</a></p></th><td><p class="norm">#{lang}</p><p class="tiny">#{@url_brace.xml_open}<a href="#@base_url/#{l[:m]}">#@base_url/#{l[:m]}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
- end
- end
- def metadata(id,info)
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
- end
- def links(url,lnk,target)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
- end
- @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">&nbsp;&nbsp;#{@url_brace.xml_open}<a href="#{static}">#{static}</a>#{@url_brace.xml_close}</p></td></tr>\n}
- end
- def output_tests
- if FileTest.file?("#@base_path/#{@md.fn[:toc]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_toc.png" alt="TOC linked" /> '
- id,file='HTML, table of contents (for segmented text)',@md.fn[:toc]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:doc]}")==true
- img='<img border="0" height="15" width="15" src="../_sisu/image_sys/b_doc.png" alt="Full Text" /> '
- id,file='HTML, full length document',@md.fn[:doc]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:book_index]}")==true
- id,file='HTML, index',@md.fn[:book_index]
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:concordance]}")==true
- id,file='HTML, concordance file',@md.fn[:concordance]
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_letter]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_letter]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_letter]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_a4]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_a4]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a4]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_a5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_a5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a5]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_b5]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_b5]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_b5]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_legal]}")==true
- img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> '
- id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_legal]}")==true
- img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> '
- id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_legal]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:odf]}")==true
- img='<img border="0" height="18" width="18" src="../_sisu/image_sys/b_odf.png" alt="ODF/ODT" /> '
- id,file='ODF:ODT (Open Document Format)',@md.fn[:odf]
- summarize(id,file,img)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:xhtml]}")==true
- id,file='XHTML',@md.fn[:xhtml]
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:sax]}")==true
- id,file='XML SAX',@md.fn[:sax]
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:dom]}")==true
- id,file='XML DOM',@md.fn[:dom]
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:plain]}")==true
- if @md.cmd =~/a/; id,file='Plaintext (Unix (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/e/; id,file='Plaintext (Unix (UTF-8) with endnotes)',@md.fn[:plain]
- elsif @md.cmd =~/A/; id,file='Plaintext (dos (UTF-8) with footnotes)',@md.fn[:plain]
- elsif @md.cmd =~/E/; id,file='Plaintext (dos (UTF-8) with endnotes)',@md.fn[:plain]
- else id,file='Plaintext (UTF-8)',@md.fn[:plain]
- end
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fns}.tex")==true
- id,file='LaTeX (portrait)',"#{@md.fns}.tex"
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fns}.tex")==true
- id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
- summarize(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fn[:digest]}")==true
- id,file="Digest/DCC - Document Content Certificate (#@dg)",@md.fn[:digest]
- summarize(id,file)
- end
- end
- def published_versions
- if FileTest.file?("#@base_path/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- languages(id,file)
- end
- end
- def language_versions
- if FileTest.file?("#@base_path/sisu_manifest.html")==true
- id,file='Markup (SiSU source)',@md.fns
- published_languages(id,file)
- end
- end
- def source_tests
- if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents
- req=@md.fns
- if FileTest.file?("#@base_path_src/#{req}")==true
- id,file='Markup Composite File (SiSU source)',req
- summarize_source(id,file)
- end
- else
- if FileTest.file?("#@base_path_src/#{@md.fns}")==true
- id,file='Markup (SiSU source)',@md.fns
- summarize_source(id,file)
- end
- end
- if FileTest.file?("#@base_path_pod/#{@md.fn[:sisupod]}")==true
- id,file='SiSU doc (zip)',@md.fn[:sisupod]
- summarize_pod(id,file)
- end
- if FileTest.file?("#@base_path/#{@md.fnb}")==true \
- and @md.fnb =~/\.kdi$/
- id,file='Kdissert (.kdi source)',@md.fnb
- summarize_pod(id,file)
- end
- end
- def metadata_tests
- if @md.full_title #dc
- id,info=@translate.full_title,@md.full_title
- metadata(id,info)
- end
- if @md.title
- id,info=@translate.title,@md.title
- metadata(id,info)
- end
- if @md.subtitle
- id,info=@translate.subtitle,@md.subtitle
- metadata(id,info)
- end
- if @md.author #dc
- id,info=@translate.author,@md.author
- metadata(id,info)
- end
- if @md.contributor #dc
- id,info=@translate.contributor,@md.contributor
- metadata(id,info)
- end
- if @md.translator
- id,info=@translate.translator,@md.translator
- metadata(id,info)
- end
- if @md.illustrator
- id,info=@translate.illustrator,@md.illustrator
- metadata(id,info)
- end
- if @md.publisher #dc
- id,info=@translate.publisher,@md.publisher
- metadata(id,info)
- end
- if @md.prepared_by
- id,info=@translate.prepared_by,@md.prepared_by
- metadata(id,info)
- end
- if @md.digitized_by
- id,info=@translate.digitized_by,@md.digitized_by
- metadata(id,info)
- end
- if @md.subject #dc
- id,info=@translate.subject,@md.subject
- metadata(id,info)
- end
- if @md.description #dc
- id,info=@translate.description,@md.description
- metadata(id,info)
- end
- if @md.abstract
- id,info=@translate.abstract,@md.abstract
- metadata(id,info)
- end
- if @md.type #dc
- id,info=@translate.type,@md.type
- metadata(id,info)
- end
- if @md.rights #dc
- id,info=@translate.rights,@md.rights
- metadata(id,info)
- end
- if @md.date #dc
- id,info=@translate.date,@md.date
- metadata(id,info)
- end
- if @md.date_created #dc
- id,info=@translate.date_created,@md.date_created
- metadata(id,info)
- end
- if @md.date_issued #dc
- id,info=@translate.date_issued,@md.date_issued
- metadata(id,info)
- end
- if @md.date_available #dc
- id,info=@translate.date_available,@md.date_available
- metadata(id,info)
- end
- if @md.date_modified #dc
- id,info=@translate.date_modified,@md.date_modified
- metadata(id,info)
- end
- if @md.date_valid #dc
- id,info=@translate.date_valid,@md.date_valid
- metadata(id,info)
- end
- if @md.language \
- and @md.language[:name] #dc
- id,info=@translate.language,@md.language[:name]
- metadata(id,info)
- end
- if @md.language_original \
- and @md.language_original[:name]
- id,info=@translate.language_original,@md.language_original[:name]
- metadata(id,info)
- end
- if @md.format #dc
- id,info=@transate.format,@md.format
- metadata(id,info)
- end
- if @md.identifier #dc
- id,info=@translate.identifier,@md.identifier
- metadata(id,info)
- end
- if @md.source #dc
- id,info=@translate.source,@md.source
- metadata(id,info)
- end
- if @md.relation #dc
- id,info=@translate.relation,@md.relation
- metadata(id,info)
- end
- if @md.coverage #dc
- id,info=@translate.coverage,@md.coverage
- metadata(id,info)
- end
- if @md.keywords
- id,info=@translate.keywords,@md.keywords
- metadata(id,info)
- end
- if @md.comments
- id,info=@translate.comments,@md.comments
- metadata(id,info)
- end
- if @md.cls_loc
- id,info=@translate.cls_loc,@md.cls_loc
- metadata(id,info)
- end
- if @md.cls_dewey
- id,info=@translate.cls_dewey,@md.cls_dewey
- metadata(id,info)
- end
- if @md.cls_pg
- id,info=@translate.cls_gutenberg,@md.cls_pg
- metadata(id,info)
- end
- if @md.cls_isbn
- id,info=@translate.cls_isbn,@md.cls_isbn
- metadata(id,info)
- end
- if @md.prefix_a
- id,info=@translate.prefix_a,@md.prefix_a
- metadata(id,info)
- end
- if @md.prefix_b
- id,info=@translate.prefix_b,@md.prefix_b
- metadata(id,info)
- end
- if @md.topic_register_array.length > 1
- @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
- @md.topic_register_array.each do |t|
- t.each_with_index do |st,i|
- if st.class == Array
- st.each do |v|
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
- end
- else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
- end
- end
- end
- @manifest[:html] << %{</td></tr>\n}
- end
- if @md.fns
- id,info=@translate.sourcefile,@md.fns
- metadata(id,info)
- end
- if @md.en[:mismatch] > 0
- id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- metadata(id,info)
- end
- if @md.wc_words
- id,info=@translate.word_count,@md.wc_words
- metadata(id,info)
- end
- if @md.dgst
- id,info="#{@translate.sourcefile_digest} (#@dg)",@md.dgst[1]
- metadata(id,info)
- end
- if @md.sc_number
- id,info=@translate.sc_number,@md.sc_number
- metadata(id,info)
- end
- if @md.sc_date
- id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
- metadata(id,info)
- end
- if @md.generated
- id,info=@translate.last_generated,@md.generated
- metadata(id,info)
- end
- if @md.sisu_version
- id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- metadata(id,info)
- end
- if @md.ruby_version
- id,info=@translate.ruby_version,@md.ruby_version
- metadata(id,info)
- end
- end
- def links_tests
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if defined? l[:say]
- target=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
- url,lnk=l[:url],l[:say]
- unless url.nil? \
- or url.empty?
- links(url,lnk,target)
- end
- end
- end
- end
- end
- def check_output
- begin
- minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet.join("\n")
- id,file='',''
- vz=SiSU_Env::Get_init.instance.skin
- banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \
- and vz.banner_home_button_only !~ /sisu\.home\.png/
-<<WOK
-<table summary="band" width="100%" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" bgcolor="#ffffff">#{vz.banner_band}</td><td width="60%"><p class="tiny">#{@url_brace.xml_open}<a href="#@base_url/#{file}">#@base_url/#{file}</a>#{@url_brace.xml_close}</p></td><td width="20%">#{@env.widget_static.search_form}</td><td><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td></tr>
-</table>
-WOK
- else
-<<WOK
-<table summary="band" border="0" cellpadding="3" cellspacing="0">
-<tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU --&gt;" /></a></td><td><p class="tiny">#{@url_brace.xml_open}<a href="#@base_url/#{file}">#@base_url/#{file}</a>#{@url_brace.xml_close}</p></td><td>#{@env.widget_static.search_form}</td></tr>
-</table>
-WOK
- end
- @manifest[:html] <<<<WOK
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>
-SiSU manifest: #{@md.full_title}
-</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta name="sourcefile" content="#{@md.fns}" />
-<link rel="generator" href="http://www.jus.uio.no/sisu" />
-<link rel="shortcut icon" href="../_sisu/image_sys/rb7.ico" />
-<link rel="stylesheet" href="../#{@env.path.style}/html.css" type="text/css" />
-</head>
-<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
-#{banner_table}
-<div class="toc">
-#{minitoc.to_s}
-</div>
-<div class="content">
-<h1 class="small">#{@translate.manifest_description}</h1>
-<h2 class="small">#{@md.full_title}</h2>
-<p class="bold">#{@md.author}</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#output">Document, Available Filetypes</a>
-</p>
-<p class="small">
-&nbsp;&nbsp;<a href="#metadata">Document Metadata</a>
-</p>
-<p class="tiny">
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">(metadata suggested links (if any)</a>
-</p>
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- published_versions
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2>
-<table summary="available output/filetypes" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr>
-
-WOK
- output_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- source_tests
- @manifest[:html] << '</table>'
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
-<table summary="document metadata" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
-WOK
- metadata_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
-<table summary="suggested links" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-WOK
- links_tests
- @manifest[:html] <<<<WOK
-</table>
-WOK
- @manifest[:html] <<<<WOK
-<h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2>
-<table summary="language versions" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
-<tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right">&nbsp;</p></th></tr>
-
-WOK
- language_versions
- @manifest[:html] <<<<WOK
-</table>
-</div>
-<div class="main_column">
-#{vz.credits_sisu}
-</div>
-</body>
-</html>
-WOK
- output
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/manpage.rb b/lib/sisu/v1/manpage.rb
deleted file mode 100644
index 9de68331..00000000
--- a/lib/sisu/v1/manpage.rb
+++ /dev/null
@@ -1,465 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: manpage text generation, stripped manpage output (unix,
- linefeed)
-
-=end
-module SiSU_manpage
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/manpage_format"
- include SiSU_Manpage_format
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/shared_structure"
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- @@dostype='unix endnotes'
- else puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
- path=@env.path.output_tell
- tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}")
- tell.flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_manpage::Source::Scroll.new(@dal_array,@md).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/shared_txt"
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- @@dp=nil
- def initialize(data,md)
- @data,@md=data,md
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m # 2004w18 pb pn removal added
- @tab="\t"
- @br="\n"
- @@dostype='unix endnotes'
- @manpage={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- end
- def songsheet
- manpage=markup(@data)
- publish(manpage)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m)
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within manpage, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_text_utils::Wrap.new(e.to_s,78,4,1)
- else SiSU_text_utils::Wrap.new(e.to_s,78,0,1)
- end
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- wrap.gsub!(/\s\.(\S+)/,' \\.\1')
- wrap.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape
- wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-.TP
-.BI \\1.
-\\2
-GSUB
- )
- else
- wrap.gsub!(/^\s*(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << wrap
- @@endnotes[:end] << wrap
- @@endnotes
- end
- end
- def manpage_metadata(meta)
- util=SiSU_text_utils::Wrap.new(meta.text,78,15,1)
- txt=util.line_wrap
- @manpage[:metadata] <<= if meta.type == 'meta'
- <<WOK
-
-#{@tab}#{meta.el}: #{txt}
-WOK
- else ''
- end
- end
- def manpage_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @manpage[:tail] <<<<WOK
-#@br
-.TP
-Other versions of this document:
-.TP
-manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}>
-.TP
-html: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:toc]}>
-.TP
-pdf: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_p]}>
-.TP
-pdf: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_l]}>
-.\" .TP
-.\" manpage: #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manpage]}
-.TP
-at: <#{vz.url_site}>
-.TP
-#{sc}
-.TP
-* #{generator}
-.TP
-* #{rubyv}
-.TP
-* #{lastdone}
-.TP
-* SiSU #{vz.url_sisu}
-WOK
- end
- def manpage_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- wrapped=if para[@regx]
- paragraph=para[@regx,2]
- if paragraph =~/#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- m=$1.to_i
- paragraph.gsub!(/#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/,'')
- util=SiSU_text_utils::Wrap.new(paragraph,78,m*2)
- else util=SiSU_text_utils::Wrap.new(paragraph,78,0)
- end
- w=util.line_wrap
- w.gsub!(/^(\\\.)/,' \1')
- w
- end
- #wrapped.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/m,"\n\n") if wrapped
- if lv
- times=wrapped.length
- times=78 if times > 78
- @manpage[:body] << case lv
- when 1; '.SH ' << @br << wrapped.upcase << @br << '.BR'
- when 2..3; '.SH ' << @br << wrapped.upcase << @br << '.BR'
- when 4; '.SH ' << @br << wrapped.upcase << @br << '.BR'
- when 5..6; '.SH ' << @br << wrapped.upcase << @br
- end
- else
- @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
- '.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output
- else
- '.BR' << @br << wrapped # [consider s/.BR/.PP/]
- end
- end
- if @@endnotes[:para] \
- and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong
- @manpage[:body] << @br
- @@endnotes[:para].each { |e| @manpage[:body] << e << @br }
- elsif @@endnotes[:para] \
- and @@dostype =~/endnote/
- @manpage[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@manpage_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @manpage_contents_close[x]='' }
- manpage_tail #($1,$2)
- table_message='[table omitted, see other document formats]'
- fix=[]
- data.each do |para|
- para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove
- para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}")
- para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down
- para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^')
- para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]')
- para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--')
- para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- para.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- para.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- para.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}")
- para.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}")
- para.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")
- unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")
- @manpage[:endnotes]=extract_endnotes(para)
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up
- #para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)[}\]]~/,'[^\1]') # endnote marker marked up
- para.gsub!(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&') ##{Mx[:gl_o]}#095#{Mx[:gl_c]}
- para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- para.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- end
- para.gsub!(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires
- para.gsub!(/\s\.(\S+)/,' \\.\1')
- para.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2')
- para.gsub!(/-/,'\-') #manpages use this
- para.gsub!(/&#126;/,'~') if para #manpages use this
- if para =~/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]})?/
- if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- #para.gsub!(/(?![}])_([<>])/m,'\1') # _> _< }_<
- end
- para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.BR\n\n") # watch
- para.gsub!(/#{Mx[:gr_o]}(?:group|verse|alt)(?:\\-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'')
- para.gsub!(/#{Mx[:gr_o]}code#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,"\n\n.nf\n\n")
- para.gsub!(/#{Mx[:gr_o]}code\\-end#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,"\n\n.fi\n\n")
- else
- para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") #unless para =~/#{Mx[:lv_o]}\d:/ #watch introduces a bug
- end
- blit=para.scan(/\[[^\]]+\]|[^\[]+/)
- blit_array=[]
- blit.each do |x|
- if x =~/^\[/
- x.gsub!(/\s+/,' \ ') #manpages use this
- else x
- end
- blit_array << x
- end
- para=blit_array.join
- para.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added
- para.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution
- para.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks
- para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3')
- para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- #para.gsub!(/(["''])/,"\\\\\\1") #check note claims that quotation marks need escape, however that appears to result in error
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- para.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
- wordlist=para.scan(/\S+/)
- if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; manpage_metadata(d_meta)
- end
- end
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=para[@regx,3]
- @p_num=SiSU_Manpage_format::Paragraph_number.new(paranum)
- end
- @sto=SiSU_Structure::Split_text_object.new(@md,para).manpage
- ### problem in scroll, it appears tables are getting paragraph numbers
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m \
- and para=~/\S+/
- para=case @sto.format
- when /^(1):(\S*)/
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body3
- when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)/
- manpage_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body6
- else
- manpage_structure(para,nil,nil,nil) #watch may be problematic
- para
- end
- elsif para =~/#{table_message}/
- @manpage[:body] << para << @br
- elsif para =~/(Note|Endnotes?)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit
- #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>')
- #para=formatMono.bold_para
- elsif para.include? 'Owner Details' \
- and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>')
- #@@manpage[:owner_details]=formatMono.bold_para
- #para=''
- elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables !
- end
- if (para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- para=''
- end
- case para
- when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- if para =~/.*<:#>.*$/m
- txt_obj={:txt =>para}
- format_text=Format_text_object.new(txt_obj)
- para=format_text.scr_indent_one_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- para.gsub!(/\s(\[)/m,' \ \1') if para #manpages use this
- para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n") if para
- para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') if para #manpages use this
- para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') if para #manpages use this
- para.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ') if para ## Clean Prepared Text
- para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
- para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text
- para
- end
- end
- @manpage
- end
- def publish(manpage)
- divider='='
- content=[]
- date=if @md.date; @md.date
- else '2007' #date missing decide on action
- end
- proj=SiSU_Env::Info_version.instance.get_version
- manpage[:open] = %{.TH "#{@md.fnb}" "1" "#{date}" "#{proj[:version]}" "#{@md.title}"#{@md.man_name}#{@md.man_synopsis}}
- content << manpage[:open]
- content << manpage[:head]
- content << manpage[:body]
- content << @@endnotes[:end] if @@dostype =~/endnotes/
- #content << manpage[:metadata]
- #content << manpage[:owner_details] if @md.stmp =~/\w+/ #not used?
- content << manpage[:tail]
- Output.new(content,@md).manpage
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- end
- def manpage #%manpage output
- SiSU_Env::SiSU_file.new(@md).mkdir
- #filename_manpage=SiSU_Env::SiSU_file.new(@md,"#{@md.fnb}.#{@md.man_section}").mkfile_man
- filename_manpage=SiSU_Env::SiSU_file.new(@md,@md.fn[:manpage]).mkfile_man
- @sisu=[]
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- line.gsub!(/\s+$/m,'')
- filename_manpage.puts line #unix manpage
- end
- else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
- end
- end
- filename_manpage.close
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/manpage_format.rb b/lib/sisu/v1/manpage_format.rb
deleted file mode 100644
index d5402b8d..00000000
--- a/lib/sisu/v1/manpage_format.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: manpage formatting template
-
-=end
-module SiSU_Manpage_format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
- end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
- end
- end
- class Format_text_object
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if @t_o.class == Hash
- @txt =@t_o[:txt] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- p t_o.class
- p caller
- end
- #@txt.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/
- rgx=/^#{Mx[:lv_o]}[1-6-]:/
- @txt.gsub!(rgx,'') if @txt =~rgx
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- def heading_body1
- end
- def heading_body2
- end
- def heading_body3
- end
- def heading_body4
- end
- def heading_body5
- end
- def heading_body6
- end
- end
- class XML
- end
-end
-__END__
-
diff --git a/lib/sisu/v1/odf.rb b/lib/sisu/v1/odf.rb
deleted file mode 100644
index 65029bdd..00000000
--- a/lib/sisu/v1/odf.rb
+++ /dev/null
@@ -1,738 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument text generation
-
-=end
-module SiSU_ODF
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Viz
- require "#{SiSU_lib}/odf_format"
- include SiSU_ODF_format
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/shared_structure"
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- class Source
- require 'zlib'
- require 'find'
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @@endnotes_para=[]
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- @env.odf_structure
- opendoc=@md.fn[:odf]
- path=@env.path.output_tell
- tool=if @opt.cmd =~/[MVv]/; "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}")
- tell.flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- SiSU_ODF::Source::Scroll.new(@particulars).songsheet
- SiSU_Env::Info_skin.new(@md).select
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/shared_txt"
- @@img_count=0
- @@odf={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- @@docstart=true
- @@fns,@@dp=nil,nil
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @serial=/\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*/
- @tab="\t"
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @br=if @md.cmd =~/M/; "\n"
- else ''
- end
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/)[1]
- @n=[]
- notes.each do |n| #high cost to deal with <br> appropriately within odf, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}/
- fix=n.split(/#{Mx[:br_line]}/) #watch #added
- fix.each do |x|
- if x =~/\S+/; @n << x
- end
- end
- else @n << n
- end
- end
- end
- def odf_metadata(meta)
- #meta.el,meta.txt,meta.type,meta.attrib
- end
- def odf_tail
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n"
- else ''
- end
- url=@md.fnb
- fn=@md.fn[:manifest]
- manifest="#{@vz.url_root_http}/#{url}/#{fn}"
- @@odf[:tail] << %{<text:p text:style-name="P1">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
- @@odf[:tail] << %{\n<text:p text:style-name="P1">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
- @@odf[:tail] << "\n</office:text></office:body></office:document-content>"
- end
- def heading(para,no)
- para.gsub!(@serial,'')
- para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- para.gsub!(/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s*/,'')
- m=/#{$1}/
- breakpage=''
- if @md.fns \
- and @md.fns != '' \
- and @md.fns !=@@fns
- @@docstart=true
- @@fns=@md.fns
- end
- unless @@docstart
- breakpage=if (@md.pagenew or @md.pagebreak) \
- and (@md.pagenew =~ m or @md.pagebreak =~m)
- '<text:p text:style-name="P9"> </text:p>'
- else ''
- end
- end
- @@docstart=false
- %{#{breakpage}<text:h text:style-name="Heading_20_#{no}" text:outline-level="#{no}">#{para}</text:h>}
- end
- def image_src(i)
- image_source=if @md.fns =~/\.ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review
- @env.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")
- @env.path.image_source_remote_tex
- elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}")
- @env.path.image_source_tex
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_local_tex},#{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}")
- tell.error2 unless @md.cmd =~/q/
- nil
- end
- end
- def image_odf(img)
- # copy image to od image directory (unless exists)
- # divide pixel dimension by 37.79485 and retain 3 decimal places
- # x=str.scan(/(aa[^a]+)/)
- m,u=img[1],img[2]
- i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/
- c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/
- w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/
- w=(w.to_i/37.79485).to_s
- h=(h.to_i/37.79485).to_s
- h=/([0-9]+\.\d{0,3})/.match(h).captures.join
- w=/([0-9]+\.\d{0,3})/.match(w).captures.join
- image_source=image_src(i)
- pwd=Dir.pwd
- cp("#{image_source}/#{i}","#{@env.path.odf}/Pictures/#{i}") if image_source
- img=if i.to_s =~/jpg|png|gif/ \
- and h.to_s =~/\d/ \
- and w.to_s =~/\d/
- @@img_count +=1
- %{<draw:frame draw:style-name="fr1" draw:name="graphics#{@@img_count}" text:anchor-type="as-char" svg:width="#{w}cm" svg:height="#{h}cm" draw:z-index="2"><draw:image xlink:href="Pictures/#{i}" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>#{c}} #anchor-type: as-char or paragraph or char or ...
- else %{<text:p text:style-name="P1">[image omitted]</text:p>}
- end
- end
- def image(para)
- para.gsub!(@serial,'')
- m=para.scan(/(#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image))/)
- if m; m.each do |i|
- cont,url=i[1],i[2]
- cont.gsub!(/([)(\]\[])/,"\\\\\\1")
- cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of +
- url.gsub!(/([+?])/,"\\\\\\1")
- para.sub!(/#{Mx[:lnk_o]}\s*#{cont}\s*#{Mx[:lnk_c]}#{url}/m,image_odf(i)) #watch
- para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- para
- end
- def text_link_odf(txt,url,trail)
- txt.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- url.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-(
- %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}
- end
- def text_link(para)
- para.gsub!(@serial,'')
- m=para.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+?))([;.,]?(?=\s|$))/) #sort
- if m
- m.each do |i|
- txt,url,trail=i[1],i[2]
- txt.gsub!(/([)(\]\[])/,"\\\\\\1")
- txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
- url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- para.gsub!(/#{Mx[:lnk_o]}\s*#{txt}#{Mx[:lnk_c]}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
- para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
- end
- m=nil
- end
- para
- end
- def normal(para) #P1 - P3
- para.gsub!(@serial,'')
- para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>\2') #http ftp matches escaped, no decoration
- para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
- '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>\3') #special case \{ e.g. \}http://url
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
- %{\\1#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
- #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works
- #%{#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@url_brace.xml_close}\\2}) #http ftp matches with decoration
- para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@url_brace.xml_close}}) if para !~/http:\/\// # improve upon, document crash where url contains '@' symbol
- para=case para
- when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/m
- m=$1
- para.gsub!(/^#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/m,'')
- %{<text:p text:style-name="P1#{m}">#{para}</text:p>}
- else %{<text:p text:style-name="P1">#{para}</text:p>}
- end
- para
- end
- def fontface(para)
- #para=para.gsub(/<b>(.+?)<\/b>/,%{<text:span text:style-name="T1">\\1</text:span>})
- #para=para.gsub(/<i>(.+?)<\/i>/,%{<text:span text:style-name="T2">\\1</text:span>})
- end
- def footnote(para)
- @astx||=10000
- para.gsub!(/#{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1')
- #para.gsub!(/<br \/><:i[1-9]>/,'<br />')
- if para =~/#{Mx[:en_a_o]}\d+\s+/
- para=para.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>')
- end
- if para=~/#{Mx[:en_a_o]}[*+]+\s/
- asterisk=para.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- para=para.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- if para=~/#{Mx[:en_b_o]}[*+]\d+\s/
- asterisk=para.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/)
- asterisk.each do |x|
- a=x[0].gsub(/([*+])/,"\\\\\\1")
- para=para.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})
- @astx+=1
- end
- end
- para
- end
- def group_clean(para)
- para.gsub!(/&amp;nbsp;|&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
- para.gsub!(/&lt;(text:span text:style-name="T[1-5]"|\/text:span)&gt;/,'<\1>') #works, not ideal
- para.gsub!(/#{Mx[:br_line]}/,'<br />')
- para.gsub!(/&lt;br(?:\s+\/)?&gt;/,'<br />')
- #para.gsub!(/\s\s/,'&#160;&#160;')
- para
- end
- def poem(para) #P4 #same as group
- para.gsub!(@serial,'')
- para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}\s*/m,'')
- parray=[]
- para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- para=parray.join + '<text:p text:style-name="Standard"/>'
- end
- def group(para) #P4 #same as verse
- para.gsub!(@serial,'')
- para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}\s*/m,'')
- parray=[]
- para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')
- parablock.gsub!(/&lt;(\/text:a)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:note text:id=.+?)&gt;/,'<\1>')
- parablock.gsub!(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>')
- parablock.gsub!(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
- parablock=footnote(parablock)
- parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
- end
- para=parray.join + '<text:p text:style-name="Standard"/>'
- end
- def code(para) #P5
- para.gsub!(@serial,'')
- para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}\s*/m,'')
- para.gsub!(/\s\s/,'&#160;&#160;')
- parray=[]
- para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
- parablock=group_clean(parablock)
- parablock.gsub!(/^\s*$/,'<br />')
- parablock.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
- '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>\2') #http ftp matches escaped, no decoration
- parray << %{<text:p text:style-name="P5">#{parablock}</text:p>} if parablock =~/\S+/
- end
- para=parray.join + '<text:p text:style-name="Standard"/>'
- para
- end
- def table(para) #
- if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block
- txt_obj={:table =>para}
- table=SiSU_ODF_format::Table.new(@md,txt_obj)
- para=table.table_split
- end
- end
- def odf_structure(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- para =t_o[:txt] || nil
- lv =t_o[:lv] || nil
- ocn =t_o[:ocn] || nil
- hname =t_o[:h_name] || nil
- #@h_name =t_o[:h_name] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- #@one,@two,@three=one,two,three
- p t_o.class
- p caller
- end
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- para=unless para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para=if para =~/#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; image(para)
- elsif para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; text_link(para)
- else para
- end
- else para
- end
- para=footnote(para)
- if lv
- @@odf[:body] << case lv
- when 1; heading(para,'1') << @br*2
- when 2; heading(para,'2') << @br*2
- when 3; heading(para,'3') << @br*2
- when 4; heading(para,'4') << @br*2
- when 5; heading(para,'5') << @br*2
- when 6; heading(para,'6') << @br*2
- end
- elsif para =~ /#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/
- @@odf[:body] << poem(para)
- @@odf[:body] << @br*2
- elsif para =~ /#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/
- @@odf[:body] << group(para)
- @@odf[:body] << @br*2
- elsif para =~ /#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/
- @@odf[:body] << code(para)
- @@odf[:body] << @br*2
- elsif para =~ /#{Mx[:gr_o]}Th?/ #elsif para =~ /<!Th?¡/u
- @@odf[:body] << table(para)
- @@odf[:body] << @br*2
- else
- @@odf[:body] << normal(para) # main text, contents, body KEEP
- @@odf[:body] << @br*2
- end
- @@endnotes_para=[]
- end
- # Used to clean words
- def tidywords(wordlist)
- #wordlist.each do |x|
- # #x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- #end
- wordlist
- end
- def markup(data) # Used for major markup instructions
- safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @odf_contents_close[x]='' }
- odf_tail #($1,$2)
- fix=[]
- bullet=image_src('bullet_09.png')
- cp("#{bullet}/bullet_09.png","#{@env.path.odf}/Pictures/.") #if image_src('bullet_09.png')
- data.each do |para|
- para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove
- #p para if para =~safe_characters and @md.cmd =~/V/ #KEEP
- #para.gsub!(/&lt;(~\d+;(?:\w|[0-6]:)\d+;\w\d+)&gt;&lt;(#@dp:#@dp)&gt;/,'<\1><\2>')
- para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/
- para_array=[]
- para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
- word=para.scan(/\S+|\n/)
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless para =~/^(?:#{Rx[:meta]}|%+ )/m
- w.gsub!(/&#(?:126|152);/,'~') #126 usual
- if w !~/&\S{1,7};/ \
- or w =~/&nbsp;/
- w.gsub!(/&/,'&amp;') #watch &nbsp;
- end
- end
- para_array << w
- end
- para=para_array.join(' ')
- para=para.strip
- end
- if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
- para.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}\s*)?#{Mx[:gl_bullet]}/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png
- #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<text:span text:style-name="T6">●</text:span> ') #bullet
- #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used
- #para.gsub!(/^_\*\s+/,'<text:span text:style-name="T6">●</text:span> ') #bullet
- para.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet
- para.gsub!(/^#{Mx[:gl_bullet]}/,'<text:span text:style-name="T6">·</text:span> ') #bullet
- para.gsub!(/#{Mx[:br_line]}/,'<br />')
- para.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'<text:p text:style-name="P8"> </text:p>')
- para.gsub!(/&#169;/,'©') #too arbitrary
- para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<text:span text:style-name="T1">\1</text:span>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<text:span text:style-name="T2">\1</text:span>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<text:span text:style-name="T3">\1</text:span>')
- para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<text:span text:style-name="T4">\1</text:span>')
- para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<text:span text:style-name="T5">\1</text:span>')
- para.gsub!(/­/u,'-')
- para.gsub!(/ /u, ' ') # space identify
- para.gsub!(/ /u, ' ') # space identify
- para.gsub!(/·/u,'*')
- para.gsub!(/[­–—]/u,'-') #— – chk
- para.gsub!(/ < /i,'&#060;')
- para.gsub!(/\\copy(?:right)?\b/,'&#169;')
- para.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
- #para.gsub!(/\43/,'&#35;') ## watch
- #para.gsub!(/$/,'&#36;') #$ watch
- para.gsub!(/\44/,'&#36;') #$ watch
- #para.gsub!(/^·/,'_*') #$ watch
- #para.gsub!(/·/,'*') #$ watch
- para.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'') # remove page breaks
- para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # remove empty lines
- para.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1')
- para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links
- #para.gsub!(/<a href=".+?">(.+?)<\/a>/im,'\1')
- #para.gsub!(/&nbsp;/,' ') # decide on
- #para.gsub!(/\{(\S+?\.(?:png|jpg)) .+?\}(?:http:\/\/\S+|image)/," [ \\1 ]") #"[ #{@env.url.images_local}\/\\1 ]")
- #para.gsub!(/<!TZ.+/,'')
- #para.gsub!(/^<!T.+/,"#@br[table: ] <~#>");
- #p para if para =~safe_characters and @md.cmd =~/M/ #KEEP
- #para.gsub!(/^(\{\S+?\.(?:png|jpg)\s+.+?"(.*?)"\s*\}\S+)/,"\\1 \n [image: \"\\2\"]")
- wordlist=para.scan(/\S+/)
- para=tidywords(wordlist).join(' ').strip
- if para =~/^#{Rx[:meta]}(\S+)\s+(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; odf_metadata(d_meta)
- end
- end
- @rcdc=true if @rcdc==false \
- and (para =~/~metadata/ or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/)
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=para[@regx,3]
- @p_num=SiSU_ODF_format::Paragraph_number.new(paranum)
- end
- @sto=SiSU_Structure::Split_text_object.new(@md,para).odt
- #<office:annotation><dc:date>yyyy-mm-ddT00:00:00</dc:date><text:p>#{ocn}</text:p></office:annotation> #followed immediately by paragraph closure
- ### problem in scroll, it appears tables are getting paragraph numbers
- unless @rcdc
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m \
- and para=~/\S+/
- para=case @sto.format
- when /^(1):(\S*)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- when /^(2):(\S*)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- when /^(3):(\S*)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- when /^(4):(\S+)/ # work on see Split_text_object
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- # work on see SiSU_text_parts::Split_text_object
- para
- when /^(5):(\S*)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- when /^(6):(\S*)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- else
- txt_obj={:txt =>para}
- odf_structure(@md,txt_obj) #watch may be problematic
- para
- end
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/)
- # i don't get the condition for no paranum
- end
- else
- if para =~ /^(4)~(\S+)/
- txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
- odf_structure(@md,txt_obj)
- para
- elsif para =~/#{Mx[:id_o]}~(\d+);m\d+;[mdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>para}
- odf_structure(@md,txt_obj) #watch may be problematic
- para
- end
- end
- para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
- para.gsub!(/#{Mx[:gr_o]}.+?#{Mx[:gr_c]}/,' ') if para ## CHECK Clean Prepared Text
- para.gsub!(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ') if para ## CHECK Clean Prepared Text
- para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text
- end
- end
- end
- def pre
- table=if @md.flag_tables
- %{<style:style style:name="Table1" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>#@br} +
- %{<style:style style:name="Table1.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>#@br} +
- %{<style:style style:name="Table1.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>#@br} +
- %{<style:style style:name="Table1.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>#@br} +
- %{<style:style style:name="Table1.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>#@br} +
- %{<style:style style:name="Table1.E" style:family="table-column"><style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/></style:style>#@br} +
- %{<style:style style:name="Table1.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>#@br} +
- %{<style:style style:name="Table1.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>#@br} +
- %{<style:style style:name="Table1.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>#@br} +
- %{<style:style style:name="Table2" style:family="table"><style:table-properties style:width="16.999cm" table:align="margins"/></style:style>#@br} +
- %{<style:style style:name="Table2.A" style:family="table-column"><style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/></style:style>#@br} +
- %{<style:style style:name="Table2.B" style:family="table-column"><style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/></style:style>#@br} +
- %{<style:style style:name="Table2.C" style:family="table-column"><style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/></style:style>#@br} +
- %{<style:style style:name="Table2.D" style:family="table-column"><style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/></style:style>#@br} +
- %{<style:style style:name="Table2.E" style:family="table-column"><style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/></style:style>#@br} +
- %{<style:style style:name="Table2.F" style:family="table-column"><style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/></style:style>#@br} +
- %{<style:style style:name="Table2.G" style:family="table-column"><style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/></style:style>#@br} +
- %{<style:style style:name="Table2.H" style:family="table-column"><style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/></style:style>#@br} +
- %{<style:style style:name="Table2.I" style:family="table-column"><style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/></style:style>#@br} +
- %{<style:style style:name="Table2.J" style:family="table-column"><style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/></style:style>#@br} +
- %{<style:style style:name="Table2.K" style:family="table-column"><style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/></style:style>#@br} +
- %{<style:style style:name="Table2.L" style:family="table-column"><style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/></style:style>#@br} +
- %{<style:style style:name="Table2.M" style:family="table-column"><style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/></style:style>#@br} +
- %{<style:style style:name="Table2.N" style:family="table-column"><style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/></style:style>#@br}
- else ''
- end
- breakpage=if @md.pagenew \
- or @md.pagebreak
- ' fo:break-before="page"'
- else ''
- end
- @@odf[:head]<<%{<?xml version="1.0" encoding="UTF-8"?>#@br} +
- %{<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"><office:scripts/>#@br} +
- %{<office:font-face-decls><style:font-face style:name="HG Mincho Light J" svg:font-family="&apos;HG Mincho Light J&apos;, &apos;MS Mincho&apos;, &apos;HG Mincho J&apos;, &apos;HG Mincho L&apos;, &apos;HG Mincho&apos;, Mincho, &apos;MS PMincho&apos;, &apos;HG Mincho Light J&apos;, &apos;MS Gothic&apos;, &apos;HG Gothic J&apos;, &apos;HG Gothic B&apos;, &apos;HG Gothic&apos;, Gothic, &apos;MS PGothic&apos;, &apos;Andale Sans UI&apos;, &apos;Arial Unicode MS&apos;, &apos;Lucida Sans Unicode&apos;, Tahoma" style:font-pitch="variable"/><style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, &apos;Lucida Sans&apos;, &apos;Arial Unicode MS&apos;" style:font-pitch="variable"/><style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Bitstream Vera Sans" svg:font-family="&apos;Bitstream Vera Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-face-decls>#@br} +
- %{<office:automatic-styles>#@br} +
- %{#{table}#@br} +
- %{<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} +
- %{<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} + # P1
- %{<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} + # P1
- %{<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} +
- %{<style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-align="start" style:justify-single-word="false"/></style:style>#@br} +
- %{<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>#@br} +
- %{<style:style style:name="P7" style:family="paragraph" style:parent-style-name="Table_20_Contents"><style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} +
- %{<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>#@br} +
- %{<style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-after="page"/></style:style>#@br} +
- %{<style:style style:name="P10" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} + # P1
- %{<style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P12" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P13" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P14" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P15" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P16" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P17" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P18" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
- %{<style:style style:name="P19" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} +
-
- %{<style:style style:name="T1" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style>#@br} +
- %{<style:style style:name="T2" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style>#@br} +
- %{<style:style style:name="T3" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style>#@br} +
- %{<style:style style:name="T4" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>#@br} +
- %{<style:style style:name="T5" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style>#@br} +
- %{<style:style style:name="T6" style:family="text"><style:text-properties style:font-name="Courier 10 Pitch" fo:font-size="12pt"/></style:style>#@br} +
- %{<style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style>#@br} +
- %{<style:style style:name="gr1" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>#@br} +
- %{<style:style style:name="gr2" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>#@br} +
- %{</office:automatic-styles>#@br} +
- %{<office:body>#@br} +
- %{<office:text><office:forms form:automatic-focus="false" form:apply-design-mode="false"/>#@br} +
- %{<text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls>}
- end
- def post
- end
- def publish
- divider='='
- content=[]
- data=@data
- content << @@odf[:open]
- content << @@odf[:head]
- content << @@odf[:body]
- content << @@odf[:metadata]
- #content << @@odf[:owner_details] if @md.stmp =~/\w+/ #not used?
- content << @@odf[:tail]
- Output.new(content,@md,@env).odf
- @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]
- end
- end
- class Output <Source
- def initialize(content,md,env)
- @content,@md,@env=content,md,env
- end
- def odf #%odf output
- SiSU_Env::SiSU_file.new(@md).mkdir
- #filename_odf=SiSU_Env::SiSU_file.new(@md,'content.xml').mkfile
- filename="#{@env.path.odf}/content.xml"
- od=File.new(filename,'w+')
- @content.each do |para| # this is a hack
- od.puts para unless para =~/\A\s*\Z/
- end
- od.close
- opendoc=@md.fn[:odf]
- system("
- cd #{@env.path.odf}
- zip -qr #{opendoc} *
- mv #{opendoc} #{@env.path.output}/#{@md.fnb}/.
- cd #{Dir.pwd}
- ")
- end
- end
- end
-end
-__END__
-todo:
-* table of contents
-* page header/footer?
-
-done:
-headings *
-footnotes *
-bold underscore italics strikethrough *
-superscript subscript *
-extended ascii set *
-indents *
- [autonomy_markup0.sst] *
-groups
- poem *
- code *
- tables
-images
-bullet
-line break
-page break
-
-notes?? [you could add a note number for every object/paragraph!]
-
- cd(@env.path.odf)
- structure=[]
- Find.find(@env.path.odf) do |f|
- structure << puts f
- end
- open(opendoc,'wb') do |f|
- zip=Zlib::ZipWriter.new(f)
- structure.each |z| do
- zip << z
- end
- zip.close
- end
- #zip -qr #{opendoc} *
- mv(opendoc,"#{@env.path.output}/#{@md.fnb}/.")
- cd(Dir.pwd)
diff --git a/lib/sisu/v1/odf_format.rb b/lib/sisu/v1/odf_format.rb
deleted file mode 100644
index 615b6fca..00000000
--- a/lib/sisu/v1/odf_format.rb
+++ /dev/null
@@ -1,263 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: opendocument formatting, default opendocument template
-
-=end
-module SiSU_ODF_format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
- end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
- end
- end
- class Format_text_object
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- #@one,@two,@three=one,two,three
- p t_o.class
- p caller
- end
- rgx=/^#{Mx[:lv_o]}[1-6-]:/
- @txt.gsub!(rgx,'') if @txt =~rgx
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#@txt</endnote> "
- end
- def heading_body1
- #%{<text:h text:style-name="Heading_20_1" text:outline-level="1">#@two</text:h>}
- end
- def heading_body2
- #%{<text:h text:style-name="Heading_20_2" text:outline-level="2">#@two</text:h>}
- end
- def heading_body3
- #%{<text:h text:style-name="Heading_20_3" text:outline-level="3">#@two</text:h>}
- end
- def heading_body4
- #%{<text:h text:style-name="Heading_20_4" text:outline-level="4">#@two</text:h>}
- end
- def heading_body5
- #%{<text:h text:style-name="Heading_20_5" text:outline-level="5">#@two</text:h>}
- end
- def heading_body6
- #%{<text:h text:style-name="Heading_20_6" text:outline-level="6">#@two</text:h>}
- end
- end
- class Table
- @@tablehead,@@table_counter=0,0 #reinitialise on new file
- @@tablefoot=[] #watch
- @@fns=''
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o,@vz=md,t_o,SiSU_Env::Get_init.instance.skin
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- @table =t_o[:table] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- if @md.cmd =~/M/
- p t_o.class
- p caller
- end
- end
- if @md.fns != @@fns
- @@table_counter=0
- @@fns=@md.fns
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- end
- def table_head(count,col,h=false)
- type=if h; 1
- else 2
- end
- alpha=case col.to_i
- when 1; 'A'
- when 2; 'B'
- when 3; 'C'
- when 4; 'D'
- when 5; 'E'
- when 6; 'F'
- when 7; 'G'
- when 8; 'H'
- when 9; 'I'
- when 10; 'J'
- when 11; 'K'
- when 12; 'L'
- when 13; 'M'
- when 14; 'N'
- else 'D'
- end
- %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#@br} +
- %{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{col}"/>#@br}
- end
- def table_end(tablefoot='')
- '</table:table>'
- end
- def table_row(inf,h=false)
- if h; %{<table:table-row>#@br} +
- %{<table:table-cell office:value-type="string">#@br} +
- %{<text:p text:style-name="Table_20_Heading">#@br}
- else %{<table:table-row>#@br} +
- %{<table:table-cell office:value-type="string">#@br} +
- %{<text:p text:style-name="P7">#@br}
- end
- end
- def table_cell(inf,h=false)
- if h; %{</text:p>#@br} +
- %{</table:table-cell>#@br} +
- %{<table:table-cell office:value-type="string">#@br} +
- %{<text:p text:style-name="Table_20_Heading">#@br}
- else %{</text:p>#@br} +
- %{</table:table-cell>#@br} +
- %{<table:table-cell office:value-type="string">#@br} +
- %{<text:p text:style-name="P7">#@br}
- end
- end
- def table_row_close(h=false)
- %{</text:p>#@br} +
- %{</table:table-cell>#@br} +
- %{</table:table-row>#@br}
- end
- def table
- @txt='' if @txt =~/^<!$/
- @txt.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- m=@txt[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- @txt.gsub!(/<!f.+?!>/,'')
- @@tablehead=1 if @txt =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- @@table_counter+=1 if @txt =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- if @txt =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @txt=table_head(@@table_counter,$1,true)
- elsif @txt =~/#{Mx[:gr_o]}T#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @txt=table_head(@@table_counter,$1)
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- tablefoot=[]
- @@tablefoot.each {|x| tablefoot << ''}
- @@tablefoot=[]
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @txt=table_end
- end
- end
- if @@tablehead == 1
- if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true))
- end
- if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @txt.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true))
- end
- if @txt =~/#{Mx[:tc_c]}/
- @txt.gsub!(/#{Mx[:tc_c]}/,table_row_close(true))
- end
- @@tablehead=0
- end
- @txt
- else
- if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1))
- end
- if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @txt.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1))
- end
- if @txt =~/#{Mx[:tc_c]}/
- @txt.gsub!(/#{Mx[:tc_c]}/,table_row_close)
- end
- @txt
- end
- @txt
- end
- def table_split
- @new_content=[]
- @table.split(/\s*#{Mx[:tc_o]}/).each do |parablock|
- table=if parablock =~/#{Mx[:gr_o]}/
- txt_obj={:txt =>parablock}
- Table.new(@md,txt_obj)
- else
- txt_obj={:txt =>"#{Mx[:tc_o]}#{parablock}"}
- Table.new(@md,txt_obj)
- end
- @new_content << table.table
- end
- @new_content.join
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v1/options.rb b/lib/sisu/v1/options.rb
deleted file mode 100644
index b0a9c8bb..00000000
--- a/lib/sisu/v1/options.rb
+++ /dev/null
@@ -1,191 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, command line options
- parsing
-
-=end
-module SiSU_commandline
- require "#{SiSU_lib}/sysenv"
- class Options
- attr_accessor :cmd,:mod,:files,:fns,:fnb,:fnc,:fncb,:what
- def initialize(a)
- @cmd,@files,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','',''
- @files,@mod,m,f,z,ca=[],[],[],[],[],[]
- @env=SiSU_Env::Info_env.new
- shortcut=SiSU_Env::Info_processing_flag.new
- a.each do |x|
- y=case x
- when /0/
- if x=~/^-1\S+/; x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1')
- else x.gsub(/^-0/,shortcut.cf_0 + ' ')
- end
- when /1/
- if x=~/^-1\S+/; x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1')
- else x.gsub(/^-1/,shortcut.cf_1 + ' ')
- end
- when /2/
- if x=~/^-2\S+/; x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1')
- else x.gsub(/^-2/,shortcut.cf_2 + ' ')
- end
- when /3/
- if x=~/^-3\S+/; x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1')
- else x.gsub(/^-3/,shortcut.cf_3 + ' ')
- end
- when /4/
- if x=~/^-4\S+/; x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1')
- else x.gsub(/^-4/,shortcut.cf_4 + ' ')
- end
- when /5/
- if x=~/^-5\S+/; x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1')
- else x.gsub(/^-5/,shortcut.cf_5 + ' ')
- end
- else x
- end
- s << " #{y}" unless y.empty?
- end
- s.strip!
- a=s.split(/\s+/)
- a.each do |x|
- if x =~/^-[a-z0-5]+/i \
- or x =~/^--\S+/
- if x =~/^-([a-z0-5]+)/i; c << $1
- end
- if x =~/^--\S+/; m << x
- end
- elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/
- if x =~/^(?:https?|file):\/\/\S+/; f << x
- elsif FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- elsif x =~ /\.termsheet\.rb$/
- if FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
- else w=x
- puts "#{x} in #{a.join(' ')}?"
- end
- end
- unless m.empty?
- m.each do |m|
- case m
- when /--maintenance/
- c=c+'M'
- when /--verbose[=-]3/
- c=c+'VM'
- when /--verbose[=-]2|--Verbose|--VERBOSE/
- c=c+'V'
- when /--verbose(?:[=-]1)?/
- c=c+'v'
- when /--verbose[=-]0|--quiet|--silent/
- c=c+'q'
- else @mod << m
- end
- end
- end
- unless c.empty?
- c.gsub!(/-/,'')
- c.scan(/./) {|x| ca << x}
- @cmd= '-' + ca.uniq.join
- end
- unless w.empty? ; @what=w
- end
- @files << f
- @files.flatten!
- if @files.length > 0 \
- and @cmd.empty? \
- and @mod.length == 0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
- @cmd=shortcut.cf_0
- end
- tell=SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n")
- tell.print_brown if @cmd =~/[vVM]/
- @files.uniq!
- end
- def cmd
- @cmd
- end
- def mod
- @mod
- end
- def fns
- @fns
- end
- def what
- @what
- end
- def fnb
- unless fns.empty?
- fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]
- end
- end
- def fnc
- @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns
- end
- end
- def fncb
- @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
- else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
- end
- end
- end
-end
-__END__
-note usually named @opt
-is carried in Param usually as @md
-@opt is a subset of @md
-where @md is passed, contents of @opt are available
-passing @opt as well is duplication
-check for fns & fnb
diff --git a/lib/sisu/v1/param.rb b/lib/sisu/v1/param.rb
deleted file mode 100644
index 7281871f..00000000
--- a/lib/sisu/v1/param.rb
+++ /dev/null
@@ -1,1008 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: parameters extracted from input file(s) for program use
-
-=end
-module SiSU_Param
- require 'uri'
- require 'pstore'
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/param_identify_markup"
- require "#{SiSU_lib}/help"
- include SiSU_Help
- @@date=SiSU_Env::Info_date.new
- @@symlnk=Create_system_link.new
- @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil
- @doc={ :initialise=>nil,:markup=>'',:lnks=>'',:stmp=>'',:req=>{} }
- @@yaml=@@yamladdr=nil
- @@trigger=nil
- @@lv,@@flag={},{}
- @@tex_backslash="\\\\"
- class Parameters
- @@publisher='SiSU scribe'
- @@md=@@fns=nil
- def initialize(opt)
- @opt=opt
- @cX||=SiSU_Screen::Ansi.new(opt.cmd)
- @cmd,@mod=opt.cmd,opt.mod
- @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK
- Instantiate.new.param_instantiate
- @env=SiSU_Env::Info_env.new(@fns)
- @pstorefile="#{@env.path.dal}/#{@fns}.pstore"
- end
- def get
- unless @@fns==@fns
- @@fns=@fns
- @@md=nil
- end
- if @@md.nil? \
- or @cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file
- if File.exist?(@pstorefile)
- param_msg='Parameters from pstore'
- retrieve_store=PStore.new(@pstorefile)
- retrieve_store.transaction do
- @md=retrieve_store['md']
- end
- @md
- else
- param_msg='Parameters extracted'
- fns_array=@env.read_source_file(@opt.fns)
- md=Instructions.new(fns_array,@opt)
- @md=Instructions.new(fns_array,@opt).extract
- @md
- end
- @@md=@md
- else @@md
- end
- tell=SiSU_Screen::Ansi.new(@cmd,param_msg,@@md.title)
- tell.txt_grey if @cmd =~/[MV]/
- @@md.cmd=@cmd
- @@md
- end
- class Instructions
- @doc={ :lv=>[] }
- @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
- @@publisher='SiSU scribe'
- attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original_publication,:original_publication_date,:original_publication_nationality,:original_publication_institution,:writing_focus
- def initialize(fns_array,opt)
- @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@author_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=@topic_register=@original_publication_details=@original_publication=@original_publication_date=@original_publication_nationality=@original_publication_institution=@writing_focus=nil
- @man_section=1
- @man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
- @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data
- @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false
- @seg_autoname_safe=true
- @sem_tag=false
- @authorship,@markup_instruction,@markup_declared,@image='','','','' #check which other values should be set to empty rather than nil
- @markup=@markup_instruction #use @markup_instruction
- @doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{}
- @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
- @authors,@topic_register_array,@papersize_array=[],[],[]
- @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
- @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
- begin
- rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error
- ensure
- end
- end
- #protected
- def determine_papersize(l)
- l=case l
- when /eu|europe|uk/i; 'A4' #European default, SiSU default
- when /(?:us-)?legal|legal/i; 'US_legal' #U.S. alternative
- when /(?:us-)?letter|u.s.|us/i; 'US_letter' #U.S. default
- when /book_a5|a5/i; 'book_a5'
- when /book_b5|b5|book/i; 'book_b5' #book default - larger
- else 'A4'
- end
- end
- def name_format(name)
- name.strip!
- @name_a_h=[]
- authors=name.scan(/[^;]+/)
- authors.each do |a|
- if a =~/"(.+?)"/
- @name_a_h << { :the => $1 }
- else #if a =~/,/
- x=a.scan(/[^,]+/)
- if x.length == 1
- @name_a_h << { :the => x[0].strip }
- elsif x.length == 2
- @name_a_h << { :the => x[0].strip, :others => x[1].strip }
- else #p x.length
- end
- end
- end
- l = @name_a_h.length
- name_str=''
- @name_a_h.each_with_index do |a,i|
- name_str += if a[:others]
- if (l - i) > 1
- "#{a[:others].strip} #{a[:the].strip}, "
- else
- "#{a[:others].strip} #{a[:the].strip}"
- end
- else
- if (l - i) > 2
- "#{a[:the].strip}, "
- else
- "#{a[:the].strip}"
- end
- end
- end
- {:name_a_h =>@name_a_h,:name_str =>name_str}
- end
- def extract
- @user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD']
- @programs,@wc,@language,@language_original={},{},{},{}
- @en={ :sum=>0,:mark=>0,:note=>0,:mismatch=>0 }
- @prog=SiSU_Env::Info_settings.new
- @sys=SiSU_Env::System_call.new
- @env=SiSU_Env::Info_env.new(@fns) #watch
- if @prog.wc \
- and @sys.wc
- wc=%x{wc #{fns}}
- wca=wc.scan(/\d+/)
- @wc_lines,@wc_words,@wc_bytes=wca[0].to_i,wca[1].to_i,wca[2].to_i
- else
- fns_a=@data.dup
- tmp=fns_a.join
- fns_a=tmp.scan(/\S+/)
- @wc_words=fns_a.length
- fns_a=tmp=nil
- end
- @concord_make=if @wc_words > @env.concord_max; false
- else true
- end
- @locale=@sys.locale
- @file_encoding=@sys.file_encoding(fns,@cmd)
- # programs set here for things that affect output appearance only
- @programs[:pdf]=SiSU_Env::System_call.new.program_found?('pdflatex')
- if @env.i18n.multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst)$/ #watch added match for sss
- @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
- @flv=@env.document_language_versions_found[:f]
- @fnz=if @fns =~/\.(?:ssm\.sst|ssm)$/; @fnn + '.ssm.zip'
- else @fnn + '.sst.zip'
- end
- else m=/(.+?)\.((?:-|ssm\.)?sst)$/
- @fnb=@fnn=@fns[m,1]
- @fnt=@fns[m,2]
- @flv<<@fns
- @fnz=if @fns =~/\.(?:_sst|ssm)$/; @fnb + '.ssm.zip'
- else @@fnb + '.sst.zip'
- end
- end
- @papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general
- @sfx_src=@fns[m,2]
- @sfx='.html' # #@sfx=nil watch
- @flag_auto_heading_num=false
- if @fns =~ /(?:-|ssm\.)?sst$/ #watch
- @env_out_root=@env.path.output
- @dir_out="#{@env.path.output}/#{@fnb}"
- @dir_tex=@env.path.tex
- @dir_lout=@env.path.lout
- @@publisher='SiSU http://www.jus.uio.no/sisu'
- end
- @txt_path=@txt_path ||= @env.path.output
- @stmp=%{#{@fns}}[/^(.+?)\..*/m,1]
- @fnstex=@fns.gsub(/_/,'\_')
- @flag_separate_endnotes=false
- @flag_separate_endnotes_make=true
- regx_date=/^\d{4}(?:-(?:[0][0-9]|1[0-2])(-(?:[0-2][0-9]|3[01]))?)?$/
- ver=SiSU_Env::Info_version.instance
- @sisu_version=ver.get_version
- @ruby_version=ver.rbversion
- @generated=Time.now
- fns_array=@data.dup
- skip unless fns_array # consider
- @markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version
- if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version
- if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version
- @markup_version_declared=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1]
- sm_a,sm_b,sm_c=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3]
- sm_c ||=0
- sv=if @cmd =~/[VMv]/; "SiSU version (#{@sisu_version[:version]})"
- else ''
- end
- s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3]
- tell=if @markup_version_declared.to_f==@markup_version.to_f
- SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version})",sv)
- else
- SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version})",sv)
- end
- ok=if s_a.to_i > sm_a.to_i
- true
- elsif s_a.to_i == sm_a.to_i \
- and s_b.to_i >= sm_b.to_i
- true
- elsif s_a.to_i == sm_a.to_i \
- and s_b.to_i == sm_b.to_i \
- and s_c.to_i >= sm_c.to_i
- true
- else false
- end
- if ok
- tell.txt_green if @cmd =~/[vVM]/
- else
- tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})")
- tell.warn unless @cmd =~/q/
- end
- else
- tell=SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided')
- tell.warn if @cmd =~/[VM]/
- end
- else
- tell=SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided')
- tell.warn unless @cmd =~/q/
- end
- @code_flag=false
- fns_array.each do |para| #% Scan document
- if para !~/^%+\s/ \
- and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included
- raise "Old markup style in file #{@fns}, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n"
- end
- @code_flag=case para
- when /^code\{\s*$/; true
- when /^\}code\s*$/; false
- else @code_flag
- end
- regx_header=/^@\S+?:[+-]?\s/
- if para =~regx_header \
- and not @code_flag #or para=~/^(?:1|:?A)~/
- case para
- when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing
- when /^@title:\s+(.+?)$/m #% metainfo DC
- @title=$1.strip
- @full_title=@title.dup
- @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
- @set_header_title=true
- @title.chomp!(' ')
- @html_title.chomp!(' ')
- tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title)
- tell.txt_grey unless @cmd =~/q/
- when /^@subtitle:\s+(.+?)$/m #% metainfo
- @subtitle=$1.strip
- @full_title="#{@title} - #{@subtitle}"
- @subtitle_tex=@subtitle
- when /^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:[|]|$)/m #when /^@(?:creator|author):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:[|]|$)/m
- names=name_format($1)
- @authorship=@author=names[:name_str]
- @authors=names[:name_a_h]
- when /^@author:\s+(.+?)$/
- names=name_format($1)
- @authorship=@author=names[:name_str]
- @authors=names[:name_a_h]
- when /^@(?:creator|author)\.title:\s+(.+?)$/; @author_title=$1 # Prof. Dr. etc.
- when /^@(?:creator|author)\.nationality:\s+(.+?)$/; @author_nationality=$1
- when /^@(?:translator|translated_by):\s+(.+?)$/m #% metainfo
- names=name_format($1)
- @translator=names[:name_str]
- when /^@(?:illustrator|illustrated_by):\s+(.+?)$/m #% metainfo
- names=name_format($1)
- @illustrator=names[:name_str]
- when /^@prepared_by:\s+(.+?)$/m #% metainfo
- names=name_format($1)
- @prepared_by=names[:name_str]
- when /^@digitized_by:\s+(.+?)$/m #% metainfo DC
- names=name_format($1)
- @digitized_by=names[:name_str]
- when /^@subject:\s+(.+?)$/m; @subject=$1 #% metainfo DC
- when /^@description:\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed
- when /^@contributor:\s+(.+?)$/m #% metainfo DC
- names=name_format($1)
- @contributor=names[:name_str]
- when /^@publisher:\s+(.+?)$/m; @publisher=$1 #% metainfo DC
- when /^@original_publication:\s+(.+?)$/m; @original_publication=$1
- when /^@original_publication\.date:\s+(.+?)$/; @original_publication_date=$1
- when /^@original_publication\.nationality:\s+(.+?)$/; @original_publication_nationality=$1
- when /^@original_publication\.institution:\s+(.+?)$/; @original_publication_institution=$1
- when /^@writing_focus\.nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law)
- when /^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m #% metainfo DC
- #when /^@date.+?$/m #% metainfo DC
- if para =~/@date:\s+(.+?)$/m
- @date=$1.strip #% original publication date unless the substantive text is updated/modified, then date of update
- if @date !~regx_date \
- and not @date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@date)
- tell.instruct if @cmd =~/v/
- end
- @date_scheme='scheme="ISO-8601"' if @date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/@date\.added_to_site:\s+(.+?)$/m
- @date_added_to_site=$1.strip
- if @date_added_to_site !~regx_date \
- and not @date_added_to_site.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@date_added_to_site)
- tell.instruct if @cmd =~/v/
- end
- @date_scheme='scheme="ISO-8601"' if @date_added_to_site =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/@date\.created:\s*(.+?)$/m
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_created=date
- @date_created_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/@date\.issued:\s*(.+?)$/m
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_issued=date
- @date_issued_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/@date\.available:\s*(.+?)$/m
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_available=date
- @date_available_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/^@date\.valid:\s*(.+?)$/m
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_valid=date
- @date_valid_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/^@date\.modified:\s*(.+?)$/m #% of interest rss feed & sitemap
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_modified=date
- @date_modified_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- if para =~/^@date\.translated:\s*(.+?)$/m
- date=$1.strip
- if date !~regx_date \
- and not date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
- tell.instruct if @cmd =~/v/
- end
- @date_translated=date
- @date_translated_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
- end
- when /^@type:\s+(.+?)$/m; @type=$1 #% metainfo DC
- when /^@format:\s+(.+?)$/m; @format=$1 #% metainfo DC
- #when /^@identifier:\s+(.+?)$/m; @identifier=$1 #% metainfo DC
- when /^@source:\s+(.+?)$/m; @source=$1 #% metainfo DC
- when /^@language(?:\.document)?:\s+(.+?)$/m #% metainfo DC
- x=$1.strip
- lang=SiSU_Env::Standardise_language.new(x.dup)
- @language[:code]=lang.code
- @language[:name]=lang.title
- when /^@language\.original:\s+(.+?)$/m #% metainfo DC
- x=$1.strip
- lang=SiSU_Env::Standardise_language.new(x.dup)
- @language_original[:name]=lang.title
- when /^@relation:\s+(.+?)$/m; @relation=$1 #% metainfo DC
- when /^@coverage:\s+(.+?)$/m; @coverage=$1 #% metainfo DC
- when /^@rights:\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc.
- when /^@papersize:\s+(.+?)$/m #% metainfo DC
- l=$1
- if @mod.inspect !~/--papersize[=-]\S+/
- l=determine_papersize(l.dup)
- @papersize=l
- end
- when /^@keywords?:\s+(.+?)$/m; @keywords=$1 #% metainfo DC
- when /^@comments?:\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC
- when /^@abstract:\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC
- when /^@tags?:\s+\S/m #% metainfo
- tags=para.match(/^@tags?:\s+(.+)\Z/m)[1]
- tags.split(/,|$/).each do |tag|
- tag.strip!
- @tags << tag
- @tag_array << tag.split(/:/)
- tag_a=tag.downcase.gsub(/\s+/,'_').gsub(/(.+)/,'[\1]')
- tag_a=tag_a.split(/:/).join('][')
- @tag_a << tag_a
- end
- when /^@catalogue:\s+(.+)?$/m #% metainfo
- m=$1
- @cls_pg=m.match(/pg=(\S+)/)[1] if m =~/pg=/
- @cls_isbn=m.match(/isbn=(\S+)/)[1] if m =~/isbn=/
- @cls_dewey=m.match(/dewey=(\S+)/)[1] if m =~/dewey=/
- @cls_loc=m.match(/loc=(\S+)/)[1] if m =~/loc=/
- when /^@class(?:ify)?_loc:\s+(.+?)$/m; @cls_loc=$1 #% metainfo
- when /^@class(?:ify)?_dewey:\s+(.+?)$/m; @cls_dewey=$1 #% metainfo
- when /^@class(?:ify)?_pg:\s+(.+?)$/m; @cls_pg=$1 #% metainfo
- when /^@(?:class(?:ify)?_)?isbn:\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo
- when /^@images?:\s+(.+?)$/m; @image=$1 #% processing
-
- when /^@make:/m #% metainfo DC
-
- if para=~ /^@make:.+?:breaks:[ ]+(.+?)\n/m
- #p $1 #FIX
- #@pagenew=
- #@pagebreak=
- end
- if para=~ /^@make:.+?:headings:[ ]+(.+?)\n/m
- s=$1
- lv=[]
- s=(s =~/;/) ? (s.split(/;\s*/)) : [ s ]
- @toc=s
- lv1=s[0] ||='1~ '
- @lv1=/^#{lv1}/
- lv2=s[1] ||='2~ '
- @lv2=/^#{lv2}/
- lv3=s[2] ||='3~ '
- @lv3=/^#{lv3}/
- lv4=s[3] ||='4~ '
- @lv4=/^#{lv4}/
- lv5=s[4] ||='5~ '
- @lv5=/^#{lv5}/
- lv6=s[5] ||='6~ '
- @lv6=/^#{lv6}/
- end
- if para=~ /^@make:.+?:num_top:[ ]+(.+?)\n/m
- @num_top=$1
- end
- if para=~ /^@make:.+?:skin:[ ]+(.+?)\n/m
- @doc_skin=$1
- end
- when /^@(?:toc|structure):\s+(.+?)\Z/m #% processing
- doc_toc_str=$1
- @toc=doc_toc_str.split(/;\s*/)
- @toc=[ @toc ] if @toc == String
- #@toc.each {|x| x.gsub!(/\{/,'\{') } #FIX~
- lv1=@toc[0] ||='1~ ' #some arbitrary changes made
- @lv1=/^#{lv1}/
- lv2=@toc[1] ||='2~ '
- @lv2=/^#{lv2}/
- lv3=@toc[2] ||='3~ '
- @lv3=/^#{lv3}/
- lv4=@toc[3] ||='4~ '
- @lv4=/^#{lv4}/
- lv5=@toc[4] ||='5~ '
- @lv5=/^#{lv5}/
- lv6=@toc[5] ||='6~ '
- @lv6=/^#{lv6}/
- when /^@(?:level|page|markup):\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4
- if para =~/@(?:markup|level|page):?\s+(.+?)\Z/m
- page_break_str=$1
- pagebreaks=page_break_str.split(/;\s*/)
- #pagebreaks=[ pagebreaks ] if pagebreaks == String
- page_new,page_break,num_top=toc_lev_limit=nil
- pagebreaks.each do |x|
- page_new = x[/(:?[\dA-C],?)+/] if x=~/new|clear/
- page_break = x[/(:?[\dA-C],?)+/] if x =~/break/
- num_top = x[/:?[\dA-C]/].to_i if x =~/num_top/
- toc_lev_limit = x[/:?[\dA-C]/].to_i if x =~/toc_limit/
- end
- @pagenew=page_new if page_new
- @pagebreak=page_break if page_break
- @num_top=num_top if num_top
- @toc_lev_limit=toc_lev_limit if toc_lev_limit
- @flag_auto_heading_num=true if para =~/num_top/
- end
- if para =~/^@markup:\s+(.+?)$/m #%use of markup depreciated for num_top
- @markup=$1
- @flag_auto_heading_num=true if para =~/num_top/
- end
- when /^@bold:\s+(.+?)$/m #% processing
- m=$1.strip
- x=case m
- when /\/i$/; 'i'
- else ''
- end
- m.gsub!(/^\/(.+?)\/i?/,'\1')
- m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + m + ')\b'
- @make_bold[:str]='\b(?:' + m + ')\b'
- @make_bold[:regx]=if x =~/i/; /#{rgx}/i
- else /#{rgx}/
- end
- @make_bold
- when /^@(?:italics?|itali[sz]e):\s+(.+?)$/m #% processing Dublin Core - dublin core within
- m=$1.strip
- x=case m
- when /\/i$/; 'i'
- else ''
- end
- m.gsub!(/^\/(.+?)\/i?/,'\1')
- m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
- rgx='\b(' + m + ')\b'
- @make_italic[:str]='\b(?:' + m + ')\b'
- @make_italic[:regx]=if x =~/i/; /#{rgx}/i
- else /#{rgx}/
- end
- @make_italic
- when /^@(?:vocabulary|wordlist):\s+(.+?)$/m #% processing
- @vocabulary=$1 #not actually used by concordance
- when /^@skin:\s+(.+?)$/; @doc_skin=$1.strip #% processing
- when /^@(?:css|stylesheet):\s+(.+?)$/; @doc_css=$1.strip #% processing
- when /^@links:\s+(.+?)\Z/m #% processing
- doc_links_str=$1
- @lnk=[]
- if doc_links_str=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- doc_links=doc_links_str.scan(/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+/)
- count=1
- doc_links.each do |x|
- @lnk[count]={}
- @lnk[count][:say],@lnk[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(x)[1,2]
- count +=1
- end
- else
- lnks=doc_links_str.split(/;\s+/)
- #lnks=[ lnks ] if lnks == String
- count=1
- lnks.each do |x|
- @lnk[count]={}
- if x =~/^\s*(?:(?:https?|file|ftp):\/\/|\.\.\/)/; @lnk[count][:url]=x
- else
- @lnk[count][:say]=x
- count +=1
- end
- end
- end
- when /^@prefix(?:_[ab])?:\s/ #% metainfo
- if para =~/prefix_a:?\s+/
- @prefix_a=para[/@prefix_a:\s+(.+?)$/im,1]
- end
- if para =~/prefix(?:_b)?:?\s+/
- @prefix_b=para[/@prefix(?:_b)?:\s+(.+?)$/im,1]
- end
- when /^@suffix:\s+(.+?)$/m; @suffix=$1 #% metainfo
- when /^@information:\s+(.+?)$/m; @information=$1 #% metainfo
- when /^(?:@topic_register:[ ]+|@classify:.+?:topic_register:[ ]+)(.+?)\n/m #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)}
- #when /^@topic_register:\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)}
- @topic_register=$1
- u=@topic_register.scan(/[^;]+/)
- v=[]
- u.each do |l|
- v << l.scan(/[^:]+/)
- end
- v.each do |m|
- m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/
- @topic_register_array << m
- end
- @topic_register_array.sort!
- when /^@contact:\s+(.+?)$/m; @contact=$1 #% metainfo
- when /^@original_publication:\s+(.+?)$/m; @original_publication=$1 #% details of original publication
- when /^@icon:\s+(.+?)$/m; @icon=$1 #% processing
- when /^@promo:\s+(.+?)$/m
- @flag_promo=true
- @promo=$1.split(/[,;]\s*/)
- when /^@ad:\s+(\S+)?\s+(\S+\.png)?\s+(.+?!)\s+(\d+)\s*$/m #% processing
- @ad_url,@ad_png,@ad_alt,@ad_began=$1,$2,$3,$4
-# when /0~ad\.home\s+(.+)?\s*$/m #% processing
-# ad_home_str=$1
-# @ad_home=ad_home_str.split(/\s+!/)
- when /^@sta?mp(?:ed)?:\s+(.+?)$/m; @stmp= $1.downcase! #% processing
- when /^@(?:rcs|cvs):\+?\s+/ #% processing
- m=/@(?:rcs|cvs):\+?\s+/ #note the + sign to turn on use of rcs or cvs id
- ver=para[/#{m}(.+)/,1] #RCS or CVS ID tag # eg. # $Id$
- contains=/[\$]Id:\s+(\S+),v\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+Exp\s+(?:\S+\s+)?[\$]/ # reason for [$] which is apparently unnecessary is that rcs or cvs will otherwise expand id!
- if contains.match(ver)
- filename,vnumber,date,time,operator=contains.match(ver).captures
- @sc_filename,@sc_number,@sc_date,@sc_time=filename,vnumber,date,time
- end
- @sc_info=true if para[/@(?:rcs|cvs):\+/]
- when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing
- #% break - break, not necessary to process headers further :-) but necessary to extract endnotes etc. ;-(
- when /^@man:\s+(.+?)\Z/m #% man pages
- maninfo_str=$1
- maninfo=maninfo_str.split(/;\s*/m)
- maninfo.each do |x|
- @man_section= x[/^([1-8])/] if x =~/^([1-8])/
- @man_name= x[/name=(.+)/,1] if x =~/name=.+/
- @man_synopsis= x[/synopsis=(.+)/m,1] if x =~/synopsis=.+/
- end
- end
- @lv1 ||=/^#{Mx[:lv_o]}1:/
- @lv2 ||=/^#{Mx[:lv_o]}2:/
- @lv3 ||=/^#{Mx[:lv_o]}3:/
- @lv4 ||=/^#{Mx[:lv_o]}4:/
- @lv5 ||=/^#{Mx[:lv_o]}5:/
- @lv6 ||=/^#{Mx[:lv_o]}6:/
- else #%
- if para =~ /^(?:1|:?A)~/ #% processing
- if para=~/^:?A~/
- if @markup.nil? \
- or @markup.empty?
- @markup=@markup_version.to_s
- elsif @markup !~/0\.38/; @markup=@markup.strip + "; #@markup_version"
- end
- end
- if (para=~/^:?A~/ and @markup_version >= 0.38) \
- or (para=~/^1~/ and @markup_version < 0.38)
- if @title.nil?
- @title=para[/^:?[A1]~\S*(.+)$/m,1]
- @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
- @title.chomp!("\n")
- @html_title.chomp!("\n")
- tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title)
- tell.txt_grey if @cmd =~/v/
- end
- end
- end
- if not @book_idx and para =~/^=\{(.+?)\}\s*$/
- @book_idx=true
- end
- unless @code_flag
- case para
- when /~\{\s+.+?\}~/m #% processing
- en=para.scan(/~\{.+?\}~/m)
- en.each { |e| @en[:sum] +=1 }
- when /~\^(?:\s|$)/m #% processing
- mk=para.scan(/~\^(?:\s|$)/)
- mk.each { |e| @en[:mark] +=1 }
- when /^\^~\s+\S/; @en[:note] +=1 #% processing
- end
- end
- if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true
- end
- unless @flag_auto_endnotes
- if para =~/^(4~endnotes\b|<:ee>)/
- @flag_separate_endnotes=true
- @flag_endnotes=true
- end
- end
- if para =~/^(?:4~endnotes|<:ee>)/; @flag_separate_endnotes_make=false
- end
- if para =~/<!!e[#0-9]+?!>\s*.+/; @flag_endnotes=true
- end
- if para =~/table\{|<!tableh?\s+c\d+;.+?!>/i; @flag_tables=true
- end
- end
- if (@markup_version >= 0.38 and para =~/^:?A~/) \
- or (@markup_version < 0.38 and para =~/^1~/)
- @set_heading_top=true
- end
- if (@markup_version >= 0.38 and para =~/^1~/) \
- or (@markup_version < 0.38 and para =~/^4~/)
- m=nil
- if @markup_version >= 0.38 \
- and para =~/^1~(\S+)\s+(.+)$/
- m,t=$1,$2
- elsif @markup_version < 0.38 \
- and para =~/^4~(\S+)\s+(.+)$/
- m,t=$1,$2
- elsif @markup_version >= 0.38 \
- and para =~/^1~\s+(.+)$/
- t=$1
- elsif @markup_version < 0.38 \
- and para =~/^4~\s+(.+)$/
- t=$1
- end
- unless @heading_seg_first_flag # extract first segment name
- @heading_seg_first=t
- @heading_seg_first_flag=true
- end
- if m # list all segment names
- @seg_names << m
- @set_heading_seg=true
- if m=~/^\d{1,3}/ \
- and m !~/^0/
- @seg_autoname_safe=false
- end
- end
- end
- if para !~/^%+\s/ \
- and para =~@rgx_image
- @ec[:image] << para.scan(@rgx_image).uniq
- end
- @ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content
- @ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content
- unless @sem_tag
- @sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later
- end
- end #% here endeth the document loop
- if @ec[:image].length > 0
- @ec[:image].flatten!
- @ec[:image].uniq!
- @ec[:image].delete_if {|x| x =~/http:\/\// }
- @ec[:image].sort!
- end
- @ec[:audio].uniq!; @ec[:audio].flatten!; @ec[:audio].sort!
- @ec[:multimedia].uniq!; @ec[:multimedia].flatten!; @ec[:multimedia].sort!
- @man_name.gsub!(/(-)/,"\\\\\\1")
- @man_name.gsub!(/\n/,"\n.BR\n")
- @man_name.gsub!(/\A/,"\n.SH NAME\n")
- unless @man_synopsis.nil?
- @man_synopsis.gsub!(/(-)/,"\\\\\\1")
- @man_synopsis.gsub!(/\n/,"\n.BR\n")
- @man_synopsis.gsub!(/\A/,"\n.SH SYNOPSIS\n")
- end
- unless @rights
- if @author
- @rights ||=if @date =~/([12][890]\d{2})/ #matches years 1800 through 20\d\d 2004w19
- "Copyright (C) #{$1} #@author"
- else 'Copyright (C)' + @author
- end
- end
- end
- if @markup_version.to_f >= 0.38 #convert values in headers to internal representation
- translated=[]
- translate_list=[@pagenew,@pagebreak,@num_top,@toc_lev_limit]
- translate_list.each do |t|
- translate=t.to_s if t
- translated << if translate
- #translate.gsub!(/6/,'9')
- #translate.gsub!(/5/,'8')
- #translate.gsub!(/4/,'7')
- translate.gsub!(/3/,'6')
- translate.gsub!(/2/,'5')
- translate.gsub!(/1/,'4')
- translate.gsub!(/:?C/,'3')
- translate.gsub!(/:?B/,'2')
- translate.gsub!(/:?A/,'1')
- translate=if translate =~/^\d+$/; translate.to_i
- else translate
- end
- else nil
- end
- end
- @pagenew,@pagebreak,@num_top,@toc_lev_limit=translated
- @markup.gsub!(/page_new\s*=\s*([\dA-C])/,"page_new=#@pagenew")
- @markup.gsub!(/page_break\s*=\s*([\dA-C])/,"page_break=#@pagebreak")
- @markup.gsub!(/num_top\s*=\s*([\dA-C])/,"num_top=#@num_top")
- @markup.gsub!(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#@toc_lev_limit")
- end
- if @mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
- or @mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
- @papersize=determine_papersize(@mod.inspect)
- end
- @papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i)
- if @sys.openssl !=false
- skin=if @doc_skin; SiSU_Env::Info_skin.new(@opt,@doc_skin).select
- else SiSU_Env::Info_skin.new(@opt).select
- end
- @dgst,@dgst_skin=[],[]
- if @env.digest.type =~/sha256/
- @dgst=@sys.sha256(@env.source_file_with_path)
- @dgst_skin=if skin; @sys.sha256(skin)
- else nil
- end
- else
- @dgst=@sys.md5(@env.source_file_with_path)
- @dgst_skin=if skin; @sys.md5(skin)
- else nil
- end
- end
- end
- @publisher ||= "#@@publisher (this copy)"
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@fns)
- unless @language[:code] \
- and @language[:name]
- lang=@env.i18n.language #default language settings for directory by name, or in sysrc.yml
- @language[:code] ||= lang.code
- @language[:name] ||= lang.title
- end
- unless fn_set_lang[:d]==true #decide, naming convention overrides other settings, within document, etc.
- @language[:code]=fn_set_lang[:c]
- @language[:name]=fn_set_lang[:l]
- end
- @fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @flv.each do |l|
- lang=SiSU_Env::Standardise_language.new.file_to_language(l)
- c={ :a=>'',:b=>'',:c=>'' }
- if @fnl[:pre] =~/\S/; c[:a]="#{lang[:c]}."
- elsif @fnl[:mid] =~/\S/; c[:b]=".#{lang[:c]}"
- elsif @fnl[:post] =~/\S/; c[:c]=".#{lang[:c]}"
- end
- @lang << [lang[:l],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
- end if @flv
- @lang.uniq!
- @fn=SiSU_Env::Env_call.new(@fns).lang(fn_set_lang[:c])
- @identifier="#{@env.url.root}/#@fnb/#{@fn[:toc]}" #DC note constructed dc identifier
- if @en[:note] > 0 \
- and @en[:sum] > 0
- if @en[:sum] > 0
- else tell=SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}")
- tell.warn if @cmd !~/q/
- end
- end
- if @en[:mark] != @en[:note] \
- and @en[:note] > 0
- @en[:mismatch]=@en[:note] - @en[:mark]
- SiSU_Screen::Ansi.new(@cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @cmd !~/q/
- footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a')
- footnote_conversion_errors << "#@fns:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n"
- end
- if @title !~/[\S]/
- tell=SiSU_Screen::Ansi.new(@cmd,'Document Title Missing','please provide it')
- tell.warn if @cmd =~/v/
- end
- if @author !~/[\S]/
- tell=SiSU_Screen::Ansi.new(@cmd,'Document Author/Creator Missing','please provide it')
- tell.warn if @cmd =~/v/
- end
- # Elementary Document Structure Analysis - adds complexity may remove - need to develop - appears to work, proof of concept
- if @title.nil?
- title_trigger=nil
- fns_array.each do |para|
- if para !~/0~|@\S+:[+-]?\s/ \
- and para =~/\S/ \
- and title_trigger.nil?
- @title=para[/(\S.+)/m,1]
- @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
- @title.chomp!("\n")
- @html_title.chomp!("\n")
- title_trigger=1
- tell=SiSU_Screen::Ansi.new(@cmd,@html_title)
- tell.txt_cyan unless @cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@cmd,'Parameters')
- tell.txt_grey unless @cmd =~/q/
- end
- end
- end
- @struct={}
- doc_struct=Hash.new(0)
- if @lv1.nil?
- fns_array.each do |para|
- if para =~/^(Part|Chapter|Section|Article)\b/i
- case para
- when /^(Part|PART)\b/
- @struct[:part]=doc_struct[:part]
- doc_struct[:part]=doc_struct[:part] + 1
- when /^(Chapter|CHAPTER)\b/
- @struct[:chapter]=doc_struct[:chapter]
- doc_struct[:chapter]=doc_struct[:chapter] + 1
- when /^(Section|SECTION)\b/
- @struct[:section]=doc_struct[:section]
- doc_struct[:section]=doc_struct[:section] + 1
- when /^(Article|ARTICLE)\b/
- @struct[:article]=doc_struct[:article]
- doc_struct[:article]=doc_struct[:article] + 1
- when /^(Clause|CLAUSE)\b/
- @struct[:clause]=doc_struct[:clause]
- doc_struct[:clause]=doc_struct[:clause] + 1
- when /^\d\..*[^\.]$/
- @struct[:number]=doc_struct[:number]
- doc_struct[:number]=doc_struct[:number] + 1
- end
- end
- end
- if doc_struct[:article] > 2 #%~level 4
- @lv4=/^(?:Article|ARTICLE)\b/
- elsif doc_struct[:chapter] > 2 \
- and doc_struct[:article] \
- and doc_struct[:article] < 3
- @lv4=/^(?:Chapter|CHAPTER)\b/
- elsif doc_struct[:clause] > 2
- @lv4=/^(?:Clause|CLAUSE)\b/
- elsif doc_struct[:number] > 2
- @lv4="^\d\..*[^\.]$"
- end
- if doc_struct[:section] > 2 #%~level 3
- @lv3=/^(?:Section|SECTION)\b/
- end
- if doc_struct[:chapter] > 2 \
- and doc_struct[:article] \
- and doc_struct[:article] > 2
- @lv2=/^(?:Chapter|CHAPTER)\b/
- end
- if doc_struct[:part] > 2 \
- and @lv[2].nil?
- @lv2=/^(?:Part|PART)\b/
- end
- if doc_struct[:part] > 2 \
- and @lv[2].inspect !~/Part/ \
- and @lv[1].nil?
- @lv1=/^(Part|PART)\b/
- end
- end
- @lnk=@lnk.compact if @lnk
- @lv1 ||=/^#{Mx[:lv_o]}1:/
- @lv2 ||=/^#{Mx[:lv_o]}2:/
- @lv3 ||=/^#{Mx[:lv_o]}3:/
- @lv4 ||=/^#{Mx[:lv_o]}4:/
- @lv5 ||=/^#{Mx[:lv_o]}5:/
- @lv6 ||=/^#{Mx[:lv_o]}6:/
- if @doc_skin
- tell=SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #@doc_skin")
- tell.txt_grey if @cmd =~/v/
- end
- @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually
- Store.new(self,@env).store #% pstore
- self
- end
- private
- class Store
- def initialize(md,dir)
- @md=md
- @pstorefile="#{dir.path.dal}/#{md.fns}.pstore"
- end
- def store
- File.unlink(@pstorefile) if FileTest.file?(@pstorefile)
- tell=SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #@pstorefile")
- tell.txt_grey if @md.cmd =~/v/
- store=PStore.new(@pstorefile)
- store.transaction do
- store['md']=@md
- #doc.each{|x,y| puts "#{x}, #{y}; "}
- store.commit
- end
- @@md=@md=nil
- end
- end
- end
- end
- class Instantiate
- def param_instantiate
- @@date=SiSU_Env::Info_date.new
- @@symlnk=SiSU_Env::Create_system_link.new
- @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil
- @doc={
- :initialise=>nil,
- :markup=>'',:lnks=>'',:stmp=>'',:prefix_a=>'',:prefix_b=>'',
- :req=>{}
- }
- @@yaml=@@yamladdr=nil
- @@flag={}
- @@publisher='SiSU scribe'
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/param_identify_markup.rb b/lib/sisu/v1/param_identify_markup.rb
deleted file mode 100644
index 0f0f40a0..00000000
--- a/lib/sisu/v1/param_identify_markup.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: A conversion script for canned substitutions, a fairly generic
- simple tool that can be used to store other canned conversions, used here for
- altering SiSU markup
-
-=end
-module SiSU_Markup_type
- class Markup_identify
- @@fns,@@version_determined,@@version_declared,@@declared_doc_type='','','','[text?]'
- attr_accessor :version_determined,:version_declared,:declared_doc_type
- def initialize(content,opt)
- @cont,@opt=content,opt
- end
- def identify
- @version_determined,@version_declared,@declared_doc_type=@@version_determined,@@version_declared,@@declared_doc_type
- if @opt.fns != @@fns
- if @cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \
- or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @declared_doc_type,@version_declared=$1,$2
- elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \
- or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @version_declared=$1
- end
- @flag_66,@flag_57,@flag_38=false,false,false
- @cont.each_with_index do |y,i|
- if y =~/^(?:0\{?~links?|@links?:)\s/
- links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
- else ' (post 0.20.4 header links)'
- end
- end
- unless @flag_38
- if y =~/^:?A~/
- version=0.38
- @version_determined=version
- @flag_38=true
- end
- end
- if @flag_38
- if @flag_69 \
- or y =~/^=\{.+?\}\s*$/
- version=0.69
- @flag_69=true
- @version_determined=version
- break
- end
- if @flag_66 \
- or y =~/[:;]\{.+?\}[:;][a-z+]/
- version='0.66'
- @flag_66=true
- @version_determined=version
- break
- end
- end
- end
- @flag_57,@flag_38=false,false
- unless @flag_66 or @flag_69
- @cont.each_with_index do |y,i|
- if @flag_57 \
- or y =~/^:?A~\?? @title/
- @version_determined=0.57
- @flag_57=true
- break
- end
- if @flag_38 \
- or y =~/^:?A~/
- @version_determined=0.38
- @flag_38=true
- break if i >= 200
- if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
- @version_determined=0.42 #0.38 can safely be treated as 0.42
- break
- end
- end
- if y =~/^0~/ \
- and not @flag_38
- @version_determined=0.16
- break
- end
- end
- end
- @@fns=@opt.fns
- @@version_determined,@@version_declared,@@declared_doc_type=@version_determined,@version_declared,@declared_doc_type
- end
- self
- end
- def markup_version?
- identify.version_determined.to_f
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/particulars.rb b/lib/sisu/v1/particulars.rb
deleted file mode 100644
index ce32ef96..00000000
--- a/lib/sisu/v1/particulars.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# coding:utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- particulars, composite information about document being processed
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_Particulars
- require 'singleton'
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/param"
- require "#{SiSU_lib}/dal"
- include SiSU_Env
- include SiSU_Param
- class Combined_singleton
- include Singleton
- def get_all(opt)
- @opt=opt
- set_env
- set_md
- set_dal #needs @md
- end
- def get_env(opt)
- @opt=opt
- set_env
- end
- def get_md(opt)
- @opt=opt
- set_md
- end
- def get_dal_array(opt)
- @opt=opt
- set_dal #needs @md
- end
- def get_env_md(opt)
- @opt=opt
- set_env
- set_md
- end
- def get_html_idx(opt)
- @opt=opt
- set_html_idx
- end
- attr_accessor :opt,:md,:html_idx
- def set_md
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- end
- end
- attr_accessor :opt,:env
- def set_env
- begin
- @env=SiSU_Env::Info_env.new(@opt.fns)
- self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- end
- end
- attr_accessor :opt,:dal_array
- def set_dal
- begin
- @dal_array=@dal_array=SiSU_DAL::Source.new(@md).get
- self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- end
- end
- def set_html_idx
- begin
- @html_idx=SiSU_DAL::Source.new(@md).get_idx_html
- self
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- end
- end
- end
-end
-__END__
-consider running as separate objects
diff --git a/lib/sisu/v1/plaintext.rb b/lib/sisu/v1/plaintext.rb
deleted file mode 100644
index 60f0f745..00000000
--- a/lib/sisu/v1/plaintext.rb
+++ /dev/null
@@ -1,423 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: plaintext text generation, stripped plaintext output (unix,
- linefeed)
-
-=end
-module SiSU_Plaintext
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/plaintext_format"
- include SiSU_Plaintext_format
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/shared_structure"
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/
- puts "#{sf} not a processed file type"
- end
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
- path=@env.path.output_tell
- tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:plain]}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:plain]}")
- tell.flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Plaintext::Source::Scroll.new(@dal_array,@md).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/shared_txt"
- include SiSU_text_utils
- @@endnotes={ :para=>[],:end=>[] }
- @@dp=nil
- def initialize(data,md)
- @data,@md=data,md
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m # 2004w18 pb pn removal added
- @tab="\t"
- @@endnotes_=case md.mod.inspect
- when /--footnote/; false
- when /--endnote/; true
- else true
- end
- @br=case md.mod.inspect
- when /--dos/; "\r\n"
- when /--unix/; "\n"
- else "\n"
- end
- @plaintext={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[] }
- end
- def songsheet
- plaintext=markup(@data)
- publish(plaintext)
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- @n=[]
- notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
- n=n.dup.to_s
- if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/
- fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added
- fix.each do |x|
- unless x.empty?; @n << x
- end
- end
- else @n << n
- end
- end
- notes=@n.flatten
- notes.each do |e|
- util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_text_utils::Wrap.new(e.to_s,78,4,1)
- else SiSU_text_utils::Wrap.new(e.to_s,78,1,1)
- end
- wrap=util.line_wrap
- if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
-\\1[\\2]: \\3
-GSUB
- )
- else
- wrap.gsub!(/^(.+)\Z/m, <<GSUB
-\\1
-GSUB
- )
- end
- @@endnotes[:para] << "-#{wrap}"
- @@endnotes[:end] << '' << wrap
- end
- @@endnotes
- end
- def plaintext_metadata(meta)
- util=SiSU_text_utils::Wrap.new(meta.text,78,15,1)
- txt=util.line_wrap
- @plaintext[:metadata] <<= if meta.type == 'meta'
- <<WOK
-
-#{@tab}#{meta.el}: #{txt}
-WOK
- else ''
- end
- end
- def plaintext_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @plaintext[:tail] <<<<WOK
-#@br
-Other versions of this document: #@br
-manifest:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}#@br
-html:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:toc]}#@br
-pdf:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_p]}
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_l]}#@br
-plaintext (plain text):
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:plain]}#@br
-at:
- #{vz.url_site}#@br
-
-#{sc}
-* #{generator}
-* #{rubyv}
-* #{lastdone}
-* SiSU #{vz.url_sisu}
-WOK
- end
- def plaintext_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- wrapped=if para[@regx]
- paragraph=para[@regx,2]
- if paragraph =~/#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- m=$1.to_i
- paragraph.gsub!(/#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/,'')
- util=SiSU_text_utils::Wrap.new(paragraph,78,m*2)
- else util=SiSU_text_utils::Wrap.new(paragraph.gsub(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,''),78,0)
- end
- util.line_wrap
- end
- if lv
- times=wrapped.length
- times=78 if times > 78
- @plaintext[:body] << case lv
- when 1; wrapped.upcase << @br << '*'*times << @br
- when 2..3; wrapped.upcase << @br << '='*times << @br
- when 4; wrapped.upcase << @br << '-'*times << @br
- when 5..6; wrapped.upcase << @br << '.'*times << @br
- end
- else
- @plaintext[:body] << wrapped << @br # main text, contents, body KEEP
- end
- if @@endnotes[:para] \
- and not @@endnotes_
- @plaintext[:body] << @br
- @@endnotes[:para].each {|e| @plaintext[:body] << e << @br}
- elsif @@endnotes[:para] \
- and @@endnotes_
- @plaintext[:body] << @br*2
- end
- @@endnotes[:para]=[]
- end
- def markup(data) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @plaintext_contents_close[x]='' }
- plaintext_tail #($1,$2)
- table_message='[table omitted, see other document formats]'
- fix=[]
- data.each do |para|
- para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove
- para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}")
- para.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check
- para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/')
- para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_')
- para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^')
- para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+')
- para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-')
- unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+|image)/,'\1 [link:] \2')
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")
- para.gsub!(/_((?:https?|file|ftp):\/\/\S+)/,'\1')
- extract_endnotes(para)
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]') # endnote marker marked up
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]') # endnote marker marked up
- para.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- para.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- para.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- para.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
- end
- if para =~/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/ ##{Mx[:gr_o]}codeline#{Mx[:gr_c]}
- if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
- end
- para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") # watch
- para.gsub!(/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'')
- else para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") # watch introduces a bug
- end
- para.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks
- para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3')
- para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
- #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
- wordlist=para.scan(/\S+/)
- if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; plaintext_metadata(d_meta)
- end
- end
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=para[@regx,3]
- @p_num=SiSU_Plaintext_format::Paragraph_number.new(paranum)
- end
- @sto=SiSU_Structure::Split_text_object.new(@md,para).txt
- ### problem in scroll, it appears tables are getting paragraph numbers
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m \
- and para=~/\S+/
- para=case @sto.format
- when /^(1):(\S*?)/
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body1
- when /^(2):(\S*?)/
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body2
- when /^(3):(\S*?)/
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body3
- when /^(4):(\S+?)/ # work on see SiSU_text_parts::Split_text_object
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body4
- when /^(5):(\S*?)/
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body5
- when /^(6):(\S*?)/
- plaintext_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body6
- else
- plaintext_structure(para,nil,nil,nil) #watch may be problematic
- para
- end
- elsif para =~/#{table_message}/
- @plaintext[:body] << para << @br
- elsif para =~/(Note|Endnotes?)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit
- #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>')
- #para=formatMono.bold_para
- elsif para.include? 'Owner Details' \
- and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>')
- #@plaintext[:owner_details]=formatMono.bold_para
- #para=''
- elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! check
- end
- para='' if (para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- case para
- when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- if para =~/.*<:#>.*$/m
- txt_obj={:txt =>para}
- format_text=Format_text_object.new(@md,txt_obj)
- para=format_text.scr_indent_one_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- para.gsub!(/#{Mx[:id_o]}.+?#{Mx[:id_c]}/,' ') if para ## Clean Prepared Text
- para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
- para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text
- end
- end
- @plaintext
- end
- def publish(plaintext)
- divider='='
- content=[]
- content << plaintext[:open]
- content << plaintext[:head]
- content << plaintext[:body]
- content << @@endnotes[:end] if @@endnotes_
- content << "#{@br}#{divider*78}#{@br}"
- content << plaintext[:metadata]
- content << "#@br#{divider*78}#@br" if @md.stmp =~/\w+/ #not used?
- content << plaintext[:owner_details] if @md.stmp =~/\w+/ #not used?
- content << plaintext[:tail]
- Output.new(content,@md).plaintext
- @@endnotes={ :para=>[],:end=>[] }
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- end
- def plaintext #%plaintext output
- SiSU_Env::SiSU_file.new(@md).mkdir
- file_plaintext=SiSU_Env::SiSU_file.new(@md,@md.fn[:plain]).mkfile
- @sisu=[]
- @content.each do |para| # this is a hack
- if para.class==Array \
- and para.length > 0
- para.each do |line|
- line.gsub!(/\s+$/m,'')
- file_plaintext.puts line #unix plaintext
- end
- else file_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
- end
- end
- file_plaintext.close
- end
- end
- end
-end
-__END__
-&#033;\|&#035;\|&&#042;\|&#045;\|&#047;\|&#095;\|&#123;\|&#125;\|&#126;\|&#
diff --git a/lib/sisu/v1/plaintext_format.rb b/lib/sisu/v1/plaintext_format.rb
deleted file mode 100644
index 9652edbb..00000000
--- a/lib/sisu/v1/plaintext_format.rb
+++ /dev/null
@@ -1,120 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: plaintext formatting template
-
-=end
-module SiSU_Plaintext_format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(paranum)
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- @paranum.gsub(/(\d+)/,'<font size="1" color="#777777">&nbsp;&nbsp;\1</font>')
- end
- def name
- @paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- end
- def goto
- @paranum.gsub(/(\d+)/,'<a href="#\1">')
- end
- end
- class Format_text_object
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- @lnk_url =t_o[:lnk_url] || nil
- @lnk_txt =t_o[:lnk_txt] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- #@one,@two,@three=one,two,three
- p t_o.class
- p caller
- end
- rgx=/^#{Rx[:lv]}/
- @txt.gsub!(rgx,'') if @txt =~rgx
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/
- @txt.gsub!(rgx,'\1') if @txt =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- def heading_body1
- end
- def heading_body2
- end
- def heading_body3
- end
- def heading_body4
- end
- def heading_body5
- end
- def heading_body6
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v1/relaxng.rb b/lib/sisu/v1/relaxng.rb
deleted file mode 100644
index aba4b8d9..00000000
--- a/lib/sisu/v1/relaxng.rb
+++ /dev/null
@@ -1,1177 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: relaxng flow/logic
-
-=end
-module SiSU_relaxng
- require "#{SiSU_lib}/sysenv"
- class RelaxNG
- def gpl3_or_later
- @gpl3_or_later =<<RELAXNG
-=begin
-
- * Name: SiSU generated relaxng
-
- * Description: generated relaxng for SiSU
- (SiSU is a framework for document structuring, publishing and search)
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: html generation, processing
-
-=end
-RELAXNG
- end
- def rnc_name
- def output_sax
- 'sisu_sax.rnc'
- end
- def output_dom
- 'sisu_dom.rnc'
- end
- def output_xhtml
- 'sisu_xhtml.rnc'
- end
- def input_sax
- 'sisu_sax.rnc'
- end
- def input_dom
- 'sisu_dom.rnc'
- end
- def input_node
- 'sisu_node.rnc'
- end
- self
- end
- def rng_name
- def output_sax
- 'sisu_sax.rng'
- end
- def output_dom
- 'sisu_dom.rng'
- end
- def output_xhtml
- 'sisu_xhtml.rng'
- end
- def input_sax
- 'sisu_sax.rng'
- end
- def input_dom
- 'sisu_dom.rng'
- end
- def input_node
- 'sisu_node.rng'
- end
- self
- end
- def xsd_name
- def output_sax
- 'sisu_sax.xsd'
- end
- def output_dom
- 'sisu_dom.xsd'
- end
- def output_xhtml
- 'sisu_xhtml.xsd'
- end
- def input_sax
- 'sisu_sax.xsd'
- end
- def input_dom
- 'sisu_dom.xsd'
- end
- def input_node
- 'sisu_node.xsd'
- end
- self
- end
- #def fn_dtd_sax
- # 'sisu_sax.dtd'
- #end
- #def fn_dtd_dom
- # 'sisu_dom.dtd'
- #end
- #def fn_dtd_node
- # 'sisu_node.dtd'
- #end
- #def fn_dtd_xhtml
- # 'sisu_xhtml.dtd'
- #end
- def rnc_sisu_object_input
- @relaxng =<<RELAXNG
-#%% sisu object model: input
-#{gpl3_or_later}
-#%% definitions
-# dublin core:
-element-semantic =
- element semantic {
- # dublin core:
- element title { text }
- & element creator { text }?
- & element subject { text }?
- & element description { text }?
- & element publisher { text }?
- & element contributor { text }?
- & element date { text }?
- & element date.created { text }?
- & element date.issued { text }?
- & element date.available { text }?
- & element date.valid { text }?
- & element date.modified { text }?
- & element type { text }?
- & element format { text }?
- & element identifier { text }?
- & element source { text }?
- & element relation { text }?
- & element coverage { text }?
- & element rights { text }?
- & element keywords { text }?
- # extended semantic metadata:
- & attribute subtitle { text }?
- & attribute illustrator { text }?
- & attribute translator { text }?
- & attribute prepared_by { text }?
- & attribute digitized_by { text }?
- & attribute language { text }?
- & attribute language.original { text }?
- & attribute classify.pg { text }?
- & attribute classify.isbn { text }?
- & attribute classify.dewey { text }?
- & attribute classify.loc { text }?
- & attribute prefix.a { text }?
- & attribute prefix.b { text }?
- & attribute suffix { text }?
- & attribute comments { text }?
- & attribute abstract { text }?
- # & attribute information { text }?
- & attribute contact { text }?
- & attribute links { text }?
- }
-element-processing =
- element processing {
- attribute structure { text }?
- & attribute level { text }?
- & attribute markup { text }?
- & attribute bold { text }?
- & attribute italics { text }?
- & attribute papersize { text }?
- & attribute vocabulary { text }?
- & element date_scheme { text }?
- & element date.issued.scheme { text }?
- & element date.available.scheme { text }?
- & element date.valid.scheme { text }?
- & element date.modified.scheme { text }?
- }?
-element-head =
- element head {
- # processing instructions, and semantic data, distinguish?:
- element metadata {
- element title { text },
- element file { text },
- element generator { text },
- element-semantic,
- element-processing
- }+
- }
-# body text/contents
-# includes <b> <i> <u> <del> <ins> <indent1> <bullet> etc.
-element-txt =
- element txt {
- text*
- & element b { text }*
- & element i { text }*
- & element u { text }*
- & element ins { text }*
- & element del { text }*
- }
-element-endnote =
- element endnote {
- element number { text },
- element note { element-txt }+
- }+
-element-para =
- element para {
- # attribute paragraph_format { text },
- element-txt+
- & element-endnote?
- }
-element-external_space =
- element external_space {
- # ignored by sisu, provide program needs
- element program {
- # e.g. kdissert
- element name { text },
- element xpos { text },
- element ypos { text },
- element font { text },
- element outline_color { text },
- element text_color { text },
- element comment { text }
- }*
- }*,
-#%% structure
- element document {
- # document head:
- element-head,
- # document body:
- element body {
- # object, a unit of text, usually a paragraph with any associated endnotes
- element node {
- element structure {
- # structure document using either node:heading levels or node:heading relationships:
- # (i) sisu default uses node:heading levels (1-6 or A-C,1-3) to build document structure
- element level { text }?,
- # (ii) sisu alternatively could use node:heading relationship information to build document structure
- element node.id { text },
- element node.parent { text },
- element node.child { text }*
- },
- element node.objects {
- element object.heading {
- # nametag used only in headings, especially important for segmented html
- element nametag { text },
- element-para
- },
- element object.para {
- element-para
- }*
- }+,
- element-external_space
- }+
- }
- }
-RELAXNG
- end
- def rnc_sisu_object_dal
- @relaxng =<<RELAXNG
-#%% sisu object model: dal
-#{gpl3_or_later}
-#%% definitions
-# dublin core:
-element-semantic =
- element semantic {
- # dublin core:
- element title { text }
- & element creator { text }?
- & element subject { text }?
- & element description { text }?
- & element publisher { text }?
- & element contributor { text }?
- & element date { text }?
- & element date.created { text }?
- & element date.issued { text }?
- & element date.available { text }?
- & element date.valid { text }?
- & element date.modified { text }?
- & element type { text }?
- & element format { text }?
- & element identifier { text }?
- & element source { text }?
- & element relation { text }?
- & element coverage { text }?
- & element rights { text }?
- & element keywords { text }?
- # extended semantic metadata:
- & attribute subtitle { text }?
- & attribute illustrator { text }?
- & attribute translator { text }?
- & attribute prepared_by { text }?
- & attribute digitized_by { text }?
- & attribute language { text }?
- & attribute language.original { text }?
- & attribute classify.pg { text }?
- & attribute classify.isbn { text }?
- & attribute classify.dewey { text }?
- & attribute classify.loc { text }?
- & attribute prefix.a { text }?
- & attribute prefix.b { text }?
- & attribute suffix { text }?
- & attribute comments { text }?
- & attribute abstract { text }?
- # & attribute information { text }?
- & attribute contact { text }?
- & attribute links { text }?
- }
-element-processing =
- element processing {
- attribute structure { text }?
- & attribute level { text }?
- & attribute markup { text }?
- & attribute bold { text }?
- & attribute italics { text }?
- & attribute papersize { text }?
- & attribute vocabulary { text }?
- & element date_scheme { text }?
- & element date.issued.scheme { text }?
- & element date.available.scheme { text }?
- & element date.valid.scheme { text }?
- & element date.modified.scheme { text }?
- }?
-element-head =
- element head {
- # processing instructions, and semantic data, distinguish?:
- element metadata {
- element title { text },
- element file { text },
- element generator { text },
- element-semantic,
- element-processing
- }+
- }
-# body text/contents
-# includes <b> <i> <u> <del> <ins> <indent1> <bullet> etc.
-element-txt =
- element txt {
- text*
- & element b { text }*
- & element i { text }*
- & element u { text }*
- & element ins { text }*
- & element del { text }*
- }
-element-checksum.endnote = element checksum.clean { text }
-element-endnote =
- element endnote {
- element number { text },
- element note { element-txt }+,
- element-checksum.endnote
- }+
-element-checksum.para =
- element checksum.para {
- element checksum.clean { text },
- element checksum.marked { text }
- }
-element-para =
- element para {
- # attribute paragraph_format { text },
- element-txt+
- & element-endnote?
- }
-element-object =
- element object {
- element-para,
- element-checksum.para
- }
-# object citation number, unique sequential number for objects:
-element-ocn = element ocn { text }
-element-object_structure_summary =
- element-ocn,
- # type: heading level value 1 -6, or normal text
- element type { text },
- # type number: sequential number for designated type
- element type_number { text },
- # type category: sequential number for designated category, e.g. sequentially counting all headers
- element category_number { text }
-element-external_space =
- element external_space {
- # ignored by sisu, provide program needs
- element program {
- # e.g. kdissert
- element name { text },
- element xpos { text },
- element ypos { text },
- element font { text },
- element outline_color { text },
- element text_color { text },
- element comment { text }
- }*
- }*,
-#%% structure
- element document {
- # document head:
- element-head,
- # document body:
- element body {
- # object, a unit of text, usually a paragraph with any associated endnotes
- element node {
- element structure {
- # structure document using either node:heading levels or node:heading relationships:
- # (i) sisu default uses node:heading levels (1-6 or A-C,1-3) to build document structure
- element level { text }?,
- # (ii) sisu alternatively could use node:heading relationship information to build document structure
- element node.id { text },
- element node.parent { text },
- element node.child { text }*
- },
- element node.objects {
- element object.heading {
- element-object_structure_summary,
- # nametag used only in headings, especially important for segmented html
- element nametag { text },
- element-object
- },
- element object.para {
- element-object_structure_summary,
- element-object
- }*
- }+,
- element-external_space
- }+
- }
- }
-RELAXNG
- end
- def rnc_model_output_sax
- @relaxng =<<RELAXNG
-#% sax output model, part of SiSU and distributed under the same license
-default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
-start =
- element document {
- element head {
- (br
- | meta
- | element creator {
- attribute class { xsd:NCName },
- (text
- | element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
- xsd:anyURI
- })+
- }
- | element date {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_available {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_created {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_issued {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_modified {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_valid {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element keywords {
- attribute class { xsd:NCName },
- text
- }
- | element language {
- attribute class { xsd:NCName },
- xsd:NCName
- }
- | element meta { xsd:NMTOKEN }
- | element rights {
- attribute class { xsd:NCName },
- (text | link)+
- }
- | element source {
- attribute class { xsd:NCName },
- text
- }
- | element structure {
- attribute class { xsd:NCName },
- text
- }
- | element subject {
- attribute class { xsd:NCName },
- text
- }
- | element title {
- attribute class { xsd:NCName },
- text
- }
- | element type {
- attribute class { xsd:NCName },
- text
- }
- | element source_control {
- (br
- | meta
- | element sc {
- attribute class { xsd:NCName },
- text
- })+
- })+
- },
- element body {
- element object {
- attribute id { text },
- element ocn {
- text
- },
- element text {
- attribute class { xsd:NCName },
- (text
- | b
- | br
- | del
- | en
- | i
- | link
- | sub
- | sup
- | u
- | element image {
- attribute alt { text }?,
- attribute height { xsd:integer }?,
- attribute width { xsd:integer }?,
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
- })+
- }?,
- element table {
- attribute align { xsd:NCName },
- attribute bgcolor { xsd:NCName },
- attribute border { xsd:integer },
- attribute cellpadding { xsd:integer },
- attribute summary { text },
- attribute width { text },
- element tr {
- element td {
- attribute valign { xsd:NCName },
- attribute width { text },
- (text | b | i)+
- }+
- }+
- }?,
- element endnote {
- attribute notenumber { xsd:integer }?,
- attribute symbol { text }?,
- (element number { xsd:integer }
- | element symbol { text }),
- element note {
- (text
- | b
- | br
- | del
- | i
- | link
- | sup
- | u
- | element em { xsd:NCName }
- | element sub { xsd:NCName })+
- }
- }*
- }+
- }
- }
-meta = element meta { text }
-br = element br { empty }
-b = element b { (text | en | i | link | sup)+ }
-i = element i { (text | b | br | sup)+ }
-en = element en { text }
-sub = element sub { xsd:NCName }
-sup = element sup { xsd:NCName }
-link =
- element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
- (xsd:anyURI | text | b | i | sup)+
- }
-u = element u { (text | b | i)+ }
-del = element del { (text | b | i | link)+ }
-RELAXNG
- end
- def rnc_model_output_dom
- @relaxng =<<RELAXNG
-#% dom output model, part of SiSU and distributed under the same license
-default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
-start =
- element document {
- element head {
- element header {
- meta,
- (element creator { text }
- | element date { xsd:NMTOKEN }
- | element date_available { xsd:NMTOKEN }
- | element date_created { xsd:NMTOKEN }
- | element date_issued { xsd:NMTOKEN }
- | element date_modified { xsd:NMTOKEN }
- | element date_valid { xsd:NMTOKEN }
- | element keywords { text }
- | element language { xsd:NCName }
- | element rights { (text | link)+ }
- | element source { text }
- | element structure { text }
- | element subject { text }
- | element title { text }
- | element type { text }
- | element source_control {
- (br
- | meta
- | element sc {
- attribute class { xsd:NCName },
- text
- })+
- })
- }+
- },
- element body {
- element heading1 {
- heading,
- contents1*,
- element heading2 {
- heading,
- contents1*,
- element heading3 {
- heading,
- element contents1 {
- heading,
- content,
- element contents2 {
- heading,
- content,
- element contents3 { heading, content }*
- }*
- }+
- }*
- }*
- }+
- }
- }
-meta = element meta { text }
-br = element br { empty }
-heading = element heading { object }
-contents1 =
- element contents1 {
- heading,
- content,
- element contents2 {
- heading,
- content,
- element contents3 { heading, content }*
- }*
- }
-content = element content { object* }
-object =
- element object {
- attribute id { xsd:integer },
- element ocn { text },
- element nametag { text }?,
- (element table {
- attribute align { xsd:NCName },
- attribute bgcolor { xsd:NCName },
- attribute border { xsd:integer },
- attribute cellpadding { xsd:integer },
- attribute summary { text },
- attribute width { text },
- element tr {
- element td {
- attribute valign { xsd:NCName },
- attribute width { text },
- (text | b | i)+
- }+
- }+
- }
- | element text {
- attribute class { xsd:NCName }?,
- (text
- | b
- | del
- | endnote
- | i
- | link
- | element br { empty }
- | element endnote {
- element number { xsd:integer },
- element note { (text | i | link)+ }
- }
- | element image {
- attribute height { xsd:integer },
- attribute width { xsd:integer },
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
- }
- | element sub { text })+
- })
- }
-i = element i { text }
-b = element i { text }
-u = element u { (text | b | i)+ }
-sub = element sub { xsd:NCName }
-sup = element sup { xsd:NCName }
-del = element del { (text | b | i | link)+ }
-link =
- element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
- xsd:anyURI
- }
-endnote =
- element endnote {
- (element number { xsd:integer }
- | element symbol { text }),
- element note {
- (text
- | b
- | br
- | del
- | i
- | link
- | sub
- | sup
- | u
- | element em { xsd:NCName }
- | element sub { xsd:NCName })+
- }
- }
-RELAXNG
- end
- def rnc_model_output_xhtml #not done
- @relaxng =<<RELAXNG
-#% xhtml output model, part of SiSU and distributed under the same license
-default namespace = ""
-namespace xlink = "http://www.w3.org/1999/xlink"
-start =
- element document {
- element head {
- (br
- | element creator {
- attribute class { xsd:NCName },
- (text
- | element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
- xsd:anyURI
- })+
- }
- | element date {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_available {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_created {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_issued {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_modified {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element date_valid {
- attribute class { xsd:NCName },
- xsd:NMTOKEN
- }
- | element language {
- attribute class { xsd:NCName },
- xsd:NCName
- }
- | element keywords {
- attribute class { xsd:NCName },
- text
- }
- | element meta {
- attribute content { text }?,
- attribute http-equiv { xsd:NCName }?,
- text
- }
- | element rights {
- attribute class { xsd:NCName },
- (text | link)+
- }
- | element source {
- attribute class { xsd:NCName },
- text
- }
- | element structure {
- attribute class { xsd:NCName },
- text
- }
- | element subject {
- attribute class { xsd:NCName },
- text
- }
- | element title {
- attribute class { xsd:NCName },
- text
- }
- | element type {
- attribute class { xsd:NCName },
- xsd:NCName
- })+
- },
- element body {
- element object {
- attribute id { xsd:integer },
- (element endnote {
- attribute notenumber { xsd:integer }?,
- attribute symbol { text }?,
- (text
- | b
- | br
- | del
- | i
- | link
- | sup
- | u
- | element em { xsd:NCName }
- | element sub { xsd:NCName })+
- }
- | element ocn { text }
- | element text {
- attribute class { xsd:NCName },
- (text
- | b
- | br
- | del
- | en
- | i
- | link
- | sup
- | u
- | element image {
- attribute alt { text }?,
- attribute height { xsd:integer }?,
- attribute width { xsd:integer }?,
- attribute xlink:actuate { xsd:NCName },
- attribute xlink:href { text },
- attribute xlink:show { xsd:NCName },
- attribute xlink:type { xsd:NCName }
- }
- | element sub { text })+
- })+,
- element table {
- attribute align { xsd:NCName },
- attribute bgcolor { xsd:NCName },
- attribute border { xsd:integer },
- attribute cellpadding { xsd:integer },
- attribute summary { text },
- attribute width { text },
- element tr {
- element td {
- attribute valign { xsd:NCName },
- attribute width { text },
- (text | b | i)+
- }+
- }+
- }?
- }+
- }
- }
-br = element br { empty }
-en = element en { text }
-sup = element sup { xsd:NCName }
-i = element i { (text | b | br | sup)+ }
-link =
- element link {
- attribute xlink:href { xsd:anyURI },
- attribute xlink:type { xsd:NCName },
- (text | b | i | sup)+
- }
-b = element b { (text | en | i | link | sup)+ }
-u = element u { (text | b | i)+ }
-del = element del { (text | b | i | link)+ }
-RELAXNG
- end
- def rnc_model_input_sax
- @relaxng =<<RELAXNG
-#% sax input model, part of SiSU and distributed under the same license
-default namespace = ""
-start =
- element document {
- element head {
- element header {
- attribute class { xsd:NCName },
- (element creator { text }
- | element date { xsd:NMTOKEN }
- | element date.available { xsd:NMTOKEN }
- | element date.created { xsd:NMTOKEN }
- | element date.issued { xsd:NMTOKEN }
- | element date.modified { xsd:NMTOKEN }
- | element date.valid { xsd:NMTOKEN }
- | element italicize { text }
- | element language { xsd:NCName }
- | element links { text }
- | element markup { text }
- | element rights { text }
- | element skin { xsd:NCName }
- | element subject { text }
- | element title { text }
- | element type { xsd:NCName }
- | element vocabulary { xsd:NCName })
- }+
- },
- element body {
- element object {
- element text {
- attribute class { xsd:NCName },
- (text
- | b
- | i
- | element endnote {
- attribute symbol { xsd:NCName },
- (text
- | i
- | element br { empty })+
- }
- | element u { i }
- | element image.path { text })+
- }?
- }+
- }
- }
-i = element i { text }
-b = element b { text }
-RELAXNG
- end
- def rnc_model_input_dom
- @relaxng =<<RELAXNG
-#% dom input model, part of SiSU and distributed under the same license
-default namespace = ""
-start =
- element document {
- element head {
- element header {
- attribute class { xsd:NCName },
- (element creator { text }
- | element date { xsd:NMTOKEN }
- | element date.available { xsd:NMTOKEN }
- | element date.created { xsd:NMTOKEN }
- | element date.issued { xsd:NMTOKEN }
- | element date.modified { xsd:NMTOKEN }
- | element date.valid { xsd:NMTOKEN }
- | element italicize { text }
- | element language { xsd:NCName }
- | element links { text }
- | element markup { text }
- | element rights { text }
- | element skin { xsd:NCName }
- | element subject { text }
- | element title { text }
- | element type { xsd:NCName }
- | element vocabulary { xsd:NCName })
- }+
- },
- element body {
- element heading1 {
- heading,
- element heading2 {
- heading,
- contents1+,
- element heading3 { heading, contents1+ }+
- }
- }
- }
- }
-heading = element heading { object }
-contents1 =
- element contents1 {
- heading,
- content,
- element contents2 {
- heading,
- content,
- element contents3 { heading, content }*
- }*
- }
-object =
- element object {
- element text {
- (text
- | italic
- | element bold { xsd:NMTOKEN }
- | element endnote {
- element symbol { text }?,
- element note {
- (text
- | italic
- | element br { empty })+
- }
- }
- | element underscore { italic }
- | element image.path { text }
- | element italic { text })+
- }
- }
-italic = element italic { text }
-content = element content { object+ }
-RELAXNG
- end
- def rnc_model_input_node
- @relaxng =<<RELAXNG
-#% node input model, part of SiSU and distributed under the same license
-default namespace = ""
-start =
- element document {
- element head {
- element header {
- attribute class { xsd:NCName },
- (element creator { text }
- | element date { xsd:NMTOKEN }
- | element date.available { xsd:NMTOKEN }
- | element date.created { xsd:NMTOKEN }
- | element date.issued { xsd:NMTOKEN }
- | element date.modified { xsd:NMTOKEN }
- | element date.valid { xsd:NMTOKEN }
- | element italicize { (text | i)+ }
- | element language { xsd:NCName }
- | element links { text }
- | element markup { text }
- | element rights { text }
- | element skin { xsd:NCName }
- | element subject { text }
- | element title { text }
- | element type { xsd:NCName }
- | element vocabulary { xsd:NCName })
- }+
- },
- element body {
- element object {
- (element text {
- attribute class { xsd:NCName },
- (text
- | b
- | i
- | element br { empty }
- | element endnote {
- attribute symbol { xsd:NCName },
- (text | i)+
- }
- | element image.path { text }
- | element sub { text })+
- }
- | (element ocn { empty },
- element table {
- attribute align { xsd:NCName },
- attribute bgcolor { xsd:NCName },
- attribute border { xsd:integer },
- attribute cellpadding { xsd:integer },
- attribute summary { text },
- attribute width { text },
- element tr {
- element td {
- attribute valign { xsd:NCName },
- attribute width { text },
- (text | b)+
- }+
- }+
- })),
- element node {
- element id { xsd:integer },
- element parent { xsd:integer },
- element offspring { text }?
- }
- }+
- }
- }
-b = element b { text }
-i = element i { text }
-RELAXNG
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/remote.rb b/lib/sisu/v1/remote.rb
deleted file mode 100644
index d0ce57d9..00000000
--- a/lib/sisu/v1/remote.rb
+++ /dev/null
@@ -1,266 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: remote operations, get source from or copy output to remote server
-
-=end
-module SiSU_Remote
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- pwd=Dir.pwd
- class Put
- def initialize(opt)
- @opt=opt
- @dir=SiSU_Env::Info_env.new(@opt.fns)
- @put=unless @opt.fns =~/\.ssm\.sst$/; @opt.fns
- else @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
- end
- @remote=SiSU_Env::Info_remote.new(@opt)
- end
- def rsync
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put)
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync
- end
- def rsync_base
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_base
- end
- def rsync_base_sync
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_base_sync
- end
- def rsync_sitemaps
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_sitemaps
- end
- def rsync_harvest
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync_harvest')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.rsync_harvest
- end
- def scp
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put)
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp
- end
- def scp_base
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp_base
- end
- def scp_base_all
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete')
- tell.dark_grey_title_hi unless @opt.cmd =~/q/
- @remote.scp_base_all
- end
- #def rsync
- # def do #rsync
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put)
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.rsync
- # end
- # def base
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.rsync_base
- # end
- # def base_sync
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.rsync_base_sync
- # end
- # def sitemaps
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.rsync_sitemaps
- # end
- # def harvest
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.rsync_harvest
- # end
- # self
- #end
- #def scp
- # def do #scp
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put)
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.scp
- # end
- # def scp_base
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.scp_base
- # end
- # def scp_base_all
- # tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete')
- # tell.dark_grey_title_hi unless @opt.cmd =~/q/
- # @remote.scp_base_all
- # end
- # self
- #end
- end
- class Get
- def initialize(opt,get_s)
- @opt,@get_s=opt,get_s
- @msg,@msgs='',nil
- @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
- end
- def fns
- require 'open-uri'
- require 'pp'
- require "#{SiSU_lib}/composite"
- @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/(?:0~|@)skin:?\s+(\S+)/ #@rgx_skin=/^0~skin\s+(\S+)/
- threads=[]
- for requested_page in @get_s
- re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
- threads << Thread.new(requested_page) do |url|
- open(url) do |f|
- raise "#{url} not found" unless f
- base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb
- imagedir=base_uri + '/_sisu/image' #check on
- doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc'
- #"Got file, and ready to process: #{fnb}.t#{instr}"
- downloaded_file=File.new("#{fnb}.-sst",'w+')
- image_download_url=SiSU_Assemble::Remote_image.new.image(imagedir)
- images=[]
- skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir)
- f.collect.each do |r| # work area
- unless r =~/^%+\s/
- skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin
- if r !~/^%+\s/ \
- and r =~@rgx_image
- images << r.scan(@rgx_image).uniq
- end
- end
- downloaded_file << r
- end
- if skin \
- and skin.length > 0
- SiSU_Assemble::Remote_image.new.download_doc_skin(skin)
- end
- if images \
- and images.length > 1
- images.flatten!
- images.uniq!
- images.delete_if {|x| x =~/http:\/\// }
- images.sort!
- @msg,@msgs='downloading images:', [ images.join(',') ]
- @tell.call.warn unless @opt.cmd =~/q/
- SiSU_Assemble::Remote_image.new.download_images(image_download_url,images)
- @msg,@msgs='downloading done',nil
- @tell.call.warn unless @opt.cmd =~/q/
- end
- downloaded_file.close
- end
- end
- end
- threads.each {|thr| thr.join} if threads #and threads.length > 0
- end
- def sisupod
- get_p=@get_s
- if get_p.length > 0 #% remote sisupod
- require 'net/http'
- for requested_pod in get_p
- pod_info=Remote_download.new(requested_pod)
- @opt.fns=pod_info.pod.name
- Net::HTTP.start(pod_info.pod.site) do |http|
- resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
- open(pod_info.pod.name,'wb') do |file|
- file.write(resp.body)
- end
- end
- end
- end
- end
- end
- class Remote_download
- def initialize(requested_file)
- @requested_file=requested_file
- end
- def pod
- re_p_div=/http:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip)?|[^\/]+?\.ssp)$/
- re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt](?:\.zip)?|[^\/]+?\.ssp)$/
- if @requested_file =~ re_p_div
- @site,@pth,@pod= re_p_div.match(@requested_file).captures
- elsif @requested_file =~ re_p
- @pod= re_p.match(@requested_file).captures
- end
- def site
- @site
- end
- def path
- @pth
- end
- def dir_stub
- re_p_stub=/.+?([^\/]+)$/
- pod_stub= re_p_stub.match(path).captures.join if path
- end
- def name_source
- @pod
- end
- def name
- name_source
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/response.rb b/lib/sisu/v1/response.rb
deleted file mode 100644
index 075c29f9..00000000
--- a/lib/sisu/v1/response.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Request response
-
-=end
-module SiSU_Response
- class Response
- def response?(ask) #move to more appropriate directory later
- response='redo'
- print ask + " ['yes', 'no' or 'quit']: "
- response=File.new('/dev/tty').gets.strip
- #response=gets.strip
- ans=if response == 'yes'; true
- elsif response == 'no'; false
- elsif response =~/^quit|exit$/; exit
- else puts "[please type: 'yes', 'no' or 'quit']"
- response?(ask)
- end
- ans
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/rexml.rb b/lib/sisu/v1/rexml.rb
deleted file mode 100644
index 0b7ab94b..00000000
--- a/lib/sisu/v1/rexml.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: rexml testing of xml
-
-=end
-module SiSU_Rexml
- # load XML file for REXML parsing
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- class Rexml
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
- def initialize(md,fno)
- @md,@fno=md,fno
- @env=SiSU_Env::Info_env.new(@md.fns)
- @prog=SiSU_Env::Info_program.new #(md.fns) #if md
- if File.file?"#{@env.path.output}/#{@md.fnb}/#@fno"
- @fnap="#{@env.path.output}/#{@md.fnb}/#@fno" #index.xml causes problems with index.html in server config
- elsif File.file?"#{Dir.pwd}/#@fno"
- @fnap="#{Dir.pwd}/#@fno"
- end
- @e_head='/document/head'
- @e_title='/document/head/title'
- @e_object='/document/body/object'
- @e_ocn='/document/body/object/ocn'
- @e_text='/document/body/object/text'
- @e_endnote='/document/body/object/endnote'
- end
- def xml
- begin
- if FileTest.file?(@fnap)
- if @prog.rexml !=false \
- and FileTest.directory?('/usr/lib/ruby/1.8/rexml/') #note values can be other than true
- xmlfile=IO.readlines(@fnap,'').join
- begin
- @xmldoc=REXML::Document.new xmlfile
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','REXML',"XML document #@fnap loaded") #% tell
- tell.colorize unless @md.cmd =~/q/
- if @md.cmd =~ /v/i #% substantive text
- @xmldoc.elements.each(@e_head) do |e|
- tell=SiSU_Screen::Ansi.new(@md.cmd,'brown',e)
- tell.colorize unless @md.cmd =~/q/
- end
- end
- rescue REXML::ParseException
- puts 'broken XML'
- end
- end
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped')
- tell.colorize unless @md.cmd =~/q/
- exit
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
-end
-__END__
- misc
-e.each do |element|
- element.each do |child|
- if child.is_a?(REXML::Text)
- puts "Text: #{child.to_s.inspect}"
- else
- puts "SubElement: #{child.name}"
- end
- end
-end
-
diff --git a/lib/sisu/v1/screen_text_color.rb b/lib/sisu/v1/screen_text_color.rb
deleted file mode 100644
index 8ffcf2c3..00000000
--- a/lib/sisu/v1/screen_text_color.rb
+++ /dev/null
@@ -1,414 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, screen colors text
-
-=end
-module SiSU_Screen
- class Color
- attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black
- def initialize(&block)
- instance_eval &block
- end
- end
- class Ansi < Color
- attr_reader :cX
- def initialize(cmd,*txt)
- @cmd,@txt=cmd,txt
- @color_instruct=txt[0]
- flag=SiSU_Env::Info_processing_flag.new
- if @cmd
- if flag.color #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off
- @use_color=if @cmd =~/c/; false
- else true
- end
- else
- @use_color=if @cmd =~/c/; true
- else false
- end
- end
- if @cmd =~/k/; @use_color=false
- end
- else @use_color=false
- end
- @cX=@@cX= unless @use_color
- Color.new do
- self.off=self.white=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black=''
- end
- else #default set to colors on
- Color.new do
- self.off = "\033[0m"
- self.white = "\033[0m"
- self.marker = "\033[42m"
- self.bold = "\033[1m"
- self.underline = "\033[4m"
- self.invert = "\033[7m"
- self.darkgrey_hi = "\033[100m"
- self.grey_hi = "\033[47m"
- self.pink_hi = "\033[105m"
- self.fuschia_hi = "\033[45m"
- self.red_hi = "\033[41m"
- self.orange_hi = "\033[101m"
- self.yellow_hi = "\033[103m"
- self.brown_hi = "\033[43m"
- self.lightgreen_hi = "\033[102m"
- self.green_hi = "\033[42m"
- self.cyan_hi = "\033[106m"
- self.blue_hi = "\033[104m"
- self.navy_hi = "\033[44m"
- self.grey = "\033[90m"
- self.pink = "\033[95m"
- self.fuschia = "\033[35m"
- self.ruby = "\033[31m"
- self.red = "\033[91m" #check
- self.orange = "\033[91m"
- self.yellow = "\033[93m"
- self.brown = "\033[33m"
- self.green = "\033[92m"
- self.darkgreen = "\033[32m"
- self.cyan = "\033[36m"
- self.blue = "\033[94m"
- self.navy = "\033[34m"
- self.black = "\033[30m"
- end
- end
- end
- def colors
- 0.upto(109) {|i| print "\033[#{i}m 33[#{i}m \033[m"}
- puts ''
- end
- def color
- case @color_instruct
- when /invert/; @cX.invert
- when /darkgrey_hi/; @cX.darkgrey_hi
- when /grey_hi/; @cX.grey_hi
- when /pink_hi/; @cX.pink_hi
- when /fuschia_hi/; @cX.fuschia_hi
- when /red_hi/; @cX.red_hi
- when /orange_hi/; @cX.orange_hi
- when /yellow_hi/; @cX.yellow_hi
- when /brown_hi/; @cX.brown_hi
- when /lightgreen_hi/; @cX.lightgreen_hi
- when /green_hi/; @cX.green_hi
- when /cyan_hi/; @cX.cyan_hi
- when /blue_hi/; @cX.blue_hi
- when /navy_hi/; @cX.navy_hi
- when /white/; @cX.white
- when /grey/; @cX.grey
- when /pink/; @cX.pink
- when /fuschia/; @cX.fuschia
- when /ruby/; @cX.ruby
- when /red/; @cX.red
- when /orange/; @cX.orange
- when /yellow/; @cX.yellow
- when /brown/; @cX.brown
- when /green/; @cX.green
- when /darkgreen/; @cX.darkgreen
- when /cyan/; @cX.cyan
- when /blue/; @cX.blue
- when /navy/; @cX.navy
- when /close/; @cX.off
- when /off/; @cX.off
- end
- end
- def colorize
- case @color_instruct
- when /invert/; puts "#{@cX.invert}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /darkgrey_hi/; puts "#{@cX.darkgrey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /grey_hi/; puts "#{@cX.grey_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /pink_hi/; puts "#{@cX.pink_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /fuschia_hi/; puts "#{@cX.fuschia_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /red_hi/; puts "#{@cX.red_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /orange_hi/; puts "#{@cX.orange_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /yellow_hi/; puts "#{@cX.yellow_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /brown_hi/; puts "#{@cX.brown_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /lightgreen_hi/; puts "#{@cX.lightgreen_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /green_hi/; puts "#{@cX.green_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /cyan_hi/; puts "#{@cX.cyan_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /blue_hi/; puts "#{@cX.blue_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /navy_hi/; puts "#{@cX.navy_hi}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off} #{@cX.grey}#{@txt[3]}#{@cX.off}"
- when /bold/; puts "#{@cX.bold}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /white/; puts "#{@cX.off}#{@txt[1]} #{@txt[2]}"
- when /grey/; puts "#{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /pink/; puts "#{@cX.pink}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /fuschia/; puts "#{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /ruby/; puts "#{@cX.ruby}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /red/; puts "#{@cX.red}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /orange/; puts "#{@cX.orange}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /yellow/; puts "#{@cX.yellow}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /brown/; puts "#{@cX.brown}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /green/; puts "#{@cX.green}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /darkgreen/; puts "#{@cX.darkgreen}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /cyan/; puts "#{@cX.cyan}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /blue/; puts "#{@cX.blue}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- when /navy/; puts "#{@cX.navy}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- end
- end
- def sourcename(sourcefilename)
- @sourcefilename=sourcefilename
- end
- def basename(sourcefilename)
- @basename=sourcefilename.sub(/\.(?:(?:-|ssm\.)?sst|ssm)$/,'')
- end
- def sisu
- end
- def rescue
- %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:"#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
- end
- def warn
- puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
- end
- def error
- puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}"
- end
- def error2
- puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- end
- def version
- puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n"
- end
- def html3numbers
- puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{#{@cX.grey}} +
- %{scroll only: #{@txt[1]}, seg only: #{@txt[2]},} +
- %{#{@cX.off} } +
- %{#{@cX.cyan}joint scroll & seg: #{@txt[3]},#{@cX.off}} +
- %{#{@cX.grey} } +
- %{nav only: #{@txt[4]}} +
- %{#{@cX.off}}
- end
- def html2numbers
- puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{#{@cX.grey}} +
- %{scroll only: #{@txt[1]},} +
- %{#{@cX.off} } +
- %{#{@cX.cyan}seg only: #{@txt[2]},#{@cX.off}} +
- %{#{@cX.grey} } +
- %{joint scroll & seg: #{@txt[3]}, nav only: #@n_files_nav} +
- %{#{@cX.off}}
- end
- def html1numbers
- puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{#{@cX.cyan}scroll only: #{@txt[1]},#{@cX.off}} +
- %{#{@cX.grey} } +
- %{seg only: #{@txt[2]}, } +
- %{joint scroll & seg: #{@txt[3]}, nav only: #@n_files_nav} +
- %{#{@cX.off}}
- end
- def html0_numbers
- puts %{\t#{@cX.ruby}#{@txt[0]} files processed#{@cX.off}. } +
- %{#{@cX.grey}} +
- %{scroll only: #{@txt[1]}, seg only: #{@txt[2]}, joint scroll & seg: #{@txt[3]},} +
- %{#{@cX.off} } +
- %{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.}
- end
- def php_numbers
- puts %{ #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{php_scr only: #{@txt[1]}, } +
- %{#{@cX.cyan}php_seg only: #{@txt[2]}#{@cX.off}, } +
- %{joint php scroll & seg: #{@txt[3]}, } +
- %{php_nav only: #{@txt[4]}}
- end
- def txt_white
- puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}"
- end
- def txt_grey
- puts "\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}"
- end
- def txt_cyan
- puts "\t#{@cX.cyan}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
- end
- def txt_blue
- puts "\t#{@cX.blue}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
- end
- def txt_red
- puts "\t#{@cX.red}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}"
- end
- def txt_green
- puts "\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
- end
- def url #clean
- blue
- end
- def result
- puts "\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.blue}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- end
- def maintenance
- puts "\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}"
- end
- def instruct
- puts %{\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off} #{@cX.cyan}#{@txt[3]}#{@cX.off} #{@cX.grey}#{@txt[4]}#{@cX.off} "#{@cX.brown}#@f#{@cX.off}"}
- end
- def grey_open
- print @cX.grey
- end
- def p_off
- print @cX.off
- end
- def p_close
- print @cX.off
- end
- def flow
- puts %{\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def output
- puts %{\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def generic
- puts %{\t#{@cX.navy}#{@txt[0]} #{@txt[1]}#{@cX.off}. }
- end
- def files_processed
- puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}}
- end
- def print_blue
- print "#{@cX.blue}#{@txt[0]} #{@txt[1]}#{@cX.off}"
- end
- def puts_blue
- puts "#{@cX.blue}#{@txt[0]} #{@txt[1]}#{@cX.off}"
- end
- def print_brown
- print "#{@cX.brown}#{@txt[0]}#{@cX.off}"
- end
- def blue_tab
- print "\t#{@cX.blue}#{@txt[0]}#{@cX.off}\n"
- end
- def print_grey
- print "#{@cX.grey}#{@txt[0]} #{@txt[1]}#{@cX.off}"
- end
- def puts_grey
- puts "#{@cX.grey}#{@txt[0]} #{@txt[1]}#{@cX.off}"
- end
- def puts_brown
- puts "#{@cX.brown}#{@txt[0]} #{@txt[1]}#{@cX.off}"
- end
- def grey_tab
- print "\t#{@cX.grey}#{@txt[0]}#{@cX.off}\n"
- end
- def green_title
- puts %{#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}}
- end
- def green_title_hi
- puts %{#{@cX.green_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.grey}#{@txt[1]}#{@cX.off}}
- end
- def green_hi_blue
- puts %{#{@cX.green_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def grey_title_hi
- puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def dark_grey_title_hi
- puts %{#{@cX.darkgrey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def cyan_title_hi
- puts %{#{@cX.cyan_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def dbi_title
- puts %{#{@cX.blue_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.cyan}#{@cX.grey}#{@txt[1]}#{@cX.off*2} #{@cX.green}#{@txt[2]}#{@cX.off}}
- end
- def yellow_title_hi
- puts %{#{@cX.yellow_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def term_sheet_title
- puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.red_hi}#{@cX.black}#{@txt[1]}.#{@cX.off*2} }
- end
- def generic_number
- puts "#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
- end
- def tex_numbers
- puts %{ #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}tex/pdf files processed#{@cX.off}.}
- end
- def tex_info_numbers
- puts %{ #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}texinfo files processed#{@cX.off}.}
- end
- def lout_numbers
- puts %{ #{@cX.green}#@n_lout#{@cX.off} #{@cX.cyan}lout/pdf files processed#{@cX.off}.}
- end
- def parameters
- end
- def reserved
- puts %{ #{@cX.grey_hi}#{@cX.black}reserved#{@cX.off*2}}
- end
- def meta_verse_title
- puts %{#{@cX.green_hi}#{@cX.black}MetaVerse#{@cX.off*2} }
- end
- def meta_verse_title_v
- b=sourcename(@txt[0])
- puts %{#{@cX.green_hi}#{@cX.black}MetaVerse#{@cX.off*2} } +
- %{#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}~meta/#{b}.meta#{@cX.off}}
- end
- def meta_verse
- puts "\t#{@cX.grey}MetaVerse#{@cX.off}"
- end
- def meta_verse_skipped
- puts %{\t#{@cX.grey}MetaVerse: MarshalLoad (creation of metaVerse skipped)#{@cX.off}}
- end
- def meta_verse_load
- puts %{\t<<MetaVerse: MarshalLoad>>}
- end
- def html_title
- puts %{#{@cX.green_hi}#{@cX.black}HTML#{@cX.off*2}}
- end
- def html_output
- puts %{\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}#{@txt[1]}#{@cX.off}}
- end
- def php_title
- puts %{\n#{@cX.green_hi}#{@cX.black}PHP#{@cX.off*2}}
- end
- def segmented
- puts "\t#{@cX.grey}Seg#{@cX.off} #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}segments#{@cX.off}"
- end
- end
-end
-
diff --git a/lib/sisu/v1/share_src.rb b/lib/sisu/v1/share_src.rb
deleted file mode 100644
index ee8749ac..00000000
--- a/lib/sisu/v1/share_src.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: share sisu source markup file, copy it to output directory!
-
-=end
-module SiSU_Markup
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- pwd=Dir.pwd
- class Source
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- stub=@opt.fnb.gsub(/~[a-z]+$/,'')
- @output_path="#{@env.path.output}/src"
- #@output_path="#{@env.path.output}/#{stub}"
- end
- def read
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #@output_path")
- tell.warn unless @opt.cmd =~/q/
- mkdir_p("#{@env.path.output}/src") unless FileTest.directory?("#{@env.path.output}/src")
- mkdir_p(@output_path) unless FileTest.directory?(@output_path)
- if FileTest.directory?(@output_path)
- unless @opt.fns =~/\.ssm$/; cp(@opt.fns,@output_path)
- else
- req=@opt.fns.gsub(/(.+?\.ssm)$/,'\1.sst')
- file="#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"
- if FileTest.file?(file); cp(file,"#@output_path/#{req}")
- else print "did not find #{file} to copy"
- end
- end
- else
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #@output_path")
- tell.warn unless @opt.cmd =~/q/
- exit
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/share_src_kdissert.rb b/lib/sisu/v1/share_src_kdissert.rb
deleted file mode 100644
index 4193aae1..00000000
--- a/lib/sisu/v1/share_src_kdissert.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: share sisu source markup file, copy it to output directory!
-
-=end
-module SiSU_Kdi_source
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- pwd=Dir.pwd
- class Source
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @output_path="#{@env.path.output}/#{@opt.fnb}"
- end
- def read
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share Kdissert Source Document!',@opt.fnb)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Copy kdissert file to output directory","#{@opt.fnb} -> #@output_path")
- tell.warn unless @opt.cmd =~/q/
- mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
- mkdir_p(@output_path) unless FileTest.directory?(@output_path)
- if FileTest.directory?(@output_path)
- if @opt.fns =~/\.kdi\._sst$/ \
- and FileTest.file?(@opt.fnb)
- cp(@opt.fnb,@output_path)
- end
- else
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fnb} -> #@output_path")
- tell.warn unless @opt.cmd =~/q/
- exit
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_html.rb b/lib/sisu/v1/shared_html.rb
deleted file mode 100644
index a62f3526..00000000
--- a/lib/sisu/v1/shared_html.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: shared html parts
-
-=end
-module SiSU_HTML_shared
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/html_table"
- class Table < SiSU_HTML_table::Table
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_html_lite.rb b/lib/sisu/v1/shared_html_lite.rb
deleted file mode 100644
index 5e0888bf..00000000
--- a/lib/sisu/v1/shared_html_lite.rb
+++ /dev/null
@@ -1,276 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by db and flatfile output generators, mostly
- xml/xhtml/html formatting
-
-=end
-module SiSU_Format_Shared
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- class CSS_Format
- require "#{SiSU_lib}/defaults"
- @@fns=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class==Hash
- @txt =t_o[:txt] #|| nil #s/@content/@txt/
- @col =t_o[:col] #|| nil
- @notenumber =t_o[:endnote_nr] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- #content.gsub!(/<:i[1-9]>/,'')
- #@md,@content=md,content
- p t_o.class
- p caller
- end
- @txt.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'')
- @id=@ocn=@col[:ocn]
- @ocnd,@ocns=@col[:ocnd],@col[:ocns]
- @lv=@col[:lev].to_s
- @@hname=if @md.fns != @@fns
- @@fns=@md.fns
- ''
- end
- @hname=if @col[:seg] \
- and not @col[:seg].to_s.empty?
- @@hname=@col[:seg].to_s
- else @@hname
- end
- @tab="\t"
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- # lots introduced to do html tables in db
- @@tablehead,@@tablefoot=[],[]
- @vz=SiSU_Env::Get_init.instance.skin
- @env=SiSU_Env::Info_env.new(@md.fns)
- @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
- end
- def urls(data)
- @words=[]
- data.each do |word|
- @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/
- if word =~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/
- m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures
- else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures
- d=''
- end
- word=case m
- when /\.png|\.jpg|\.gif|c=|\d+x\d+/
- w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/
- w=%{width="#{w}"} if w
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{<br /><p class="caption">#{c}</p>} if c
- png=m.scan(/\S+/)[0]
- #image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external
- #else @env.url.images_local
- #end
- ins=if u \
- and u.strip !~/^image$/
- %{<a href="#{u}">[#{png}]</a>#{caption}}
- else %{[#{png}] #{caption}}
- end
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/,ins)
- else
- link=m[/(.+)/m]
- png=m.scan(/\S+/)[0].strip
- link=link.strip
- ins=%{<a href="#{u}">#{link}</a>#{d}}
- #ins=%{#{link} <a href="#{u}">[link]</a>#{d}}
- word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins)
- end
- else word
- end
- word
- end
- @words=@words.join(' ')
- end
- def markup(para)
- if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/
- if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/
- wm=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|\S+/)
- words=urls(wm)
- para.gsub!(/.+/m,words)
- end
- para.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;')
- para.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
- para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'')
- para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
- para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
- else
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- para
- end
- def paragraph
- %{#{@tab*1}<p class="h#{@lv}" id="#{@ocn}" type="substantive" header="#{@hname}">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n} << "\n"
- end
- def endnote #used only by db
- @txt=markup(@txt)
- <<GSUB
-#{@tab*1}<p class="endnote" name="note_#{@notenumber}" from="#{@ocn}">
-#{@tab*2}<a href="#{@base_url}#-#{@notenumber}" name="_#{@notenumber}">#{@notenumber}.</a> <note>#{@txt}</note>
-#{@tab*1}</p>
-GSUB
- end
- def lev_toc_hname
- %{#{@tab*1}<p class="toc#{@lv}" header="#{@hname}"><a href="##{@ocn}">\n#{@tab*2}#{@txt}\n#{@tab*1}</a></p>\n} << "\n"
- end
- def lev_toc
- %{#{@tab*1}<p class="toc#{@lv}"><a href="##{@ocn}">\n#{@tab*2}#{@txt}\n#{@tab*1}</a></p>\n} << "\n"
- end
- def lev4_plus
- %{#{@tab*1}<p class="h#{@lv}" id="#{@ocn}" type="substantive" header="#{@hname}">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n} << "\n"
- end
- def lev4_minus
- %{#{@tab*1}<p class="h#{@lv}" id="#{@ocn}" type="substantive">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n} << "\n"
- end
- def norm_comment
- %{#{@tab*1}<p class="norm" id="none" type="comment">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n}
- end
- def norm
- @txt=markup(@txt)
- %{#{@tab*1}<p class="norm" id="#{@ocn}" type="substantive">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n}
- end
- def indent(t)
- @txt=markup(@txt)
- %{#{@tab*1}<p class="indent#{t}" id="#{@ocn}" type="substantive">\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n}
- end
- def para_table
- %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>}
- end
- def ocn
- %{#{@tab*1}<label class="ocn">#{@ocn}</label>} << "\n"
- end
- def html_table # get rid of use html_table
- @new_content=[]
- @txt.split(/\n/).each do |parablock|
- m=parablock[/<!f(.+?)!>/,1]
- @@tablefoot<<m if m
- parablock.gsub!(/<!f.+?!>/,'')
- @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/,
- #%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"><tr><td valign="top" align="justify"><p class="norm" id="\\1"> </p> </td><td>\n} +
- %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})
- if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- tablefoot=[]
- @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}}
- @@tablefoot=[]
- parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,
- %{#{@vz.table_close}\n}) # +
- #%{#{tablefoot}})
- end
- if @@tablehead == 1
- if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{\n<tr>} +
- %{\n<td width="\\1%" valign="top">} +
- %{#{para_table}<b>})
- parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</b></td><td width="\\1%" valign="top">} +
- %{#{para_table}<b>})
- parablock.gsub!(/#{Mx[:tc_c]}/, '</b></td></tr>')
- @@tablehead=0
- end
- parablock
- else
- parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{\n<tr>} +
- %{\n<td width="\\1%" valign="top">} +
- %{#{para_table}})
- parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</td><td width="\\1%" valign="top">} +
- %{#{para_table}})
- parablock.gsub!(/#{Mx[:tc_c]}/, '</td></tr>')
- parablock
- end
- @new_content << parablock
- end
- @new_content.join
- end
- end
- class CSS_Format_generic #does CSS_Format in one definition, needs to be told about attrib, despite brevity of generic, easier to see structure with CSS_Format
- def initialize(attrib='',txt='',id=nil,ocnd=nil,ocns=nil,lv='',hname=nil)
- @tab="\t"
- @attrib=attrib
- @txt=txt
- @lv=@notenumber=lv.to_s
- #{@ocn}=ocn.to_s
- @hname=hname.to_s
- @id=@ocn=id
- end
- def paragraph
- attrib=%{class="#{@attrib}" }
- if @ocn
- id=%{id="#{@ocn}" }
- type=%{type="substantive" }
- else
- id=%{id="none" }
- type=%{type="comment" }
- end
- header=%{header="#{@hname}" } if @hname
- %{#{@tab*1}<p #{attrib}#{id}#{type}#{header}>\n#{@tab*2}#{@txt}\n#{@tab*1}</p>\n} << "\n"
- end
- def para
- paragraph
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_sem.rb b/lib/sisu/v1/shared_sem.rb
deleted file mode 100644
index 837422a9..00000000
--- a/lib/sisu/v1/shared_sem.rb
+++ /dev/null
@@ -1,157 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- Sematic tags
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_sem
- require "#{SiSU_lib}/param"
- class Tags
- def initialize(para,md)
- @para,@md=para,md
- end
- def rgx
- def exclude
- /^(?:<:code>|%+ )/
- end
- def each_csc
- /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):)\{|\}[:;][a-z]+(?:[_:.][a-z]+)*/m
- end
- def each_c
- /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):\{|\}:[a-z]+(?:[_:.][a-z]+)*/m
- end
- def each_sc
- /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*);\{|\};[a-z]+(?:[_:.][a-z]+)*/m
- end
- def pair_csc
- /(([a-z]+(?:[_:.][a-z]+)+|[a-z]+)(?::\{(.+?)\}:\2)|([:;])\{(.+?)\}\4[a-z]+(?:[_:.][a-z]+)*)/m
- end
- def pair_c
- /(([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\2)|:\{(.+?)\}:[a-z]+(?:[_:.][a-z]+)*)/m
- end
- def pair_sc
- /(;\{.+?\};[a-z]+(?:[_:.][a-z]+)*)/m
- end
- def whole_csc_ae
- /(([a-z]+(?:[_.][a-z]+)+|[a-z]*)(?::\[(.+?)\]:\2)|;\{(.+?)\};(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)\b)/m
- end
- def each_csc_ae
- /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+)*:|[a-z]*:)\[|\][:;](?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)/m
- end
- self
- end
- def print
- def scan_pair_c
- if @para =~ rgx.pair_c
- matched=@para.scan(rgx.pair_c).flatten
- puts matched[0] unless matched[0].nil?
- end
- end
- def scan_pair_sc
- matched=@para.scan(rgx.pair_sc).flatten
- puts matched[0] unless matched[0].nil?
- end
- def if_pair_c
- if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m; puts "#{$1}:{ #{$2} }:#{$1}"
- end
- end
- def if_pair_sc
- if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/; puts ";{ #{$1} };#{$2}"
- end
- end
- def match_pair_c
- matched=[]
- matched=rgx.pair_c.match(@para)[1] if @para =~ rgx.pair_c
- puts matched unless matched.nil?
- end
- def match_pair_sc
- matched=[]
- matched=rgx.pair_sc.match(@para)[1] if @para =~ rgx.pair_sc
- puts matched unless matched.nil?
- end
- def matching
- scan_pair_c
- end
- self
- end
- def rm
- def sem_marker_parts
- unless @para =~ rgx.exclude
- @para.gsub!(rgx.each_csc,'')
- end
- @para
- end
- def sem_marker_added_extra_parts
- unless @para =~ rgx.exclude
- @para.gsub!(rgx.whole_csc_ae,'')
- if @para =~rgx.each_csc_ae; puts "WARNING semantic taggin error: #@para"
- end
- end
- @para
- end
- def all
- if @md.sem_tag
- #print.matching
- sem_marker_parts
- sem_marker_added_extra_parts
- end
- @para
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_structure.rb b/lib/sisu/v1/shared_structure.rb
deleted file mode 100644
index 5d12fec8..00000000
--- a/lib/sisu/v1/shared_structure.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# coding:utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
- shared document structure
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_Structure
- class Split_text_object
- include SiSU_Viz
- #include SiSU_HTML_Format
- @@dp=nil
- attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn,:lev_para_ocn
- def initialize(md,para)
- @md,@para=md,para
- @format,@ocn='ordinary','ordinary'
- #@format,@ocn=nil,nil
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}"
- end
- def lev_segname_para_ocn
- if @para =~/^#{Mx[:lv_o]}\d:.+?#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if @para[/^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,segname,@text,@ocn=$1,$2,$3,$4
- #@format="#@format:#{segname}" #
- elsif @para[/^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,@text,@ocn=$1,$2,$3
- end
- else
- if @para[/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}#{Mx[:gl_bullet]})\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,@text,@ocn=$1,$2,$3 #,$4 #watch and work on
- elsif @para[/^(#{Mx[:gl_bullet]})\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,@text,@ocn=$1,$2,$3
- elsif @para[/#{Mx[:pa_o]}:(i[1-9])#{Mx[:pa_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,@text,@ocn=$1,$2,$3 #consider
- elsif @para[/#{Mx[:gr_o]}(code|alt|verse|group)#{Mx[:gr_c]}(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @format,@text,@ocn=$1,$2,$3
- elsif @para[/(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m]
- @text,@ocn=$1,$2 #,$3
- end
- if @para !~/#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06
- @text=@para[/(.+?)/m,1]
- end
- if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s*(.+)/m]
- @format,@text=$1,$2
- end
- end
- @format="#@format:#{segname}" if @format =~/^[1-6]$/
- self
- end
- def html_seg
- lev_segname_para_ocn
- @seg_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]
- txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn}
- SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
- end
- self
- end
- def html_scroll
- lev_segname_para_ocn
- @scroll_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]
- txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn}
- SiSU_HTML_Format::Format_scroll.new(@md,txt_obj)
- end
- self
- end
- def xml
- require "#{SiSU_lib}/shared_xml"
- lev_segname_para_ocn
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>@text,:format =>@format,:ocn =>"x#@ocn"}
- SiSU_XML_format::Format_scroll.new(@md,txt_obj)
- else
- id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}"
- txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block}
- SiSU_XML_format::Format_scroll.new(@md,txt_obj)
- end
- self
- end
- def odt
- lev_segname_para_ocn
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn}
- SiSU_ODF_format::Format_text_object.new(@md,txt_obj)
- else
- id_block="#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}"
- txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block}
- SiSU_ODF_format::Format_text_object.new(@md,txt_obj)
- end
- self
-
- end
- def txt
- lev_segname_para_ocn
- #format=@format.dup
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn}
- SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj)
- else
- id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}"
- txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block}
- SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj)
- end
- self
- end
- def manpage #check
- lev_segname_para_ocn
- #format=@format.dup
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn}
- SiSU_Manpage_format::Format_text_object.new(@md,txt_obj)
- else
- id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}"
- txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block}
- SiSU_Manpage_format::Format_text_object.new(@md,txt_obj)
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_txt.rb b/lib/sisu/v1/shared_txt.rb
deleted file mode 100644
index ffed2778..00000000
--- a/lib/sisu/v1/shared_txt.rb
+++ /dev/null
@@ -1,223 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules shared by flatfile output generators
-
-=end
-module SiSU_text_utils
- class Wrap
- def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil)
- @para,@n_char_max,@n_indent=para,n_char_max,n_indent
- @n_char_max_extend = n_char_max
- @br="\n"
- @n_hang=unless n_hang; @n_hang=@n_indent
- else n_hang
- end
- end
- def line_wrap
- space=' '
- spaces_indent,spaces_hang="#@br#{space*@n_indent}",space*@n_hang
- line=0
- out=[]
- out[line]=''
- @para.gsub!(/#{Mx[:br_nl]}/,"\n\n")
- words=@para.scan(/\n\n|\S+/m)
- while words != ''
- word=words.shift
- if not word
- out[line] unless out[line].empty? #check
- break
- elsif word =~/\n\n/
- word="\n"
- @n_char_max_extend = @n_char_max + out[line].length
- line=line
- elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \
- and out[line] =~/\S+/
- @n_char_max_extend = @n_char_max
- out[line].squeeze!(' ')
- line += 1
- end
- if word
- out[line]=if out[line] \
- and out[line] !~/\S+$/m
- "#{out[line]}#{word}"
- elsif out[line] \
- and out[line] =~/\S+/
- "#{out[line]} #{word}"
- else "#{word.strip}"
- end
- end
- @oldword=word if word =~/\S+/
- end
- x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang)
- end
- def line_wrap_indent1
- @n_indent,@n_hang=2,2
- line_wrap
- end
- def line_wrap_endnote
- @n_indent,@n_hang=4,2
- line_wrap
- end
- end
- class Header_scan
- def initialize(md,para)
- @regxcl=/#{Mx[:id_o]}~\d+;\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}(?:[0-9a-f]{32}|[0-9a-f]{64}):(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:id_c]}/
- para=para.gsub(@regxcl,'').dup
- @md,@p=md,para
- end
- def extract(tag,tag_content,type,attrib)
- dc=if dc_tag \
- and dc_content
- [dc_tag,dc_content,{dc_tag=>dc_content}]
- else nil
- end
- end
- def header(tag,tag_content,type='',attrib='') #this will break stuff and must be tested thoroughly 20060825
- @tag,@tag_content,@type,@attrib=tag,tag_content,type,attrib
- def label #element
- @tag
- end
- def type
- @type
- end
- def text
- @tag_content
- end
- def info #element text
- @tag_content
- end
- def attribute
- @attrib
- end
- def element
- @tag
- end
- def attrib
- @attrib
- end
- def el
- @tag
- end
- self
- end
- def start_is_match
- meta=case @p
- when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.full_title,'meta','dc') #dc 1
- #when /^@(subtitle):\s+(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2
- when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3
- when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 4
- when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 5
- when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 6
- when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 7
- when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 8
- when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 9
- when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 10
- when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 11
- when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 12
- when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 13
- when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 14
- when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 15
- when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('translator',$2)
- when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('illustrator',$2)
- when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra')
- when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_loc',$2,'meta','extra')
- when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_dewey',$2,'meta','extra')
- when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_pg',$2,'meta','extra')
- when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_isbn',$2,'meta','extra')
- when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/; header('structure',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/; header('markup',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(skin)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct')
- when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b
- when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct')
- when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/; header('version',$2,'process','instruct')
- else nil
- end
- end
- def dublin
- out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/
- start_is_match
- else nil
- end
- end
- def meta
- out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/
- start_is_match
- else nil
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/shared_xml.rb b/lib/sisu/v1/shared_xml.rb
deleted file mode 100644
index de1f7266..00000000
--- a/lib/sisu/v1/shared_xml.rb
+++ /dev/null
@@ -1,739 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: common file for xml generation
-
-=end
-module SiSU_text_parts
- require "#{SiSU_lib}/shared_structure"
- class Split_text_object < SiSU_Structure::Split_text_object
- require "#{SiSU_lib}/param"
- require "#{SiSU_lib}/xml_format"
- include SiSU_Viz
- include SiSU_XML_format
- @@alt_id_count=0
- @@dp=nil
- def lev_segname_para
- if @para =~/^#{Mx[:lv_o]}(?:\d:|<:.+?>).+/
- if /^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+)/m.match(@para)
- @format,segname,@text=$1,$2,$3
- elsif /^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+)/m.match(@para)
- @format,@text=$1,$2
- elsif /<:(.+?)>\s*(\S.+?)/m.match(@para)
- @format,@text=$1,$2
- elsif /^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+?)/m.match(@para)
- @@alt_id_count+=1
- @format,segname,@text=$1,$2,$3
- #@format="#@format:#{segname}" #
- elsif /^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+?)/m.match(@para)
- @@alt_id_count+=1
- @format,@text=$1,$2
- end
- else
- if /(.+?)/m.match(@para)
- @text=$1
- end
- if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06
- @text=/(.+?)/m.match(@para)[1]
- end
- if /^(\d)~\S*\s+(.+)/m.match(@para)
- @format,@text=$1,$2
- end
- end
- @format="#@format:#{segname}" #
-#follow this search beneath for heading_body1-6
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- t_o={:format=>@format,:txt=>@text,:ocn=>@ocn} #(@format,@text,@ocn)
- SiSU_XML_format::Format_scroll.new(@md,t_o)
- else
- t_o={:format=>@format,:txt=>@text,:ocn=>0} #(@format,@text,@ocn)
- SiSU_XML_format::Format_scroll.new(@md,t_o)
- #SiSU_XML_format::Format_scroll.new(@md,@format,@text,"#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}")
- end
- self
- end
- end
-end
-module SiSU_XML_munge
- class Trans
- require "#{SiSU_lib}/defaults"
- def initialize(md)
- @md=md
- @sys=SiSU_Env::System_call.new
- @dir=SiSU_Env::Info_env.new(@md.fns)
- @dp=SiSU_Env::Info_env.new.digest.pattern
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- if @md.sem_tag
- #@ab ||=SiSU_Viz::Skin.new.semantic_tags.default
- @ab ||=semantic_tags.default
- end
- end
- def semantic_tags
- def default
- {
- :pub => 'publication',
- :conv => 'convention',
- :vol => 'volume',
- :pg => 'page',
- :cty => 'city',
- :org => 'organization',
- :uni => 'university',
- :dept => 'department',
- :fac => 'faculty',
- :inst => 'institute',
- :co => 'company',
- :com => 'company',
- :conv => 'convention',
- :dt => 'date',
- :y => 'year',
- :m => 'month',
- :d => 'day',
- :ti => 'title',
- :au => 'author',
- :ed => 'editor', #editor?
- :v => 'version', #edition
- :n => 'name',
- :fn => 'firstname',
- :mn => 'middlename',
- :ln => 'lastname',
- :in => 'initials',
- :qt => 'quote',
- :ct => 'cite',
- :ref => 'reference',
- :ab => 'abreviation',
- :def => 'define',
- :desc => 'description',
- :trans => 'translate',
- }
- end
- self
- end
- def char_enc #character encode
- def utf8(para='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
- #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
- ##para.gsub!(//, '&#;')
- ##para.gsub!(//, '&;')
- para.gsub!(/</u, '&#60;') # '&lt;' # &#060;
- para.gsub!(/>/u, '&#62;') # '&gt;' # &#062;
- para.gsub!(/¢/u, '&#162;') # '&cent;' # &#162;
- para.gsub!(/£/u, '&#163;') # '&pound;' # &#163;
- para.gsub!(/¥/u, '&#165;') # '&yen;' # &#165;
- para.gsub!(/§/u, '&#167;') # '&sect;' # &#167;
- para.gsub!(/©/u, '&#169;') # '&copy;' # &#169;
- para.gsub!(/ª/u, '&#170;') # '&ordf;' # &#170;
- para.gsub!(/«/u, '&#171;') # '&laquo;' # &#171;
- para.gsub!(/®/u, '&#174;') # '&reg;' # &#174;
- para.gsub!(/°/u, '&#176;') # '&deg;' # &#176;
- para.gsub!(/±/u, '&#177;') # '&plusmn;' # &#177;
- para.gsub!(/²/u, '&#178;') # '&sup2;' # &#178;
- para.gsub!(/³/u, '&#179;') # '&sup3;' # &#179;
- para.gsub!(/µ/u, '&#181;') # '&micro;' # &#181;
- para.gsub!(/¶/u, '&#182;') # '&para;' # &#182;
- para.gsub!(/¹/u, '&#185;') # '&sup1;' # &#185;
- para.gsub!(/º/u, '&#186;') # '&ordm;' # &#186;
- para.gsub!(/»/u, '&#187;') # '&raquo;' # &#187;
- para.gsub!(/¼/u, '&#188;') # '&frac14;' # &#188;
- para.gsub!(/½/u, '&#189;') # '&frac12;' # &#189;
- para.gsub!(/¾/u, '&#190;') # '&frac34;' # &#190;
- para.gsub!(/×/u, '&#215;') # '&times;' # &#215;
- para.gsub!(/÷/u, '&#247;') # '&divide;' # &#247;
- para.gsub!(/¿/u, '&#191;') # '&iquest;' # &#191;
- para.gsub!(/À/u, '&#192;') # '&Agrave;' # &#192;
- para.gsub!(/Á/u, '&#193;') # '&Aacute;' # &#193;
- para.gsub!(/Â/u, '&#194;') # '&Acirc;' # &#194;
- para.gsub!(/Ã/u, '&#195;') # '&Atilde;' # &#195;
- para.gsub!(/Ä/u, '&#196;') # '&Auml;' # &#196;
- para.gsub!(/Å/u, '&#197;') # '&Aring;' # &#197;
- para.gsub!(/Æ/u, '&#198;') # '&AElig;' # &#198;
- para.gsub!(/Ç/u, '&#199;') # '&Ccedil;' # &#199;
- para.gsub!(/È/u, '&#200;') # '&Egrave;' # &#200;
- para.gsub!(/É/u, '&#201;') # '&Eacute;' # &#201;
- para.gsub!(/Ê/u, '&#202;') # '&Ecirc;' # &#202;
- para.gsub!(/Ë/u, '&#203;') # '&Euml;' # &#203;
- para.gsub!(/Ì/u, '&#204;') # '&Igrave;' # &#204;
- para.gsub!(/Í/u, '&#205;') # '&Iacute;' # &#205;
- para.gsub!(/Î/u, '&#206;') # '&Icirc;' # &#206;
- para.gsub!(/Ï/u, '&#207;') # '&Iuml;' # &#207;
- para.gsub!(/Ð/u, '&#208;') # '&ETH;' # &#208;
- para.gsub!(/Ñ/u, '&#209;') # '&Ntilde;' # &#209;
- para.gsub!(/Ò/u, '&#210;') # '&Ograve;' # &#210;
- para.gsub!(/Ó/u, '&#211;') # '&Oacute;' # &#211;
- para.gsub!(/Ô/u, '&#212;') # '&Ocirc;' # &#212;
- para.gsub!(/Õ/u, '&#213;') # '&Otilde;' # &#213;
- para.gsub!(/Ö/u, '&#214;') # '&Ouml;' # &#214;
- para.gsub!(/Ø/u, '&#216;') # '&Oslash;' # &#216;
- para.gsub!(/Ù/u, '&#217;') # '&Ugrave;' # &#217;
- para.gsub!(/Ú/u, '&#218;') # '&Uacute;' # &#218;
- para.gsub!(/Û/u, '&#219;') # '&Ucirc;' # &#219;
- para.gsub!(/Ü/u, '&#220;') # '&Uuml;' # &#220;
- para.gsub!(/Ý/u, '&#221;') # '&Yacute;' # &#221;
- para.gsub!(/Þ/u, '&#222;') # '&THORN;' # &#222;
- para.gsub!(/ß/u, '&#223;') # '&szlig;' # &#223;
- para.gsub!(/à/u, '&#224;') # '&agrave;' # &#224;
- para.gsub!(/á/u, '&#225;') # '&aacute;' # &#225;
- para.gsub!(/â/u, '&#226;') # '&acirc;' # &#226;
- para.gsub!(/ã/u, '&#227;') # '&atilde;' # &#227;
- para.gsub!(/ä/u, '&#228;') # '&auml;' # &#228;
- para.gsub!(/å/u, '&#229;') # '&aring;' # &#229;
- para.gsub!(/æ/u, '&#230;') # '&aelig;' # &#230;
- para.gsub!(/ç/u, '&#231;') # '&ccedil;' # &#231;
- para.gsub!(/è/u, '&#232;') # '&egrave;' # &#232;
- para.gsub!(/é/u, '&#233;') # '&acute;' # &#233;
- para.gsub!(/ê/u, '&#234;') # '&circ;' # &#234;
- para.gsub!(/ë/u, '&#235;') # '&euml;' # &#235;
- para.gsub!(/ì/u, '&#236;') # '&igrave;' # &#236;
- para.gsub!(/í/u, '&#237;') # '&acute;' # &#237;
- para.gsub!(/î/u, '&#238;') # '&icirc;' # &#238;
- para.gsub!(/ï/u, '&#239;') # '&iuml;' # &#239;
- para.gsub!(/ð/u, '&#240;') # '&eth;' # &#240;
- para.gsub!(/ñ/u, '&#241;') # '&ntilde;' # &#241;
- para.gsub!(/ò/u, '&#242;') # '&ograve;' # &#242;
- para.gsub!(/ó/u, '&#243;') # '&oacute;' # &#243;
- para.gsub!(/ô/u, '&#244;') # '&ocirc;' # &#244;
- para.gsub!(/õ/u, '&#245;') # '&otilde;' # &#245;
- para.gsub!(/ö/u, '&#246;') # '&ouml;' # &#246;
- para.gsub!(/ø/u, '&#248;') # '&oslash;' # &#248;
- para.gsub!(/ù/u, '&#250;') # '&ugrave;' # &#250;
- para.gsub!(/ú/u, '&#251;') # '&uacute;' # &#251;
- para.gsub!(/û/u, '&#252;') # '&ucirc;' # &#252;
- para.gsub!(/ü/u, '&#253;') # '&uuml;' # &#253;
- para.gsub!(/þ/u, '&#254;') # '&thorn;' # &#254;
- para.gsub!(/ÿ/u, '&#255;') # '&yuml;' # &#255;
- para.gsub!(/‘/u, '&#8216;') # '&lsquo;' # &#8216;
- para.gsub!(/’/u, '&#8217;') # '&rsquo;' # &#8217;
- para.gsub!(/“/u, '&#8220;') # &ldquo; # &#8220;
- para.gsub!(/”/u, '&#8221;') # &rdquo; # &#8221;
- para.gsub!(/–/u, '&#8211;') # &ndash; # &#8211;
- para.gsub!(/—/u, '&#8212;') # &mdash; # &#8212;
- para.gsub!(/∝/u, '&#8733;') # &prop; # &#8733;
- para.gsub!(/∞/u, '&#8734;') # &infin; # &#8734;
- para.gsub!(/™/u, '&#8482;') # &trade; # &#8482;
- para.gsub!(/✠/u, '&#10016;') # &cross; # &#10016;
- para.gsub!(/ /u, ' ') # space identify
- para.gsub!(/ /u, ' ') # space identify
- end
- end
- def html(para='')
- if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
- para.gsub!(/ /u, ' ') # space identify
- para.gsub!(/ /u, ' ') # space identify
- else
- para.gsub!(/¢/u, '&cent;') # &#162;
- para.gsub!(/£/u, '&pound;') # &#163;
- para.gsub!(/¥/u, '&yen;') # &#165;
- para.gsub!(/§/u, '&sect;') # &#167;
- para.gsub!(/©/u, '&copy;') # &#169;
- para.gsub!(/ª/u, '&ordf;') # &#170;
- para.gsub!(/«/u, '&laquo;') # &#171;
- para.gsub!(/®/u, '&reg;') # &#174;
- para.gsub!(/°/u, '&deg;') # &#176;
- para.gsub!(/±/u, '&plusmn;') # &#177;
- para.gsub!(/²/u, '&sup2;') # &#178;
- para.gsub!(/³/u, '&sup3;') # &#179;
- para.gsub!(/µ/u, '&micro;') # &#181;
- para.gsub!(/¶/u, '&para;') # &#182;
- para.gsub!(/¹/u, '&sup1;') # &#185;
- para.gsub!(/º/u, '&ordm;') # &#186;
- para.gsub!(/»/u, '&raquo;') # &#187;
- para.gsub!(/¼/u, '&frac14;') # &#188;
- para.gsub!(/½/u, '&frac12;') # &#189;
- para.gsub!(/¾/u, '&frac34;') # &#190;
- para.gsub!(/×/u, '&times;') # &#215;
- para.gsub!(/÷/u, '&divide;') # &#247;
- para.gsub!(/¿/u, '&iquest;') # &#191;
- para.gsub!(/À/u, '&Agrave;') # &#192;
- para.gsub!(/Á/u, '&Aacute;') # &#193;
- para.gsub!(/Â/u, '&Acirc;') # &#194;
- para.gsub!(/Ã/u, '&Atilde;') # &#195;
- para.gsub!(/Ä/u, '&Auml;') # &#196;
- para.gsub!(/Å/u, '&Aring;') # &#197;
- para.gsub!(/Æ/u, '&AElig;') # &#198;
- para.gsub!(/Ç/u, '&Ccedil;') # &#199;
- para.gsub!(/È/u, '&Egrave;') # &#200;
- para.gsub!(/É/u, '&Eacute;') # &#201;
- para.gsub!(/Ê/u, '&Ecirc;') # &#202;
- para.gsub!(/Ë/u, '&Euml;') # &#203;
- para.gsub!(/Ì/u, '&Igrave;') # &#204;
- para.gsub!(/Í/u, '&Iacute;') # &#205;
- para.gsub!(/Î/u, '&Icirc;') # &#206;
- para.gsub!(/Ï/u, '&Iuml;') # &#207;
- para.gsub!(/Ð/u, '&ETH;') # &#208;
- para.gsub!(/Ñ/u, '&Ntilde;') # &#209;
- para.gsub!(/Ò/u, '&Ograve;') # &#210;
- para.gsub!(/Ó/u, '&Oacute;') # &#211;
- para.gsub!(/Ô/u, '&Ocirc;') # &#212;
- para.gsub!(/Õ/u, '&Otilde;') # &#213;
- para.gsub!(/Ö/u, '&Ouml;') # &#214;
- para.gsub!(/Ø/u, '&Oslash;') # &#216;
- para.gsub!(/Ù/u, '&Ugrave;') # &#217;
- para.gsub!(/Ú/u, '&Uacute;') # &#218;
- para.gsub!(/Û/u, '&Ucirc;') # &#219;
- para.gsub!(/Ü/u, '&Uuml;') # &#220;
- para.gsub!(/Ý/u, '&Yacute;') # &#221;
- para.gsub!(/Þ/u, '&THORN;') # &#222;
- para.gsub!(/ß/u, '&szlig;') # &#223;
- para.gsub!(/à/u, '&agrave;') # &#224;
- para.gsub!(/á/u, '&aacute;') # &#225;
- para.gsub!(/â/u, '&acirc;') # &#226;
- para.gsub!(/ã/u, '&atilde;') # &#227;
- para.gsub!(/ä/u, '&auml;') # &#228;
- para.gsub!(/å/u, '&aring;') # &#229;
- para.gsub!(/æ/u, '&aelig;') # &#230;
- para.gsub!(/ç/u, '&ccedil;') # &#231;
- para.gsub!(/è/u, '&egrave;') # &#232;
- para.gsub!(/é/u, '&acute;') # &#233;
- para.gsub!(/ê/u, '&circ;') # &#234;
- para.gsub!(/ë/u, '&euml;') # &#235;
- para.gsub!(/ì/u, '&igrave;') # &#236;
- para.gsub!(/í/u, '&acute;') # &#237;
- para.gsub!(/î/u, '&icirc;') # &#238;
- para.gsub!(/ï/u, '&iuml;') # &#239;
- para.gsub!(/ð/u, '&eth;') # &#240;
- para.gsub!(/ñ/u, '&ntilde;') # &#241;
- para.gsub!(/ò/u, '&ograve;') # &#242;
- para.gsub!(/ó/u, '&oacute;') # &#243;
- para.gsub!(/ô/u, '&ocirc;') # &#244;
- para.gsub!(/õ/u, '&otilde;') # &#245;
- para.gsub!(/ö/u, '&ouml;') # &#246;
- para.gsub!(/ø/u, '&oslash;') # &#248;
- para.gsub!(/ù/u, '&ugrave;') # &#250;
- para.gsub!(/ú/u, '&uacute;') # &#251;
- para.gsub!(/û/u, '&ucirc;') # &#252;
- para.gsub!(/ü/u, '&uuml;') # &#253;
- para.gsub!(/þ/u, '&thorn;') # &#254;
- para.gsub!(/ÿ/u, '&yuml;') # &#255;
- para.gsub!(/‘/u, '&#lsquo;') # &lsquo; # &#8216;
- para.gsub!(/’/u, '&#rsquo;') # &rsquo; # &#8217;
- para.gsub!(/“/u, '&ldquo;') # &ldquo; # &#8220;
- para.gsub!(/”/u, '&rdquo;') # &rdquo; # &#8221;
- para.gsub!(/–/u, '&ndash;') # &ndash; # &#8211;
- para.gsub!(/—/u, '&mdash;') # &mdash; # &#8212;
- para.gsub!(/∝/u, '&prop;') # &prop; # &#8733;
- para.gsub!(/∞/u, '&infin;') # &infin; # &#8734;
- para.gsub!(/™/u, '&trade;') # &trade; # &#8482;
- para.gsub!(/✠/u, '&#10016;') # &#10016;
- #para.gsub!(/✠/u, '&dagger;') # &dagger; # &#8224; incorrect replacement †
- para.gsub!(/ /u, ' ') # space identify
- para.gsub!(/ /u, ' ') # space identify
- end
- end
- self
- end
- def tidywords(wordlist)
- wordlist.each do |x|
- #imperfect solution will not catch all possible cases
- x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- x.gsub!(/&([A-Z])/,'&amp;\1')
- end
- end
- def markup(para='')
- wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- para=tidywords(wordlist).join(' ').strip
- para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
- para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- para.gsub!(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1&lt; '); para.gsub!(/\s+>(\s+|$)/,' &gt;\1')
- #para.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>')
- para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>')
- para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>')
- para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- para.gsub!(/<:pb>\s*/,'') #Fix
- para.gsub!(/<+[-~]#>+/,'')
- para.gsub!(/#{Mx[:id_o]}0;\w\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- if para !~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- #embeds a red-bullet image -->
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
- para.gsub!(/#{Mx[:br_page]}\s*/,'')
- para.gsub!(/#{Mx[:br_page_new]}\s*/,'')
- para.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); para.gsub!(/<[-~]#>/,'')
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}image/,
- %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/,
- '\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
- %{\\1#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\2">\\2</link>#{@url_brace.xml_close}\\3})
- para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
- '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>\2') #escaped urls not linked, deal with later
- else
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
- para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
- end
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;')
- para
- end
- def markup_light(para='')
- para.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- para.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- para.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- para.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- para.gsub!(/<br(\s*\/)?>/,'<br />')
- para.gsub!(/<:pb>\s*/,'')
- para.gsub!(/<[-~]#>/,'')
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- para.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- #para.gsub!(/&nbsp;/,' ') #clean
- wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- para=tidywords(wordlist).join(' ').strip
- para
- end
- def markup_fictionbook(para='')
- para.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]')
- para.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
- para.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
- para.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
- para.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
- para.gsub!(/<br(\s*\/)?>/,'<br />')
- para.gsub!(/<:pb>\s*/,'')
- para.gsub!(/<[-~]#>/,'')
- #temporary -->
- para.gsub!(/<:\S+?>/,'')
- #<-- temporary
- para.gsub!(/<[-~]#>/,'')
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; ') #sort
- para.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,
- "<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
- #para.gsub!(/&nbsp;/,' ') #clean
- wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
- para=tidywords(wordlist).join(' ').strip
- para
- end
- def markup_group(para='')
- para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
- para.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')
- para.gsub!(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>')
- para.gsub!(/&lt;(\/link)&gt;/,'<\1>')
- para.gsub!(/&lt;(\/?en)&gt;/,'<\1>')
- para
- end
- def xml_sem_block_paired(matched) # colon depth: many, recurs
- matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}) # sem :
- matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}) # sem :
- matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}) # sem :
- matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}) # sem :
- matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}) # sem :
- matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}) # sem :
- matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}) # sem :
- matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}) # sem :
- matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}) # sem :
- matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}) # sem :
- matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}) # sem :
- matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>') # sem :
- end
- def xml_semantic_tags(para)
- if @md.sem_tag
- para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem :
- para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem :
- para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem :
- #colon one / single / flat / shallow
- para.gsub!(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}) # sem :
- para.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>') # sem :
- #semicolon zero / none
- para.gsub!(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}) # sem ;
- para.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>') # sem ;
- end
- para
- end
- end
-end
-module SiSU_XML_tags #Format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class RDF
- def initialize(md='',seg_name=[],tracker=0)
- @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
- #seg_name=%{#{@@seg_name[@@tracker]} - } if @@seg_name[@@tracker]
- @md=md
- @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
- if @md.full_title # DublinCore 1 - title
- @rdf_title=%{ dc.title="#{seg_name}#{@md.full_title}"\n}
- @full_title=%{ <meta name="dc.title" content="#{@md.full_title}" />\n}
- #@full_title=%{ <meta name="dc.title" content="#{seg_name}#{@md.full_title}" />\n}
- end
- if @md.author # DublinCore 2 - creator/author (author)
- @rdf_author=%{ dc.author="#{@md.author}"\n}
- content=meta_content_clean(@md.author)
- @author=%{ <meta name="dc.author" content="#{content}" />\n}
- end
- if @md.subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
- @rdf_subject=%{ dc.subject="#{@md.subject}"\n}
- content=meta_content_clean(@md.subject)
- @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
- end
- if @md.description # DublinCore 4 - description
- @rdf_description=%{ dc.description="#{@md.description}"\n}
- content=meta_content_clean(@md.description)
- @description=%{ <meta name="dc.description" content="#{content}" />\n}
- end
- if @md.publisher # DublinCore 5 - publisher (current copy published by)
- @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
- content=meta_content_clean(@md.publisher)
- @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
- end
- if @md.contributor # DublinCore 6 - contributor
- @rdf_contributor=%{ dc.contributor="#{@md.contributor}"\n}
- content=meta_content_clean(@md.contributor)
- @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
- end
- if @md.date # DublinCore 7 - date year-mm-dd
- @rdf_date=%{ dc.date="#{@md.date}"\n}
- @date=%{ <meta name="dc.date" content="#{@md.date}" #{@md.date_scheme} />\n}
- end
- if @md.date_created # DublinCore 7 - date.created year-mm-dd
- @rdf_date_created=%{ dc.date.created="#{@md.date_created}"\n}
- @date_created=%{ <meta name="dc.date.created" content="#{@md.date_created}" #{@md.date_created_scheme} />\n}
- end
- if @md.date_issued # DublinCore 7 - date.issued year-mm-dd
- @rdf_date_issued=%{ dc.date.issued="#{@md.date_issued}"\n}
- @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date_issued}" #{@md.date_issued_scheme} />\n}
- end
- if @md.date_available # DublinCore 7 - date.available year-mm-dd
- @rdf_date_available=%{ dc.date.available="#{@md.date_available}"\n}
- @date_available=%{ <meta name="dc.date.available" content="#{@md.date_available}" #{@md.date_available_scheme} />\n}
- end
- if @md.date_valid # DublinCore 7 - date.valid year-mm-dd
- @rdf_date_valid=%{ dc.date.valid="#{@md.date_valid}"\n}
- @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date_valid}" #{@md.date_valid_scheme} />\n}
- end
- if @md.date_modified # DublinCore 7 - date.modified year-mm-dd
- @rdf_date_modified=%{ dc.date.modified="#{@md.date_modified}"\n}
- @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date_modified}" #{@md.date_modified_scheme} />\n}
- end
- if @md.type # DublinCore 8 - type (genre eg. report, convention etc)
- @rdf_type=%{ dc.type="#{@md.type}"\n}
- content=meta_content_clean(@md.type)
- @type=%{ <meta name="dc.type" content="#{content}" />\n}
- end
- if @md.format # DublinCore 9 - format (use your mime type)
- @rdf_format=%{ dc.format="#{@md.format}"\n}
- content=meta_content_clean(@md.format)
- @format=%{ <meta name="dc.format" content="#{content}" />\n}
- end
- if @md.identifier # DublinCore 10 - identifier (your identifier, could use urn which is free)
- @rdf_identifier=%{ dc.identifier="#{@md.identifier}"\n}
- content=meta_content_clean(@md.identifier)
- @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
- end
- if @md.source # DublinCore 11 - source (document source)
- @rdf_source=%{ dc.source="#{@md.source}"\n}
- content=meta_content_clean(@md.source)
- @source=%{ <meta name="dc.source" content="#{content}" />\n}
- end
- if @md.language \
- and @md.language[:name] # DublinCore 12 - language (English)
- @rdf_language=%{ dc.language="#{@md.language[:name]}"\n}
- @language=%{ <meta name="dc.language" content="#{@md.language[:name]}" />\n}
- end
- if @md.language_original \
- and @md.language_original[:name]
- @rdf_language_original=%{ dc.language="#{@md.language_original[:name]}"\n}
- @language_original=%{ <meta name="dc.language" content="#{@md.language_original[:name]}" />\n}
- end
- if @md.relation # DublinCore 13 - relation
- @rdf_relation=%{ dc.relation="#{@md.relation}"\n}
- content=meta_content_clean(@md.relation)
- @relation=%{ <meta name="dc.relation" content="#{content}" />\n}
- end
- if @md.coverage # DublinCore 14 - coverage
- @rdf_coverage=%{ dc.coverage="#{@md.coverage}"\n}
- content=meta_content_clean(@md.coverage)
- @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
- end
- if @md.rights # DublinCore 15 - rights
- @rdf_rights=%{ dc.rights="#{@md.rights}"\n}
- content=meta_content_clean(@md.rights)
- @rights=%{ <meta name="dc.rights" content="#{content}" />\n}
- end
- content=meta_content_clean(@md.keywords)
- @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def meta_content_clean(content='')
- unless content.nil?
- content.tr!('"',"'")
- end
- content
- end
- def rdftoc #tocHead #values strung together, because some empty, and resulting output (line breaks) is much better
- #<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- # xmlns:dc="http://purl.org/dc/elements/1.1/">
- # <rdf:Description rdf:about="http://www.jus.uio.no/lm/doc"
- # dc:creator="Author"
- # dc:title="Title"
- # dc:description="Description if any"
- # dc:date="Publication Date"
- # />
- #</rdf:RDF>
- #Dublin Core
-#### XML only :-( KEEP
-#<<WOK
-#<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-# xmlns:dc="http://purl.org/dc/elements/1.1/">
-# <rdf:Description
-# #@rdfurl#@rdf_title#@rdf_subtitle#@rdf_creator#@rdf_subject#@rdf_description#@rdf_publisher#@rdf_contributor#@rdf_date#@rdf_dateCreated#@rdf_dateIssued#@rdf_dateAvailable#@rdf_dateValid#@rdf_dateModified#@rdf_type#@rdf_format#@rdf_identifier#@rdf_source#@rdf_language#@rdf_relation #@rdf_coverage#@rdf_rights
-# />\n
-#</rdf:RDF>\n
-#WOK
- end
- def rdfseg #segHead
- rdftoc
- end
- def comment_xml(extra='')
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
- else ''
- end
- if extra.empty?
-<<WOK
-<!-- Document processing information:
- * #{generator}
- * #{rubyv}
- * #{sc}
- * #{lastdone}
- * SiSU http://www.jus.uio.no/sisu
--->
-WOK
- else
-<<WOK
-<!-- Document processing information:
- * #{extra}
- * #{generator}
- * #{rubyv}
- * #{sc}
- * #{lastdone}
- * SiSU http://www.jus.uio.no/sisu
--->
-WOK
- end
- end
- def comment_xml_sax
- desc='SiSU XML, SAX type representation'
- comment_xml(desc)
- end
- def comment_xml_node
- desc='SiSU XML, Node type representation'
- comment_xml(desc)
- end
- def comment_xml_dom
- desc='SiSU XML, DOM type representation'
- comment_xml(desc)
- end
- def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
-#{@vz.js_head}
-<<WOK
-#@full_title#@subtitle#@author#@subject#@description#@publisher#@contributor#@date#@date_created#@date_issued#@date_available#@date_valid#@date_modified#@type#@format#@identifier#@source#@language#@relation#@coverage#@rights#@copyright#@owner
-#{@vz.txt_generator}
-#{@vz.png_ico}
-WOK
- end
- end
-end
-module SiSU_Tables
- require "#{SiSU_lib}/xml_tables"
-end
-__END__
diff --git a/lib/sisu/v1/sisupod_make.rb b/lib/sisu/v1/sisupod_make.rb
deleted file mode 100644
index 1fa742aa..00000000
--- a/lib/sisu/v1/sisupod_make.rb
+++ /dev/null
@@ -1,337 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: create sisupod filetype and copy it to output directory!
-
-=end
-module SiSU_Doc
- require 'fileutils'
- include SiSU_Env
- class Source
- include FileUtils #::Verbose
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/response"
- def initialize(opt)
- @opt=opt
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @date=SiSU_Env::Info_date.new.dt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @ver=SiSU_Env::Info_version.instance.get_version
- @ans=SiSU_Response::Response.new
- pod_path="#{@env.path.processing}/sisupod"
- @v=if @opt.cmd =~/[VM]/; 'v'
- else ''
- end
- @local_path="#{@env.path.output_pod}" #@local_path="#{@env.path.output}/#{@env.fnb}"
- @zipfile=if @opt.fns =~/\.ssm\.sst$/; @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm')
- else @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
- end
- mkdir_p(pod_path) unless FileTest.directory?(pod_path)
- rm_rf("#{@env.path.processing}sisupod/*") if FileTest.directory?("#{@env.path.processing}sisupod")
- end
- def read
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns)
- tell.green_hi_blue unless @opt.cmd =~/q/
- unless @opt.fns.empty?
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@env.path.output_pod}/#{@zipfile}.zip")
- tell.warn unless @opt.cmd =~/q/
- directories
- sisupod_build
- sisupod_zip
- #sisupod_7zip
- else
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip) of sisu work directory',"#{@env.stub_pwd}\_#@date.zip")
- tell.warn unless @opt.cmd =~/q/
- tell.blue_tab unless @opt.cmd =~/q/
- ans=@ans.response?('make sisupod of entire directory?')
- if ans; sisupod_zip_directory
- end
- end
- end
- def sisupod_zip_directory
- sisupod_directory="sisupod-#{@env.stub_pwd}-#@date.ssp" # "sisupod-#{@env.stub_pwd}-#@date.zip"
- unless File.symlink?('sisupod'); File.symlink(Dir.pwd,'sisupod')
- end
- re_base_dir='^sisupod/([^.][^/]*\.(ssm|ssi|sst)$|_sisu/)'
- re_files='/[a-zA-Z0-9.~_-]+\.(ssm|ssi|sst|rb|css|png|jpg|gif|yaml)$'
- re_ignore='/[.~_-][^/]+$'
- if File.symlink?('sisupod')
- info="SiSU sisupod #{@ver[:version]} directory contents #{sisupod_directory}"
- system(%{
- echo "#{info}"
- echo "#{info}" > sisu_zip.txt
- zip -qz #{sisupod_directory} sisu_zip.txt < sisu_zip.txt
- for I in `find -H sisupod -print | \
- egrep "#{re_base_dir}" | \
- egrep "#{re_files}" | \
- egrep -v "#{re_ignore}" `
- do zip #{sisupod_directory} $I
- done
- })
- else puts "the required systemlink 'sisupod' could not be created on the current directory: remove the file or directory named 'sisupod' within #{Dir.pwd}"
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar gzip)',@opt.fns)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory',sisupod_directory)
- tell.warn unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new('',sisupod_directory)
- tell.blue_tab unless @opt.cmd =~/q/
- end
- def directories
- SiSU_Env::Info_env.new.sisupod
- end
- def select(skin='') # skin loading logic here
- load "#{SiSU_lib}/defaults.rb"
- @skin={}
- skin_path = [
- "#{@env.path.pwd}/_sisu/skin",
- "#{@env.path.home}/.sisu/skin",
- '/etc/sisu/skin',
- "#{@env.path.processing}/external_document/skin"
- ]
- sk_doc,sk_dir="doc/#{skin}.rb","dir/skin_#{@env.stub_pwd}.rb"
- skin_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/#{sk_doc}")
- @skin[:name],@skin[:type]="#{v}/#{sk_doc}",'doc'
- break
- end
- end
- unless @skin.length > 0
- skin_path.each do |v| #directory skin priority 2
- if FileTest.file?("#{v}/#{sk_dir}")
- @skin[:name],@skin[:type]="#{v}/#{sk_dir}",'dir'
- break
- end
- end
- end
- @skin
- end
- def sisupod_build #see also sisupod in sysenv
- @rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/
- @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/^(?:@skin:|0~skin)\s+(\S+)/
- @rgx_doc_import=/^%\s\s*\|(\S+?\.ss[ti])\|@\|\^\|>>ok/
- use_file=if @opt.fns =~/(?:\.ssm|\.ssm\.sst)$/; "#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"
- else @opt.fns
- end
- file_array=IO.readlines(use_file,'')
- skin,images,doc_import=[],[],[]
- file_array.each do |f| #% work area
- if f !~/^%+\s/
- skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin
- if f !~/^%+\s/ \
- and f =~@rgx_image
- images << f.scan(@rgx_image).uniq
- end
- elsif f =~/^%\s/ \
- and @opt.fns =~/\.ssm\.sst$/
- doc_import << f.scan(@rgx_doc_import).uniq if f =~@rgx_doc_import
- end
- end
- docskin=nil
- if skin \
- and skin.length > 0
- docskin=skin.pop.flatten.join
- skin_source=select(docskin)
- else
- skin_source=select
- end
- docskin_place="#{@env.path.processing}/sisupod/_sisu/skin/#{skin_source[:type]}"
- if skin_source[:type] =~/dir/
- docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb"
- docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')]
- docskin='skin_sisupod'
- end
- if skin_source \
- and docskin #imperfect, revisit
- unless skin_source[:name].nil? \
- or skin_source[:name].empty?
- cp_r(skin_source[:name],"#{docskin_place}/#{docskin}.rb")
- skinfile_array=IO.readlines(skin_source[:name],'')
- para_images=[]
- skinfile_array.each do |f| #% work area
- unless f =~/^%+ / #hmmm
- images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image #and FileTest.file?(f.scan(@rgx_rb_image).uniq)
- #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool
- end
- end
- end
- end
- #1. mapping in doc dir?
- #2. need images used by skin, scan skin??
- if images \
- and images.length > 1
- images.flatten!
- images.uniq!
- images.delete_if {|x| x =~/http:\/\// }
- #images.sort!
- image_path_pwd='_sisu/image'
- path_pod_conf="#{@env.path.processing}/sisupod/_sisu"
- images_path_pod="#{path_pod_conf}/image"
- #unattractive hard coding ... !
- images_pwd="#{@env.path.pwd}/#{image_path_pwd}"
- ##sequence copies base images, defaults used in all html outputs
- #image_source_base='/usr/share/sisu/image'
- #dir_pwd=Dir.pwd
- #Dir.chdir(image_source_base)
- #base_images=Dir.glob('*')
- #base_images.each do |i|
- # cp_r(i,"#{images_path_pod}/#{i}")
- #end
- #Dir.chdir(dir_pwd)
- if FileTest.directory?(image_path_pwd)
- images=images.uniq
- images.each do |i|
- cp_r("#{images_pwd}/#{i}","#{images_path_pod}/#{i}") if FileTest.file?("#{images_pwd}/#{i}")
- end
- #chmod(0755, dir_images_www)
- else puts "\tWARN, did not find - #{image_path_pod}"
- end
- end
- x=@env.document_language_versions_found #check multiple document language versions (param not used)
- if doc_import.flatten.length > 0 \
- and @opt.fns =~/\.ssm\.sst$/
- doc_import.flatten.each do |f|
- cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")
- end
- end
- if x[:f] \
- and x[:f].length > 1 #store multiple document language versions, sisupod
- x[:f].each do |f|
- cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")
- end
- elsif @opt.fns =~/\.ssm\.sst/
- ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
- cp_r("#{@env.path.pwd}/#{ssm}","#{@env.path.processing}/sisupod/#{ssm}")
- else cp_r("#{@env.path.pwd}/#{@opt.fns}","#{@env.path.processing}/sisupod/#{@opt.fns}")
- end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
- end
- def sisupod_7zip #look at later
- mkdir_p(@local_path) unless FileTest.directory?(@local_path)
- system(%{
- cd #{@env.path.processing}
- echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt
- #7zip -qz #{@opt.fns}.7z sisu_zip.txt < sisu_zip.txt
- 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisu_zip.txt
- 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisupod
- #7zip -qr #{@zipfile}.7z sisupod
- mv #{@zipfile}.7z #{@local_path}/. &
- rm -r sisupod/* && cd #{@env.path.pwd}
- })
- tell=SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z")
- tell.blue_tab unless @opt.cmd =~/q/
- end
- def sisupod_zip
- mkdir_p(@local_path) unless FileTest.directory?(@local_path)
- system(%{
- cd #{@env.path.processing}
- echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt
- zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt
- zip -qr #{@zipfile}.zip sisupod
- mv #{@zipfile}.zip #{@local_path}/. &
- rm -r sisupod/* && cd #{@env.path.pwd}
- })
- tell=SiSU_Screen::Ansi.new('',"#{@zipfile}.zip")
- tell.blue_tab unless @opt.cmd =~/q/
- end
- end
-end
-__END__
-question?: should you permit the packing of multiple files in single .gz ?
-
- open @opt.fns, parse file
- extract from file content:
- images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image
- skin and copy active skin from whatever source to _sisu/sisupod/sisu/_sisu/skin/doc
- extract from skin images required by skin
-
- remove previously existing contents of _/sisu/sisupod &
- make directory structure:
-
- _sisu
- sisupod
- sisu
- content.sst [file content]
- filename.sst [link to content.sst]
- _sisu
- conf
- skin/
- doc [relevant skin if any other than default]
- image [all images for specific document gathered here]
-
-sisu
- _sisu
- sisurc.yml
- skin/
- dir/
- doc/
- misc/
- site/
- yaml/
- convert/
- standard_terms/
- image
- processing
- dal/
- tex/
- texinfo/
- tune/
- sisupod
-
-special case
-
-composite file (master), e.g.
-SiSU.ssm
-
diff --git a/lib/sisu/v1/sitemaps.rb b/lib/sisu/v1/sitemaps.rb
deleted file mode 100644
index adafa3c6..00000000
--- a/lib/sisu/v1/sitemaps.rb
+++ /dev/null
@@ -1,224 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: sitemap created from parameters extracted from input file(s)
-
-=end
-module SiSU_Sitemaps
- require "#{SiSU_lib}/param"
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/shared_xml"
- include SiSU_Env
- include SiSU_Param
- include SiSU_XML_munge
- class Source
- require 'fileutils'
- include FileUtils
- def initialize(opt)
- @opt=opt
- end
- def read
- songsheet
- end
- def songsheet
- begin
- @sys=SiSU_Env::System_call.new
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
- if @opt.cmd =~/Y/
- @md=SiSU_Param::Parameters.new(@opt).get
- @trans=SiSU_XML_munge::Trans.new(@md) #check @md is required
- @env=SiSU_Env::Info_env.new(@md.fns)
- @rdf=SiSU_XML_tags::RDF.new(@md)
- @fnb_utf8_xml=@md.fnb.dup
- @trans.char_enc.utf8(@fnb_utf8_xml) if @sys.locale =~/utf-?8/i #% utf8
- output_map(sitemap)
- elsif @opt.mod.inspect =~/--sitemaps/
- @sitemap_idx_fn='sitemapindex.xml'
- @env=SiSU_Env::Info_env.new
- output_idx(sitemap_index)
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#@sitemap_idx_fn")
- tell.result unless @opt.cmd =~/q/
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else
- SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def make_path(path)
- mkdir_p(path) unless FileTest.directory?(path)
- end
- def output_map(sitemap)
- path="#{@env.path.output}/#{@md.fnb}"
- filename=@fn[:sitemap]
- touch_path=@env.path.sitemaps
- touch_filename=@fn[:sitemap_touch]
- SiSU_Env::SiSU_file.new(@md).make_path(path)
- file=SiSU_Env::SiSU_file.new(@md).make_file(path,filename)
- file << sitemap
- if FileTest.file?("#{touch_path}/#{touch_filename}")
- rm("#{touch_path}/#{touch_filename}")
- end
- #SiSU_Env::SiSU_file.new(@md).touch_file(touch_path,touch_filename)
- end
- def output_idx(sitemap)
- path=@env.path.output
- filename=@sitemap_idx_fn
- make_path(path)
- file=make_file(path,filename)
- file << sitemap
- #cp("#{path}/#{filename}","#{@env.path.output}/#{filename}")
- end
- def sitemap_index
- sitemap_files=Dir.glob("#{@env.path.sitemaps}/sitemap_*.xml")
- sitemap_idx=[]
- sitemap_idx <<<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemaps/0.9
- http://www.sitemaps.org/schemas/sitemaps/sitemap.xsd"
- xmlns="http://www.sitemaps.org/schemas/sitemapindex/0.9">
-WOK
- sitemap_files.each do |s|
- f=s.gsub(/.+?\/sitemap_([^\/]+?)\.xml$/,'\1')
- @trans.char_enc.utf8(f) if @sys.locale =~/utf-?8/i #% utf8
-sitemap_idx <<<<WOK
- <sitemap>
- <loc>#{@env.path.url.remote}/#{f}/sitemap.xml</loc>
- </sitemap>
-WOK
-#<lastmod>1993-10-03T16:00:16+00:00</lastmod>
- end
- sitemap_idx <<<<WOK
-</sitemapindex>
-WOK
- idx=sitemap_idx.join
- end
- def sitemap
- map=if @md.date_modified \
- and @md.date_modified=~/\d{4}-\d{2}-\d{2}/
- sitemap_date_modified
- else sitemap_no_date
- end
- end
- def sitemap_date_modified
-<<WOK
-<?xml version='1.0' encoding='UTF-8'?>
-<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemaps/0.9
- http://www.sitemaps.org/schemas/sitemaps/sitemap.xsd"
- xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-#{@rdf.comment_xml}
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:toc]}</loc>
- <lastmod>#{@md.date_modified}</lastmod>
- <changefreq>monthly</changefreq>
- <priority>0.7</priority>
- </url>
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:doc]}</loc>
- <lastmod>#{@md.date_modified}</lastmod>
- <priority>0.5</priority>
- </url>
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:manifest]}</loc>
- <lastmod>#{@md.date_modified}</lastmod>
- <priority>0.5</priority>
- </url>
-</urlset>
-WOK
- end
- def sitemap_no_date
-<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-#{@rdf.comment_xml}
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:toc]}</loc>
- <changefreq>monthly</changefreq>
- <priority>0.7</priority>
- </url>
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:doc]}</loc>
- <priority>0.5</priority>
- </url>
- <url>
- <loc>#{@env.path.url.remote}/#@fnb_utf8_xml/#{@fn[:manifest]}</loc>
- <priority>0.5</priority>
- </url>
-</urlset>
-WOK
- end
- end
-end
-__END__
-* sanitize xml, pass through filter to ensure is valid - done but needs testing
-* remote placement of sitemaps --sitemaps -R (probably makes more sense than doing against -Y [filename/wildcard]) - done but needs testing
-* gzip sitemaps - not before testing / after testing
-* issue with master documnts, naming and mapping, check multilingual
-
-<!-- Document processing information:
- * Generated by: SiSU 0.48.6 of 2006w45/6 (20061111)
- * Ruby version: ruby 1.8.5 (2006-08-25) [i486-linux]
- *
- * Last Generated on: Sat Nov 18 15:28:08 +0000 2006
- * SiSU http://www.jus.uio.no/sisu
--->
-
diff --git a/lib/sisu/v1/spell.rb b/lib/sisu/v1/spell.rb
deleted file mode 100644
index 84f503f9..00000000
--- a/lib/sisu/v1/spell.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: spellchecking
-
-=end
-module Utility
- class Spell
- def initialize(input,filesrc,flg)
- @flg=flg
- @filename, @filetype = /(.+?)(\.\w\w\w0$)/.match(filesrc)[1,2] #.gsub(/\.\w\w\w0$/, "")
- @input=input
- @allwords=[]
- puts @filename
- @speller='aspell' # 'ispell'
- @dictionary='british'
- @lang='en_GB'
- end
- def check
- @input.each do |data|
- data.gsub!(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ')
- data.gsub!(/(&nbsp;|#{Mx[:nbsp]})/i,' ')
- data.gsub!(/<\/?(table|tr|td|b|p|href).*?>/i,' ')
- data.gsub!(/(<==.+|<:\S+>|<!.+?!>|^0~.+|\{\{\{|~)/,' ')
- data.gsub!(/(["|<>)(\n'`'.;&_-]|\=)/,' ')
- data.gsub!(/\b(altExternal|
- target|externalimg|
- srcimagebext|
- img|src|toc|pdf|
- cd|org|
- helvetica|roman
- )\b/i,' ')
- data.gsub!(/EOF/,'')
- @words=data.scan(/\S+/)
- @words.each { |y| @allwords << y }
- end
- @allwords.uniq!
- if @flg =~ /S/
- File.open('/home/ralph/spell_error','a+') do |file| #fix
- file.puts %{\n\n<<#@filename>>}
- end
- @allwords.each { |y| puts y.inspect; system(%{cat #{y} | /usr/bin/#@speller -l -d #@dictionary >> ~/spell_error })}
- else
- @allwords.each { |y| sp=%x{echo #{y}|#@speller -l }; puts sp unless sp.empty?}
- end
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v1/sst_convert_markup.rb b/lib/sisu/v1/sst_convert_markup.rb
deleted file mode 100644
index 35b09b71..00000000
--- a/lib/sisu/v1/sst_convert_markup.rb
+++ /dev/null
@@ -1,318 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: A conversion script for canned substitutions, a fairly generic
- simple tool that can be used to store other canned conversions, used here for
- altering SiSU markup
-
-=end
-module SiSU_Modify
- require "#{SiSU_lib}/sst_identify_markup"
- require "#{SiSU_lib}/sst_from_kdissert"
- require "#{SiSU_lib}/sst_to_s_xml_sax"
- require "#{SiSU_lib}/sst_to_s_xml_dom"
- require "#{SiSU_lib}/sst_to_s_xml_node"
- require "#{SiSU_lib}/sst_from_xml"
- require "#{SiSU_lib}/response"
- class Convert_markup
- require 'fileutils'
- include FileUtils #::Verbose
- def initialize(opt)
- @opt=opt
- @description='This is a script that contains canned text conversions for reuse'
- @response=SiSU_Response::Response.new
- @ask=SiSU_Response::Response.new
- @warn='WARNING, PROCEED AT YOUR OWN RISK, will make file changes.'
- end
- def current_match_and_replace
- convert_37_to_38
- end
- def message(text)
- response=''
- unless @opt.cmd=~/QQ/ \
- or @opt.cmd=~/q/
- response=@ask.response?(%{#{ text}\nProceed? })
- end
- end
- def help
- print <<WOK
-
-#@description
-
-sisu --convert --to38 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
- [--37to38]
-
-sisu --convert --to37 [filename/wildcard]
- converts pre 0.37 sisu markup to 0.38 experimental
- [--38to37]
-
-sisu --convert --36to37 [filename/wildcard]
- converts pre 0.36 file-name, to 0.37 file-name
- [--36to37]
-
-sisu --identify [filename]
- attempts to identify markup version used in file
-
-sisu --query [version number]
- gives short summary of distinguishing characteristic
- of that version of markup
-
-WOK
- exit
- end
- #%% substitutions to be made
- def convert_37_to_38
- message("#@warn\nConvert sisu markup from 0.37 to 0.38")
- [
- [/^0~(\S+?)([+-])\s+/, '@\1:\2 ', //],
- [/^0~(\S+)\s+/, '@\1: ', //],
- [/^@toc:\s+/, '@structure: ', //],
- [/^1~/, ':A~', //],
- [/^2~/, ':B~', //],
- [/^3~/, ':C~', //],
- [/^4~/, '1~', //],
- [/^5~/, '2~', //],
- [/^6~/, '3~', //],
- [/^7~/, '4~', //],
- [/^8~/, '5~', //],
- [/^9~/, '6~', //],
- [/1/, ':A', /^@(?:level|markup):\s/],
- [/2/, ':B', /^@(?:level|markup):\s/],
- [/3/, ':C', /^@(?:level|markup):\s/],
- [/4/, '1', /^@(?:level|markup):\s/],
- [/5/, '2', /^@(?:level|markup):\s/],
- [/6/, '3', /^@(?:level|markup):\s/]
- ]
- end
- def convert_38_to_37
- message("#@warn\nConvert sisu markup from 0.38 to 0.37")
- [
- [/^@(\S+?):([+-])\s+/, '0~\1\2 ', //],
- [/^@(\S+?):\s+/, '0~\1 ', //],
- [/^0~structure\s+/, '0~toc ', //],
- [/^1~/, '4~', //],
- [/^2~/, '5~', //],
- [/^3~/, '6~', //],
- [/^4~/, '7~', //],
- [/^5~/, '8~', //],
- [/^6~/, '9~', //],
- [/^:?A~/, '1~', //],
- [/^:?B~/, '2~', //],
- [/^:?C~/, '3~', //],
- [/1/, '4', /^0~(?:level|markup)\s/],
- [/2/, '5', /^0~(?:level|markup)\s/],
- [/3/, '6', /^0~(?:level|markup)\s/],
- [/:?A/, '1', /^0~(?:level|markup)\s/],
- [/:?B/, '2', /^0~(?:level|markup)\s/],
- [/:?C/, '3', /^0~(?:level|markup)\s/]
- ]
- end
- def convert_filename_36_to_37
- @opt.files.each do |f|
- s=case f
- when /(\.s[1-3])$/; f.sub($1,'.sst')
- when /(\.r[1-3])$/; f.sub($1,'.ssm')
- when /(\.ri)$/; f.sub($1,'.ssi')
- else f
- end
- pwd=Dir.pwd
- unless f == s
- unless File.exist?("#{pwd}/#{s}")
- puts "./#{f} -> ./#{s}"
- cp("#{pwd}/#{f}","#{pwd}/#{s}")
- else "File already exists, < #{s} > will not overwrite"
- end
- end
- end
- end
- def convert_to_simple_xml_model_sax
- SiSU_simple_xml_model_sax::Convert.new(@opt).read
- end
- def convert_to_simple_xml_model_dom
- SiSU_simple_xml_model_dom::Convert.new(@opt).read
- end
- def convert_to_simple_xml_model_node
- SiSU_simple_xml_model_node::Convert.new(@opt).read
- end
- def convert_kdi_to_sst
- SiSU_Kdissert::Convert.new(@opt).read
- end
- def convert_s_xml_to_sst
- SiSU_sst_from_xml::Convert.new(@opt).read
- end
- def convert_footnotes
- require "#{SiSU_lib}/sst_do_inline_footnotes"
- SiSU_Convert_footnotes::Source.new(@opt).read
- end
- def conversion
- #%% do it -------------------------->
- if @opt.files \
- and @opt.files.length > 0
- mr=nil
- #%% changes to make m match, r replace -------------------------->
- if @opt.mod.inspect =~/--help/; help
- elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/
- ext=case @opt.mod.inspect
- when /(?:convert|to)[=-](?:xml|sxs|sax)/; '.sxs.xml'
- when /(?:convert|to)[=-](?:sxd|dom)/; '.sxd.xml'
- when /(?:convert|to)[=-](?:sxn|node)/; '.sxn.xml'
- end
- message("#{@opt.files.inspect}\n\nWARNING, PROCEED AT YOUR OWN RISK,\noverwriting any equivalent file with the extension #{ext}")
- mr=case @opt.mod.inspect
- when /(?:convert|to)[=-](?:sxs|sax|xml )/; convert_to_simple_xml_model_sax
- when /(?:convert|to)[=-](?:sxd|dom)/; convert_to_simple_xml_model_dom
- when /(?:convert|to)[=-](?:sxn|node)/; convert_to_simple_xml_model_node
- else help
- end
- else
- mr=case @opt.mod.inspect
- when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/; convert_37_to_38
- when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/; convert_38_to_37
- when /(?:36to37)/; convert_filename_36_to_37
- when /(?:convert|from)[=-]kdi/; convert_kdi_to_sst
- when /(?:(?:convert|from)[=-])?(?:xml_to_sst|xml2sst|sxml|sxs|sxd|sxd)/; convert_s_xml_to_sst
- when /(?:convert|to)[=-]footnotes/; convert_footnotes
- when /convert|default/; current_match_and_replace
- else help
- end
- end
- unless @opt.mod.inspect =~/kdi/
- match_and_replace=mr
- #start_processing =/not used in this example/i
- end_processing =/END\s+OF\s+FILE/
- i=@opt.fns
- if i =~/(?:\.sst|\.ssm|\.ssi)$/
- @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false
- o="#{i}.bk" #o is for old
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
- if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) \
- or (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/)
- puts "#{i} #{markup_version}"
- file=File.open(i,'r')
- cont=file.readlines
- file.close
- cont.each do |y|
- match_and_replace.each do |m,r,w|
- if y =~m \
- and y =~w
- if @new
- @new=false
- File.unlink(o) if File.exist?(o)
- File.rename(i,o)
- File.unlink(i) if File.exist?(i)
- @file=File.new(i,'w')
- @matched=true
- break
- end
- end
- end
- end
- if @matched
- puts "conversion match in #{i}" unless @opt.cmd=~/q/
- @flag_start=true
- cont.each do |y|
- if y =~end_processing
- @flag_end=true
- end
- if @flag_start \
- and not @flag_end
- match_and_replace.each do |m,r,w|
- if y =~m \
- and y =~w
- puts m.inspect + ' -> ' + r unless @opt.cmd=~/q/
- puts "in: #{y}" if @opt.cmd=~/[vVM]/
- y.gsub!(m,r) if m and r
- puts "out: #{y}" if @opt.cmd=~/[vVM]/
- end
- end
- end
- if y=~/^\s*$/; @empty1=true
- else @empty1=false
- end
- @file.puts y unless (@empty1==true and @empty2==true)
- if y=~/^\s*$/; @empty2=true
- else @empty2=false
- end
- end
- @file.close
- else puts "NO conversion match in #{i}" unless @opt.cmd=~/q/
- end
- else puts "Requested conversion #{@opt.mod.inspect} markup #{markup_version} identified in #{i}" if @opt.cmd=~/[vVM]/
- end
- end
- end
- else puts 'this routine makes permanent changes to the contents of the files matched, as instructed within [no matches]'
- end
- end
- end
-end
-#%% files to match for this conversion set ------------------------->
-require "#{SiSU_lib}/options"
-argv=$*
-@opt=SiSU_commandline::Options.new(argv)
-case @opt.mod.inspect
-when /=kdi/
- SiSU_Modify::Convert_markup.new(@opt).conversion
-when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/
-@opt.files.each do |fns|
- @opt.fns=fns
- SiSU_Modify::Convert_markup.new(@opt).conversion
-end
-else
- @opt.mod='--help'
- SiSU_Modify::Convert_markup.new(@opt).help
-end
-__END__
diff --git a/lib/sisu/v1/sst_do_inline_footnotes.rb b/lib/sisu/v1/sst_do_inline_footnotes.rb
deleted file mode 100644
index 1c8a75cd..00000000
--- a/lib/sisu/v1/sst_do_inline_footnotes.rb
+++ /dev/null
@@ -1,482 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: preprocessing, (dal), data abstraction used in subsequent
- processing
-
-=end
-module SiSU_Convert_footnotes
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/param"
- require "#{SiSU_lib}/dal_syntax"
- require "#{SiSU_lib}/i18n"
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- include SiSU_Syntax
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={} #Beware!!
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=@@flag_vocab=0
- @@endnote={}
- @@endnote_array=@@word_mode=[]
- @@endnote_call_counter=1
- @@line_mode=''
- end
- end
- class Source <Instantiate
- @@dal_array=[]
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @@fns||@opt.fns
- @my_make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @fnm=@my_make_fns.marshal_meta
- SiSU_Env::Create_system_link.new.images
- end
- def read #creates dal
- begin
- dal=[]
- @@dal_array=[]
- @@fns=@opt.fns
- create_dal
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- def get #reads dal, unless does not exist then creates first
- begin
- dal=[]
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@dal_array=[]
- end
- dal=if @@dal_array.empty?; read_fnm
- else @@dal_array.dup #check
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- Instantiate.new
- end
- end
- protected
- def create_dal
- dal_array=[]
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes')
- tell.green_title_hi unless @opt.cmd =~/q/
- file_array=IO.readlines(@opt.fns,'')
- file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
- end
- end
- meta=file_array.dup
- meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
- @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
- if @md.en[:mismatch] == 0 \
- or @md.mod.inspect =~/=footnotes-force/
- meta=nil
- dal=SiSU_Convert_footnotes::Make.new(@md,file_array).song
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.cmd =~/v/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn") unless @md.cmd =~/q/
- tell.txt_red unless @md.cmd =~/q/
- dal.each{|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}
- dal_array
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)')
- tell.warn if @cmd !~/q/
- ''
- end
- end
- def read_fnm
- dal=[]
- dal=if FileTest.file?(@fnm); File.open(@fnm){ |f| dal=Marshal.load(f)}
- else SiSU_Convert_footnotes::Source.new(@opt).create_dal #watch
- end
- end
- end
- class Output
- def initialize(md,data)
- @md,@data=md,data
- #@data=data.compact
- @my_make=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- dir=SiSU_Env::Info_env.new(@md.fns)
- @hard="#{Dir.pwd}/#{@md.fns}.fn"
- end
- def hard_output
- filename_note=@my_make.file_note
- @data.each {|s| filename_note.puts s.strip + "\n\n" unless s.strip.empty?}
- end
- end
- class Make
- @@endnote={}
- @@endnote_array=@@word_mode=[]
- @@endnote_call_counter=1
- @@comment='%'
- @@flag={ ['table_to']=>false }
- @@dp=nil
- def initialize(md,data)
- @md,@data=md,data
- @@word_mode=[]
- @env=SiSU_Env::Info_env.new(@md.fns)
- @skin=SiSU_Env::Info_skin.new(@md)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
- @language=l[:l]
- @translate=SiSU_Translate::Source.new(@md,@language)
- end
- def reset
- @@counter=@@column=@@columns=@@flag_vocab=0
- @@endnote={}
- @@endnote_array=@@word_mode=[]
- @@endnote_call_counter=1
- @@line_mode=''
- end
- def song
- reset
- data=@data
- @metafile="#{@env.path.dal}/#{@md.fns}.meta"
- my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
- data=data.join.split("\n\n")
- data_new=[]
- data.each do |x|
- data_new << if x =~ /\n\n/m; x.split(/\n\n+/)
- else x
- end
- end
- data=data_new.flatten
- data=SiSU_Convert_footnotes::Make.new(@md,data).substitutions_and_insertions?
- data=SiSU_Convert_footnotes::Make.new(@md,data).character_check
- data=SiSU_Convert_footnotes::Make.new(@md,data).endnotes
- SiSU_Convert_footnotes::Output.new(@md,data).hard_output
- reset
- data
- end
- protected
- def vocabulary
- data=@data
- tuned_file,vocab_insert=[],[]
- data.each do |para|
- if para =~/^1~/ \
- and @@flag_vocab == 0
- vocab_insert << '@vocabulary: lex' << "\n\n" << para
- tuned_file << vocab_insert unless para.nil?
- @@flag_vocab=1
- else tuned_file << para unless para.nil?
- end
- end
- tuned_file
- end
- def character_check
- require 'iconv'
- reset
- data=@data
- @tuned_file=[]
- endnote_no=1
- data.each do |para|
- para.strip!
- #para.gsub!(/([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12
- para.gsub!(/^[{~}]\s*$/,'')
- para.gsub!(/^#{@@comment}.*/,'') #remove comment and divider #%
- para.gsub!(/<~#>|~#\s*/,'~#')
- para.gsub!(/-#\s*/,'-#')
- #para.gsub!(/-#\s*/,'<-#><~#>')
- para.gsub!(/(~\{ )\s+/,'\1')
- para.gsub!(/ \/\//,'<br />') #added 2004w29
- para.gsub!(/<br>/,'<br />') #needed by xml, xhtml etc.
- para.gsub!(/`/,"'")
- para.gsub!(/\342\200\231/,"'") #if para =~/’/ #Avoid #&lsquo; &rsquo; #&ldquo; &rdquo;
- para.gsub!(/\t/,' ')
- para.gsub!(/�/,' ') #watch, replace with char code
- para.gsub!(/[“”]/,'""')
- para.gsub!(/[­–—]/,'-') #— – chk
- para.gsub!(/·/,'*')
- para.gsub!(/\\copy(?:right)?\b/,'&#169;')
- para.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
- para.gsub!(/\44/,'&#36;') #$ watch
- para=para + "\n"
- case para
- when /\^~/ # endnotes
- #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
- sub_para=para.dup
- @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,'~{ \1 }~').strip
- endnote_no+=1
- para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion
- end
- @tuned_file << para unless para.nil?
- end
- @tuned_file
- end
- def substitutions_and_insertions?
- data=@data
- tuned_file=[]
- data.each do |para|
- if @md.markup =~/0\.16|0\.37/ #parameters not extracted/available
- para.gsub!(/^0~\S+\s+/,'@\1: ')
- para.gsub!(/^1~/,':A~')
- para.gsub!(/^2~/,':B~')
- para.gsub!(/^3~/,':C~')
- para.gsub!(/^4~/,'1~')
- para.gsub!(/^5~/,'2~')
- para.gsub!(/^6~/,'3~')
- para.gsub!(/^7~/,'4~')
- para.gsub!(/^8~/,'5~')
- para.gsub!(/^9~/,'6~')
- end
- if para =~/<:insert\d+!?>/ \
- and para !~/^%\s+/
- @skin.select
- #require "#{@md.doc_skin}" #FIX now
- ins=SiSU_Viz::Inserts.new
- case para
- when /^\s*<:insert1>\s*$/
- para=[]
- ins.insert1.split(/\n\n/).each{|x| para << x }
- when /^\s*<:insert2>\s*$/
- para=[]
- ins.insert2.split(/\n\n/).each{|x| para << x }
- when /^\s*<:insert3>\s*$/
- para=[]
- ins.insert3.split(/\n\n/).each{|x| para << x << "\n"}
- para=ins.insert3
- when /^\s*<:insert4>\s*$/
- para=[]
- ins.insert4.split(/\n\n/).each{|x| para << x << "\n"}
- para=ins.insert4
- when /^\s*<:insert5>\s*$/
- para=[]
- ins.insert5.split(/\n\n/).each{|x| para << x << "\n"}
- when /^\s*<:insert6>\s*$/
- para=[]
- ins.insert6.split(/\n\n/).each{|x| para << x << "\n"}
- when /^\s*<:insert7>\s*$/
- para=[]
- ins.insert7.split(/\n\n/).each{|x| para << x << "\n"}
- end
- para.each{|x| tuned_file << x }
- else tuned_file << para
- end
- tuned_file.compact!
- end
- tuned_file
- end
- def name_endnote_seg
- data=@data
- @tuned_file=[]
- data.each do |para|
- para.gsub!(/<:3>\s*<:ee>/,
- "#{@@endnote['special_align']} <p /><br />\r " +
- "#{@@endnote['seg_name_3']} <p /> " +
- "#{@@endnote['special_align_close']}")
- para.gsub!(/<:2>\s*<:ee>/,
- "#{@@endnote['special_align']} <p /><br />\r " +
- "#{@@endnote['seg_name_2']} <p />" +
- "#{@@endnote['special_align_close']}")
- para.gsub!(/<:1>\s*<:ee>/,
- "#{@@endnote['special_align']} <p /><br />\r " +
- "#{@@endnote['seg_name_1']} <p /> " +
- "#{@@endnote['special_align_close']}")
- @tuned_file << para
- end
- # debug 2003w46 adding revision control info
- if @md.flag_auto_endnotes \
- and @md.flag_separate_endnotes_make
- @tuned_file << "\n1~endnotes Endnotes #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" #prob numbering, revisit
- end
- @tuned_file << "\n<ENDNOTES>"
- @tuned_file
- end
- def owner_details_seg
- data << '1~owner.details Owner Details'
- end
- def number_sub_heading(para,num,title_no)
- case para
- when /#{num}~- /; para.gsub!(/#{num}~- /,"#{title_no} ")
- when /^#{num}~#\s*/; para.gsub!(/^#{num}~#\s*/,"#{title_no} ")
- when /^#{num}~[a-z_\.]+ /
- para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>})
- else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main
- end
- if @md.toc_lev_limit \
- and @md.toc_lev_limit < num
- para.gsub!(/^[2-6]~(?:~\S+)?\s*/,'!_ ')
- end
- para
- end
- def set_heading_top #% make sure no false positives
- unless @md.set_heading_top
- puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/
- data=@data
- @tuned_file=[]
- data.each do |para|
- unless @md.set_heading_top
- if para !~/^(?:@\S+:|0~\S+)\s/m \
- and para !~/\A\s*\Z/m
- @md.set_heading_top=true
- head=if @md.title ; ":A~ #{@md.title}"
- else ':A~ [no title provided]'
- end
- @tuned_file << head
- end
- end
- @tuned_file << para
- end
- @tuned_file
- end
- end
- def set_heading_seg #% make sure no false positives
- unless @md.set_heading_seg
- puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/
- data=@data
- @tuned_file=[]
- data.each do |para|
- unless @md.set_heading_seg
- if para !~/^(?:@\S+:|0~\S+|:[ABC]~)/m \
- and para !~/\A\s*\Z/m \
- and para !~/<:p[bn]>/
- @md.set_heading_seg=true
- head=if @md.title ; "1~seg [#{@md.title}]"
- else '1~seg [segment]'
- end
- @tuned_file << head
- end
- end
- @tuned_file << para
- end
- @tuned_file
- end
- end
- def set_header_title #% make sure no false positives
- unless @md.set_header_title
- puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/
- data=@data
- @tuned_file=[]
- data.each do |para|
- unless @md.set_header_title
- if para !~/^%{1,2}\s/m \
- and para !~/\A\s*\Z/m
- @tuned_file << "0~title #{@md.heading_seg_first}"
- @md.title=@md.heading_seg_first
- @md.set_header_title=true
- end
- end
- @tuned_file << para
- end
- @tuned_file
- end
- end
- def endnotes #% endnote work zone
- data=@data
- @tuned_file=[]
- endnote_no,endnote_ref=1,1
-
- data.each do |para|
- case para # manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
- when /~\{\s+.+?\}~/ # auto-numbered endnotes <!e!> <!e_!> -->
- para.gsub!(/\s*\}~/,' }~') # required 2003w31
- @word_mode=para.scan(/\S+/)
- word_mode=SiSU_Convert_footnotes::Make.new(@md,@word_mode).endnote_call_number
- para=word_mode.join(' ')
- endnote_ref+=1
- when /~\^(?:\s|$)|<:e>/ #%Note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
- word_mode=para.scan(/\S+/)
- word_mode=SiSU_Convert_footnotes::Make.new(@md,word_mode).endnote_call_number
- para=word_mode.join(' ')
- endnote_ref+=1
- end
- @tuned_file << para
- end
- @tuned_file
- end
- def endnote_call_number
- data=@data
- data.each do |word|
- case word
- when /~\{/
- unless word =~/~\{\*+/
- #word.gsub!(/~\{/,"~\{#{@@endnote_call_counter} ") #hard places/writes footnote number
- @@endnote_call_counter+=1
- end
- when /~\^|<:e>/
- word.gsub!(/~\^|<:e>/,"#{@@endnote_array[@@endnote_call_counter-1]}")
- @@endnote_call_counter+=1
- end
- end
- end
- def strip_clean_extra_spaces(s) # dal output tuned
- s=s.dup
- s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1')
- s=s.gsub(/ [ ]+/,' ')
- s=s.gsub(/^ [ ]+/,'')
- s=s.gsub(/ [ ]+$/,'')
- s=s.gsub(/(<\/[bi]>')[ ]+(s )/,'\1\2')
- end
- def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean
- s=s.dup
- s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^:[A-C]~\S+|^[1-6]~\S+|~\{\d+\s.+?\}~)/,'') # markup and endnotes removed
- #% same as db clean -->
- s=s.gsub(/<del>(.+?)<\/del>/,'DELETED(\1)') # deletions
- s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]')
- s=s.gsub(/(?:&nbsp\\;|#{Mx[:nbsp]})+/,' ') #checking source Mx not necessary
- s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- s=s.gsub(/\s\s+/,' ')
- s=s.strip
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/sst_from_kdissert.rb b/lib/sisu/v1/sst_from_kdissert.rb
deleted file mode 100644
index f42755b3..00000000
--- a/lib/sisu/v1/sst_from_kdissert.rb
+++ /dev/null
@@ -1,194 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Conversion script from kdissert .kdi to sisu markup .ssm
- (master document)
-
-=end
-module SiSU_Kdissert
- require "#{SiSU_lib}/sysenv"
- class Convert
- require 'rexml/document'
- include REXML
- def initialize(opt)
- @opt=opt
- @sisu,@sisu_base=[],[]
- @ver=SiSU_Env::Info_version.instance.get_version
- end
- def read
- kdissert_to_sisu
- end
- def sisu_head
- sisu_head=<<WOK
-% SiSU #{@ver[:version]} auto-conversion from Kdissert file [check necessary]
-
-@title: #{@title}
-
-@prefix: Kdissert document map, converted to SiSU markup
-
-@links: {Kdissert}http://freehackers.org/~tnagy/kdissert/
-
-@base_program: kdissert
-
-@skin: skin_kdissert
-
-% @date:
-
-@rcs:+ $Id$
-
-@level: num_top=1
-
-WOK
- end
- def kdissert_to_sisu
- unless @opt.files.empty?
- @opt.files.each do |kdi|
- @sisu_base=[]
- if kdi =~/\.kdi$/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Kdissert to SiSU',"#{kdi} --> #{kdi}.ssm")
- tell.green_hi_blue unless @opt.cmd =~/q/
- system("cp #{kdi} /tmp/. && cd /tmp && tar xzvf /tmp/#{kdi} && cd -")
- file=File.new("/tmp/maindoc.xml")
- @output=File.new("#{kdi}.ssm",'w')
- doc=Document.new(file)
- root=doc.root
- @el=[]
- root.each do |x|
- end
- root.each_with_index do |content,idx|
- if root.elements["item[#{idx}]/summary"]
- id,ma,ch=nil,nil,[]
- 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]={ :id=>id,:ma=>ma,:ch=>ch,:sum=>sum,:txt=>txt }
- if ma=='-1'
- @el[id][:lev]=':A'
- @top=id
- end
- end
- end
- @doc=[]
- @title=@el[@top][:sum]
- puts @el[@top][:sum].inspect
- @doc << @el[@top][:txt] #% careful: hack to make it possible to modify sisu headers
- @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
- # regexs strip most kdissert markup, and provide minimal info for sisu markup -->
- @doc.each do |c,idx|
- c.gsub!(/<\/summary>/,'')
- c.gsub!(/<html>.+?\n|<\/body>|<\/html>|<p>/m,'')
- c.gsub!(/<\/p>/,"\n")
- c.gsub!(/<span style="font-weight:600">(.+?)<\/span>/,' *{ \1 }* ')
- c.gsub!(/<span style="text-decoration:underline">(.+?)<\/span>/,' _{ \1 }_ ')
- c.gsub!(/<span style="font-style:italic">(.+?)<\/span>/,' /{ \1 }/ ')
- c.gsub!(/<ul type="disc">/,'_* ')
- c.gsub!(/<\S+?>/,'')
- c.gsub!(/&lt;br&gt;/,'<br>')
- c.gsub!(/&lt;(:p[bn])&gt;/,'<\1>')
- c.gsub!(/&lt;&lt;([|]\S+[|]@[|].?[|])/,'<<\1')
- c.gsub!(/&lt;/,'\<')
- c.gsub!(/&gt;/,'\>')
- c.gsub!(/&quot;/,'"')
- c.gsub!(/ \s+/,' ')
- @sisu_base << c.strip + "\n\n"
- end
- else puts ".kdi extension expected, filename not recognised: << #{kdi} >>"
- end
- @output << sisu_head << @sisu_base
- end
- else puts '.kdi file for conversion to sisu expected'
- end
- @opt.files.each do |f|
- f.gsub!(/.kdi$/,'.kdi.ssm')
- end
- puts @opt.files.inspect
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/sst_from_xml.rb b/lib/sisu/v1/sst_from_xml.rb
deleted file mode 100644
index db7e859f..00000000
--- a/lib/sisu/v1/sst_from_xml.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: Conversion script from kdissert .kdi to sisu markup .ssm
- (master document)
-
-=end
-module SiSU_sst_from_xml
- require "#{SiSU_lib}/sysenv"
- class Convert
- require 'rexml/document'
- include REXML
- def initialize(opt)
- @opt=opt
- @sisu,@sisu_base=[],[]
- @ver=SiSU_Env::Info_version.instance.get_version
- end
- def tell(filename,type)
- SiSU_Screen::Ansi.new(@opt.cmd,"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue
- end
- def read
- xml_to_sisu
- end
- def markup_head(text)
- text.strip!
- text.gsub!(/(?:\s*\n|\s\s+)/,' ')
- text.gsub!(/<header class=['"]\S+?['"]>(.+?)<\/header>/,'\1')
- text.gsub!(/<(\w+)>(.+?)<\/\w+>/,'@\1: \2')
- text.gsub!(/<header class=['"]\S+?['"]><(\w+)>(.+?)<\/\w+><\/header>/,'@\1: \2')
- text.gsub!(/\s +/,' ')
- text.strip!
- text + "\n\n"
- end
- def markup(text)
- text.strip!
- text.gsub!(/(?:\s*\n|\s\s+)/,' ')
- text.gsub!(/<text class='h1'>(.+?)<\/text>/,':A~ \1')
- text.gsub!(/<text class='h2'>(.+?)<\/text>/,':B~ \1')
- text.gsub!(/<text class='h3'>(.+?)<\/text>/,':C~ \1')
- text.gsub!(/<text class='h4'>(.+?)<\/text>/,'1~ \1')
- text.gsub!(/<text class='h5'>(.+?)<\/text>/,'2~ \1')
- text.gsub!(/<text class='h6'>(.+?)<\/text>/,'3~ \1')
- text.gsub!(/<text class='norm'>(.+?)<\/text>/,'\1')
- text.gsub!(/<endnote symbol='norm'>(.+?)<\/endnote>/,'~{ \1 }~')
- text.gsub!(/<br ?\/>/,'<br>')
- text.gsub!(/<i>(.+?)<\/i>/,'/{\1}/')
- text.gsub!(/<b>(.+?)<\/b>/,'*{\1}*')
- text.gsub!(/<u>(.+?)<\/u>/,'_{\1}_')
- text.gsub!(/<sem:([a-z_]+)\s+depth=['"]zero['"]>(\s*.+?\s*)<\/sem:\1>/,';{ \2 };\1')
- text.gsub!(/<sem:([a-z_]+)\s+depth=['"]one['"]>(\s*.+?\s*)<\/sem:\1>/,':{ \2 }:\1')
- text.gsub!(/<sem:([a-z_]+)\s+depth=['"]many['"]>(\s*.+?\s*)<\/sem:\1>/,'\1:{ \2 }:\1')
- text.gsub!(/<sem:([a-z_]+)>(\s*.+?\s*)<\/sem:\1>/,'\1:{ \2 }:\1')
- text.gsub!(/\s +/,' ')
- text.strip!
- #text.gsub!(/<header>(.+?)<\/header/,"@#{x.name}: \\1\n\n")
- text + "\n\n"
- end
- def sax
- out_file=File.new(@output_file_name,'w')
- head=@doc.root.get_elements('//head/header')
- body=@doc.root.get_elements('//object/text')
- out_file.puts "% SiSU text #{@ver[:version]} (generated from a SiSU XML markup representation)\n\n"
- head.each do |x|
- if x.name == 'header'
- head=markup_head(x.to_s)
- out_file.puts head
- end
- end
- body.each do |x|
- if x.name == 'text'
- body=markup(x.to_s)
- out_file.puts body
- end
- end
- end
- def node
- sax
- end
- def dom
- raise "#{__FILE__}::#{__LINE__} xml dom representation to sst not yet implemented (experimental simple xml representations sax and node to sst are in place)."
- end
- def xml_to_sisu
- unless @opt.files.empty?
- @opt.files.each do |xml|
- @sisu_base=[]
- if xml =~/\.sx[sdn]\.xml$/
- begin
- @doc_str=IO.readlines(xml,'').join("\n")
- @output=File.new("#{xml}.sst",'w')
- @doc=REXML::Document.new(@doc_str)
- @output_file_name="#{Dir.pwd}/#{xml}.sst"
- @el=[]
- rescue REXML::ParseException
- end
- end
- if xml =~/\.sxs\.xml$/
- unless @opt.cmd =~/q/; tell(xml,'sax')
- end
- sax
- elsif xml =~/\.sxd\.xml$/
- unless @opt.cmd =~/q/; tell(xml,'dom')
- end
- dom
- elsif xml =~/\.sxn\.xml$/
- unless @opt.cmd =~/q/; tell(xml,'node')
- end
- node
- else puts "filename not recognised: << #{xml} >>"
- end
- @output << @sisu_base
- end
- else puts '.xml file for conversion to sisu expected'
- end
- puts @opt.files.inspect
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/sst_identify_markup.rb b/lib/sisu/v1/sst_identify_markup.rb
deleted file mode 100644
index aa2a5438..00000000
--- a/lib/sisu/v1/sst_identify_markup.rb
+++ /dev/null
@@ -1,439 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: A conversion script for canned substitutions, a fairly generic
- simple tool that can be used to store other canned conversions, used here for
- altering SiSU markup
-
-=end
-module SiSU_Markup
- class Markup_inform
- attr_accessor :version
- def initialize(version,message,declared_markup='',declared_type='')
- @version,@message,@declared_markup,@declared_type=version,message,declared_markup,declared_type
- end
- def version
- @version
- end
- def message
- @message
- end
- def declared_version
- @declared_markup
- end
- def declared_type
- @declared_type
- end
- def history
- Markup_history.new(@version).query
- end
- end
- class Markup_identify
- def initialize(opt)
- @opt=opt
- @description='This is a script attempts to identify the version of markup used in SiSU (and provides information on changes in markup)'
- end
- def help
- print <<WOK
-
-#@description
-
-WOK
- exit
- end
- def identify
- f=@opt.fns
- if f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])$/ \
- and File.exist?(f)
- file=File.open(f,'r')
- cont=file.readlines
- file.close
- links,oldlinks='',''
- markup=nil
- @declared_type,@declared_markup='[text?]',''
- if cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \
- or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @declared_type,@declared_markup=$1,$2
- #puts "SiSU #@declared_markup (declared markup version)"
- #else puts 'markup version not declared'
- elsif cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \
- or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
- @declared_markup=$1
- end
- @flag_66,@flag_57,@flag_38=false,false,false
- cont.each_with_index do |y,i|
- if y =~/^(?:0\{?~links?|@links?:)\s/ \
- and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
- links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
- else ' (post 0.20.4 header links)'
- end
- end
- unless @flag_38
- if (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
- version='0.38'
- markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
- @flag_38=true
- end
- end
- if @flag_38
- if @flag_69 \
- or y =~/^=\{.+?\}\s*$/
- version='0.69'
- markup=Markup_inform.new(version,'0.69' + oldlinks,@declared_markup,@declared_type)
- @flag_69=true
- break
- end
- if @flag_66 \
- or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/
- version='0.66'
- markup=Markup_inform.new(version,'0.66' + oldlinks,@declared_markup,@declared_type)
- @flag_66=true
- break
- end
- end
- end
- unless @flag_66 or @flag_69
- cont.each_with_index do |y,i|
- if y =~/^(?:0\{?~links?|@links?:)\s/ \
- and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
- links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
- else ' (post 0.20.4 header links)'
- end
- end
- if @flag_57 \
- or (y =~/^:?A~\?? @title/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
- version='0.57'
- markup=Markup_inform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
- @flag_57=true
- break
- end
- if @flag_38 \
- or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
- version='0.38'
- markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
- @flag_38=true
- break if i >= 200
- if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
- version='0.42'
- markup=Markup_inform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
- break
- end
- end
- if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \
- and not @flag_38
- version='0.37'
- markup=Markup_inform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
- break
- end
- if y =~/^1~/ \
- and f =~/\.([rs])([123])/ \
- and not @flag_38
- t,n=$1,$2
- version='0.16'
- instruct=if t =~/r/
- " (change file extension from .#{t}#{n} to .ssm)"
- else " (change file extension from .#{t}#{n} to .sst)"
- end
- markup=Markup_inform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
- break
- end
- if y =~/^0\{~/ \
- and not @flag_38
- version='0.1'
- markup=Markup_inform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
- break
- end
- if y =~/^0\{{3}/ \
- and not @flag_38
- markup=Markup_inform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
- break
- end
- markup='Not a recognised file type '
- end
- end
- markup
- else Markup_history.new(@opt).help_query
- end
- end
- def determine_markup_version
- if @opt.fns.nil? \
- or @opt.fns.empty?
- Markup_history.new(@opt).help_identify
- end
- if File.exist?(@opt.fns)
- if @opt.fns =~/\.(?:sst|ssm|ssi|s[123i]|r[123])/
- markup=identify #(@opt.fns)
- if defined? markup.version
- #if defined? markup and defined? markup.version
- unless @opt.cmd =~/q/
- message=unless markup.declared_version.empty?
- "#{@opt.fns}\n markup Type Declared as SiSU #{markup.declared_version} #{markup.declared_type}\n appears to be SiSU #{markup.version}"
- else
- "Markup Type Appears to be SiSU #{markup.version}\n in file #{@opt.fns}"
- end
- puts message
- #puts markup.message
- puts %{"sisu --query-#{markup.version}" for a brief description of markup type}
- end
- end
- else puts 'file-type not recognised: ' + @opt.fns
- end
- else puts 'file not found: ' + @opt.fns
- end
- if defined? markup.version; markup.version
- else 'markup type/version not determined'
- end
- end
- def markup_version?
- if @opt.fns.empty?
- @opt.files.each do |fns|
- @opt.fns=fns
- determine_markup_version
- end
- else determine_markup_version
- end
- end
- end
- class Markup_history
- def initialize(opt)
- @opt=opt
- end
- def sisu_0_69
- <<WOK
- SiSU 0.69 same as previous, adds book index tags
- /^=\{.+?\}$/
- 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"
- ={GNU/Linux community distribution:Debian+2|Fedora|Gentoo;Free Software Foundation+5}
-
- Free Software Foundation, 1-6
- GNU/Linux community distribution, 1
- Debian, 1-3
- Fedora, 1
- Gentoo,
-
-WOK
- end
- def sisu_0_66
- <<WOK
- SiSU 0.66 same as previous, adds semantic tags
- /[:;]\{.+?\}[:;][a-z+]/
- e.g. :{ Ralph last;{Amissah};last }:author
-
-WOK
- end
- def sisu_0_65
- <<WOK
- SiSU 0.65 same as previous, adds semantic tags
- /[a-z+][:;]\{.+?\}[:;][a-z+]/
- e.g. author:{ Ralph last;{Amissah};last }:author
-
-WOK
- end
- def sisu_0_57
- <<WOK
- 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:]
-
- :A~ @title by @author
-
-WOK
- end
- def sisu_0_42
- <<WOK
- SiSU 0.42 is the same as 0.38 with the introduction of some additional endnote types,
-
- Introduces some varations 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
-
-WOK
- end
- def sisu_0_38
- <<WOK
-
- 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
-WOK
- end
- def sisu_0_37
- <<WOK
-
- 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
-WOK
- end
- def sisu_0_16
- <<WOK
-
- 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
-WOK
- end
- def sisu_0_1
- <<WOK
-
- SiSU 0.1 headers and headings structure represented by
- header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{
-WOK
- end
- def help_query
- <<WOK
-
- sisu --query=[sisu version [0.38] or 'history]
- provides a short history of changes to SiSU markup
-
-WOK
- end
- def help_identify
- <<WOK
-
- sisu --identify [filename]
- attempts to identify the SiSU markup used in a file
-
-WOK
- end
- def query
- tell=if @opt.mod.inspect =~/--query/
- tell=case @opt.mod.inspect
- when /history/
- "#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
- when /0.69/
- "#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
- when /0.66/
- "#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
- when /0.65/
- "#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
- when /0.57/
- "#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
- when /0.42/
- "#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
- when /0.38/
- "#{sisu_0_38}#{sisu_0_16}"
- when /0.37/
- "#{sisu_0_37}\n#{sisu_0_16}"
- when /0.1[6-9]|0.2[0-9]|0.3[0-6]/
- "#{sisu_0_16}\n#{sisu_0_1}"
- when /0.[1-9]|0.1[1-4]/
- sisu_0_1
- else puts "NOT RECOGNISED: #{@opt.mod.inspect}"
- help_query
- end
- tell
- else help_query
- end
- end
- end
-end
-__END__
-#%% to use as independent program ------------------------->
-f=$*
-cf=f[0].to_s
-f.shift
-match_and_replace=[]
-unless f.length > 0; f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be
-end
-puts "SiSU files:"
-puts f
-f.each do |x|
- SiSU_Markup::Markup_identify.new(x).markup_version?
-end
diff --git a/lib/sisu/v1/sst_to_s_xml_dom.rb b/lib/sisu/v1/sst_to_s_xml_dom.rb
deleted file mode 100644
index af8c140a..00000000
--- a/lib/sisu/v1/sst_to_s_xml_dom.rb
+++ /dev/null
@@ -1,589 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (dom style)
-
-=end
-module SiSU_simple_xml_model_dom
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/shared_sem" # shared_sem.rb
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Convert
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- end
- def read
- begin
- @env,@md=@particulars.env,@particulars.md #bug, md relies on info persistence, assumes -m has previously been run
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxd]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxd]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{Dir.pwd}/#{@md.fn[:sxd]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',"#{@md.fns} -> #{@md.fn[:sxd]}").colorize unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxd]}")
- tell.flow if @opt.cmd =~/[MV]/
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@fns_array=[]
- end
- @fns_array=if @@fns_array.empty?; read_fnm
- else @@fns_array.dup # check
- end
- SiSU_simple_xml_model_dom::Convert::Songsheet.new(@fns_array,@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure #file closed in songsheet
- end
- end
- def read_fnm
- dal=[]
- if FileTest.file?("#{Dir.pwd}/#{@opt.fns}")
- dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
- else puts 'Error'
- end
- end
- private
- class Songsheet
- def initialize(data,particulars)
- @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md
- end
- def songsheet
- begin
- SiSU_simple_xml_model_dom::Convert::Scroll.new(@data,@particulars).songsheet
- SiSU_simple_xml_model_dom::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sxd]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- require "#{SiSU_lib}/css" # css.rb
- include SiSU_text_utils
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
- def initialize(data='',particulars='')
- @data,@env,@md=data,particulars.env,particulars.md
- @vz=SiSU_Env::Get_init.instance.skin
- @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/
- @tab="\t"
- if @md
- @trans=SiSU_XML_munge::Trans.new(@md)
- end
- @sys=SiSU_Env::System_call.new
- end
- def songsheet
- pre
- markup
- post
- publish
- end
- protected
- def embedded_endnotes(para='')
- para.gsub!(/~\{(.+?)\}~/,
- '<endnote><note>\1</note></endnote> ')
- para.gsub!(/~\[([*+])\s+(.+?)\]~/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- end
- def xml_clean(para='')
- para.gsub!(/~\[([*+])\s+(.+?)\]~/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- para.gsub!(/~\{([*+]+)\s+(.+?)\}~/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- para.gsub!(/~\{(.+?)\}~/,
- '<endnote><note>\1</note></endnote> ')
- para.gsub!(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,'') #Danger, watch
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/\/{(.+?)}\//,'<i>\1</i>')
- txt.gsub!(/[*!]{(.+?)}[*!]/,'<b>\1</b>')
- txt.gsub!(/_{(.+?)}_/,'<u>\1</u>')
- txt.gsub!(/-{(.+?)}-/,'<del>\1</del>')
- txt.gsub!(/<br(?: \/)?>/,'<br />')
- txt.gsub!(/ & /,' and ')
- @@xml[:head] <<<<WOK
-#{@tab}<header class="#{meta.attrib}">
-#{@tab*2}<#{meta.el}>
-#{@tab*3}#{txt}
-#{@tab*2}</#{meta.el}>
-#{@tab}</header>
-WOK
- end
- def xml_sc(md='')
- sc=if @md.sc_info
- <<WOK
- <source_control>
- <sc class="sourcefile">
- #{@md.sc_filename}
- </sc>
- <sc class="number">
- #{@md.sc_number}
- </sc>
- <sc class="date">
- #{@md.sc_date}
- </sc>
- </source_control>
-WOK
- else ''
- end
- @@xml[:sc]=sc
- end
- def xml_element(lv='',para='',hname='',tag='',xml_element='',xml_content='')
- lv=lv.to_i
- n=lv - 1
- n1=lv
- n2=lv + 1
- n3=lv + 2
- v=lv - 3
- tag=''
- tag="\n#{@tab*n3}<nametag>#{hname}</nametag>\n" if hname
- @@xml[:body] <<<<WOK
-#{@tab*n}#{xml_element}
-#{@tab*n1}<heading>
-#{@tab*n2}<object>
-#{@tab*n3}<text>#{para[@regx,2]}</text>
-#{@tab*n2}</object>
-#{@tab*n1}</heading>#{xml_content}
-WOK
- if lv==4
- @copen[1]=true
- @copen[2]=@copen[3]=false
- elsif lv==5
- @copen[2]=true
- @copen[3]=false
- elsif lv==6
- @copen[3]=true
- end
- end
- def xml_structure(lv='',para='',hname='' )
- puts lv if @md.cmd =~/[VM]/
- lv=lv.to_i
- n=lv - 1
- n1=lv
- n2=lv + 1
- n3=lv + 2
- v=lv - 3
- tag=''
- tag="\n#{@tab*n3}<nametag>#{hname}</nametag>\n" if hname !=nil
- case lv
- when 1..3
- xml_element="<heading#{lv}>"
- 3.downto(lv) do |x|
- y=x - 1
- if @cont[1] \
- or @cont[2] \
- or @cont[3]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- @cont[1]=false if @cont[1]
- @cont[2]=false if @cont[2]
- @cont[3]=false if @cont[3]
- ####### attempt to close contents
- if @copen[3] # 6{
- [3,2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[2] # 5{
- [2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[1] # 4{
- [1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- end
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]
- @level[x]=false
- end
- when 4..6
- 6.downto(lv) do |x|
- y=x - 1
- if @level[x]==true
- u=x - 3;
- @xml_contents_close[x]=''
- end
- end
- cv=lv - 3
- xml_element="<contents#{cv}>"
- xml_content="\n#{@tab*5}<content>"
- case lv
- when 4
- @@xml[:body] << "#{@tab*5}</content>\n" if @cont[1]
- if @copen[3]==true # 6{
- [3,2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[2]==true # 5{
- [2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[1]==true # 4{
- [1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- end
- @cont[1]=true
- when 5
- if @cont[2] \
- or @cont[1]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- if @copen[3]==true #6{
- [3,2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[2]==true #5{
- [2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- end
- @cont[2]=true
- when 6
- if @cont[3] \
- or @cont[2] \
- or @cont[1]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- [3].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } if @copen[3]
- @cont[3]=true
- end
- end
- xml_element(lv,para,hname,tag,xml_element,xml_content)
- @level[lv]=true
- ((lv+1)..6).each { |x| @level[x]=false }
- end
- def group_structure(para='')
- para.gsub!(/<:group(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def poem_structure(para='')
- para.gsub!(/<:verse(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def code_structure(para='')
- para.gsub!(/<:code(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def table_structure(table='')
- @@xml[:body] << %{#{@tab*0}<object>} << "\n"
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- @endnotes=[]
- end
- def tidywords(wordlist)
- wordlist.each do |x|
- x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- end
- end
- def markup
- data=@data
- dir=SiSU_Env::Info_env.new(@md.fns)
- xml_sc(@md)
- @rcdc=false
- @level,@cont,@copen,@xml_contents_close=[],[],[],[]
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- data.each do |para|
- #para=SiSU_sem::Tags.new(para,@md).rm.all
- wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17
- para=tidywords(wordlist).join(' ').strip
- para.gsub!(/<[-~]#>/,'')
- para.gsub!(/<br\/?>/,'<br />')
- para.gsub!(/<:pb>\s*/,'')
- para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,
- "<image.path>#{dir.url.images_local}/\\1</image.path>")
- para.gsub!(/#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,
- "<image.path>#{dir.url.images_local}/\\1</image.path>")
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # checking source Mx not necessary
- para=SiSU_document_structure::Structure.new(@md,para).structure
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- para.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- para.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- para='' if para=~/#{Mx[:lv_o]}@\S+?#{Mx[:lv_c]}/
- if @rcdc==false \
- and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/)
- @rcdc=true
- end
- if para !~/(^0~|^@\S+?:|<ENDNOTES>|<EOF>)/
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para
- unless @rcdc
- if para !~/^(?:%\s|0~|@\S+?:)/
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S*)/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)?/
- xml_clean(para)
- xml_structure($1,para,$2)
- para=@sto.lev_para_ocn.heading_body6
- else
- if para =~ /<:verse>/
- para=poem_structure(para)
- elsif para =~ /<:group>/
- para=group_structure(para)
- elsif para =~ /<:code>/
- para.gsub!(/</,'&lt;')
- para.gsub!(/>/,'&gt;')
- para=code_structure(para)
- elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13
- #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para)
- para=table.table_split
- @@xml[:body] << table_structure(para)
- else #xml_structure
- xml_clean(para)
- if para[@regx] \
- and para[@regx,2]
- @@xml[:body] << %{#{@tab*6}<object>} << "\n"
- end
- @@xml[:body] << "#{@tab*7}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx]
- end
- end
- elsif para =~/(Note|Endnotes?)/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@@dp}:#{@@dp}#{Mx[:id_c]}$/ #debug 2003w46 add rc info
- format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>')
- para=format_scroll.bold_para
- elsif para =~/(Owner Details)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@@dp}:#{@@dp}#{Mx[:id_c]}$/
- format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>')
- @@xml[:owner_details]=format_scroll.bold_para
- para=''
- elsif para =~/(.*)<:#>(.*)/
- one,two=$1,$2
- format_text=Format_text_object.new(one,two)
- para=format_text.seg_no_paranum
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if para =~/.*<:#>.*$/
- para=case para
- when /<:i1>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- when /<:i2>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # where condition for no paranum
- end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
- para=format_text.center
- end
- end
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+!>/,' ')
- para
- end
- end
- @content_flag=true
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- if @level[x]==true
- if @content_flag==true
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n"
- @content_flag=false
- else
- @@xml[:body] << "\n#{@tab*y}</contents#{v}>\n"
- end
- end
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]==true
- end
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- @@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xml_sax
- encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
-#{rdf.comment_xml_dom}
-<document>
-WOK
- @@xml[:head] << "<head>\n"
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << @@xml[:sc]
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- data=@data
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- Output.new(content.join,@md).xml
- @@xml={}
- end
- end
- class Output
- def initialize(data,md)
- @data,@md=data,md
- @trans=SiSU_XML_munge::Trans.new(@md)
- end
- def xml
- @sisu=[]
- @data.each do |para|
- if para !~/^\s*(?:%+ |<:code>)/
- if @md.sem_tag and para =~/[:;]\{|\}[:;]/
- para=@trans.xml_semantic_tags(para)
- end
- if para =~/[:;]\{|\}[:;]/
- para=SiSU_sem::Tags.new(para,@md).rm.all
- end
- end
- para.gsub!(/\/\{(.+?)\}\//,'<italic>\1</italic>')
- para.gsub!(/\*\{(.+?)\}\*/,'<bold>\1</bold>')
- para.gsub!(/!\{(.+?)\}!/,'<bold>\1</bold>')
- para.gsub!(/_\{(.+?)\}_/,'<underscore>\1</underscore>')
- para.gsub!(/-\{(.+?)\}-/,'<strike>\1</strike>')
- # do { links }http://url
- #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+?!>/,'')
- para="#{para}\n" unless para.empty?
- @sisu << para
- end
- new_file_data=@sisu.join
- @sisu=new_file_data.scan(/.+/)
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxd]).mkfile_pwd
- if filename_sxm.class==File
- @sisu.each {|para| filename_sxm.puts para}
- filename_sxm.close
- else puts 'file not created, is directory writable?'
- end
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy =SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxd]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/sst_to_s_xml_node.rb b/lib/sisu/v1/sst_to_s_xml_node.rb
deleted file mode 100644
index cba4c81e..00000000
--- a/lib/sisu/v1/sst_to_s_xml_node.rb
+++ /dev/null
@@ -1,649 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (node style)
-
-=end
-module SiSU_simple_xml_model_node
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/param" # param.rb
- include SiSU_Param
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb
- require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb
- require "#{SiSU_lib}/shared_xml" # shared_xml.rb
- include SiSU_XML_munge
- require "#{SiSU_lib}/shared_sem" # shared_sem.rb
- require "#{SiSU_lib}/xml_format" # xml_format.rb
- include SiSU_XML_format
- require "#{SiSU_lib}/rexml" # rexml.rb
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Convert
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- end
- def read
- begin
- @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run
- @env=@particulars.env
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxn]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxn]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{Dir.pwd}/#{@md.fn[:sxn]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML Node',"#{@md.fns} -> #{@md.fn[:sxn]}").colorize unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxn]}")
- tell.flow if @opt.cmd =~/[MV]/
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@fns_array=[]
- end
- @fns_array=if @@fns_array.empty?; read_fnm
- else @@fns_array.dup #.dup #jokes on you
- end
- SiSU_simple_xml_model_node::Convert::Songsheet.new(@fns_array,@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure #file closed in songsheet
- end
- end
- def read_fnm
- dal=[]
- if FileTest.file?("#{Dir.pwd}/#{@opt.fns}")
- dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
- else puts 'Error'
- end
- end
- private
- class Songsheet
- def initialize(data,particulars)
- @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md
- end
- def songsheet
- begin
- SiSU_simple_xml_model_node::Convert::Scroll.new(@data,@particulars).songsheet
- SiSU_simple_xml_model_node::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sxn]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt" # shared_txt.rb
- require "#{SiSU_lib}/css" # css.rb
- include SiSU_text_utils
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
- @@parent={ :ocn=>[],:node=>[] }
- @@offspring={ :ocn=>[],:node=>[] }
- @@current=nil
- def initialize(data='',particulars='')
- @data,@env,@md=data,particulars.env,particulars.md
- @vz=SiSU_Env::Get_init.instance.skin
- @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/
- @tab="\t"
- if @md
- @trans=SiSU_XML_munge::Trans.new(@md)
- end
- @sys=SiSU_Env::System_call.new
- @ocn=[]
- @node={ :ocn=>[],:no=>[] }
- end
- def songsheet
- pre
- markup
- post
- publish
- end
- protected
- def embedded_endnotes(para='')
- para.gsub!(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/,'<endnote symbol="norm">\1</endnote> ')
- para.gsub!(/#{Mx[:en_b_o]}([*+])\s+(.+?)#{Mx[:en_b_c]}/,'<endnote symbol="\1">\2</endnote> ')
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- txt.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- txt.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'<br />')
- txt.gsub!(/ & /,' and ')
- @@xml[:head] <<<<WOK
-#{@tab}<header class="#{meta.attrib}">
-#{@tab*2}<#{meta.el}>
-#{@tab*3}#{txt}
-#{@tab*2}</#{meta.el}>
-#{@tab}</header>
-WOK
- end
- def xml_sc(md='')
- sc=if @md.sc_info
- <<WOK
- <source_control>
- <sc class="sourcefile">
- #{@md.sc_filename}
- </sc>
- <sc class="number">
- #{@md.sc_number}
- </sc>
- <sc class="date">
- #{@md.sc_date}
- </sc>
- </source_control>
-WOK
- else ''
- end
- @@xml[:sc]=sc
- end
- def parent
- def node
- @@parent[:node]
- end
- def ocn
- @@parent[:ocn]
- end
- def prt_node
- parent.node.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n==0 } #x==node
- end
- def prt_ocn
- parent.ocn.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n==0 } #x==node
- end
- self
- end
- def offspring
- def node
- @@offspring=if parent.node
- @offspring=[]
- parent.node.each_with_index do |n,o|
- if n
- @offspring[n] ||=[]
- @offspring[n] << o
- end
- end
- @offspring
- else @@offspring
- end
- end
- self
- end
- def build_relationships(o='',lv='')
- if lv.inspect =~/[0-6]/
- @node[:ocn][lv]=o.ocn
- @node[:no][lv]=o.node
- end
- if lv.inspect =~/^[1-6]/; @@current=lv
- end
- if o.node==1 \
- or lv==1
- @@parent[:node][o.node]=0
- elsif @@current==lv \
- and @@current !=nil
- if @node[:no][lv-1] != nil
- @@parent[:node][o.node]=@node[:no][lv-1]
- elsif @node[:no][lv-2] != nil
- @@parent[:node][o.node]=@node[:no][lv-2]
- elsif @node[:no][lv-3] != nil:
- @@parent[:node][o.node]=@node[:no][lv-3]
- else puts 'error'
- end
- elsif lv==nil
- if o.ocn.class==Fixnum \
- and @@current
- @@parent[:node][o.node]=@node[:no][@@current]
- end
- else puts 'error'
- end
- if @@current==lv \
- and @@current !=nil
- if @node[:ocn][lv-1] != nil
- @@parent[:ocn][o.ocn]=@node[:ocn][lv-1]
- elsif @node[:ocn][lv-2] != nil
- @@parent[:ocn][o.ocn]=@node[:ocn][lv-2]
- elsif @node[:ocn][lv-3] != nil:
- @@parent[:ocn][o.ocn]=@node[:ocn][lv-3]
- else puts 'error'
- end
- elsif lv==nil
- if o.ocn.class==Fixnum \
- and @@current
- @@parent[:ocn][o.ocn]=@node[:ocn][@@current]
- end
- else puts 'error'
- end
- end
- #def node_structure(o='',para='',lv='',hname='') #extracted endnotes
- # if o.ocn
- # lv=lv.to_i
- # lv=nil if lv==0
- # build_relationships(o,lv)
- # end
- #end
- def xml_structure(o='',para='',lv='',hname='') #extracted endnotes
- if o.ocn
- puts para if lv and @md.cmd =~/M/
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv==0
- embedded_endnotes(para)
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- if @md.cmd =~/[VM]/
- if offspring.node[o.node]
- puts "#{o.node}::#{parent.node[o.node]}::[#{offspring.node[o.node].join(',')}]"
- else
- puts "#{o.node}::#{parent.node[o.node]}"
- end
- end
- @@xml[:body] << "#{@tab*0}<object>" if para[@regx]
- #@@xml[:body] << "#{@tab*1}<heading>#{lv}</heading>" << "\n" if lv
- @@xml[:body] << "#{@tab*1}" << "\n" if para[@regx]
- if @md.mod.inspect =~/odf/ #condition not currently present, but consider
- @@xml[:body] << %{#{@tab*1}<ocn>#{o.ocn}</ocn>\n}
- end
- @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n"
- elsif wrapped =~/\A%%?\s+/; %{<!--\n#{@tab*1}<text class="comment">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n-->\n} # comments [not included, review]
- else %{#{@tab*1}<text class="norm">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP
- end
- #@@xml[:body] << "#{@tab*1}<text>\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n" # main text, contents, body KEEP
- @@xml[:body] << "#{@endnotes}" if @endnotes # main text, endnotes KEEP
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << %{#{@tab*1}<node>\n}
- @@xml[:body] << %{#{@tab*2}<id>#{o.node}</id>\n}
- @@xml[:body] << %{#{@tab*2}<parent>#{parent.node[o.node]}</parent>\n}
- if offspring.node[o.node]
- @@xml[:body] << %{#{@tab*2}<offspring>#{offspring.node[o.node].join(',')}</offspring>\n}
- end
- @@xml[:body] << %{#{@tab*1}</node>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- @endnotes=[]
- end
- end
- def group_structure(o='',para='')
- para.gsub!(/<:group(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- if @md.mod.inspect =~/odf/
- @@xml[:body] << %{#{@tab*1}<ocn>#{o.ocn}</ocn>\n}
- end
- @@xml[:body] << %{#{@tab*1}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << %{#{@tab*1}<node>\n}
- @@xml[:body] << %{#{@tab*2}<id>#{o.node}</id>\n}
- @@xml[:body] << %{#{@tab*2}<parent>#{parent.node[o.node]}</parent>\n}
- if offspring.node[o.node]
- @@xml[:body] << %{#{@tab*2}<offspring>#{offspring.node[o.node].join(',')}</offspring>\n}
- end
- @@xml[:body] << %{#{@tab*1}</node>\n}
- @@xml[:body] << "#{@tab*0}</object>"
- end
- def poem_structure(o='',para='')
- para.gsub!(/<:verse(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- if @md.mod.inspect =~/odf/
- @@xml[:body] << %{#{@tab*1}<ocn>#{o.ocn}</ocn>\n}
- end
- @@xml[:body] << %{#{@tab*1}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << %{#{@tab*1}<node>\n}
- @@xml[:body] << %{#{@tab*2}<id>#{o.node}</id>\n}
- @@xml[:body] << %{#{@tab*2}<parent>#{parent.node[o.node]}</parent>\n}
- if offspring.node[o.node]
- @@xml[:body] << %{#{@tab*2}<offspring>#{offspring.node[o.node].join(',')}</offspring>\n}
- end
- @@xml[:body] << %{#{@tab*1}</node>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def code_structure(o='',para='')
- para.gsub!(/<:code(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- if @md.mod.inspect =~/odf/
- @@xml[:body] << %{#{@tab*1}<ocn>#{o.ocn}</ocn>\n}
- end
- @@xml[:body] << %{#{@tab*1}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << %{#{@tab*1}<node>\n}
- @@xml[:body] << %{#{@tab*2}<id>#{o.node}</id>\n}
- @@xml[:body] << %{#{@tab*2}<parent>#{parent.node[o.node]}</parent>\n}
- if offspring.node[o.node]
- @@xml[:body] << %{#{@tab*2}<offspring>#{offspring.node[o.node].join(',')}</offspring>\n}
- end
- @@xml[:body] << %{#{@tab*1}</node>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def table_structure(o='',table='') #tables
- @@xml[:body] << %{#{@tab*0}<object>}
- if @md.mod.inspect =~/odf/
- @@xml[:body] << %{#{@tab*1}<ocn>#{o.ocn}</ocn>\n}
- end
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n} # unless lv # main text, contents, body KEEP
- @@xml[:body] << %{#{@tab*1}<node>\n}
- @@xml[:body] << %{#{@tab*2}<id>#{o.node}</id>\n}
- @@xml[:body] << %{#{@tab*2}<parent>#{parent.node[o.node]}</parent>\n}
- if offspring.node[o.node]
- @@xml[:body] << %{#{@tab*2}<offspring>#{offspring.node[o.node].join(',')}</offspring>\n}
- end
- @@xml[:body] << %{#{@tab*1}</node>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx]
- @endnotes=[]
- end
- def xml_clean(para)
- para.gsub!(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,'')
- para
- end
- def markup
- data=[]
- @data=@data.join.split("\n\n")
- @data=SiSU_document_structure::Code.new(@md,@data).code
- @data.each do |para|
- data << SiSU_document_structure::Structure.new(@md,para).structure
- end
- data=SiSU_Syntax::Markup.new(@md,data).songsheet
- data=SiSU_document_structure::Tables.new(@md,data).tables
- obj=SiSU_document_structure::OCN.new(@md,data).ocn
- obj.compact!
- data=nil
- dir=SiSU_Env::Info_env.new(@md.fns)
- xml_sc(@md)
- @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- obj.each do |o|
- para=o.txt unless o.txt =~/^%% / #comments are lost, consider
- if para
- if para !~/^\s*(?:%+ |<:code>)/
- if @md.sem_tag and para =~/[:;]\{|\}[:;]/
- para=@trans.xml_semantic_tags(para)
- end
- if para =~/[:;]\{|\}[:;]/
- para=SiSU_sem::Tags.new(para,@md).rm.all
- end
- end
- para=SiSU_sem::Tags.new(para,@md).rm.all
- para=@trans.markup_light(para)
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- end
- end
- obj.each do |o|
- para=o.txt unless o.txt =~/^%% / #comments are lost, consider
- if para
- para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>')
- para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>')
- para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')
- para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
- para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'<br />')
- if @rcdc==false \
- and (para =~/~metadata/ \
- or para =~/^1~meta\s+Document Information/)
- @rcdc=true
- end
- if para !~/(^0~|^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para
- unless @rcdc
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2} # o,para,$1,$2
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2}
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2}
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S*)/ # work on see Split_text_object
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2}
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2}
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)/
- xml_clean(para)
- t_o={:txt =>para,:ocn =>o.ocn,:format =>$1,:segname =>$2}
- xml_structure(@md,t_o)
- para=@sto.lev_para_ocn.heading_body6
- else
- if para =~ /<:verse>/
- poem_structure(o,para)
- elsif para =~ /<:group>/
- group_structure(o,para)
- elsif para =~ /<:code>/
- para.gsub!(/</,'&lt;')
- para.gsub!(/>/,'&gt;')
- code_structure(o,para)
- elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13
- #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para)
- para=table.table_split
- table_structure(o,para)
- else xml_structure(o,para,nil,nil)
- end
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if para =~/.*<:#>.*$/
- para=case para
- when /<:i1>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- when /<:i2>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
- para=format_text.center
- end
- end
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+!>/,'') ## Clean Prepared Text #bugwatch reinstate
- end
- end
- end
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x]==true
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]==true
- end
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- @@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xml_sax
- encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
-#{rdf.comment_xml_node}
-<document>
-WOK
- @@xml[:head] << "<head>\n"
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << @@xml[:sc]
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- data=@data
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- Output.new(content.join,@md).xml
- @@xml={}
- end
- end
- class Output
- def initialize(data,md)
- @data,@md=data,md
- end
- def xml
- @sisu=[]
- @data.each do |para|
- #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+?!>/,'')
- para="#{para}\n" unless para.empty?
- @sisu << para
- end
- new_file_data=@sisu.join
- @sisu=new_file_data.scan(/.+/)
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxn]).mkfile_pwd
- if filename_sxm.class==File
- @sisu.each {|para| filename_sxm.puts para}
- filename_sxm.close
- else puts 'file not created, is directory writable?'
- end
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxn]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
-Notes:
-
-ocn
-ocn are given to substantive text objects
-
-nodes
-nodes != ocn
-nodes are given to every text object (regardless of whether or not it is "substantive" and/or introduced by the editor just for structuring purposes)
-
-nodes are required for a node/tree based representation of content, e.g. a document mapping tool such as kdissert
-nodes are given to all structural divisions/headings whether or not they are given an ocn
-
-why arn't all structural divisions given an ocn?
-sometimes to structure documents correctly, it is necessary to introduce a dummy level, e.g. using a marker like
-4~ [Preamble]-#
-these are heading items that are not in the original text, and do not warrant an ocn
-they do however require a node value
-
-[at other times the editor introduces a comment that is not to be recognised as a part of the original text]
-
-it is unofortunate that the nature of documents is such that ocn != nodes
-[that ocn should be the equivalent of nodes has been rejected]
-
-map
-parent <parent>x</parent>
-parent of 1 is either 0 or as in kdissert -1 (i prefer 0)
-offspring <offspring>x..y</offspring>
-siblings - gratuitous, <siblings>x..y</siblings> and therefore optional but might as well
diff --git a/lib/sisu/v1/sst_to_s_xml_sax.rb b/lib/sisu/v1/sst_to_s_xml_sax.rb
deleted file mode 100644
index 54118349..00000000
--- a/lib/sisu/v1/sst_to_s_xml_sax.rb
+++ /dev/null
@@ -1,454 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: simple xml representation (sax style)
-
-=end
-module SiSU_simple_xml_model_sax
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/dal_doc_str"
- require "#{SiSU_lib}/shared_xml"
- require "#{SiSU_lib}/shared_sem"
- require "#{SiSU_lib}/xml_format"
- include SiSU_XML_format
- include SiSU_XML_munge
- require "#{SiSU_lib}/rexml"
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Convert
- @@fns=nil
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- end
- def read
- begin
- @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run
- @env=@particulars.env
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxs]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxs]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{Dir.pwd}/#{@md.fn[:sxs]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow if @opt.cmd =~/[MV]/
- unless @@fns==@opt.fns
- @@fns=@opt.fns
- @@fns_array=[]
- end
- @fns_array=if @@fns_array.empty?; read_fnm
- else @@fns_array.dup #check
- end
- SiSU_simple_xml_model_sax::Convert::Songsheet.new(@fns_array,@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure #file closed in songsheet
- end
- end
- def read_fnm
- dal=[]
- if FileTest.file?("#{Dir.pwd}/#{@opt.fns}")
- dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n")
- else puts 'Error'
- end
- end
- private
- class Songsheet
- def initialize(data,particulars)
- @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md
- end
- def songsheet
- begin
- SiSU_simple_xml_model_sax::Convert::Scroll.new(@data,@particulars).songsheet
- SiSU_simple_xml_model_sax::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/css"
- include SiSU_text_utils
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
- def initialize(data='',particulars='')
- @data,@env,@md=data,particulars.env,particulars.md
- @vz=SiSU_Env::Get_init.instance.skin
- @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/
- @tab="\t"
- if @md
- @trans=SiSU_XML_munge::Trans.new(@md)
- end
- @sys=SiSU_Env::System_call.new
- end
- def songsheet
- pre
- markup
- post
- publish
- end
- protected
- def embedded_endnotes(para='')
- para.gsub!(/~\{(.+?)\}~/,'<endnote symbol="norm">\1</endnote> ')
- para.gsub!(/~\[([*+])\s+(.+?)\]~/,'<endnote symbol="\1">\2</endnote> ')
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/\/{(.+?)}\//,'<i>\1</i>')
- txt.gsub!(/[*!]{(.+?)}[*!]/,'<b>\1</b>')
- txt.gsub!(/_{(.+?)}_/,'<u>\1</u>')
- txt.gsub!(/-{(.+?)}-/,'<del>\1</del>')
- txt.gsub!(/<br(?: \/)?>/,'<br />')
- txt.gsub!(/ & /,' and ')
- @@xml[:head] <<<<WOK
-#{@tab}<header class="#{meta.attrib}">
-#{@tab*2}<#{meta.el}>
-#{@tab*3}#{txt}
-#{@tab*2}</#{meta.el}>
-#{@tab}</header>
-WOK
- end
- def xml_sc(md='')
- sc=if @md.sc_info
- <<WOK
- <source_control>
- <sc class="sourcefile">
- #{@md.sc_filename}
- </sc>
- <sc class="number">
- #{@md.sc_number}
- </sc>
- <sc class="date">
- #{@md.sc_date}
- </sc>
- </source_control>
-WOK
- else ''
- end
- @@xml[:sc]=sc
- end
- def xml_structure(para='',lv='',hname='') #extracted endnotes
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- embedded_endnotes(para)
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- @@xml[:body] << "#{@tab*0}<object>" if para[@regx]
- #@@xml[:body] << "#{@tab*1}<heading>#{lv}</heading>" << "\n" if lv
- @@xml[:body] << "#{@tab*1}" << "\n" if para[@regx]
- @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n"
- elsif wrapped =~/\A%%?\s+/; %{<!--\n#{@tab*1}<text class="comment">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n-->\n} # comments
- else %{#{@tab*1}<text class="norm">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP
- end
- #@@xml[:body] << "#{@tab*1}<text>\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n" # main text, contents, body KEEP
- @@xml[:body] << "#{@endnotes}" if @endnotes # main text, endnotes KEEP
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- @endnotes=[]
- end
- def group_structure(para='')
- para.gsub!(/<:group(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- @@xml[:body] << %{#{@tab*1}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>"
- end
- def poem_structure(para='')
- para.gsub!(/<:verse(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- @@xml[:body] << %{#{@tab*1}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def code_structure(para='')
- para.gsub!(/<:code(?:-end)?>/,'')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object>}
- @@xml[:body] << %{#{@tab*1}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def table_structure(table='') #tables
- @@xml[:body] << %{#{@tab*0}<object>}
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n} # unless lv # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx]
- @endnotes=[]
- end
- def tidywords(wordlist)
- wordlist.each do |x|
- x.gsub!(/&/,'&amp;') unless x =~/&\S+;/
- end
- end
- def xml_clean(para)
- para.gsub!(/#{Mx[:gl_o]}[1-9]:\S*?#{Mx[:gl_c]}/,'') #Danger, watch
- para
- end
- def markup
- data=[]
- dir=SiSU_Env::Info_env.new(@md.fns)
- xml_sc(@md)
- @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- @data.each do |para|
- data << SiSU_document_structure::Structure.new(@md,para).structure #takes on Mx marks
- end
- data.each do |para|
- if para !~/^\s*(?:%+ |<:code>)/
- if @md.sem_tag and para =~/[:;]\{|\}[:;]/
- para=@trans.xml_semantic_tags(para)
- end
- if para =~/[:;]\{|\}[:;]/
- para=SiSU_sem::Tags.new(para,@md).rm.all
- end
- end
- para=@trans.markup_light(para)
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- para.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- para.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
- if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- para='' if para=~/#{Mx[:lv_o]}@\S+?#{Mx[:lv_c]}/
- if @rcdc==false \
- and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/)
- @rcdc=true
- end
- if para !~/(^0~|^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para
- unless @rcdc
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S*)/ # work on see Split_text_object
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)/
- xml_clean(para)
- xml_structure(para,$1,$2)
- para=@sto.lev_para_ocn.heading_body6
- else
- if para =~ /<:verse>/
- para=poem_structure(para)
- elsif para =~ /<:group>/
- para=group_structure(para)
- elsif para =~ /<:code>/
- para.gsub!(/</,'&lt;')
- para.gsub!(/>/,'&gt;')
- para=code_structure(para)
- #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para)
- para=table.table_split
- para=table_structure(para)
- else xml_structure(para,nil,nil)
- end
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if para =~/.*<:#>.*$/
- para=case para
- when /<:i1>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- when /<:i2>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
- para=format_text.center
- end
- end
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+!>/,'') ## Clean Prepared Text #bugwatch reinstate
- para
- end
- para
- end
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x] == true
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true
- end
- #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true }
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- @@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_select.new(@md).xml_sax
- encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
-#{rdf.comment_xml_sax}
-<document>
-WOK
- @@xml[:head] << "<head>\n"
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << @@xml[:sc]
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- data=@data
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- Output.new(content.join,@md).xml
- @@xml={}
- end
- end
- class Output
- def initialize(data,md)
- @data,@md=data,md
- end
- def xml
- @sisu=[]
- @data.each do |para|
- #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch
- para.gsub!(/<:\S+?>/,'')
- para.gsub!(/<!.+?!>/,'')
- para="#{para}\n" unless para.empty?
- @sisu << para
- end
- new_file_data=@sisu.join
- @sisu=new_file_data.scan(/.+/)
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxs]).mkfile_pwd
- if filename_sxm.class == File
- @sisu.each {|para| filename_sxm.puts para}
- filename_sxm.close
- else puts 'file not created, is directory writable?'
- end
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy =SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/sysenv.rb b/lib/sisu/v1/sysenv.rb
deleted file mode 100644
index 519c0f9f..00000000
--- a/lib/sisu/v1/sysenv.rb
+++ /dev/null
@@ -1,3282 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: system environment, resource control and configuration details
-
-=end
-@@cX=nil
-@@current_document=Dir.pwd #nil #''
-module SiSU_Env
- require 'fileutils'
- require 'singleton'
- include FileUtils::Verbose
- @@noyaml=false
- class Info_date
- require 'date'
- attr_accessor :dt,:t
- def initialize
- @dt,@t=Date.today.to_s,Time.now
- end
- def week
- w=@t.strftime('%W')
- "#{@t.year}w#{w}"
- end
- def month
- "#{@t.year}#{@t.month}"
- end
- def year
- @t.year
- end
- def weekonly
- #@t.cweek
- @t.strftime('%W')
- end
- def monthonly
- @t.month
- end
- def year_static
- '2010'
- end
- end
- class Info_system
- require 'rbconfig'
- include Singleton
- @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver']
- out=Config::CONFIG['localstatedir']
- etc=Config::CONFIG['sysconfdir'] + '/sisu'
- share=Config::CONFIG['datadir'] + '/sisu'
- data=Config::CONFIG['datadir'] + '/doc/sisu'
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @stub_pwd ||=@@pwd[m,1]
- prcss_dir='_sisu_processing_'
- prcss_dir_tmp_root="/tmp/#{prcss_dir}"
- prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}"
- if @@user
- tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
- tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}"
- else #error
- tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}"
- end
- tmp_processing_home=if @@home \
- and File.writable?("#{@@home}/.")
- "#{@@home}/#{prcss_dir_stub}"
- else prcss_dir_stub
- end
- processing_path=tmp_processing_individual
- processing_dir=prcss_dir
- user=ENV['USER']
- port_pgsql=if defined? ENV['PGPORT'] \
- and not (ENV['PGPORT'].nil? \
- or ENV['PGPORT'].empty?) \
- and ENV['PGPORT']=~/^\d+$/
- ENV['PGPORT']
- else '5432'
- end
- IMAGES=:images
- SISU_ETC=:sisu_etc
- SISU_SHARE=:sisu_share
- SAMPLE_DATA_PATH=:sample_data_path
- IMAGE_STUB=:image_stub
- STYLESHEET_STUB=:stylesheet_stub
- IMAGE_LOCAL=:image_local
- WEBSERV_PATH=:webserv_path
- WEBSERV_MAN=:webserv_man
- WEBSERV_PHP=:webserv_php
- WEBSERV_CGI=:webserv_cgi
- WEBSERV_RSS=:webserv_rss
- WEBSERV_SQLITE=:webserv_sqlite
- OUTPUT_LOCAL=:output_local
- PROCESSING_DIR=:processing_dir
- PROCESSING_PATH=:processing_path
- PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root
- PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base
- PROCESSING_DAL=:processing_dal
- PROCESSING_TUNE=:processing_tune
- PROCESSING_LATEX=:processing_latex
- PROCESSING_TEXINFO=:processing_texinfo
- PROCESSING_LOUT=:processing_lout
- PROCESSING_SQLITE=:processing_sqlite
- PROCESSING_POSTGRESQL=:processing_postgresql
- PROCESSING_ENCODING=:processing_encoding
- PAPERSIZE=:papersize
- LANGUAGE=:language
- LANGUAGE_CODE=:language_code
- MULTILINGUAL=:multilingual
- CONCORD_MAX=:concord_max
- DIGEST=:digest
- WEBSERV_HOST_CGI=:webserv_host_cgi
- WEBSERV_PORT_CGI=:webserv_port_cgi
- POSTGRESQL_USER=:postgresql_user
- POSTGRESQL_PORT=:postgresql_port
- SQLITE_USER=:sqlite_user
- SQLITE_PATH=:sqlite_path
- SQLITE_PORT=:sqlite_port
- DEFAULT_DIR={
- IMAGES => '_sisu/image',
- SISU_ETC => etc,
- SISU_SHARE => share,
- SAMPLE_DATA_PATH => data,
- IMAGE_STUB => '_sisu/image',
- STYLESHEET_STUB => '_sisu/css',
- IMAGE_LOCAL => @@pwd + '/_sisu/image',
- WEBSERV_PATH => out + '/www',
- #WEBSERV_DIR => www, # uncomment for urls...
- #WEBSERV_IMAGE => out + '/www/_sisu/image',
- WEBSERV_MAN => out + '/www/man', #alter
- WEBSERV_PHP => out + '/www/php',
- WEBSERV_CGI => '/usr/lib/cgi-bin',
- WEBSERV_RSS => out + '/www/feed',
- WEBSERV_SQLITE => out + '/www/sqlite',
- OUTPUT_LOCAL => @@home + '/sisu_www',
- PROCESSING_DIR => processing_dir,
- PROCESSING_PATH => processing_path,
- PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root,
- PROCESSING_PATH_TMP_BASE => processing_path,
- PROCESSING_DAL => 'dal',
- PROCESSING_TUNE => 'tune',
- PROCESSING_LATEX => 'tex',
- PROCESSING_TEXINFO => 'texinfo',
- PROCESSING_LOUT => 'lout',
- PROCESSING_SQLITE => 'sqlite',
- PROCESSING_POSTGRESQL=> 'postgresql',
- PROCESSING_ENCODING => 'encoding',
- #TEXINFO_STUB => 'texinfo',
- PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal
- LANGUAGE => 'English',
- LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used
- MULTILINGUAL => true,
- CONCORD_MAX => 260000,
- DIGEST => 'md5',
- WEBSERV_HOST_CGI => ' http://localhost',
- WEBSERV_PORT_CGI => 8081, #8111,8123,8081
- POSTGRESQL_USER => @@user, #'ralph', # change user !!!
- POSTGRESQL_PORT => port_pgsql,
- #POSGRESQL_LINKS_PATH => '',
- SQLITE_USER => @@user,
- SQLITE_PATH => @@user, #??
- SQLITE_PORT => '**',
- }
- @@default_dir=DEFAULT_DIR
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- stub_pwd=@@pwd[m,1]
- @@rc_path=["#@@pwd/_sisu","#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"]
- @@yamlrc_path=unless stub_pwd =~/^sisupod$/
- ["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#@@home/.sisu/#{SiSU_version_dir}","#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"]
- else #security policy: prevent reading of sisurc.yml in sisupod
- ["#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"]
- end
- @@ad_path=unless stub_pwd =~/^sisupod$/
- ["#@@pwd/_sisu/skin/yml","#@@home/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]
- else #security policy: prevent reading of sisurc.yml in sisupod
- ["#@@home/.sisu",@@sisu_etc]
- end
- attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:yamlrc_path,:ad_path
- def initialize
- @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=@@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path
- #note rbver is duplicated in Info_version
- end
- end
- class Load
- def initialize(prog,mandatory=false)
- @prog,@mandatory=prog,mandatory
- end
- def prog
- load_prog=false
- $:.each do |reqpath|
- if FileTest.exist?("#{reqpath}/#@prog.rb")
- load_prog=true
- break
- end
- end
- if load_prog \
- and @prog=~/dbi/
- require 'dbi' #revisit
- end
- if load_prog; require @prog
- else
- tell=if @mandatory; SiSU_Screen::Ansi.new(@cmd,"module required: #@prog")
- else SiSU_Screen::Ansi.new(@cmd,"#@prog load requested")
- end
- tell.warn
- end
- load_prog
- end
- def prog?
- load_prog=false
- $:.each do |reqpath|
- if FileTest.exist?("#{reqpath}/#@prog.rb"); load_prog=true
- break
- end
- end
- load_prog
- end
- end
- class Get_init < Info_system
- include Singleton
- @@noyaml=false
- @@rc,@@vz,@@tx=nil,nil,nil
- @@ad={ :promo=>nil,:promo_list=>nil,:flag_promo=>false }
- attr_accessor :yaml
- def initialize
- super()
- end
- def skin
- @@vz ||=SiSU_Viz::Skin.new
- end
- def tex
- @@tx ||=SiSU_Viz::TeX.new
- end
- def yamlrc
- unless @@rc
- @yamlrc_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml
- @@noyaml=true
- break
- else
- if FileTest.exist?("#{v}/sisurc.yml")
- unless @@rc
- require 'yaml'
- @@rc ||= YAML::load(File::open("#{v}/sisurc.yml"))
- end
- break
- end
- unless @@rc
- if FileTest.exist?("#{v}/sisurc.yaml")
- unless @@rc
- require 'yaml'
- @@rc ||= YAML::load(File::open("#{v}/sisurc.yaml"))
- end
- break
- end
- end
- end
- end
- end
- @@rc
- end
- def ads #WORK AREA
- tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:'
- @ad_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
- @@noyaml=true
- break
- else
- #tell=SiSU_Screen::Ansi.new('','promo off (file not found): list.yml')
- if FileTest.exist?("#{v}/list.yml")
- unless @@ad[:promo_list]
- require 'yaml'
- @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml"))
- end
- @@ad[:flag_promo]=true
- break
- end
- #tell.warn if @cmd=~/MV/
- @@ad[:flag_promo]=false
- end
- end
- @ad_path.each do |v|
- if @@noyaml \
- or FileTest.exist?("#{v}/noyaml")
- puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml
- @@noyaml=true
- break
- else
- #tell=SiSU_Screen::Ansi.new('','promo off (file not found): promo.yml')
- if FileTest.exist?("#{v}/promo.yml")
- unless @@ad[:promo]
- require 'yaml'
- @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml"))
- end
- @@ad[:flag_promo]=true
- break
- end
- #tell.warn if @cmd=~/MV/
- @@ad[:flag_promo]=false
- end
- end
- @@ad
- end
- end
- class Env_call
- @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil
- @@ad={}
- attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad
- def initialize(fns='')
- super()
- @fns=fns
- @sys=Info_system.instance
- @rc=Get_init.instance.yamlrc
- @ad=Get_init.instance.ads
- if @fns \
- and @fns != '' \
- and @fns !=@@fns
- @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil
- end
- if @fns \
- and @fns != '' #watch
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/
- @@fnn ||=@fns[m,1]
- @@fnb ||=@fns[m,2]
- @@fnt ||=@fns[m,3]
- @@flv ||=document_language_versions_found[:f]
- unless @@fns =~/\S+?\.zip/
- @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- elsif @@fnb; @@fnb + '.sst.zip'
- else '' # e.g. termsheet
- end
- end
- else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
- @@fnb ||=@fns[m,1]
- @@fnm ||=@fns[m,1]
- @@fnt ||=@fns[m,2]
- unless @@fns =~/\S+?\.zip/
- @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- else @@fnb + '.sst.zip'
- end
- end
- end
- end
- @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
- end
- def multilingual
- if defined? @rc['default']['multilingual'] \
- and @rc['default']['multilingual'] != nil
- @rc['default']['multilingual']
- else true
- end
- end
- def document_language_versions_found
- @fn={}
- unless (@fns.nil? \
- or @fns.empty?)
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
- @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
- else m=/(.+?)\.((?:-|ssm\.)?sst$)/
- @fn[:b]=@fn[:m]=@fns[m,1]
- @fn[:t]=@fns[m,2]
- end
- end
- lang=SiSU_Env::Standardise_language.new
- langs=lang.codes
- x=[]
- if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
- end
- x << @fns
- langs.each do |l|
- lng=SiSU_Env::Standardise_language.new(l)
- if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
- elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
- end
- end
- @fn[:f]=x.uniq!
- @fn
- end
- def published_manifests?(output_base)
- ob=output_base
- @fn={}
- @m=[]
- unless (@fns.nil? \
- or @fns.empty?)
- if multilingual
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
- @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
- #@fl[:v]=@env.document_language_versions_found
- else m=/(.+?)\.((?:-|ssm\.)?sst$)/
- @fn[:b]=@fn[:m]=@fns[m,1]
- @fn[:t]=@fns[m,2]
- end
- end
- lang=SiSU_Env::Standardise_language.new
- langs=lang.codes
- x=[]
- if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
- end
- dir=SiSU_Env::Info_env.new(@fns)
- @m << {:m => 'sisu_manifest.html', :l => 'English' } #fix later, default language
- langs.each do |l|
- lng=SiSU_Env::Standardise_language.new(l)
- fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
- fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
- if FileTest.file?(fns_c)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_c)
- lng=fn_set_lang[:l]
- fn=SiSU_Env::Env_call.new(fns_c).lang(fn_set_lang[:c])
- @m << {:m => fn[:manifest], :l => lng }
- elsif FileTest.file?(fns_l)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_l)
- @fnl=dir.i18n.lang_filename(fn_set_lang[:c])
- fn=SiSU_Env::Env_call.new(fns_l).lang(fn_set_lang[:c])
- @m << {:m => fn[:manifest], :l => lng }
- end
- end
- @m.uniq!
- @m
- end
- def filename(code,name,suffix)
- d=SiSU_Env::Info_env.new(@fns)
- fnl=d.i18n.lang_filename(code)
- if code
- "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}"
- else "#{name}#{suffix}"
- end
- end
- def lang(code)
- @fn={
- :html => filename(code,'','.html'),
- :book_index => filename(code,'idx','.html'),
- :concordance => filename(code,'concordance','.html'),
- :sax => filename(code,'sax','.xml'),
- :dom => filename(code,'dom','.xml'),
- :docbook => filename(code,'docbook','.xml'),
- :xhtml => filename(code,'scroll','.xhtml'),
- :pdf_l => filename(code,'landscape','.pdf'),
- :pdf_p => filename(code,'portrait','.pdf'),
- :pdf_l_a4 => filename(code,'landscape.a4','.pdf'),
- :pdf_p_a4 => filename(code,'portrait.a4','.pdf'),
- :pdf_l_a5 => filename(code,'landscape.a5','.pdf'),
- :pdf_p_a5 => filename(code,'portrait.a5','.pdf'),
- :pdf_l_b5 => filename(code,'landscape.b5','.pdf'),
- :pdf_p_b5 => filename(code,'portrait.b5','.pdf'),
- :pdf_l_letter => filename(code,'landscape.letter','.pdf'),
- :pdf_p_letter => filename(code,'portrait.letter','.pdf'),
- :pdf_l_legal => filename(code,'landscape.legal','.pdf'),
- :pdf_p_legal => filename(code,'portrait.legal','.pdf'),
- :toc => filename(code,'toc','.html'),
- :doc => filename(code,'doc','.html'),
- :index => filename(code,'index','.html'),
- :odf => filename(code,'opendocument','.odt'),
- :plain => filename(code,'plain','.txt'),
- :manpage => filename(code,@fnb,'.1'),
- :wiki => filename(code,'wiki','.txt'),
- :digest => filename(code,'digest','.txt'),
- :metadata => filename(code,'metadata','.html'), #chk
- :manifest => filename(code,'sisu_manifest','.html'),
- :oai_pmh => filename(code,'oai_pmh','.xml'),
- :sitemap => filename(code,'sitemap','.xml'),
- :sitemap_touch => filename(code,"sitemap_#@fnb",'.xml'),
- :sxs => filename(code,@fnb,'.sxs.xml'),
- :sxd => filename(code,@fnb,'.sxd.xml'),
- :sxn => filename(code,@fnb,'.sxn.xml'),
- :sisupod => filename(nil,@fnz,''),
- :book_idx_html => filename(code,'book_index','.html'),
- }
- @fn
- end
- end
- class System_call
- @@locale_flag=false
- def initialize(input='',output='',cmd='')
- @input,@output,@cmd=input,output,cmd
- @prog=SiSU_Env::Info_program.new
- @sys=Info_system.instance
- end
- def program_found?(program)
- found=`whereis #{program}`
- state=if found =~/bin\/#{program}\b/; true
- else false
- end
- end
- def locale #locales utf8 or other
- unless @@locale_flag
- @@locale_flag=true
- puts @sys.locale #unless @cmd =~/q/ # locale info UTF8 etc. KEEP
- end
- @sys.locale
- end
- def file_encoding(filename,cmd='') #file encoding
- program='file'
- fnsp=Info_env.new(filename).source_file_with_path
- if program_found?(program)
- encoding=%x{file -L #{fnsp}}.strip
- encoding.gsub!(/#{fnsp}:(\s+|$)/,'')
- encoding=if encoding \
- and not encoding.empty?
- encoding
- else 'UTF-8 assumed, encoding undetermined'
- end
- puts encoding if cmd =~/[VM]/
- encoding
- else encoding='UTF-8 assumed, file encoding check program unavailable'
- end
- end
- def wc #word count
- program='wc'
- if program_found?(program) \
- and locale !~/utf-?8/i
- true
- else
- program_ref="(not available)" unless program_found?(program)
- program_ref="(UTF-8)" if locale =~/utf-?8/i
- #puts "\tWARN: #{program}\n\t\t using alternative to word count program #{program_ref}"
- false
- end
- end
- def rcs #rcs for document markup data
- program='rcs'
- program_ref="\n\t\tdocument version information requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def cvs #cvs for document markup data
- program='cvs'
- program_ref="\n\t\tdocument version information requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def openssl #openssl for digests
- program='openssl'
- program_ref="\n\t\tused to generate requested source document identification digest"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def md5(filename) #md5 dgst
- program='openssl'
- program_ref="\n\t\tmd5 digest requested"
- if program_found?(program)
- pwd=Dir.pwd
- Dir.chdir(File.dirname(filename))
- dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path
- Dir.chdir(pwd)
- dgst.scan(/\S+/)
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def sha256(filename) #sha dgst
- program='openssl'
- program_ref="\n\t\tsha digest requested"
- if program_found?(program)
- pwd=Dir.pwd
- Dir.chdir(File.dirname(filename))
- dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path
- Dir.chdir(pwd)
- dgst.scan(/\S+/)
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def psql #psql
- program='psql'
- program_ref="\n\t\tpsql requested"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def create_pg_db(dbname_stub=nil) #createdb
- unless dbname_stub
- @pwd ||=Dir.pwd
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- dbname_stub=@pwd[m,1]
- end
- program='createdb'
- program_ref="\n\t\tcreatedb dbname SiSU_#{dbname_stub} #for postgresql database creation"
- if program_found?(program); system("createdb SiSU_#{dbname_stub}")
- else puts "\tWARN: #{program} is not available #{program_ref}" #if @cmd =~/v/
- end
- end
- def relaxng(cmd='') #trang - convert between different schema languages for XML
- program='trang'
- program_ref="\n\t\tsee http://www.thaiopensource.com/relaxng/trang.html"
- if program_found?(program); system("trang #@input #@output")
- else puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/
- end
- end
- def rmagick #rmagick is a ruby library
- program='identify'
- program_ref="\n\t\tsee http://www.imagemagick.org/"
- if program_found?(program); true
- else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/
- false
- end
- end
- def well_formed? #tidy - check for well formed xml xhtml etc.
- program=@prog.tidy
- program_ref="\n\t\tsee http://tidy.sourceforge.net/"
- if program_found?(program); system("#{@prog.tidy} -xml #@input > #@output")
- else puts "\tWARN: #{program} is not installed #{program_ref}"
- end
- end
- def tex2pdf_engine
- prog=['xetex','xelatex','pdflatex','pdfetex','pdftex']
- @pdfetex_flag=false
- @cmd ||=''
- @texpdf=nil
- prog.each do |program|
- if program_found?(program)
- @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/
- @pdfetex_flag=true
- break
- end
- end
- if @pdfetex_flag==false
- @texpdf=prog.join(', ')
- end
- @texpdf
- end
- def latex2pdf(md,papersize='a4') #convert from latex to pdf
- tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' )
- mode='batchmode'
- #mode='nonstopmode'
- program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra"
- texpdf=tex2pdf_engine
- if @pdfetex_flag;
- texpdf_cmd=case texpdf
- when /xetex/
- if @input =~/landscape\.tex$/
- %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #@input #{tell}\n}
- else
- %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #@input #{tell}\n}
- end
- when /xelatex/
- if @input =~/landscape\.tex$/
- %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #@input #{tell}\n}
- else
- %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #@input #{tell}\n}
- end
- when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #@input #{tell}\n"
- when /pdflatex/; "#{texpdf} -interaction=#{mode} #@input #{tell}\n"
- end
- system(texpdf_cmd)
- else puts "\tWARN: none of the following programs appear to be installed: #{texpdf}. #{program_ref}"
- end
- end
- def makeinfo #texinfo
- program='makeinfo'
- program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/"
- if program_found?(program); system("#{program} #@input\n")
- else puts "\tWARN: #{program} is not installed #{program_ref}"
- end
- end
- def scp
- program='scp'
- puts "scp -Cr #@input #@output" if @cmd =~/[vVM]/
- if program_found?(program); system("scp -Cr #@input #@output")
- else puts "\tWARN: #{program} not found"
- end
- end
- def rsync(action='')
- program='rsync'
- if program_found?(program)
- vb=if @cmd =~/q/; 'q'
- elsif @cmd =~/v/; 'v'
- else ''
- end
- msg=''
- msg=" && echo 'OK: #@input -> #@output'" unless @cmd =~/q/
- puts "rsync -az#{vb} #{action} #@input #@output" if @cmd =~/[vVM]/
- system("rsync -az#{vb} #{action} #@input #@output #{msg}")
- else puts "\tWARN: #{program} not found"
- end
- end
- def rm
- if @cmd =~/^-Z[mMvVq]*$/; rm_rf(@input)
- elsif @cmd =~/V/; rm(@input)
- elsif @cmd !~/q/; rm(@input)
- elsif @cmd =~/q/; rm(@input)
- #elsif @cmd =~/q/; system("rm #{action} #@input")
- else puts "\tWARN: operation ignored"
- end
- end
- end
- class Standardise_language
- def initialize(l='')
- @language=l
- if @language.empty?
- @language=Info_env.new.defaults[:language]
- end
- end
- def language #use ISO_639-2
- lang={}
- case @language
- when /American|^us$/i; d,c,l=false,'en','American English' #depreciated, see iso 639-2
- when /English|^en$/i; d,c,l=false,'en','English'
- when /French|Francais|^fr$/i; d,c,l=false,'fr','French'
- when /German|^de$/i; d,c,l=false,'de','German'
- when /Italian|^it$/i; d,c,l=false,'it','Italian'
- when /Spanish|Espanol|^es$/i; d,c,l=false,'es','Spanish'
- when /Brazilian(?: Portuguese)?|^br$/i; d,c,l=false,'pt','Brazilian Portuguese' #depreciated, see iso 639-2
- when /Portuguese|^pt$/i; d,c,l=false,'pt','Portuguese'
- when /Swedish|Svensk|^sv$/i; d,c,l=false,'sv','Swedish'
- when /Danish|Dansk|^da$/i; d,c,l=false,'da','Danish'
- when /Finnish|Finsk|Suomi|^fi$/i; d,c,l=false,'fi','Finnish'
- when /Norwegian|Norsk|^no$/i; d,c,l=false,'no','Norwegian'
- when /Icelandic|^is$/i; d,c,l=false,'is','Icelandic'
- when /Dutch|^nl$/i; d,c,l=false,'nl','Dutch'
- when /Estonian|^et$/i; d,c,l=false,'et','Estonian'
- when /Hungarian|^hu$/i; d,c,l=false,'hu','Hungarian'
- when /Polish|^pl$/i; d,c,l=false,'pl','Polish'
- when /Romanian|^ro$/i; d,c,l=false,'ro','Romanian'
- when /Russian|^ru$/i; d,c,l=false,'ru','Russian'
- when /Greek|^el$/i; d,c,l=false,'el','Greek'
- when /Ukranian|^uk$/i; d,c,l=false,'uk','Ukranian'
- when /Turkish|^tr$/i; d,c,l=false,'tr','Turkish'
- #when /Serbian/i; d,c,l=false,'', 'Serbian'
- #when /Welsh/i; d,c,l=false,'', 'Welsh'
- #when /Basque/i; d,c,l=false,'', 'Basque'
- #when /Breton/i; d,c,l=false,'', 'Breton'
- #when /Catalan/i; d,c,l=false,'', 'Catalan'
- #when /Galician/i; d,c,l=false,'', 'Galician'
- #when /Saa?mi/i; d,c,l=false,'', 'Saami'
- #when /Hebrew/i; d,c,l=false,'', 'Hebrew'
- #when /Latin/i; d,c,l=false,'', 'Latin'
- #when /Esperanto/i; d,c,l=false,'', 'Esperanto'
- when /Slovenian|^sl$/i; d,c,l=false,'sl','Slovenian'
- when /Croatian|^hr$/i; d,c,l=false,'hr','Croatian'
- when /Slovak(?:ian)?|^sk$/i; d,c,l=false,'sk','Slovakian'
- when /Czech|^cs$/i; d,c,l=false,'cs','Czech'
- when /Bulgarian|^bg$/i; d,c,l=false,'bg','Bulgarian'
- else d,c,l=true,'en','English (default)'
- #else d,c,l=true,'xx','Default'
- end
- lang[:d],lang[:c],lang[:l]=d,c,l
- lang
- end
- def name
- language[:l].downcase
- end
- def title
- language[:l]
- end
- def code
- language[:c]
- end
- def file_to_language(file)
- m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/
- @language=if file =~m ; file[m,1]
- else ''
- end
- language
- end
- def codes
- codes=['us','en','fr','de','it','es','br','pt','sv','da','fi','no','is','nl','et','hu','pl','ro','ru','el','uk','tr','sk','hr','sl','cs','bg'] # remove us and br see iso-639-2
- end
- end
- class Info_env < Env_call
- require 'fileutils'
- include FileUtils
- attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:etc,:yamlrc_dir
- @@image_flag,@@local_image=true,true #warning on @@image_flag
- @@fb=@@man_path=nil,nil
- def initialize(fns='',md=nil)
- super() #you may not want to re-execute this static info so frequently!
- @fns,@md=fns,md
- @env=Env_call.new(fns) if fns
- fnb=if @md \
- and defined? @md.fnb
- @md.fnb
- elsif defined? @env.fnb \
- and @env.fnb
- @env.fnb
- elsif not @fns.nil? \
- and not @fns.empty?
- m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m
- @fns[m,1] if not @fns.empty?
- end
- if fnb; @@fb ||=fnb
- end
- @sys=Info_system.instance
- @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters
- @fixed_websev_root='' # @home
- @pwd=@@pwd||=Dir.pwd
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @stub_pwd=@@pwd[m,1]
- @stub_src=@stub_pwd + '/src'
- @stub_pod=@stub_pwd + '/pod'
- @stub_md=@stub_pwd + '/sisu_site_metadata'
- end
- def user
- @sys.user
- end
- def hostname
- @sys.hostname
- end
- def host
- @sys.host
- end
- def arch
- @sys.arch
- end
- def rbver
- @sys.rbver
- end
- def locale
- @sys.locale
- end
- def concord_max
- concord_max=if defined? @rc['processing']['concord_max'] \
- and @rc['processing']['concord_max']
- @rc['processing']['concord_max']
- else defaults[:concord_max]
- end
- end
- def current_document
- @@current_document||=Dir.pwd
- @@current_document
- end
- def stub_pwd #200412
- @stub_pwd
- end
- def stub_md_harvest
- @stub_md
- end
- def stub_src
- @stub_src
- end
- def stub_pod
- @stub_pod
- end
- def sisupod
- #path.processing
- # sisupod
- # sisu
- # content.sst [file content]
- # filename.sst [link to content.sst]
- # _sisu
- # conf
- # skin/
- # doc [relevant skin if any other than default]
- # image [all images for specific document gathered here]
- sisupod_processing_path="#{path.processing}/sisupod"
- if FileTest.directory?(sisupod_processing_path) \
- or FileTest.file?(sisupod_processing_path)
- rm_rf(sisupod_processing_path)
- end
- paths=[]
- paths=["#{path.processing}/sisupod/_sisu/skin/doc","#{path.processing}/sisupod/_sisu/skin/dir","#{path.processing}/sisupod/_sisu/skin/site","#{path.processing}/sisupod/_sisu/image"]
- paths.each {|x| mkdir_p(x) unless FileTest.directory?(x) }
- end
- def defaults #multiple default directories
- @default_dir ||=@sys.default_dir #DEFAULT_DIR
- end
- #def skin
- # @@vz ||=SiSU_Viz::Skin.new
- #end
- def widget #needs (md) #move
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @ad=SiSU_Env::Get_init.instance.ads
- @vz=SiSU_Env::Get_init.instance.skin
- @flag={ :ad=>false,:md=>false,:sk=>false,:rc=>false }
- def promo?
- @flag[:ad]=if @md.flag_promo && @ad[:flag_promo]
- @flag[:md]=true
- true
- elsif defined? @vz.widget_promo \
- and not @vz.widget_promo.nil? \
- and @vz.widget_promo.class == Array \
- and @vz.widget_promo.length > 0
- @flag[:sk]=true
- true
- elsif defined? @rc['promo'] \
- and not @rc['promo'].nil? \
- and @rc['promo'].length > 0
- @flag[:rc]=true
- true
- else
- false
- end
- @flag
- end
- def search?
- searches=['sisu','hyperestraier']
- flag=false
- if defined? @rc['search']
- searches.each do |type|
- flag=if defined? @rc['search'][type] \
- and defined? @rc['search'][type]['action'] \
- and @rc['search'][type]['flag']==true \
- and @rc['search'][type]['action'] =~/https?:\/\//
- flag=if promo?[:ad]
- false
- elsif defined? @vz.widget_search \
- and @vz.widget_search == true
- true
- elsif defined? @rc['search'][type]['flag'] \
- and @rc['search'][type]['flag'] == true
- true
- else false
- end
- else false
- end
- end
- else false
- end
- #flag=true
- flag
- end
- def search_fixed?
- searches=['sisu','hyperestraier']
- flag=if defined? @rc['search']
- searches.each do |type|
- if defined? @rc['search'][type] \
- and defined? @rc['search'][type]['action'] \
- and @rc['search'][type]['action'] =~/https?:\/\// \
- and defined? @rc['search'][type]['db'] \
- and @rc['search'][type]['db'] =~/\S+/
- flag=if promo?[:ad]
- false
- elsif defined? @vz.widget_search \
- and @vz.widget_search == true
- true
- elsif defined? @rc['search'][type]['flag'] \
- and @rc['search'][type]['flag'] == true
- true
- else false
- end
- else false
- end
- end
- else false
- end
- end
- def search_form(type='sisusearch',action=nil,db=nil,table=false)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form_hyperestraier=if defined? rc['search']['sisu']['flag'] \
- and rc['search']['sisu']['flag']==true \
- and action \
- and action =~/https?:\/\//
- true
- else false
- end
- create_form_sisu=if action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget.search?
- db=if rc['search']['sisu']['flag']==true \
- and rc['search']['sisu']['db']=~/\S+/
- rc['search']['sisu']['db']=~/^SiSU_\S+/ \
- ? rc['search']['sisu']['db'] \
- : "SiSU_#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- else false
- end
- if table
- table_open='<td align="center" bgcolor="#ffffff">'
- table_close='</td>'
- else
- table_open=''
- table_close='<br />'
- end
- form=if create_form_sisu \
- and type=~/sisusearch/ \
- and defined? rc['search']['sisu'] \
- and defined? rc['search']['sisu']['action']
- <<WOK
-<!-- SiSU Search -->
-#{table_open}
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="ltd" value="1000" />
-<input type="hidden" name="off" value="0" />
-<input type="hidden" name="doc" value="#{@md.fnb}" />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font></form>
-#{table_close}
-<!-- SiSU Search -->
-WOK
- elsif create_form_hyperestraier \
- and type=~/hyperestraier/ \
- and defined? rc['search']['hyperestraier']
- <<WOK
-<!-- SiSU Search using Hyperestraier -->
-#{table_open}
-<a name="search"></a>
-<form method="get" action="#{rc['search']['hyperestraier']['action']}" target="_top">
-<font size="2">
-<input type="text" name="phrase" value="" size="24" maxlength="255" />
-<br />
-<input type="submit" value="search" />
-<input type="hidden" name="enc" value="UTF-8" />
-<font size="2">
-<a href="#{rc['search']['hyperestraier']['action']}">hyperestraier search</a>
-</font></form>
-#{table_close}
-<!-- SiSU Search using Hyperestraier -->
-WOK
- else ''
- end
- form
- end
- def search_form_static(action=nil,db=nil)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form=if rc['search']['sisu']['flag']==true \
- and action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget.search_fixed?
- db=if rc['search']['sisu']['flag']==true \
- and rc['search']['sisu']['db']=~/\S+/
- rc['search']['sisu']['db']=~/^SiSU_\S+/ \
- ? rc['search']['sisu']['db'] \
- : "SiSU_#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- else false
- end
- if create_form
- %{<td align="center" bgcolor="#ffffff">
-<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="ltd" value="1000" />
-<input type="hidden" name="off" value="0" />
-<input type="hidden" name="doc" value="#{@md.fnb}" />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font>
-</form>
-<!-- SiSU Search -->
-</td> }
- else ''
- end
- end
- def search_action
- action=if search?
- else ''
- end
- end
- self
- end
- def widget_static
- @rc=SiSU_Env::Get_init.instance.yamlrc
- @vz=SiSU_Env::Get_init.instance.skin
- @flag={ :ad=>false,:md=>false,:sk=>false,:rc=>false }
- def search?
- flag=if defined? @rc['search'] \
- and defined? @rc['search']['sisu'] \
- and defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/https?:\/\// \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/ \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- flag=if defined? @vz.widget_search \
- and @vz.widget_search == true
- true
- elsif defined? @rc['search']['sisu']['flag'] \
- and @rc['search']['sisu']['flag'] == true
- true
- else
- false
- end
- else
- false
- end
- end
- def search_fixed?
- flag=if defined? @rc['search'] \
- and defined? @rc['search']['sisu'] \
- and defined? @rc['search']['sisu']['action'] \
- and @rc['search']['sisu']['action'] =~/https?:\/\// \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/ \
- and defined? @rc['search']['sisu']['db'] \
- and @rc['search']['sisu']['db'] =~/\S+/
- flag=if defined? @vz.widget_search \
- and @vz.widget_search == true
- true
- elsif defined? @rc['search']['sisu']['flag'] \
- and @rc['search']['sisu']['flag'] == true
- true
- else
- false
- end
- else
- false
- end
- end
- def search_form(action=nil,db=nil)
- rc=SiSU_Env::Get_init.instance.yamlrc
- create_form=if defined? rc['search']['sisu']['flag'] \
- and rc['search']['sisu']['flag']==true \
- and action \
- and db \
- and action =~/https?:\/\// \
- and db =~/\S+/
- true
- elsif widget_static.search? \
- and rc['search']['sisu']['flag']==true
- db=if rc['search']['sisu']['db']=~/\S+/
- rc['search']['sisu']['db']=~/^SiSU_\S+/ ? rc['search']['sisu']['db'] : "SiSU_#{rc['search']['sisu']['db']}"
- else nil
- end
- action=rc['search']['sisu']['action']
- true
- else false
- end
- if create_form \
- and @fnb \
- and @fnb=~/\S+/
- %{<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="hidden" name="fns" value="#@fnb" />
-<input type="hidden" name="doc" value="#{@fnb}" />
-<input type="submit" name="search" value="search doc" />
-<input type="submit" name="search" value="search db" />
-</font>
-</form>
-<!-- SiSU Search --> }
- elsif create_form
- %{<!-- SiSU Search -->
-<a name="search"></a>
-<form method="get" action="#{rc['search']['sisu']['action']}" target="_top">
-<font size="2">
-<input type="text" name="s1" size="24" maxlength="255" />
-<br />
-<input type="hidden" name="db" value="#{db}" />
-<input type="submit" />
-</font>
-</form>
-<!-- SiSU Search --> }
- else ''
- end
- end
- def search_action
- action=if search?
- else ''
- end
- end
- self
- end
- def source_file_path
- file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
- pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}"
- else "#{path.composite_file}"
- end
- end
- def source_file_with_path
- file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')
- "#{source_file_path}/#{file}"
- end
- def read_source_file(fns)
- fns_array=if RUBY_VERSION < '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'')
- else IO.readlines("#{path.composite_file}/#{fns}",'')
- end
- else #ruby version >= '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'r:utf-8')
- else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8')
- end
- end
- end
- def path #dir
- def home
- @sys.home
- end
- def pwd
- @sys.pwd
- end
- def stub_pwd
- @stub_pwd
- end
- def stub_src
- @stub_src
- end
- def stub_pod
- @stub_pod
- end
- def stub_md_harvest
- @stub_md
- end
- def etc
- defaults[:sisu_etc] #live/dynamic
- # @sys.sisu_etc #broken: live/dynamic
- # defaults[:sisu_etc] #live/dynamic
- end
- def arch
- @sys.dir_arch
- end
- def sitearch
- @sys.dir_sitearch
- end
- def bin
- @sys.dir_bin
- end
- def share #shared data repository source directory
- defaults[:sisu_share]
- end
- def style
- defaults[:stylesheet_stub]
- end
- def sample_data #sample data repository source directory
- defaults[:sample_data_path]
- end
- def rc
- @sys.rc_path
- end
- def yamlrc
- rc.each do |v|
- if FileTest.exist?("#{v}/sisurc.yml")
- @yamlrc_dir="#{v}/sisurc.yml"
- break
- end
- end
- unless @yamlrc_dir
- rc.each do |v|
- if FileTest.exist?("#{v}/sisurc.yaml")
- @yamlrc_dir="#{v}/sisurc.yaml"
- break
- end
- end
- end
- @yamlrc_dir
- end
- def man #check use
- if defined? @rc['webserv']['man']; "#{webserv}/#{@rc['webserv']['man']}"
- else defaults[:webserv_man]
- end
- end
- def webserv_path #testing, check need, remove
- webserv
- end
- def webserv #separation required for webrick which cannot use path.output (different requirements as no file is passed)
- man_path=if @@man_path.nil?
- man_path=if defined? @rc['webserv']['path'] \
- and @rc['webserv']['path'] =~/\S\S+/
- man_path=@@man_path=File.expand_path(@rc['webserv']['path'])
- else nil
- end
- else manpath=@@man_path
- end
- @webserv_path=if defined? man_path \
- and File.writable?("#{man_path}/.")
- man_path #web server path as configured in rc file
- elsif FileTest.directory?(defaults[:webserv_path]) \
- and File.writable?("#{defaults[:webserv_path]}/.") #web server path default
- defaults[:webserv_path]
- else #create default directory under home and place output there
- unless FileTest.directory?(defaults[:output_local])
- mkdir_p(defaults[:output_local])
- end
- defaults[:output_local]
- end
- end
- def webserv_stub_ensure
- mkdir_p(path.webserv) unless FileTest.directory?(path.webserv)
- mkdir_p("#{path.webserv}/#@stub_pwd") unless FileTest.directory?("#{path.webserv}/#@stub_pwd")
- end
- def webserv_map_pwd #dir
- "#{path.webserv}/#{stub_pwd}"
- end
- def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
- defaults[:webserv_dir]
- end
- def webserv_image #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name)
- images=if defined? @rc['webserv']['images']
- @rc['webserv']['images']
- else defaults[:images]
- end
- "#{path.webserv}/#{images}"
- end
- def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
- "#{path.webserv}/#@stub_pwd"
- end
- def output_src
- "#{path.output}/src"
- end
- def output_md_harvest
- "#{path.output}/sisu_site_metadata"
- end
- def output_pod
- "#{path.output}/pod"
- end
- def output_harvest
- "#{path.output}/sisu_site_metadata"
- end
- def manpage
- "#{path.output}/man"
- end
- def sitemaps
- "#{path.output}/sitemaps"
- end
- def encoding
- pth="#{processing}/#{defaults[:processing_encoding]}"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def processing_base_tmp
- defaults[:processing_path_tmp_base]
- end
- def processing_dir_tmp_root
- defaults[:processing_dir_tmp_root]
- end
- def processing_path_root
- proposed_path_base=if defined? @rc['processing']['path'] \
- and not @rc['processing']['path'].nil? \
- and not @rc['processing']['path'].empty?
- x=if @rc['processing']['path'] =~/^(?:~|home)$/
- home #fix
- else @rc['processing']['path']
- end
- else nil
- end
- proposed_dir=if defined? @rc['processing']['dir'] \
- and not @rc['processing']['dir'].nil? \
- and not @rc['processing']['dir'].empty?
- @rc['processing']['dir']
- else defaults[:processing_dir]
- end
- path=if proposed_path_base \
- and FileTest.directory?(proposed_path_base) \
- and File.writable?("#{proposed_path_base}/.")
- x=if proposed_dir
- "#{proposed_path_base}/#{proposed_dir}"
- else
- "#{proposed_path_base}/#{defaults[:processing_dir]}"
- end
- else defaults[:processing_dir_tmp_root]
- end
- end
- def processing_path_usr?
- case processing_path_root
- when /^\/home/; false
- else true
- end
- end
- def processing_path
- if processing_path_usr?
- "#{processing_path_root}/#{user}/#{stub_pwd}"
- else
- "#{processing_path_root}/#{stub_pwd}" # see defaults[:processing_path]
- end
- end
- def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
- unless FileTest.directory?(processing_path_root)
- mkdir_p(processing_path_root)
- File.chmod(0777,processing_path_root)
- end
- if processing_path_usr?
- processing_path_usr="#{processing_path_root}/#{user}"
- mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
- File.chmod(0700,processing_path_usr)
- end
- mkdir_p(processing_path) unless FileTest.directory?(processing_path)
- File.chmod(0700,processing_path)
- path_processing=[processing_path,defaults[:processing_path],defaults[:processing_path_home]]
- processing=nil
- path_processing.each do |v| #
- processing=v
- unless FileTest.directory?(processing)
- puts "a processing directory (#{processing}) is being created for use by sisu"
- mkdir_p(processing)
- File.chmod(0700,processing)
- end
- break
- end
- processing
- end
- def sql
- pth="#{processing}/sql"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def composite_file
- pth=path.dal #"#{processing}/composite"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def dal
- pth=if defined? @rc['processing']['dal'] \
- and not @rc['processing']['dal'].nil? \
- and not @rc['processing']['dal'].empty?
- "#{processing}/#{@rc['processing']['dal']}"
- else "#{processing}/#{defaults[:processing_dal]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def tune
- pth=if defined? @rc['processing']['tune'] \
- and not @rc['processing']['tune'].nil? \
- and not @rc['processing']['tune'].empty?
- "#{processing}/#{@rc['processing']['tune']}"
- else "#{processing}/#{defaults[:processing_tune]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def odf
- pth="#{processing}/odf"
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def tex
- pth=if defined? @rc['processing']['latex'] \
- and not @rc['processing']['latex'].nil? \
- and not @rc['processing']['latex'].empty?
- "#{processing}/#{@rc['processing']['latex']}"
- else "#{processing}/#{defaults[:processing_latex]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def texi
- pth=if defined? @rc['processing']['texinfo'] \
- and not @rc['processing']['texinfo'].nil? \
- and not @rc['processing']['texinfo'].empty?
- "#{processing}/#{@rc['processing']['texinfo']}"
- else "#{processing}/#{defaults[:processing_texinfo]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def texinfo #texinfo webserv, check
- "#{processing}/#{defaults[:processing_texinfo]}"
- end
- def lout
- pth=if defined? @rc['processing']['lout'] \
- and not @rc['processing']['lout'].nil? \
- and not @rc['processing']['lout'].empty?
- "#{processing}/#{@rc['processing']['lout']}"
- else "#{processing}/#{defaults[:processing_lout]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def sqlite
- pth=if defined? @rc['processing']['sqlite'] \
- and not @rc['processing']['sqlite'].nil? \
- and not @rc['processing']['sqlite'].empty?
- "#{processing}/#{@rc['processing']['sqlite']}"
- else "#{processing}/#{defaults[:processing_sqlite]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def postgresql
- pth=if defined? @rc['processing']['postgresql'] \
- and not @rc['processing']['postgresql'].nil? \
- and not @rc['processing']['postgresql'].empty?
- "#{processing}/#{@rc['processing']['postgresql']}"
- else "#{processing}/#{defaults[:processing_postgresql]}"
- end
- mkdir_p(pth) unless FileTest.directory?(pth)
- pth
- end
- def feed
- if defined? @rc['webserv']['feed']; "#{public_output}/#{@rc['webserv']['feed']}"
- else defaults[:webserv_feed]
- end
- end
- def feed_home
- "#{public_output}/#{@rc['webserv']['feed_home']}"
- end
- def scripts #used previously only to include tla version info
- if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}"
- end
- end
- def cgi
- if defined? @rc['webserv']['cgi']; "#{@rc['webserv']['cgi']}"
- else defaults[:webserv_cgi]
- end
- end
- def php
- if defined? @rc['webserv']['php']; "#{public_output}/#{@rc['webserv']['php']}"
- else defaults[:webserv_php]
- end
- end
- # programs
- def output_tell
- url.webserv_map_pwd
- end
- def image_source #image repository source directory
- image_path=if defined? @rc['image']['path'] \
- and defined? @rc['image']['public']
- pth="#{@rc['image']['path']}"
- "#{pth}/#{@rc['image']['public']}"
- else
- "#{share}/image"
- end
- end
- def image_source_tex #image repository source directory
- image_path=if defined? @rc['image']['path'] \
- and defined? @rc['image']['public']
- pth="#{@rc['image']['path']}"
- "#{pth}/#{@rc['image']['public']}"
- else
- image=defaults[:image_stub]
- "#{share}/image"
- end
- end
- def image_external
- "#{processing}/external_document/image"
- end
- def image_source_local_tex
- if FileTest.directory?(defaults[:image_local]); defaults[:image_local]
- end
- end
- def image_source_remote_tex
- if FileTest.directory?(image_external); image_external
- end
- end
- self
- end
- def url
- def hostname
- "http://#{@sys.hostname}"
- end
- def dir_url
- "file://#{path.webserv}/#{stub_pwd}"
- end
- def localhost
- "http://localhost/#{stub_pwd}"
- end
- def local
- "http://#{hostname}/#@stub_pwd"
- end
- def root
- if defined? @rc['webserv']['url_root'] \
- and @rc['webserv']['url_root'] =~/https?:\/\//
- "#{@rc['webserv']['url_root']}/#@stub_pwd"
- elsif defined? @rc['webserv']['url_root'] \
- and @rc['webserv']['url_root'] =~/localhost/
- "http://localhost/#@stub_pwd"
- else "file://#{path.output}"
- end
- end
- def remote
- root
- end
- def src_txt
- "#{root}/src"
- end
- def src_pod
- "#{root}/pod"
- end
- def webserv_host_base
- if defined? @rc['webserv']['host']
- case @rc['webserv']['host']
- when /https?:\/\//; @rc['webserv']['host']
- when /\S+/; "http://#{@rc['webserv']['host']}"
- else defaults[:webserv_host_cgi]
- end
- else defaults[:webserv_host_cgi]
- end
- end
- def webrick_port
- if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else defaults[:webserv_port_cgi]
- end
- else defaults[:webserv_port_cgi]
- end
- end
- end
- def webserv_port_cgi
- if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else nil
- end
- else nil
- end
- end
- end
- def webserv_cgi #web url for local webserv (localhost, or hostname)
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=@rc['webserv_cgi']['host'] =~ /https?:\/\// ? '' : 'http://' #check https? missing
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}/#@stub_pwd"
- else "#{http}#{@rc['webserv_cgi']['host']}/#@stub_pwd"
- end
- else
- http=webserv_host_base=~/https?:\/\// ? '' : 'http://'
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}/#@stub_pwd"
- else "#{http}#{webserv_host_base}/#@stub_pwd"
- end
- end
- end
- def webserv_base_cgi #web url for local webserv (localhost, or hostname)
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=@rc['webserv_cgi']['host'] =~ /https?:\/\// ? '' : 'http://'
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}"
- else "#{http}#{@rc['webserv_cgi']['host']}"
- end
- else
- http=webserv_host_base=~/https?:\/\// ? '' : 'http://'
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}"
- else "#{http}#{webserv_host_base}"
- end
- end
- end
- def webrick #must have a port #REMOVE
- #port=":#{webserv_port_cgi}"
- if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
- http=if @rc['webserv_cgi']['host'] =~/http:\/\//
- 'http://'
- elsif @rc['webserv_cgi']['host'] =~/https:\/\//
- 'https://'
- else defaults
- end
- "#{http}#{@rc['webserv_cgi']['host']}"
- elsif webserv_host_base \
- and not webserv_host_base.nil?
- "#{http}#{webserv_host_base}"
- else "#{http}localhost" end
- end
- def webserv #web url for local webserv (localhost, or hostname)
- if path.webserv_dir \
- and path.webserv =~ /#{path.webserv_dir}/ #revisit
- "#{path.webserv}/#@stub_pwd".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#@stub_pwd")
- elsif defined? @rc['webserv']['webrick_url'] \
- and @rc['webserv']['webrick_url'] == false
- "file://#{path.webserv}/#@stub_pwd"
- elsif webserv_port_cgi =~/\S+/
- "#{url.hostname}:#{webserv_port_cgi}/#@stub_pwd"
- else "#{url.hostname}/#@stub_pwd"
- end
- end
- def webserv_base #web url for local webserv (localhost, or hostname)
- if path.webserv_dir \
- and path.webserv =~ /#{path.webserv_dir}/ #revisit
- "#{path.webserv}/#@stub_pwd".gsub(/#{path.webserv_dir}/,"#{url.hostname}")
- elsif defined? @rc['webserv']['webrick_url'] \
- and @rc['webserv']['webrick_url'] == false
- "file://#{path.webserv}"
- else "#{url.webrick_base}"
- end
- end
- def webserv_files_from_db #sort this out, messy
- if defined? @rc['webserv_cgi']['file_links']
- case @rc['webserv_cgi']['file_links']
- when /webserv_cgi/; url.webserv_base_cgi
- when /webserv/; @rc['webserv']['url_root']
- when /https?:\/\//; @rc['webserv_cgi']['file_links']
- when /\S+/; "http://#{@rc['webserv_cgi']['file_links']}"
- else webserv_base_cgi
- end
- else webserv_base_cgi
- end
- end
- def sample_search_form_title
- if defined? @rc['search']['sisu']['title'] \
- and @rc['search']['sisu']['title'] =~/\S+/
- @rc['search']['sisu']['title']
- else %{SiSU search form (sample):}
- end
- end
- def output_tell
- output_type=if defined? @rc['show_output_on'] \
- and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/
- @rc['show_output_on']
- else 'filesystem'
- end
- output=case output_type
- when /^filesystem(?:_url)?/; url.dir_url
- when /^remote(?:_webserv)?/; url.remote
- when /^(?:webserv|local_webserv)/; url.local
- when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd
- when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd
- when /^localhost/; url.localhost
- when /^webrick/; url.webrick
- when /^path/; url.webserv_map_pwd
- else url.webserv_map_pwd
- end
- end
- def images
- '../_sisu/image'
- end
- def images_local
- if FileTest.directory?(defaults[:image_local])
- if @@image_flag
- images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}")
- pth="#{path.webserv}/#@stub_pwd"
- mkdir_p("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image")
- images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0
- @@image_flag=false
- end
- '../_sisu/image'
- else
- if @@local_image==true
- cmd=if @cmd; @cmd
- else ''
- end
- tell=SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] )
- tell.warn unless cmd =~/q/
- @@local_image=false
- end
- url.images
- end
- end
- #def images_external #url_images_external #ex defaults url.path_png
- # '../_sisu/image_external'
- #end
- def images_external
- if FileTest.directory?(image_external)
- if @@image_flag
- images=Dir.glob("#{image_external}/*.{png,jpg,gif}")
- pth="#{path.webserv}/#@stub_pwd"
- mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external")
- images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0
- @@image_flag=false
- end
- '../_sisu/image_external'
- else
- if @@local_image==true
- tell=SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external )
- tell.warn unless @cmd =~/q/
- @@local_image=false
- end
- url.images_external
- end
- end
- self
- end
- def digest
- def type
- if defined? @rc['default']['digest'] \
- and @rc['default']['digest'] != nil
- case @rc['default']['digest']
- when /^sha(?:2|256)?$/; 'sha256'
- when /^md5$/; 'md5'
- else 'md5'
- end
- else 'md5'
- end
- end
- def length
- case digest.type
- when /sha256/; 64
- when /md5/; 32
- else 32
- end
- end
- def pattern
- "[0-9a-f]{#{digest.length}}" #/[0-9a-f]{#{digest.length}}/
- end
- self
- end
- def program
- def text_editor
- if defined? @rc['program_select']['editor'] \
- and @rc['program_select']['editor'] =~/\S\S+/
- @rc['program_select']['editor']
- elsif defined? @rc['program_select']['text_editor'] \
- and @rc['program_select']['text_editor'] =~/\S\S+/
- @rc['program_select']['text_editor']
- else 'editor' #'gvim -c :R -c :S'
- end
- end
- def pdf_viewer
- if defined? @rc['program_select']['pdf_viewer'] \
- and @rc['program_select']['pdf_viewer'] =~/\S\S+/
- @rc['program_select']['pdf_viewer']
- else 'pdf-viewer' #'evince'
- end
- end
- def web_browser
- if defined? @rc['program_select']['www_browser'] \
- and @rc['program_select']['www_browser'] =~/\S\S+/
- @rc['program_select']['www_browser']
- elsif defined? @rc['program_select']['web_browser'] \
- and @rc['program_select']['web_browser'] =~/\S\S+/
- @rc['program_select']['web_browser']
- else 'x-www-browser' #'kazehakase' 'galeon'
- end
- end
- def www_browser
- web_browser
- end
- def console_web_browser
- if defined? @rc['program_select']['console_www_browser'] \
- and @rc['program_select']['console_www_browser'] =~/\S\S+/
- @rc['program_select']['console_www_browser']
- elsif defined? @rc['program_select']['console_web_browser'] \
- and @rc['program_select']['console_web_browser'] =~/\S\S+/
- @rc['program_select']['console_web_browser']
- else 'console-www-browser' #'lynx' 'links2' 'elinks' 'epiphany'
- end
- end
- def console_www_browser
- web_browser
- end
- def xml_viewer
- if defined? @rc['program_select']['xml_viewer'] \
- and @rc['program_select']['xml_viewer'] =~/\S\S+/
- @rc['program_select']['xml_viewer']
- else text_editor
- end
- end
- def xml_editor
- xml_viewer
- end
- def odf_viewer
- if defined? @rc['program_select']['odf_viewer'] \
- and @rc['program_select']['odf_viewer'] =~/\S\S+/
- @rc['program_select']['odf_viewer']
- else 'oowriter' #'odf-viewer','oowriter'
- end
- end
- def manpage_generator
- if defined? @rc['program_select']['man'] \
- and @rc['program_select']['man'] =~/\S\S+/
- @rc['program_select']['man']
- else 'nroff -man' #'nroff -man' #'groff -man -Tascii'
- end
- end
- def file_encoding #file encoding
- is=''
- if defined? @rc['program_set']['file_encoding']
- is=@rc['program_set']['encoding']
- end
- if is.nil? \
- or is==true
- is='encoding'
- end
- is
- end
- def wc #wordcount
- is=''
- if defined? @rc['program_set']['wc']
- is=@rc['program_set']['wc']
- end
- if is.nil? \
- or is==true
- is='wc'
- end
- is
- end
- def tidy
- if defined? @rc['program_set']['tidy']
- is=@rc['program_set']['tidy']
- end
- if is.nil? \
- or is==true
- is='tidy'
- end
- is
- end
- def rmagick
- if defined? @rc['program_set']['rmagick']
- is=@rc['program_set']['rmagick']
- end
- if is.nil? \
- or is==true
- is='rmagick'
- end
- is
- end
- def rexml #should be part of ruby 1.8 but apparently not always
- is=if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
- true
- else false
- end
- is=if defined? @rc['program_set']['rexml']; @rc['program_set']['rexml']
- else ''
- end
- if is.nil? \
- or is==true
- is='rexml'
- end
- is
- end
- def pdflatex
- is=if defined? @rc['program_set']['pdflatex']; @rc['program_set']['pdflatex']
- else ''
- end
- if is.nil? \
- or is==true
- is='pdflatex'
- end
- is
- end
- def postgresql
- is=if defined? @rc['program_set']['postgresql']; @rc['program_set']['postgresql']
- else ''
- end
- if is.nil? \
- or is==true
- is='postgresql'
- end
- is
- end
- def sqlite
- is=if defined? @rc['program_set']['sqlite']; @rc['program_set']['sqlite']
- else ''
- end
- if is.nil? \
- or is==true
- is='sqlite'
- end
- is
- end
- self
- end
- def i18n
- def language # language settings
- m=/.+\/\S+?\~(\S+)/
- pwd=Dir.pwd
- conf=if defined? @rc['default']['language']; @rc['default']['language']
- else nil
- end
- l=if pwd=~ m; pwd[m,1] #2 directory: by visible directory name
- elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml
- else defaults[:language] #4 sisu: program default
- end #1 document: param gets
- SiSU_Env::Standardise_language.new(l)
- end
- def multilingual
- if defined? @rc['default']['multilingual'] \
- and @rc['default']['multilingual'] != nil; @rc['default']['multilingual']
- else defaults[:multilingual]
- end
- end
- def lang_filename(l)
- @lang={}
- x=if multilingual
- x=if defined? @rc['default']['language_file'] \
- and @rc['default']['language_file'] != nil; @rc['default']['language_file']
- else 1
- end
- else 0
- end
- if (l != defaults[:language_code]) \
- or (language.code != defaults[:language_code]) #watch
- if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'',''
- elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",''
- elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}"
- else @lang[:pre],@lang[:mid],@lang[:post]='','',''
- end
- else @lang[:pre],@lang[:mid],@lang[:post]='','',''
- end
- @lang
- end
- self
- end
- def file_encoding
- is=''
- if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding']
- end
- if is.nil? \
- or is==true; is='encoding'
- end
- is
- end
- def papersize # paper settings, default overidden in param if set within document
- if defined? @rc['default']['papersize']; @rc['default']['papersize'].downcase
- else defaults[:papersize].downcase
- end
- end
- def odf_structure
- rm_rf("#{path.processing}/odf")
- system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{path.processing}")
- end
- def sisupod_gen(fns_pod)
- pwd=Dir.pwd
- sisupod_processing_path="#{path.processing}/sisupod"
- if FileTest.directory?(sisupod_processing_path) \
- or FileTest.file?(sisupod_processing_path)
- rm_rf(sisupod_processing_path)
- end
- unless FileTest.directory?(sisupod_processing_path)
- mkdir_p(sisupod_processing_path)
- end
- if FileTest.file?("#{Dir.pwd}/#{fns_pod}")
- system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{path.processing}")
- else
- tell=SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}")
- tell.warn unless @cmd=~/q/
- end
- sisupod_processing_path
- end
- end
- class Info_processing_flag
- attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5
- def initialize
- @rc=Get_init.instance.yamlrc
- end
- def color #processing flag shortcuts
- if defined? @rc['flag']['color']; @rc['flag']['color']
- else false
- end
- end
- def cf_0 #processing flag shortcuts
- if defined? @rc['flag']['default'] \
- and not (@rc['flag']['default'].nil? \
- or @rc['flag']['default'].empty?)
- @rc['flag']['default']
- else '-NhwpaobxXyYv'
- end
- end
- def cf_1 #processing flag shortcuts
- if defined? @rc['flag']['i'] \
- and not (@rc['flag']['i'].nil? \
- or @rc['flag']['i'].empty?)
- @rc['flag']['i']
- else '-hwpoy'
- end
- end
- def cf_2 #processing flag shortcuts
- if defined? @rc['flag']['ii'] \
- and not (@rc['flag']['ii'].nil? \
- or @rc['flag']['ii'].empty?)
- @rc['flag']['ii']
- else '-NhwpaobxXy'
- end
- end
- def cf_3 #processing flag shortcuts
- if defined? @rc['flag']['iii'] \
- and not (@rc['flag']['iii'].nil? \
- or @rc['flag']['iii'].empty?)
- @rc['flag']['iii']
- else '-NhwpaobxXyY'
- end
- end
- def cf_4 #processing flag shortcuts
- if defined? @rc['flag']['iv'] \
- and not (@rc['flag']['iv'].nil? \
- or @rc['flag']['iv'].empty?)
- @rc['flag']['iv']
- else '-NhwpaobxXDyY --import'
- end
- end
- def cf_5 #processing flag shortcuts
- if defined? @rc['flag']['v'] \
- and not (@rc['flag']['v'].nil? \
- or @rc['flag']['v'].empty?)
- @rc['flag']['v']
- else '-NhwpaobxXDyY --update'
- end
- end
- end
- class Info_settings < Info_env
- def permission?(prog) #program defaults
- if defined? @rc['permission_set'][prog]; @rc['permission_set'][prog]
- else false
- end
- end
- def program?(prog) #program defaults
- if defined? @rc['program_set'][prog]; @rc['program_set'][prog]
- else false
- end
- end
- end
- class File_map < Info_env
- attr_accessor :local_sisu_source
- def initialize(opt='') #watch
- super()
- @opt=opt #,opt.fns,opt.cmd
- #@file=@opt.fns #not always fns
- @env=if @opt.fns \
- and not @opt.fns.empty?
- SiSU_Env::Info_env.new(@opt.fns)
- else
- SiSU_Env::Info_env.new('dummy.sst')
- end
- if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get
- end
- ft=[]
- if @md \
- and defined? @md.fn \
- and @md.fn # used for multilingual
- if @md.cmd =~ /[hH]/
- ft << @md.fn[:html]
- end
- if @md.cmd =~ /w/ \
- and @md.cmd !~ /[hH]/
- ft << @md.fn[:concordance]
- end
- if @md.cmd =~ /y/ \
- and @md.cmd !~ /[hH]/
- ft << @md.fn[:manifest]
- end
- if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
- end
- if @md.cmd =~ /x/; ft << @md.fn[:sax]
- end
- if @md.cmd =~ /X/; ft << @md.fn[:dom]
- end
- if @md.cmd =~ /b/; ft << @md.fn[:xhtml]
- end
- if @md.cmd =~ /a/; ft << @md.fn[:plain]
- end
- if @md.cmd =~ /i/; ft << @md.fn[:manpage]
- end
- if @md.cmd =~ /g/; ft << @md.fn[:wiki]
- end
- if @md.cmd =~ /N/; ft << @md.fn[:digest]
- end
- if @md.cmd =~ /o/; ft << @md.fn[:odf]
- end
- if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh]
- end
- if @md.cmd =~ /s/; ft << @md.fns
- end
- if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'
- end
- @fnb=@md.fnb
- else # still needed where/when param is not parsed
- if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??'
- end
- if @opt.cmd =~ /w/ \
- and @opt.cmd !~ /[hH]/
- ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html'
- end
- if @opt.cmd =~ /y/ \
- and @opt.cmd !~ /[hH]/
- ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html'
- end
- if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf'
- end
- if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml'
- end
- if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml'
- end
- if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
- end
- if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1'
- end
- if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
- end
- if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt'
- end
- if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt'
- end
- if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt'
- end
- if @opt.cmd =~ /O/; ft << 'oai_pmh.xml'
- end
- if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm'
- end
- if @opt.cmd =~ /S/; ft << '.zip' << '.kdi'
- end
- if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml'
- end
- if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml'
- end
- if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml'
- end
- end
- ft=ft.uniq
- filetypes=ft.join(',')
- @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all
- elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u
- elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type
- else '*' + filetypes # one relevant file type
- end
- @source_path=if @fnb \
- and not @fnb.empty?
- "#{@env.path.output}/#@fnb"
- else @env.path.output
- end
- @source_path_src=if @fnb \
- and not @fnb.empty?
- "#{@env.path.output}/src"
- else @env.path.output_src
- end
- @source_path_pod=if @fnb \
- and not @fnb.empty?
- "#{@env.path.output}/pod"
- else @env.path.output_pod
- end
- @source_path_harvest=if @fnb \
- and not @fnb.empty?
- "#{@env.path.output}/sisu_site_metadata"
- else @env.path.output_harvest
- end
- @local_sisu_source=if @filetypes =~/\S/; "#@source_path/#@filetypes"
- else @source_path
- end
- end
- end
- class Clean_output
- require 'fileutils'
- include FileUtils::Verbose
- def initialize(opt)
- @opt=opt
- z=File_map.new(@opt)
- @zap=z.local_sisu_source
- if @opt.cmd =~ /[hH]/
- @zap=Dir.glob(@zap).join(' ')
- if @opt.cmd !~ /w/; @zap.gsub!(/#@source_path\/concordance.html/,'')
- end
- end
- @env=SiSU_Env::Info_env.new
- end
- def zap
- if @zap !~/\/\//; rm_rf(@zap) if FileTest.directory?(@zap)
- else puts 'suspect zap request, ignored'
- end
- #Dir.unlink(@zap) if FileTest.directory?(@zap)
- #System_call.new(@zap,'',@cmd).rm
- end
- def zap_map
- if @opt.fnb \
- and not @opt.fnb.empty?
- sm="#{@env.path.output}/sitemaps/sitemap_#{@opt.fnb}.xml"
- rm(sm) if FileTest.file?(sm)
- end
- end
- end
- class Info_remote_host
- def initialize
- @rc=Get_init.instance.yamlrc
- end
- def remote_host #see Info_remote remote_host_base_general
- r=[]
- r=if (defined? @rc['remote'] \
- and @rc['remote'].class==Array)
- r_array=@rc['remote']
- r_array.each_with_index do |renv,i|
- r[i]={}
- if defined? renv['user'] \
- and defined? renv['host']
- end
- r[i][:user]=renv['user']
- r[i][:host]=renv['host']
- r[i][:path]=if defined? renv['path']
- renv['path']
- else ''
- end
- r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}"
- end
- r
- elsif (defined? @rc['remote'] \
- and @rc['remote'].class==Hash \
- and defined? @rc['remote']['user'] \
- and defined? @rc['remote']['host'])
- r[0]={}
- r[0][:user]=@rc['remote']['user']
- r[0][:host]=@rc['remote']['host']
- r[0][:path]=if defined? @rc['remote']['path']
- @rc['remote']['path']
- else ''
- end
- r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}"
- r
- else
- r[0]={}
- r[0][:name]='.'
- r[0][:user]=''
- r[0][:host]=''
- r[0][:path]=''
- #puts "no remote host or user"
- r
- end
- end
- def rhost
- def r1
- rhost1=if defined? SiSU_Env::Info_remote_host.new.remote_host[0][:name]
- SiSU_Env::Info_remote_host.new.remote_host[0][:name]
- else nil
- end
- end
- def r2
- rhost2=if defined? SiSU_Env::Info_remote_host.new.remote_host[1][:name]
- SiSU_Env::Info_remote_host.new.remote_host[1][:name]
- else nil
- end
- end
- def r3
- rhost3=if defined? SiSU_Env::Info_remote_host.new.remote_host[2][:name]
- SiSU_Env::Info_remote_host.new.remote_host[2][:name]
- else nil
- end
- end
- def r4
- rhost4=if defined? SiSU_Env::Info_remote_host.new.remote_host[3][:name]
- SiSU_Env::Info_remote_host.new.remote_host[3][:name]
- else nil
- end
- end
- def r5
- rhost5=if defined? SiSU_Env::Info_remote_host.new.remote_host[4][:name]
- SiSU_Env::Info_remote_host.new.remote_host[4][:name]
- else nil
- end
- end
- def r6
- rhost6=if defined? SiSU_Env::Info_remote_host.new.remote_host[5][:name]
- @ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]
- else nil
- end
- end
- self
- end
- end
- class Info_remote < File_map
- @@flag_remote=false
- require 'socket'
- def initialize(opt)
- super(opt) #
- @opt=opt
- @rc=Get_init.instance.yamlrc
- end
- def remote_host_base_general
- SiSU_Env::Info_remote_host.new.remote_host
- end
- def remote_host_base
- remote_host_base_general.each do |remote_conn|
- #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty?
- @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/
- #remote_conn[:name]
- end
- remote_host_base_general
- end
- def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- remote_gen=case @opt.cmd
- when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
- when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/."
- else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- end
- #remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- System_call.new(local_gen,remote_gen).scp
- if FileTest.file?("#{local_src}/#{src_txt}")
- System_call.new("#{local_src}/#{src_txt}",remote_src).scp
- end
- if FileTest.file?("#{local_pod}/#{src_pod}")
- System_call.new("#{local_src}/#{src_pod}",remote_pod).scp
- end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
- end
- if FileTest.file?("#{local_pod}/#{src_doc}.zip")
- puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
- end
- else
- puts 'suspect scp request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #@@flag_remote"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/."
- remote_images_external="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image_external/."
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local_gen,remote_gen,@opt.cmd).rsync(delete_extra_files)
- if FileTest.file?("#{local_src}/#{src_txt}")
- System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
- if defined? @md.ec[:image] and not @md.ec[:image].empty?
- images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/")
- System_call.new(images,remote_images,@opt.cmd).rsync
- images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/")
- System_call.new(images_external,remote_images_external,@opt.cmd).rsync
- end
- end
- if FileTest.file?("#{local_pod}/#{src_pod}")
- System_call.new("#{local_pod}/#{src_pod}",remote_pod,@opt.cmd).rsync
- end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}") \
- or FileTest.file?("#{local_src}/#{src_doc}.zip")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
- end
- else
- puts 'suspect rsync request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #@@flag_remote"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def scp_base #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base: #{local} -> #{remote}"
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "begin scp_base: #{local} -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def scp_base_all #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base_all: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).scp
- System_call.new("#{local}/_sisu/image/",remote).scp
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "scp_base_all: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_base #base site
- ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu"
- image_sys="#{@env.path.webserv}/_sisu/image_sys"
- images="#{@env.path.webserv}/_sisu/image"
- self.remote_host_base.each do |remote_conn|
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_conf="#{remote_conn[:name]}/_sisu"
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- #puts "begin rsync_base: #{local} -> #{remote}"
- System_call.new("#{image_sys}","#{remote_conf}").rsync
- System_call.new("#{images}","#{remote_conf}").rsync
- System_call.new("#{ldest}","#{remote}").rsync
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base: #{local} -> #{remote}"
- puts "#{local}/_sisu/image -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_base_sync #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- puts "begin rsync_base_sync: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base_sync: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_sitemaps #sitemap directory
- self.remote_host_base.each do |remote_conn|
- local="#@source_path/sitemapindex.xml"
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if @@flag_remote
- #if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] #and @@flag_remote==true and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local,remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_sitemaps: #{local} -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_harvest
- self.remote_host_base.each do |remote_conn|
- local=@source_path_harvest
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if @@flag_remote
- delete_extra_files='--delete' # '--delete-after'
- System_call.new(local,remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_sitemaps: #{local} -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- end
- class Info_version <Info_env
- include Singleton
- require 'rbconfig'
- @@lib_path=nil
- def get_version
- @version={}
- @pwd=ENV['PWD']
- yst_ver="#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml"
- lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':')
- @@lib_path ||=lib_path
- if File.exist?(yst_ver); @version=YAML::load(File::open(yst_ver)) #unless @@noyaml
- end
- @version
- end
- def rbversion
- #Config::CONFIG['ruby_version']
- %x{ruby -v}.strip
- end
- end
- class Create_system_link #< Info_env #revisit problems created 2004w41
- def initialize
- @env=SiSU_Env::Info_env.new
- end
- def images
- unless FileTest.directory?("#{@env.path.output}/_sisu")
- mkdir_p("#{@env.path.output}/_sisu")
- end
- unless File.exist?("#{@env.path.output}/_sisu/image_sys") \
- or File.symlink?("#{@env.path.output}/_sisu/image_sys")
- File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys")
- end
- end
- def man_forms
- #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form") == true
- end
- def man_pdf
- #File.symlink("../../man/form", "#{@env.path.output}/man/pdf") unless File.symlink?("#{@env.path.output}/man/pdf") == true
- end
- end
- class Info_file < Info_env
- def initialize(fns='')
- @env=SiSU_Env::Info_env.new
- @fns=fns
- end
- def basefilename
- m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
- fnb=@fns[m,1]
- end
- def project
- "#{@env.development}/sisu.lnk"
- end
- def project_info
- "#{@env.datapriv_i}/sisu.er3"
- end
- def project_todo
- "#{@env.development}/todo.txt"
- end
- def admin_self
- "#{@env.path.home}/.corundum/dots.lnk"
- end
- def admin_root
- '/root/.corundum/admin.txt'
- end
- end
- class Info_db < Info_env
- @@rc=nil
- def initialize
- @@pwd ||=Dir.pwd
- @pwd=Dir.pwd
- @env=SiSU_Env::Info_env.new
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub=@pwd[m,1]
- @rc=@@rc ||=Get_init.instance.yamlrc
- @defaults=Info_env.new.defaults
- end
- def engine
- def default
- if defined? @rc['db']['engine']['default'] \
- and @rc['db']['engine']['default']=~/postgresql|sqlite/
- @rc['db']['engine']['default']
- else 'sqlite'
- end
- end
- self
- end
- def psql
- def user
- if defined? @rc['db']['postgresql']['user'] \
- and @rc['db']['postgresql']['user']=~/\S+/
- @rc['db']['postgresql']['user']
- else @env.user
- end
- end
- def db #db_name
- "SiSU_#@pwd_stub"
- end
- def port #PGPORT
- if defined? @rc['db']['postgresql']['port'] \
- and ( @rc['db']['postgresql']['port'] =~/\d+/ \
- or @rc['db']['postgresql']['port'].class == Fixnum)
- @rc['db']['postgresql']['port']
- else @defaults[:postgresql_port]
- end
- end
- def dbi
- "DBI:Pg:database=#{psql.db};port=#{psql.port}"
- end
- def password
- if defined? @rc['db']['postgresql']['password'] \
- and @rc['db']['postgresql']['password']=~/\S+/
- @rc['db']['postgresql']['password']
- else ''
- end
- end
- def host
- if defined? @rc['db']['postgresql']['host'] \
- and @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/
- @rc['db']['postgresql']['host']
- else ''
- end
- end
- def dbi
- if psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/
- "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
- else "DBI:Pg:database=#{psql.db};port=#{psql.port}"
- end
- end
- def conn_dbi
- DBI.connect(psql.dbi,psql.user,psql.db)
- end
- self
- end
- def mysql
- def db
- #"SiSU_#@pwd_stub"
- end
- def port
- '**'
- end
- def dbi
- "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}"
- end
- self
- end
- def sqlite
- def db
- "#{@env.path.webserv}/#@pwd_stub/sisu_sqlite.db"
- end
- def dbi
- "DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
- end
- def sqlite3
- sqlite.db #sqlite3 ?
- end
- def conn_dbi
- DBI.connect(sqlite.dbi)
- end
- def conn_sqlite3
- SQLite3::Database.new(sqlite.sqlite3)
- end
- self
- end
- end
- class Info_port < Info_env
- def initialize
- @env=SiSU_Env::Info_env.new
- end
- def webrick
- @env.url.webrick_port
- end
- end
- class Info_program < Info_env #revisit
- attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite
- def initialize
- prog=SiSU_Env::Info_env.new.program
- @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite
- end
- end
- class Info_skin
- def initialize(md=nil,skin=nil)
- @md=md
- @d_sk=if skin.class==String ; skin
- elsif defined? md.doc_skin \
- and md.doc_skin
- md.doc_skin
- else nil
- end
- @home,@pwd=ENV['HOME'],ENV['PWD']
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub=@pwd[m,1]
- @env=SiSU_Env::Info_env.new
- end
- def select # skin loading logic here
- load "#{SiSU_lib}/defaults.rb"
- skin_path=[]
- @env.sys.rc_path.each{|x| skin_path << "#{x}/skin"}
- skin_path << "#{@env.path.processing}/external_document/skin"
- #skin_path << "#{@env.path.processing}/external_document/_sisu/skin" #revisit
- skin=true
- if @pwd_stub =~/^sisupod$/ \
- and @md.mod.inspect !~/--trust/
- skin=false #security only run skins on sisupod if --trust flag is provided
- end
- doc_skin,dir_skin=nil,nil
- if skin
- unless @d_sk.nil?
- sk_doc="doc/#@d_sk.rb"
- skin_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/#{sk_doc}")
- doc_skin="#{v}/#{sk_doc}"
- load doc_skin
- break
- end
- end
- end
- unless doc_skin
- sk_dir="dir/skin_#@pwd_stub.rb"
- skin_path.each do |v| #directory skin priority 2
- if FileTest.file?("#{v}/#{sk_dir}")
- dir_skin="#{v}/#{sk_dir}"
- load dir_skin
- break
- end
- end
- end
- end
- sk=if doc_skin; doc_skin
- elsif dir_skin; dir_skin
- else nil
- end
- end
- end
- class CSS_default
- def html
- 'html.css'
- end
- def html_tables
- 'html_tables.css'
- end
- def xhtml
- 'xhtml.css'
- end
- def xml_sax
- 'sax.css'
- end
- def xml_dom
- 'dom.css'
- end
- def docbook_xml
- 'docbook.css'
- end
- def homepage
- 'homepage.css'
- end
- def harvest
- 'harvest.css'
- end
- end
- class CSS_select < Info_env
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new
- end
- def html
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css")
- "#{@md.doc_css}_html.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css")
- "#{@env.path.stub_pwd}_html.css"
- else CSS_default.new.html
- end
- end
- def html_tables
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css")
- "#{@md.doc_css}_html_tables.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css")
- "#{@env.path.stub_pwd}_html_tables.css"
- else CSS_default.new.html_tables
- end
- end
- def xhtml
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css")
- "#{@md.doc_css}_xhtml.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css")
- "#{@env.path.stub_pwd}_xhtml.css"
- else CSS_default.new.xhtml
- end
- end
- def xml_sax
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css")
- "#{@md.doc_css}_xml_sax.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css")
- "#{@env.path.stub_pwd}_xml_sax.css"
- else CSS_default.new.xml_sax
- end
- end
- def xml_dom
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css")
- "#{@md.doc_css}_xml_dom.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css")
- "#{@env.path.stub_pwd}_xml_dom.css"
- else CSS_default.new.xml_dom
- end
- end
- def docbook_xml
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css")
- "#{@md.doc_css}_xml_dom.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css")
- "#{@env.path.stub_pwd}_docbook.css"
- else CSS_default.new.docbook_xml
- end
- end
- def homepage
- css=if @md.doc_css \
- and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css")
- "#{@md.doc_css}_homepage.css"
- elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css")
- "#{@env.path.stub_pwd}_homepage.css"
- else CSS_default.new.homepage
- end
- end
- end
- class CSS_stylesheet
- def initialize(md)
- @md=md
- @css=CSS_select.new(@md)
- @env=SiSU_Env::Info_env.new
- end
- def html
- %{ <link rel="stylesheet" href="../#{@env.path.style}/#{@css.html}" type="text/css" />}
- end
- def html_tables
- %{ <link rel="stylesheet" href="../#{@env.path.style}/#{@css.html_tables}" type="text/css" />}
- end
- end
- class SiSU_file <Info_env #todo unify with Create_file
- def initialize(md,fno='')
- begin
- @fno,@fns,@fnb=fno,md.fns,md.fnb
- @env=SiSU_Env::Info_env.new(@fns)
- @env_out="#{@env.path.output}/#@fnb"
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
- ensure
- end
- end
- def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def touch_file(path,filename)
- if File.writable?("#{path}/.");
- system("touch #{path}/#{filename}")
- #File.new("#{path}/#{filename}",'w+')
- else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
- end
- def make_path(path)
- mkdir_p(path) unless FileTest.directory?(path)
- end
- def mkdir_initialize # not used but consider using
- mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
- mkdir_p("#{@env.path.output}/#@fnb") unless FileTest.directory?("#{@env.path.output}/#@fnb")
- mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
- mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
- end
- def mkdir
- dir=@env.path.output
- txt_path="#{dir}/#@fnb"
- mkdir_p(dir) unless FileTest.directory?(dir)
- mkdir_p(txt_path) unless FileTest.directory?(txt_path)
- mkdir_p("#{dir}/#{@env.path.style}") unless FileTest.directory?("#{dir}/#{@env.path.style}")
- mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
- end
- def mkfile #consider using more
- path="#{@env.path.output}/#@fnb"
- filename=@fno
- file=make_file(path,filename)
- end
- def mkfile_man
- path="#{@env.path.output}/man"
- make_path(path)
- filename=@fno
- file=make_file(path,filename)
- end
- def mkfile_pwd
- path=Dir.pwd
- filename=@fno
- file=make_file(path,filename)
- end
- end
- class Create_file <Info_env #todo unify with SiSU_file
- def initialize(cmd,fns,operation='')
- @cmd=cmd
- begin
- super(fns)
- @env=SiSU_Env::Info_env.new(fns)
- ver=Info_version.instance
- case operation #watch
- when /pdf/; @env_out=''
- when /sql/
- when /xml|plaintext|ascii/; @env_out="#{@env.path.output}/#@fnb" #check change of name to plaintext from ascii
- else
- if defined? @md.sfx_src \
- and @md.sfx_src =~/ss[ftsumc]/
- @env_suf='lm'
- @env_out_root=@env.path.output
- @env_out="#{@env.path.output}/#@fnb"
- @env_tex=@env.path.tex
- @env_lout=@env.path.lout
- @@publisher='SiSU http://www.jus.uio.no/sisu'
- @env_pdf="#@env_out_root/pdf"
- end
- end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
- ensure
- end
- end
- def param_instantiate
- @cX||=SiSU_Screen::Ansi.new(@cmd)
- @@date=Info_date.new
- @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil
- @@publisher='SiSU scribe'
- end
- def html_root
- #@env.path.output
- end
- def mkdir_pdf
- Dir.mkdir(@env.path.tex) unless FileTest.directory?(@env.path.tex)
- end
- def file_generic(output_file='')
- filename="#{@env.path.output}/#@fnb/#{output_file}"
- File.new(filename,'w+')
- end
- def file_error
- File.new('/tmp/errorlog.sisu','w+')
- end
- def file_meta
- File.new("#{@env.path.dal}/#@fns.meta",'w+')
- end
- def file_meta_idx_html
- File.new("#{@env.path.dal}/#@fns.idx.html",'w+')
- end
- def file_note
- File.new("#{Dir.pwd}/#@fns.fn",'w+')
- end
- def marshal_meta
- "#{@env.path.dal}/#@fns.meta.rbm"
- end
- def marshal_meta_idx_html
- "#{@env.path.dal}/#@fns.idx_html.rbm"
- end
- def meta
- "#{@env.path.dal}/#@fns.meta"
- end
- def file_tune
- File.new("#{@env.path.tune}/#@fns.tune",'w+')
- end
- def marshal_tune
- "#{@env.path.tune}/#@fns.marshal_tune"
- end
- def file_semantic
- filename_semantic="./semantic.yaml"
- @@filename_semantic=File.new(filename_semantic,'w+')
- end
- def file_rss
- filename_rss="./semantic.xml"
- @@filename_rss=File.new(filename_rss,'w+')
- end
- def file_html_scroll(md)
- filename_scroll="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}doc#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- @@filename_html_scroll=File.new(filename_scroll,'w+')
- end
- def file_html_index(md)
- filename_index="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}index#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- @@filename_html_index=File.new(filename_index,'w+')
- end
- def file_html_segtoc(md)
- filename_segtoc="#{@env.path.output}/#{md.fnb}/#{md.fnl[:pre]}toc#{md.fnl[:mid]}.html#{md.fnl[:post]}"
- File.new(filename_segtoc,'w+')
- end
- def file_texinfo
- File.new("#{@env.path.texinfo}/#@fnb.texinfo",'w+')
- end
- end
- class Create_site < Info_env
- require "#{SiSU_lib}/css"
- include SiSU_Style
- def initialize(cmd)
- @cmd=cmd
- @env=SiSU_Env::Info_env.new
- @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd
- @rc=Get_init.instance.yamlrc
- @vz=SiSU_Env::Get_init.instance.skin
- @vz_home=SiSU_Viz::Home.new
- end
- def homepage
- homepage_path=nil
- @env.sys.rc_path.each do |v|
- if FileTest.file?("#{v}/home/index.html")
- homepage_path="#{v}/home/index.html"
- break
- end
- end
- mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}")
- if homepage_path \
- and FileTest.file?(homepage_path)
- cp(homepage_path,"#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html")
- cp(homepage_path,"#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html")
- else
- doc_skin=nil
- sk_doc='doc/skin_sisu.rb'
- @env.sys.rc_path.each do |v| #document skin priority 1
- if FileTest.file?("#{v}/skin/#{sk_doc}")
- doc_skin="#{v}/skin/#{sk_doc}"
- load doc_skin
- break
- end
- end
- filename_homepage=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html",'w')
- filename_homepage_toc=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html",'w')
- filename_homepage << @vz_home.homepage
- filename_homepage_toc << @vz_home.homepage
- end
- end
- def cp_images(src_path,dest_path)
- if FileTest.directory?(src_path)
- cd(src_path)
- source=Dir.glob("*.{png,jpg,gif,ico}")
- mkdir_p(dest_path) unless FileTest.directory?(dest_path)
- chmod(0755,dest_path)
- source.each do |i|
- cp_r(i,"#{dest_path}/#{i}")
- chmod(0644,"#{dest_path}/#{i}")
- end
- cd(@pwd)
- else puts "\tWARN, did not find - #{src_path}"
- end
- end
- def cp_local_images
- src="#@pwd/_sisu/image"
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_external_images
- src="#{@env.path.processing}/external_document/image"
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- cp_images(src,dest)
- end
- def cp_webserver_images
- src=@env.path.image_source
- dest="#{@env.path.webserv}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_webserver_images_local #this should not have been necessary
- src=@env.path.image_source
- dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- cp_images(src,dest)
- end
- def cp_base_images #fix images
- src="#{@env.path.share}/image"
- dest="#{@env.path.webserv}/_sisu/image_sys"
- cp_images(src,dest)
- end
- def cp_css
- mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
- css_path=['/etc/sisu/css',"#@home/.sisu/css","#@pwd/_sisu/css"] #BROKEN
- if defined? @rc['permission_set']['css_modify'] \
- and @rc['permission_set']['css_modify']
- tell=SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}")
- css_path.each do |x|
- if FileTest.directory?(x)
- cd(x)
- source=Dir.glob("*.{css}")
- source.each do |i|
- cp(i,"#{@env.path.output}/#{@env.path.style}")
- end
- cd(@pwd)
- end
- end
- else tell=SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false")
- end
- tell.warn if @cmd=~/[MV]/
- fn_css=SiSU_Env::CSS_default.new
- css=SiSU_Style::CSS.new
- path_style="#{@env.path.output}/#{@env.path.style}"
- mkdir_p(path_style) unless FileTest.directory?(path_style)
- style=File.new("#{path_style}/#{fn_css.homepage}",'w')
- style << css.homepage
- style.close
- style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
- style << css.html_tables
- style.close
- style=File.new("#{path_style}/#{fn_css.html}",'w')
- style << css.html
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
- style << css.xml_sax
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
- style << css.xml_dom
- style=File.new("#{path_style}/#{fn_css.docbook_xml}",'w')
- style << css.docbook_xml
- style.close
- style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
- style << css.xhtml
- style=File.new("#{path_style}/#{fn_css.harvest}",'w')
- style << css.harvest
- style.close
- end
- end
-end
-module SiSU_Screen
- require "#{SiSU_lib}/screen_text_color"
-end
-module SiSU_Errors
- require "#{SiSU_lib}/errors"
-end
-__END__
-https? intro check 2007-09-22
-
-fns_array=unless fns =~/\.ssm.sst$/
- if RUBY_VERSION < '1.9'
- IO.readlines(fns,'')
- else IO.readlines(fns,'r:utf-8')
- end
-else
- if RUBY_VERSION < '1.9'
- IO.readlines("#{path.composite_file}/#{fns}",'')
- else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8')
- end
-end
diff --git a/lib/sisu/v1/termsheet.rb b/lib/sisu/v1/termsheet.rb
deleted file mode 100644
index eb37c085..00000000
--- a/lib/sisu/v1/termsheet.rb
+++ /dev/null
@@ -1,167 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, specialised pre-processing wrapper
- ** NOTE wrapper makes little sense without additional components, additional
- sample files must be provided - (saved till later as may confuse)
-
-=end
-require "#{SiSU_lib}/sysenv"
-require "#{SiSU_lib}/param"
-include SiSU_Param
-@do,@done,@used,@html_output,@txt_input,@txt_output,@@report=Array.new(7){[]}
-@@info=nil
-@c=0
-@cX=SiSU_Screen::Ansi.new('yes').cX
-@done << "\n#{@cX.blue_hi}#{@cX.black}Summary#{@cX.off*2}"
-def talent(termsheet,flag)
- no_ocn='0' if flag =~/0/ #flag to request switch off of text object numbering
- @@info=nil
- @@info=termsheet.gsub(/(.+?)\.termsheet\.rb/,'../facility_data/\1.html')
- @env=SiSU_Env::Info_env.new
- @dir_fd="#{@env.path.output}/facility_data"
- mkdir_p(@dir_fd) unless FileTest.directory?(@dir_fd)==true
- html_output=[]
- case termsheet
- when /.+?\.(termsheet)\.rb$/
- @basename=termsheet[/(.+?)\.termsheet\.rb/, 1]
- @standard_form={}
- require termsheet
- include Termsheet
- @standard_form=Termsheet::StandardForms.new.standardforms
- puts %{\n#{@@cX.yellow_hi}#{@@cX.black}From#{@@cX.off*2}: #{@@cX.grey_hi}#{@@cX.black}#{@basename}.termsheet.rb#{@@cX.off*3}\n\n}
- @standard_form.each do |k,v|
- @c+=1
- require v
- puts %{\n#{@@cX.blue_hi}#{@@cX.black}Producing the following#{@@cX.off*2}: #{@@cX.green}#{@basename}.#{k}#{@@cX.off}\n\n}
- @done << %{\n\t#{@@cX.grey}Documents generated#{@@cX.off}: #{@@cX.cyan}#{@basename}.#{k}#{@@cX.off}\n}
- @used << %{\n\t#{@@cX.grey}Using#{@@cX.off}: #{@@cX.ruby}#{v}#{@@cX.off}\n}
- html_output=<<WOK
-<br /><a href="../#{@basename}.#{k}/landscape.pdf">
-<img border="0" width="18" height="15" src="../_sisu/image/b_pdf.png" alt="pdf landscape"></a>&nbsp;
-<a href="../#{@basename}.#{k}/portrait.pdf">
-<img border="0" width="15" height="18" src="../_sisu/image/b_pdf.png" alt="pdf portrait"></a>&nbsp;
-<a href="../#{@basename}.#{k}/sisu_manifest.html">#{@basename}.#{k}.sisu_manifest.html</a>
-WOK
- @html_output << html_output
- @txt_input << %{\n\tForm #@c: <url:#{Dir.pwd}/#{v}>\n\t |#{Dir.pwd}/#{v}|@|^|\n}
- @txt_output << %{\n\t#{k}: |../#{@basename}.#{k}/sisu_manifest.html|@|^|\n}
- @report_file_i=File.new("#@dir_fd/#@basename.txt",'w+')
- @report_file_o=File.new("#@dir_fd/#@basename.html",'w+')
- @filename_new=File.new("#@basename.#{k}.sst",'w+')
- file_array=IO.readlines(v,"\n")
- @do << %{#{k}}
- @filename_new << @document
- # "require v" pulls in the composite @document
- # "termsheet" having all the variables required to complete the standard form @document
- @filename_new.close
- end
- @do.each do |x|
- system %{sisu -Nhwpo #{@basename}.#{x}.sst\n}
- end
- else print "not processed --> ", termsheet, "\n"
- end
- @done << %{\n\t#{@@cX.green}Summary:#{@@cX.off} #{@@cX.blue}#{@env.path.output}/facility_data/#{@basename}.html#{@@cX.off}\n}
- @done << %{\n\t#{@@cX.grey}From details provided in#{@@cX.off}: #{@@cX.green}#{termsheet}#{@@cX.off}\n}
- terms=%{\nTermsheet: <url:#{Dir.pwd}/#{termsheet}>\n |#{Dir.pwd}/#{termsheet}|@|^|\n}
- @report_file_i << "<url:all.txt>\n|all.txt|@|^|\n" << terms << "\nForms:\n" << @txt_input << "\nOutput Files\n" << @txt_output
- @report_file_o << %{<a href="toc.html">^</a><br />\n} << @html_output
- @@report << @done << @used << "\n"
- @done,@used=[],[]
-end
-require "#{SiSU_lib}/param"
-@argv=$*
-@proc="#{@argv[0].to_s}"
-if @proc =~ /^-?[wft]/
- @argv.shift
- @argv.each do |termsheet|
- talent(termsheet,@proc)
- end
-end
-@env=SiSU_Env::Info_env.new
-@dir_fd="#{@env.path.output}/facility_data"
-@url="#{@env.url.webserv}/facility_data"
-@@report << %{\n#{@@cX.grey}See#{@@cX.off}: #{@@cX.blue}#@dir_fd/all.txt\t#@dir_fd/toc.html\t#@dir_fd/#{@@cX.off}\n\n#{@@cX.grey}See#{@@cX.off}: #{@@cX.blue}#@url/all.txt\t#@url/toc.html\t#@url/#{@@cX.off}\n\n}
-puts @@report
-File.unlink("#@dir_fd/all.txt") if FileTest.file?("#@dir_fd/all.txt")
-File.unlink("#@dir_fd/toc.html") if FileTest.file?("#@dir_fd/toc.html")
-summary_file=File.new("#@dir_fd/all.txt",'w+')
-summary_html=File.new("#@dir_fd/toc.html",'w+')
-ls_txt=%x{ls #@dir_fd/*.txt}
-report_thlnk=[]
-ls_txt.scan(/.+/)
-ls_txt.each {|x| report_thlnk << x.gsub!(/#@dir_fd\/(.+)/,"<url:\\1>\n|\\1|@|^|")}
-report_thlnk.join("\n")
-ls_html=%x{ls #@dir_fd/*.html}
-#NOTE is necessary to purge @dir_fd ~myout/faciliytData
-report_html=[]
-ls_html.split(/.+/)
-ls_html.each {|x| report_html << x.gsub!(/#@dir_fd\/(.+)/,'<a href="\1">\1</a><br />')}
-report_html.join("\n")
-summary_file << "#{report_thlnk}"
-summary_html << "#{report_html}"
-__END__
-sisu -t x_bank.and.*
-e.g. sisu -t x_bank.and.*.termsheet.rb
-e.g. sisu_termsheet.rb -t x_bank.and.c*.termsheet.rb
-program calls upon termsheet file with extension termsheet.rb
-termsheet.rb calls upon relevant standard form files (to be used) with extension .sForm.rb
-there is also a standard_terms.rb file - with terms/details that are constant
-the file produced is named after the termsheet.rb with that extension replaced with .er30
-from there scribbler.rb is called upon its usual metaVerse html and pdf creation
-! :-)
-to test run
-termsheet.rb -f dev.export.import.trade.facility.termsheet.rb
-the term sheet calls the standard form or template that is to be run against it.
diff --git a/lib/sisu/v1/texinfo.rb b/lib/sisu/v1/texinfo.rb
deleted file mode 100644
index a4b26e43..00000000
--- a/lib/sisu/v1/texinfo.rb
+++ /dev/null
@@ -1,438 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: texinfo processing
-
-=end
-module SiSU_TexInfo
- require "#{SiSU_lib}/html"
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- #include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags)
- require "#{SiSU_lib}/texinfo_format"
- include SiSU_Texinfo_format
- @tex_file=[]
- @@tex_backslash="\\\\"
- @@tabular="{tabular}"
- @@table_pagebreak_counter,@@tex_endnote_call_counter,@@tex_table_flag,@@tex_counter,@@tex_column,@@tex_columns,@@counting=0,0,0,0,0,0,0
- @@column_instruct,@@tex_line_mode,@@tex_word_mode,@@start_table,@@line_mode='','','','',''
- @@n,@@copyright,@@tableheader=nil,nil,nil
- @@tex_col_w=[]
- @@tex_pattern_margin_number="\\\\marginpar.+?\s+"
- class Source #Songsheet
- include SiSU_Param
- include SiSU_Viz
- include SiSU_TexInfo
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @st={ 'tex'=>{} }
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def directories
- begin
- case @opt.fns
- when /\.(?:-|ssm\.)?sst$/
- Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}")
- Dir.mkdir(@env.path.texi) unless FileTest.directory?(@env.path.tex)
- @@filename_texinfo=File.new(%{#{@env.path.texi}/#{@opt.fnb}.texinfo},'w+')
- end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
- ensure
- end
- end
- def read
- songsheet
- end
- def songsheet
- begin
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo')
- tell.green_title_hi unless @opt.cmd =~/q/
- data=IO.readlines(@opt.fns,'')
- @md=SiSU_Param::Parameters.new(@opt).get
- puts "\t#{@@cX.grey}TexInfo#{@@cX.off}"
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- directories
- @marshalfile=my_make.marshal_meta
- if FileTest.file?(@marshalfile)==true
- File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
- tell.meta_verse_skipped unless @opt.cmd =~/q/
- else
- tex_array=IO.readlines(@opt.fns,'')
- SiSU_Metaverse.songsheet(tex_array)
- end
- tex_array=@@tuned_file
- Texinfo_make.new(tex_array,@md).songsheet
- tex_array=''
- @@filename_texinfo=nil
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
- ensure
- @@filename_texinfo.close if @@filename_texinfo
- end
- end
- end
- class Texinfo_make
- include SiSU_Param
- include SiSU_Texinfo_format
- @@tex_1='(?:.+?)+~' #?? debug
- @@tabular="{tabular}"
- @@tex_pattern_margin_number="\\\\marginpar.+?\s+"
- @@dp=nil
- def initialize(data,md)
- @data,@md=data,md #fns
- @env=SiSU_Env::Info_env.new(@md.fns)
- @st={ 'tex'=>{} }
- #@tex=SiSU_Texinfo_format::Texinfo.new
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def songsheet
- begin
- @data=pre
- @data=endnote
- @data=markup
- @data=tail
- output
- makeinfo
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.cmd,$!,$@).rescue
- ensure
- end
- end
- def pre
- @tex_file=[]
- data=@data
- data.each do |para|
- # DEBUG 2003w16 this is a kludge, because i could not get parameters
- # from param, Sort out ... revert to more elegant solution
- if para =~ /#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u
- @@flag['tables']='y' # KLUDGE get from param
- end
- para.gsub!(/<:p[bn]>/,'')
- para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)')
- txt_obj={:txt =>para}
- do_mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- @tex_file << do_mono.spec_char
- end
- data=@tex_file.delete_if {|x| x =~ /^0(?:\\)+~/m}
- data=@tex_file # ...
- end
- def endnote
- data=@data
- @tex_file=[]
- data.each do |para|
- # BUG bug -> have problems with endnotes in headers
- if para =~ /#{Mx[:en_a_o]}\d+\s+/ #if para =~ /<!e\s+/ # watch
- para.gsub!(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
- elsif para =~ /#{Mx[:en_a_o]}\*+\s+/ #if para =~ /<!e\s+/ # watch
- para.gsub!(/\s*#{Mx[:en_a_o]}(\*+)\s+(?:.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
- end
- @tex_file << para
- end
- @tex_file
- end
- def poem
- data=@data
- @tex_file=[]
- @@counting=0
- data.each do |para|
- if para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- @@flag['code']=true
- @@counting=1
- end
- if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/
- @@flag['poem']=1
- end
- if @@flag['code']
- if @@flag['code'] \
- and para =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501
- @@flag['code']=false
- end
- if @@flag['code'] \
- and para =~ /\S/
- sub_array=para.dup
- @@line_mode=sub_array.scan(/.+/)
- Tune.code_lines(@@line_mode)
- para=@@line_mode.join
- end
- elsif @@flag['poem']==1
- if @@flag['poem']==1 \
- and para =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501
- @@flag['poem']=0
- end
- if @@flag['poem']==1 \
- and para =~ /\S/
- sub_array=para.dup
- @@line_mode=sub_array.scan(/.+/)
- Tune.code_lines(@@line_mode)
- para=@@line_mode.join
- end
- end
- @tex_file << para
- end
- end
- def code_lines
- data=@data
- data.each do |line|
- if line =~ /\S/ \
- and line !~ /#{Mx[:gr_o]}(code|verse).+/
- if @@flag['code']
- line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\")
- @@counting+=1 if @@flag['code']
- else line.gsub!(/(.+)/m,'\noindent\1')
- end
- end
- end
- end
- def tables
- data=@data
- @tex_file=[]
- @@tableheader=0
- data.each do |para|
- if para =~ /#{Mx[:tc_p]}|#{Mx[:gr_o]}T/ui
- txt_obj={:txt =>para}
- do_mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- para=do_mono.longtable # using longtable latex package
- end
- @tex_file << para
- end
- end
- def markup
- data=@data
- @tex_file=[]
- @row_break='\\\\\\'
- @break_page="#@row_break\n#@row_break \n"
- md={}
- txt_obj={:txt =>''}
- @tex_file << SiSU_Texinfo_format::Texinfo.new(@md,txt_obj).head
- txt_obj={:txt =>@md.title}
- mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- @tex_file << mono.topnode
- texinfo_menu=[]
- n_menu,n_submenu=0,0
- @submenu,@subsubmenu={},{}
- data.each do |para|
- para.gsub!(/\s*<:name#example>\s*/,' ')
- para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove
- if para =~ /^#{Mx[:lv_o]}[1-3]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/
- txt_obj={:txt =>$1}
- toc=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- texinfo_menu << toc.menu
- elsif para =~ /^#{Mx[:lv_o]}[4-6]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/
- txt_obj={:txt =>$1}
- toc=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- texinfo_menu << toc.menu
- case para
- when /^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/
- n_menu+=1
- @submenu[n_menu]=[]
- when /^#{Mx[:lv_o]}5:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/
- n_submenu+=1
- @subsubmenu[n_menu]=[]
- @submenu[n_menu] << toc.menu
- when /^#{Mx[:lv_o]}6:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/
- n_submenu+=1
- @subsubmenu[n_submenu]=[]
- @subsubmenu[n_submenu] << toc.menu
- end
- else
- #para.gsub!(/\s*(?:<:?br>|<br \/>)\s*/,"\n#@row_break ")
- para.gsub!(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n")
- end
- end
- texinfo_menu.compact!
- texinfo_menu << "* Dublin Core::"
- @tex_file << texinfo_menu
- @tex_file << "* Index::\n" +
- "@end menu\n\n" +
- "@c %% 5\n\n"
- n_menu,n_submenu=0,0
- @@do_submenu,@@do_subsubmenu=1,1
- data.each do |para|
- txt_obj={:txt =>para}
- mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- case para
- when /^#{Mx[:lv_o]}1:/; mono.level1
- when /^#{Mx[:lv_o]}2:/; mono.level2
- when /^#{Mx[:lv_o]}3:/; mono.level3
- when /^#{Mx[:lv_o]}4:/;
- mono.level4
- n_menu+=1
- @@do_submenu,@@do_subsubmenu=1,1
- when /^#{Mx[:lv_o]}5:/;
- n_submenu+=1
- @@do_subsubmenu=1
- if @@do_submenu==1
- txt_obj={:txt =>@submenu[n_menu]}
- menu=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- para="#{menu.submenu}#{mono.level5}"
- @@do_submenu=0
- else mono.level5
- end
- when /^#{Mx[:lv_o]}6:/;
- if @@do_submenu==1
- txt_obj={:txt =>@submenu[n_menu]}
- menu=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- para="#{menu.subsubmenu}#{mono.level6}"
- @@do_subsubmenu=0
- else
- mono.level6
- end
- # when /^<!i1!>/
- # mono.indent1
- # when /^<!i2!>/
- # mono.indent2
- # when /<!:\s+/
- # mono.graphics
- # when /^\s*<!image\s+/
- # mono.image
- # when /\}image/
- # mono.png
- # when /\}http/
- # mono.http
- else
- if para !~/\S/
- para=nil
- else
- para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>')
- para
- end
- end
- #%case with endnotes
- para.gsub!(/\s*[0-8]\\+(\S+)?\s+/,' ') if para
- @tex_file << para if para
- end
- data=@tex_file
- end
- def numbering
- data=@data
- data=Texinfo_make.new(data,@md).number_titles
- #TOGGLE to SWITCH PARAGRAPH NUMBERING (ON & OFF)
- data=Texinfo_make.new(data,@md).number_paras \
- if @md.fns !~ /\.e[pdr]00/ \
- and @md.markup !~ /not_to/i
- end
- def number_titles
- data=@data
- @tex_file=[]
- input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input
- #input=/(num_top\s*=\s*(\d?))?/m.match(@md[:markup]) [2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input
- num_top=input.to_i
- t_no1=0; t_no2=0; t_no3=0; t_no4=0;
- no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3);
- data.each do |para|
- if @md.markup =~ /num_top/i \
- and para !~ /#{Rx[:meta]}/
- if para =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \
- and para !~ /<:\d-endnotes>/
- header=para[/<!h-(.+?)-!>/m, 1].gsub!(/-/m,'.')
- para.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/,
- "\\1 #{header} ")
- end
- elsif para =~ /<!h!>|<!h\d!>|<!h.+?!>|<!!h.+?!>/
- if para =~ /<!h-.+?-!>/
- para.gsub!(/<!h-(.+?)-!>/,'\1 ')
- end
- end
- @tex_file << para
- end
- data=@tex_file
- end
- def number_paras
- data=@data
- @tex_file=[]
- paranumber=0
- data.each do |para|
- if para =~/#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/ \
- and para !~ /#{Mx[:br_eof]}/
- parablock,paranum=/(.+?)#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/im.match(para)[1,2]
- do_duo=SiSU_Texinfo_format::DuoTex.new(parablock,paranum) ###is BUG
- para=do_duo.paraNum if parablock
- end
- @tex_file << para
- end
- data=@tex_file
- end
- def tail
- data=@data
- txt_obj={:txt =>''}
- tex=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj)
- data << tex.dublincore
- data << tex.tail
- end
- def output
- data=@data
- data.compact!
- data.each {|para| (@@filename_texinfo.puts para,"\n") if para}
- @@filename_texinfo.close
- end
- def makeinfo
- if @md.fns =~/\.(?:-|ssm\.)?sst$/
- m=/(.+?)\.([_-]?sst)$/.match(@md.fns)
- fnb,sfx=m[1],m[2]
- pwd=Dir.pwd
- case sfx
- when /(?:-|ssm\.)?sst$/
- @env=SiSU_Env::Info_env.new(@md.fns,@md.cmd)
- Dir.chdir(@env.path.texi)
- texinfo=SiSU_Env::System_call.new("#{fnb}.texinfo")
- texinfo.makeinfo
- end
- Dir.chdir(pwd)
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/texinfo_format.rb b/lib/sisu/v1/texinfo_format.rb
deleted file mode 100644
index 9563e22e..00000000
--- a/lib/sisu/v1/texinfo_format.rb
+++ /dev/null
@@ -1,520 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: texinfo formatting template
-
-=end
-module SiSU_Texinfo_format
- @@table_pg_break_counter=1
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Texinfo
- @@tex_backslash="\\\\"
- @@tex_1='\\\\~' #?? debug
- @@tabular="{tabular}"
- @@tex_pattern_margin_number="\\\\marginpar.+?\s+"
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- #@h_name =t_o[:h_name] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- p t_o.class
- p caller
- end
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def head
- t=Time.now
- year=t.year
- filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1]
- title=spec_char_string(@md.title)
- title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
- title.gsub!(/\$/,"\\$")
- title.gsub!(/[,]\s*/,' - ')
- if @md.subtitle
- subtitle=spec_char_string(@md.subtitle)
- subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
- subtitle.gsub!(/\$/,"\\$")
- subtitle.gsub!(/[,]\s*/,' - ')
- subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch
- end
- subtitle ||=''
- author=@md.author if @md.author
- author ||=''
- author.gsub!(/[\*]/,'') #if author
- v=SiSU_Env::Info_version.instance.get_version
- #(version @value{VERSION} #{v[:version]}, @value{UPDATED} #{v[:date]})
- head =<<WOK
-\\input texinfo @c -*-texinfo-*-
-@comment $Id$
-@comment %**start of header
-@setfilename #{@md.fnb}.info
-@settitle #{title} @value{VERSION}
-@syncodeindex pg cp
-@comment %**end of header
-@c %% 2
-@copying
-SiSU texinfo of #{title}
-
-Copyright @copyright{} #{year} #{author}.
-
-@quotation
-Copyright #{author}, generated by ``SiSU''
-@end quotation
-@end copying
-
-@dircategory SiSU Texinfo
-@direntry
-* sisu: SiSU texinfo file.
-@end direntry
-WOK
- if @md.subtitle
- titlepage=<<WOK
-@c %% 3
-@titlepage
-@title #{title} #{subtitle}
-@author #{author}
-@page
-@vskip 0pt plus 1filll
-@insertcopying
-@end titlepage
-@contents
-WOK
- else
- titlepage=<<WOK
-@c %% 3
-@titlepage
-@title #{title}
-@value{VERSION}, @value{UPDATED}
-@author #{author}
-@page
-@vskip 0pt plus 1filll
-@insertcopying
-@end titlepage
-
-@contents
-WOK
- end
- "#{head}#{titlepage}"
- end
- def topnode
- txt=spec_char_string(@txt)
- txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
- txt.gsub!(/\$/,"\\$")
- txt.gsub!(/[,]\s*/,' - ')
- "@c %% 4\n" +
- "@ifnottex\n" +
- "@node Top\n" +
- "@top #{txt}\n\n" +
- "@insertcopying\n" +
- "@end ifnottex\n\n" +
- "@menu\n"
- end
- def dublincore
- title=spec_char_string(@md.title) if @md.title
- subtitle=spec_char_string(@md.subtitle) if @md.subtitle
- full_title="#{title} - #{subtitle}" #dc
- author=spec_char_string(@md.author) if @md.author #dc
- subject=spec_char_string(@md.subject) if @md.subject #dc
- description=spec_char_string(@md.description) if @md.description #dc
- publisher=spec_char_string(@md.publisher) if @md.publisher #dc
- contributor=spec_char_string(@md.contributor) if @md.contributor #dc
- date=spec_char_string(@md.date) if @md.date #dc
- date_created=spec_char_string(@md.date_created) if @md.date_created #dc
- date_issued=spec_char_string(@md.date_issued) if @md.date_issued #dc
- date_available=spec_char_string(@md.date_available) if @md.date_available #dc
- date_valid=spec_char_string(@md.date_valid) if @md.date_valid #dc
- date_modified=spec_char_string(@md.date_modified) if @md.date_modified #dc
- type=spec_char_string(@md.type) if @md.type #dc
- format=spec_char_string(@md.format) if @md.format #dc
- identifier=spec_char_string(@md.identifier) if @md.identifier #dc
- source=spec_char_string(@md.source) if @md.source #dc
- language=spec_char_string(@md.language[:name]) if @md.language[:name] #dc
- #language_original=spec_char_string(@md.language_original[:name]) if @md.language_original[:name]
- relation=spec_char_string(@md.relation) if @md.relation #dc
- coverage=spec_char_string(@md.coverage) if @md.coverage #dc
- rights=spec_char_string(@md.rights) if @md.rights #dc
- full_title="Title: #{full_title}\n\n" if full_title #dc
- author="Author: #{author}\n\n" if author #dc
- subject="Subject: #{subject}\n\n" if subject #dc
- description="Description: #{description}\n\n" if description #dc
- publisher="Publisher: #{publisher}\n\n" if publisher #dc
- contributor="Contributor: #{contributor}\n\n" if contributor #dc
- date="Date: #{date}\n\n" if date #dc
- date_created="Date Created: #{date_created}\n\n" if date_created #dc
- date_issued="Date Issued: #{date_issued}\n\n" if date_issued #dc
- date_available="Date Available: #{date_available}\n\n" if date_available #dc
- date_valid="Date Valid: #{date_valid}\n\n" if date_valid #dc
- date_modified="Date Modified: #{date_modified}\n\n" if date_modified #dc
- format="Format: #{format}\n\n" if format #dc
- identifier="Identifier: #{identifier}\n\n" if identifier #watch #dc
- source="Source: #{source}\n\n" if source #dc
- language="Language: #{language}\n\n" if language #dc
- relation="Relation: #{relation}\n\n" if relation #dc
- coverage="Coverage: #{coverage}\n\n" if coverage #dc
- rights="Rights: #{rights}\n\n" if rights #dc
- "@node Dublin Core\n" +
- "@unnumbered Dublin Core\n" +
- "@cindex chapter, Dublin Core\n\n" +
- "#{full_title}" +
- "#{author}" +
- "#{subject}" +
- "#{description}" +
- "#{publisher}" +
- "#{contributor}" +
- "#{date}" +
- "#{date_created}" +
- "#{date_issued}" +
- "#{date_available}" +
- "#{date_valid}" +
- "#{date_modified}" +
- "#{format}" +
- "#{identifier}" +
- "#{source}" +
- "#{language}" +
- "#{relation}" +
- "#{coverage}" +
- "#{rights}" +
- "\n\n"
- end
- def tail
- "@c %% 6\n" +
- "@node Index\n" +
- "@unnumbered Index\n" +
- "@printindex cp\n\n" +
- "@bye"
- end
- def clean(para)
- para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>')
- para.gsub!(/\s*[,:]\s*/,' - ')
- para.gsub!(/<:#>/,'')
- para.strip!
- para
- end
- def menu
- para=clean(@txt)
- para=para.gsub(/@footnote\{.+?\}\s+/,'')
- "* #{para}::"
- end
- def level1
- @txt.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def level2
- @txt.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def level3
- @txt.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,"\\1 \\3\n\\2")
- #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,'\1 \3 \2')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def level4
- @txt.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def level5
- @txt.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def level6
- @txt.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@txt)
- nd=para.gsub(/@footnote\{.+?\}\s+/,'')
- para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @txt.gsub!(/.+/,"#{para}")
- end
- def submenu
- @txt=@txt.join("\n")
- @txt.gsub!(/[5]\\+~\S+/,'')
- para=clean(@txt)
- para="@menu\n#{para}\n@end menu\n\n"
- @txt.gsub!(/.+/m,"#{para}")
- end
- def subsubmenu
- @txt=@txt.join("\n")
- @txt.gsub!(/[6]\\+~\S+/,'')
- para=clean(@txt)
- para="@menu\n#{para}\n@end menu\n\n"
- @txt.gsub!(/.+/m,"#{para}")
- end
- def indent1
- @txt.gsub!(/<:i1>(.*)/,'\1')
- end
- def indent2
- @txt.gsub!(/<:i2>(.*)/,'\1')
- end
- def spec_char_string(txt) # special characters
- txt_obj={:txt =>txt}
- SiSU_Texinfo_format::Texinfo.new(@md,txt_obj).spec_char
- end
- def spec_char # special characters
- @txt.gsub!(/#{Mx[:br_eof]}/i,'')
- @txt.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)')
- @txt.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @txt.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>')
- @txt.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @txt.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- @txt.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- @txt.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- @txt.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- @txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- @txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- @txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- @txt.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- @txt.gsub!(/\\/,'\\backslash ')
- @txt.gsub!(/<:pb>/,'\\newpage')
- @txt.gsub!(/\\backslash copyright/,'\\copyright ')
- @txt.gsub!(/\^/,'\\wedge ')
- @txt.gsub!(/(\$)/,"\\$")
- @txt.gsub!(/\~/,'\\~')
- @txt.gsub!(/%/,"\\%")
- #if @txt !~ /^\s*<:image|\}:image\s/
- # @txt.gsub!(/_/,'\_')
- #end
- @txt.gsub!(/_(https?:\/\/)/,'\1')
- @txt.gsub!(/§/i,'\S')
- @txt.gsub!(/£/i,'\pounds')
- @txt.gsub!(/å/i,'\aa')
- @txt.gsub!(/æ/i,'\ae')
- @txt.gsub!(/ø/i,'\o')
- @txt.gsub!(/Å/i,'\AA')
- @txt.gsub!(/Æ/i,'\AE')
- @txt.gsub!(/Ø/i,'\O')
- @txt.gsub!(/<a href=".+?">/i,' ')
- @txt.gsub!(/<\/a>/i,' ')
- @txt.gsub!(/<:ee>/i,'')
- @txt.gsub!(/<!>/i,' ')
- @txt.gsub!(/<b>(.+?)<\/b>/,'\*\1\*')
- @txt.gsub!(/<i>(.+?)<\/i>/,'\/\1\/')
- @txt.gsub!(/<u>(.+?)<\/u>/,'\_\1\_')
- @txt.gsub!(/@/i,'@@')
- @txt.gsub!(/\{/,'@{'); @txt.gsub!(/\}/,'@}')
- #@txt.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @txt.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1')
- @txt.gsub!(/(?:&nbsp;|#{Mx[:nbsp]})+/,' ') # ~ character for hardspace
- @txt.gsub!(/&(\S+?);/,' ')
- @txt.gsub!(/&/,'<=and>')
- @txt.gsub!(/(\s+&\s+)/,' and ')
- @txt.gsub!(/(\&)/,"\\&")
- @txt.gsub!(/"(.+?)"/,"`\\1'") # open & close "
- @txt.gsub!(/\s+"/," `") # open "
- @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open "
- @txt.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close "
- @txt.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close "
- @txt.gsub!(/"(\.|,)/,"'") # close "
- @txt.gsub!(/\s+'/," `") # open '
- @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open '
- @txt.gsub!(/(<font.*?>|<\/font>)/,'')
- @txt.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1')
- @txt.gsub!(/(<sup>|<\/sup>)/,'')
- @txt
- end
- def longtable
- @end_table="\\end{longtable}"
- @row_break='\\\\\\'
- if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure
- no_of_cols,cols_width=$1,$2
- @@tableheader=1 if @txt =~ /#{Mx[:gr_o]}Th/i
- @w=cols_width.split(/;\s+/)
- @@number_of_cols=no_of_cols
- @colW=[]
- @colW << '{'
- @w.each do |x|
- col_w=x.gsub(/.+/,'l\|') #unless x.nil?
- @colW << "#{col_w}" if col_w
- end
- @colW << '}'
- @colW=@colW.join
- @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
- "\\begin{longtable}[hb]#@colW\n"
- @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table")
- end
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
- if @@tableheader==1
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
- tablefoot=para[/\<!f(.+?)!\>/,1]
- @txt.gsub!(/\<!f(.+?)!\>/,'')
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
- "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&")
- @txt.gsub!(/&>\s*$/,
- " #@row_break \\hline\\endhead #@row_break")
- @txt="#{@txt} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
- @@tableheader=0
- @@number_of_cols=0
- end
- else
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
- @txt.gsub!(/&>\s*$/," #@row_break")
- end
- end
- @txt
- end
- def scopedtable
- # some features related to headers have been incorporated in longtable
- # that are not included yet here, so until synced is broken on some
- # input files, work needs to be done if is to work as before
- @end_table="\\end{tabular}"
- @row_break='\\\\\\\\'
- @break_page="#@row_break\n#@row_break \n"
- if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui]
- no_of_cols,cols_width=$1,$2
- @w=cols_width.split(/;\s+/)
- @colW=[]
- @w.each do |x|
- col_w=((x.to_i*12)/100.00).to_s #unless x.nil?
- @colW << "p{#{col_w}cm}" if col_w
- end
- @@start_table="\\begin{tabular}{#@colW}\n"
- @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table")
- @@table_pg_break_counter=1
- end
- if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u
- if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape
- @txt =
- "\n\n#@end_table \n" +
- "#@break_page" +
- "#{@@start_table}\n"
- @@table_pg_break_counter=1
- else
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
- @@table_pg_break_counter+=1
- tablefoot=@txt[/\<!f(.+?)!\>/]
- @txt.gsub!(/\<!f(.+?)!\>/,'')
- end
- end
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
- @txt.gsub!(/&>\s*$/,"#@row_break")
- end
- @txt
- end
- def graphics
- dir=SiSU_Env::Info_env.new(@md.fns)
- @txt.gsub!(/<::\s+(\S+?)\s+>/i, #watch
- "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
- end
- def image
- dir=SiSU_Env::Info_env.new(@md.fns)
- width="100"
- width=@txt[/<:image.+?width=``(\d+)''.+?>/im,1]
- width=width.to_i*0.4
- @txt.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
- "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\2}}")
- @txt.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i,
- "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\1}")
- end
- def png
- # very messy clean up ! - work area, testing
- z=@txt[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
- image,w,x,y=z.scan(/\S+/)
- image.gsub!(/\\/,'')
- @txt.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
- end
- def http
- # very messy clean up ! - work area, testing
- z=@txt[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile !
- url=@txt[/((?:https?|file|ftp):\S+)/im,1]
- if @txt =~/\.(png|jpg|gif)/
- image,w,x,y=z.scan(/\S+/)
- image.gsub!(/\\/,'')
- width=200
- width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/
- width=width.to_i*0.8
- width=400 if width > 400
- c=z[/``(.+?)''/im,1]
- caption="{\\\\\\\ \n\\begin{scriptsize}#{c}\\end{scriptsize}&}" if c
- end
- if image
- dir=SiSU_Env::Info_env.new(@md.fns)
- @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile !
- "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}")
- else
- link=z[/(.+?)\\/im,1]
- @txt.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
- end
- end
- end
-end
-__END__
-watch title, might need full_title
diff --git a/lib/sisu/v1/texpdf.rb b/lib/sisu/v1/texpdf.rb
deleted file mode 100644
index eb3b943f..00000000
--- a/lib/sisu/v1/texpdf.rb
+++ /dev/null
@@ -1,797 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: LaTeX generation
-
-=end
-module SiSU_TeX
- require 'pstore'
- require "#{SiSU_lib}/defaults" # defaults.rb
- include SiSU_Viz
- require "#{SiSU_lib}/particulars" # particulars.rb
- include SiSU_Particulars
- require "#{SiSU_lib}/texpdf_format" # texpdf_format.rb
- include SiSU_TeX_Pdf
- @tex_file=@@tex_footnote_array=@@tex_col_w=[]
- @@tex_backslash ||="\\\\"
- @@tilde='\\\\\\~' #?? debug crazy
- @@tabular="{tabular}"
- @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
- @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
- @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/
- @@n=@@tableheader=@@rights=nil
- @@date ||=SiSU_Env::Info_date.new
- class Source #Songsheet #<SiSU_Param::MyFiles
- require 'pstore'
- require "#{SiSU_lib}/sysenv" # sysenv.rb
- include SiSU_Env
- include SiSU_Viz
- require "#{SiSU_lib}/dal" # dal.rb
- include SiSU_DAL
- include SiSU_TeX
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @md=@particulars.md
- @env=@particulars.env
- end
- def directories
- begin
- @dir_out_root=@env.path.output
- case @opt.fns
- when /\.(?:-|ssm\.)?sst$/
- SiSU_Env::SiSU_file.new(@md).mkdir
- Dir.mkdir(@env.path.tex) unless FileTest.directory?(@env.path.tex)
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- def read
- songsheet
- end
- def songsheet
- begin
- @md=@particulars.md
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF')
- tell.green_title_hi unless @opt.cmd =~/q/
- path=@env.url.output_tell
- if @opt.cmd =~/[MVv]/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_l]}")
- tell.flow
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}")
- tell.flow
- end
- @md=@particulars.md
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
- @dir_o="#{@env.path.output}/#{@opt.fnb}"
- directories
- #% needed needs to be reprogrammed !!!
- SiSU_Env::Info_skin.new(@md).select
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_TeX::Source::LaTeX_create.new(@particulars).songsheet
- dal_array=''
- pwd=Dir.pwd
- SiSU_TeX::Source::LaTeX_to_pdf.new(@md,@particulars.env).latexrun_selective
- Dir.chdir(pwd)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- unless @opt.cmd =~/[MV]/ #check maintenance flag
- texfiles=Dir["#{@env.path.tex}/#{@opt.fns}*"]
- texfiles.each do |f|
- if FileTest.file?(f)
- File.unlink(f)
- end
- end
- end
- @tex_file=@@tex_footnote_array=[]
- @@column_instruct=''
- @@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
- @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
- @@tex_col_w=[]
- @@n=@@tableheader=@@rights=nil
- @@date=SiSU_Env::Info_date.new
- @@flag={}
- $flag=1 #remove at some stage
- SiSU_Env::Create_file.new(@opt.cmd,@opt.fns).param_instantiate
- end
- end
- private
- class LaTeX_to_pdf #<Songsheet
- require 'fileutils'
- include FileUtils #::Verbose
- @@n_lpdf||=0 #change
- def initialize(md,env)
- @md,@env=md,env
- end
- def latex_do(texfilename,papersize)
- @texfilename=texfilename
- @@n_lpdf=@@n_lpdf+1
- tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->")
- tell.dark_grey_title_hi if @md.cmd =~/[MVv]/
- tex_fn_base=@texfilename.gsub(/\.tex$/,'')
- cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.cmd)
- tell=SiSU_Screen::Ansi.new(@md.cmd)
- tell.grey_open unless @md.cmd =~/q/
- if "#{tex_fn_base}" =~/\w+/ \
- and "#{papersize}" =~/\w+/
- 2.times { |i| cmd.latex2pdf(@md,papersize) }
- end
- tell.p_off unless @md.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->")
- tell.dark_grey_title_hi if @md.cmd =~/[MVv]/
- cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd)
- tell.grey_open
- if "#{tex_fn_base}" =~/\w+/ \
- and "#{papersize}" =~/\w+/
- 2.times { |i| cmd.latex2pdf(@md,papersize) }
- end
- tell.p_off unless @md.cmd =~/q/
- pwd=Dir.pwd
- portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"
- landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf"
- case papersize
- when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5]
- when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5]
- when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter]
- when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal]
- else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- end
- if FileTest.file?(portrait_pdf)
- cp(portrait_pdf,"#@dir_sisu/#{@md.fnb}/#{pdf_p}")
- rm(portrait_pdf)
- else p "here #{__FILE__} #{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.cmd.inspect =~/M/
- end
- if FileTest.file?(landscape_pdf)
- cp(landscape_pdf,"#@dir_sisu/#{@md.fnb}/#{pdf_l}")
- rm(landscape_pdf)
- else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.cmd.inspect =~/M/
- end
- tell=SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)')
- tell.generic_number unless @md.cmd =~/q/
- end
- def latexrun_selective
- begin
- pwd=Dir.pwd
- Dir.chdir(pwd) #watch
- @tex_f_no=0
- info={}
- if FileTest.file?(@env.source_file_with_path)
- @md.papersize_array.each do |ps|
- if @md.fns =~/\.(?:-|ssm\.)?sst$/
- @dirout=SiSU_Env::Info_env.new(@md.fns)
- case @md.fns
- when /\.(?:-|ssm\.)?sst$/
- if FileTest.directory?(@env.path.tex)==true
- Dir.chdir(@env.path.tex)
- @dir_sisu=@dirout.path.output
- texfile=@md.fns.gsub(/$/,".#{ps}.tex")
- texfile=texfile.gsub(/~/,'-')
- if File.exist?(texfile) \
- and File.size(texfile) > 0
- @tex_f_no+=1
- latex_do(texfile,ps)
- else
- puts "\tzero file size #{@env.path.tex}/#{texfile}"
- end
- end
- end
- end
- end
- outputdir="#@dir_sisu/#{@md.fnb}"
- case @md.papersize_array[0] #default pdf
- when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5]
- when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5]
- when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter]
- when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal]
- else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4]
- end
- if FileTest.file?("#{outputdir}/#{pdf_p}")
- system("
- cd #{outputdir}
- rm portrait.pdf
- ln -s #{pdf_p} portrait.pdf
- ")
- end
- if FileTest.file?("#{outputdir}/#{pdf_l}")
- system("
- cd #{outputdir}
- rm landscape.pdf
- ln -s #{pdf_l} landscape.pdf
- ")
- end
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped")
- tell.warn
- end
- lst=Dir["*.{aux,log,out}"]
- lst.each {|file| File.unlink(file)} if lst
- #touch("#{@dir_pdf}index.html") #correct @dir_pdf appears to contain slash / and should not
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- end
- class LaTeX_create
- #include SiSU_Param
- @@tex_backslash ||="\\\\"
- @@tilde='\\\\\\~' #?? debug crazy
- @@tex_head={
- 'a4'=>{:p => nil, :l => nil},
- 'a5'=>{:p => nil, :l => nil},
- 'b5'=>{:p => nil, :l => nil},
- 'letter'=>{:p => nil, :l => nil},
- 'legal'=>{:p => nil, :l => nil},
- 'book'=>{:p => nil, :l => nil}
- }
- @@flag_alt,@@flag_group,@@flag_code=false,false,false
- @@dp,@@prefix_b=nil,nil
- def initialize(particulars)
- @particulars=particulars
- @md=@particulars.md
- @env=@particulars.env
- @data=@particulars.dal_array # dal file drawn here
- @st={ :tex=>{} }
- @tex=SiSU_TeX_Pdf::Use_TeX.new(@md)
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- vz=SiSU_Env::Get_init.instance.skin
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off == true
- true
- else false
- end
- end
- def songsheet
- begin
- data=@data
- @@tex_footnote_array=[]
- @@rights=nil
- tell=SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape")
- tell.txt_grey unless @md.cmd =~/q/
- if @md.rights
- use=@md.rights.dup #dup is necessary, else contents of :rights changed
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,use)
- copymark=if @md.author_copymark; '{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
- else ''
- end
- copymark='Copyright {\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
- copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
- @@rights||="\n #{@@tex_backslash*2}[3]\\ \\linebreak #{copyright}"
- end
- if @md.prefix_b
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.prefix_b)
- prefix_b=sp_char.special_characters_safe
- @@prefix_b="\n #{@@tex_backslash*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b
- end
- data=pre(data)
- data=footnote(data)
- if @md.flag_tables
- data=tables(data)
- end
- ocn=if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- false
- else true
- end
- data=number_paras(data,ocn)
- data=markup(data)
- output(data)
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- protected
- def pre(data)
- @tex_file=[]
- data.each do |para|
- # DEBUG 2003w16 this is a kludge, because i could not get parameters
- # from param, Sort out ... revert to more elegant solution
- # even more of a kludge as had to insert newlines where code is used not satisfactory, think about
- para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/
- para=if para =~/#{Mx[:br_nl]}|\n/; para.split(/#{Mx[:br_nl]}|\n/)
- else para
- end
- if para.class == String
- @md.flag_tables=true if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para)
- @tex_file << sp_char.special_characters
- elsif para.class == Array
- para.each do |grp|
- @md.flag_tables=true if grp =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,grp)
- @tex_file << sp_char.special_characters
- end
- end
- end
- data=@tex_file.delete_if {|x| x =~/^\s*#{Rx[:meta]}/}
- @tex_file
- end
- def footnote(data)
- @tex_file=[]
- data.each do |para|
- # EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch.
- if para =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/ # note escape not necessary in front of ~ has implications for many other matches #debug note
- para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ") #removed space before \\footnote 2004w21, watch
- para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes
- para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes
- end
- @tex_file << para
- end
- @tex_file
- end
- def tables_hash(md,para)
- @block={}
- @para=para
- @md.papersize_array.each do |ps|
- @@tableheader={ ps => { :p => 0, :l => 0 }}
- para,para_p=@para.dup,@para.dup #visit
- txt_obj={:txt =>para,:paper_size =>ps}
- format_l=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj)
- txt_obj={:txt =>para_p,:paper_size =>ps}
- format_p=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj)
- @block[ps]={
- :l => format_l.longtable_landscape,
- :p => format_p.longtable_portrait
- }
- end
- @block
- end
- def tables(data)
- @tex_file=[]
- data.each do |para|
- @tex_file << if para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T/u
- tables_hash(@md,para) #Hash result
- else para
- end
- end
- @tex_file
- end
- def enclose(para,type='')
- para.strip!
- para=if type =~/code/; para
- elsif para !~/(\\begin\{tabular\}.*|\\end\{tabular\}|&|#{@@tex_backslash*2})\s*$/ #check
- para.gsub!(/(.+)/m,"\n#{@tex.skip_small} \\1 #{@tex.skip_small}\n")
- else para
- end
- end
- def markup_common(para)
- tex_f=nil
- txt_obj={:txt =>para}
- mono=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj)
- if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ \
- or @@flag_alt
- if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/
- @lineone=case para
- when /#{Mx[:gr_o]}(?:alt|verse|group)#{Mx[:gr_c]}/; para
- when /#{Mx[:gr_o]}code#{Mx[:gr_c]}/; "#{@tex.paraskip_small} \\begin{scriptsize} " + para
- else 'error' #should never occur
- end
- end
- if para =~/<=curly/ #takes care of escaped curly braces, expand
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para)
- para=sp_char.special_characters_curly(para)
- end
- regx=/#{Mx[:gr_o]}((?:code|alt|verse|group)(?:-end)?)#{Mx[:gr_c]}/m
- x=nil
- x=regx.match(para)[1] if para =~regx
- para.gsub!(/\n#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}\n/m,'')
- para=enclose(para,'code') unless para =~/^$/
- if x =~/(?:alt|verse|group)/; @@flag_alt=true
- if x =~/group/; @@flag_group=true
- end
- elsif x =~/code/; @@flag_alt,@@flag_code=true,true
- elsif @@flag_alt
- if para =~ /(?:https?|file|ftp)/m
- txt_obj={:txt =>para,:paper_size =>'a4'}
- para=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http
- end
- @group_collect << para #<< "\n\n"
- end
- if x =~/(?:code|alt|verse|group)-end/m
- regx=/(\\+marginpar\{\\+begin\{tiny\}\d+\\+end\{tiny\}\})/
- y=if para =~regx
- regx.match(para)[1]
- else ''
- end
- para.gsub!(regx,'')
- group_collect=[]
- group_collect << '\begin{footnotesize} ' unless @@flag_code
- @group_collect.each do |x|
- x.gsub!(/(<:\S+>|#{Mx[:id_o]}.*?#{Mx[:id_c]}|#{Mx[:tc_o]}.*?#{Mx[:tc_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #Mx fix
- x=x.split(/ \\\\ /)
- group_collect << x
- end
- group_collect << ' \end{footnotesize} ' unless @@flag_code
- @group_collect=group_collect.flatten
- @lineone.gsub!(/(<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ')
- insert=[]
- insert=if para =~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/m
- insert << y + @lineone << @group_collect << ' \end{scriptsize}' << " #{@tex.paraskip_normal}"
- else insert << y + @lineone << @group_collect
- end
- para.gsub!(/(<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ')
- @@flag_alt,@@flag_group,@@flag_code=false,false,false
- @group_collect=[]
- tex_f=insert.flatten
- end
- para=tex_f
- else
- case para
- when /^#{Mx[:lv_o_1]}/; mono.level1
- when /^#{Mx[:lv_o_2]}/; mono.level2
- when /^#{Mx[:lv_o_3]}/; mono.level3
- when /^#{Mx[:lv_o_4]}/; mono.level4
- when /^#{Mx[:lv_o_5]}/; mono.level5
- when /^#{Mx[:lv_o_6]}/; mono.level6
- when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; mono.indent($1)
- when /<:=/; mono.symbol_graphic #watch
- when /^\s*<:image\s+/; mono.image
- when /#{Mx[:lnk_c]}image/; mono.png
- else
- para.strip!
- para=enclose(para) unless para =~/^$/
- end
- para.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \\\\\\\\ ') #% tread with care
- para.gsub!(/(\.#{@@tilde}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
- #para.gsub!(/(.#{@@tilde}(?:\\~\S+)?\s*|<:\S+>|<!.*?!>|<!>)/,' ') #KEEP reference, problem escaping open curly braces \{
- if para =~/<=curly/ #takes care of escaped curly braces, expand
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para)
- para=sp_char.special_characters_curly(para)
- end
- para
- end
- if para =~ /(?:https?|file|ftp)/
- para=if para !~/\.(?:png|jpg|gif)/
- txt_obj={:txt =>para,:paper_size =>'a4'}
- SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http
- else
- @block={}
- @md.papersize_array.each do |ps|
- txt_obj={:txt =>para,:paper_size =>ps}
- image=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http
- @block[ps]={
- :l => image,
- :p => image
- }
- end
- @block
- end
- end
- para
- end
- def markup(data)
- @tex_file=[]
- md={}
- #% document headers watch special characters in title & subtitle: glark "\{\{~(sub)?title.+?[$&%#_\{\}]" *.(lm|er)??
- home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
- title=@md.title.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
- subtitle=@md.subtitle.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') if @md.subtitle #no line splitting in heading neither html nor latex
- @md.papersize_array.each do |ps|
- txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'portrait'}
- orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj)
- txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'landscape'}
- orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj)
- @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation
- @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation
- end
- @tex_file <<<<WOK
-#{@tex.header}#{@tex.footer}
-\\tolerance=300
-\\clubpenalty=300
-\\widowpenalty=300
-\\makeatother
-\\makeatother
-\\chardef\\txtbullet="2022
-\\chardef\\tilde="7E
-% \\sloppy
-\\begin{document}
-WOK
- sisu_rc_footnote=if @md.sc_info; @tex.doc_sc_info_footnote_full
- else @tex.doc_sc_info_footnote_brief
- end
- @copymark='' #check and remove as now is superflous
- x={}
- txt_obj={:title =>@md.title,:subtitle =>@md.subtitle}
- x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_landscape
- x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_portrait
- @tex_file << x
- x=nil
- if @md.author
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.author)
- author=sp_char.special_characters
- @tex_file << if @md.author_home
- <<WOK
-
-\\author{\\href{#{@md.author_home}}{#@copymark \\textnormal{#{author}}}}
-WOK
- else "\n\\author{#@copymark \\textnormal{#{author}}}"
- end
- end
- @tex_file << unless @md.fnb =~/^mail\s*$/; "\n\\date{\\begin{footnotesize} copy @ #{@tex.site} \\end{footnotesize} #{sisu_rc_footnote}}"
- else "\\date"
- end
- @tex_file <<<<WOK
-\\pagenumbering{roman}\\maketitle
-\\pagestyle{fancy}
-WOK
- #@tex_file << @tex.newpage #newpage clearpage depending on portrait or landscape
- @tex_file << "\\newpage\n"
- @tex_file << @@rights if @md.rights #if @orientation =~/landscape/
- @tex_file << @@prefix_b if @md.prefix_b
- @tex_file << @tex.sisu_rights
- @tex_file << if @md.sc_info; @tex.doc_sc_info
- else @tex.doc_no_sc_info
- end
- @tex_file << @tex.manifest_info
- x={}
- x[:l] =<<WOK
-#{@tex.newpage('landscape')}
-\\pagestyle{fancy}
-\\tableofcontents
-#{@tex.newpage('landscape')}
-\\pagenumbering{arabic}
-#{@tex.paraskip_normal}
-#{@tex.newpage('landscape')}
-WOK
- x[:p] =<<WOK
-#{@tex.newpage('portrait')}
-\\pagestyle{fancy}
-\\tableofcontents
-#{@tex.newpage('portrait')}
-\\pagenumbering{arabic}
-#{@tex.paraskip_normal}
-#{@tex.newpage('portrait')}
-WOK
- @tex_file << x
- x=nil
- @group_collect=[]
- data.each do |para| #% case follows with levels 1-6 indents & graphics
- if para.class == String
- para=markup_common(para)
- elsif para.class == Hash
- if ( para['a4'] or para['a5'] or para['b5'] \
- or para['letter'] or para['legal'])
- @md.papersize_array.each do |ps|
- if para[ps]
- if (para[ps][:p] and para[ps][:l])
- para[ps]={
- :p => markup_common(para[ps][:p]),
- :l => markup_common(para[ps][:l])
- }
- else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- end
- elsif (para[:p] and para[:l])
- para = {
- :p => markup_common(para[:p]),
- :l => markup_common(para[:l])
- }
- else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- @tex_file << para
- end
- @tex_file << "\n\\newpage\n" # was \\pagebreak\n
- @md.subtitle_tex=@md.subtitle.dup if @md.subtitle
- # kludge ... look again later
- @tex_file << if @md.doc_skin !~/skin_mail/; @tex.doc_tail
- else @tex.mail_tail
- end
- if defined? @md.lnk \
- and @md.lnk
- @md.lnk.each do |l|
- if l[:say]
- url=%<#{l[:url]}>
- url.gsub!(/(?:\\)*([$&~%_#}{^])/,"\\\\\\1") #latex special chars
- s_lnk=l[:say]
- s_lnk.gsub!(/\s*(#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]})\s*/,' \\\\\\\\ ')
- s_lnk.gsub!(/(?:\\)*([$&~%_#}{^])/,"\\\\\\1") #latex special chars
- if url !~/^\.(\.)?\//
- s_lnk_url=%<\\begin{scriptsize}\\url{#{url}}\\end{scriptsize}> # note this bit of dereferencing magic
- else
- url.gsub!(/\.\.\//,'')
- s_lnk_url="(#{@tex.site}) \\\\\n" + ' ' +
- "\\begin{scriptsize}" +
- %<\\url\{#{@vz.url_root_http}/#{url}\}> + # note this bit of dereferencing magic
- "\\end{scriptsize}"
- end
- @tex_file << " #{s_lnk} \\\\\n #{s_lnk_url} \n" unless @md.doc_skin =~/skin_mail/
- s_lnk=s_lnk_url=nil
- end
- end
- end
- @tex_file << " #{@tex.sitename} home: \\\\
-\\begin{bfseries}#{@tex.site}\\end{bfseries}
-"
- #Stamp.stamp #removed 200408 but watch
- #% code for inclusion of addresses of promulgating authority
- @st[:tex][:stmp]||=@md.stmpd
- stamp=@st[:tex][:stmp] if @st[:tex][:stmp]
- if stamp
- use=stamp.gsub(/\n/,"#{@@tex_backslash*2}\n")
- @tex_file << "\n\\newpage\n"
- @tex_file << "\\section*" +
- "{#{@tex.owner_chapter}}\n" +
- "\\addcontentsline{toc}" +
- "{section}{#{@tex.owner_chapter}}\n"
- @tex_file << "#{use}\n"
- @tex_file << @@rights if @@rights
- end
- @tex_file << "\n\\end{document}"
- end
- def number_paras_numbering(para,ocn)
- if para =~/#{Mx[:id_o]}\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ \
- and para !~/\\end\{longtable\}|#{Mx[:br_eof]}/ #catch <!TZ!>
- m=/(.+?)#{Mx[:id_o]}\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m
- parablock=para[m,1]
- paranum=if ocn; para[m,2]
- else ''
- end
- paranum = '' if paranum.to_i == 0
- txt_obj={:txt =>parablock,:ocn =>paranum}
- do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj)
- para=do_duo.para_num if parablock
- elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #2005 this is added for tables, rationalise
- m=/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m
- paranum=para[m,1]
- para.gsub!(/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- para="\\marginpar{\\begin{tiny}#{paranum}\\end{tiny}}" + para
- elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ #extra 2005 this is added for tables, rationalise
- m=/#{Mx[:id_o]}~(\d+);[oh]\d+;\w\d+#{Mx[:id_c]}/m
- paranum=para[m,1]
- para.gsub!(/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/,'')
- para="\\marginpar{\\begin{tiny}#{paranum}\\end{tiny}}" + para
- elsif para =~/\\end\{longtable\}/ #catch <!TZ!>
- para.gsub!(/#{Mx[:id_o]}\\~\d+#{Mx[:id_c]}|#{Mx[:id_o]}\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- para.gsub!(/#{Mx[:id_o]}\\~\d+#{Mx[:id_c]}|#{Mx[:id_o]}\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/,'') #extra
- end
- para
- end
- def number_paras(data,ocn)
- tex_file=[]
- data.each do |para|
- para=if para.class == Hash
- if ( para['a4'] or para['a5'] or para['b5'] \
- or para['letter'] or para['legal'])
- @para={}
- @md.papersize_array.each do |ps|
- if para[ps]
- if (para[ps][:p] and para[ps][:l])
- @para[ps]={
- :p => number_paras_numbering(para[ps][:p],ocn),
- :l => number_paras_numbering(para[ps][:l],ocn)
- }
- else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- end
- elsif (para[:p] and para[:l])
- @para = {
- :p => number_paras_numbering(para[:p],ocn),
- :l => number_paras_numbering(para[:l],ocn)
- }
- else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/
- end
- else #elsif para.class == String
- @para=number_paras_numbering(para,ocn)
- end
- tex_file << @para
- end
- tex_file
- end
- def output(array)
- array.flatten!
- array.compact!
- @array=array
- fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~
- @md.papersize_array.each do |ps|
- filename_tex_landscape=File.new("#{@env.path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+')
- filename_tex_portrait=File.new("#{@env.path.tex}/#{fns_l}.#{ps}.tex",'w+')
- filename_tex_portrait << @@tex_head[ps][:p]
- filename_tex_landscape << @@tex_head[ps][:l]
- array.each do |para|
- case para
- when String
- para.gsub!(/^\s+/,'')
- if para !~/\A\s*\Z/
- filename_tex_portrait.puts para,"\n"
- filename_tex_landscape.puts para,"\n"
- end
- when Hash
- if para[ps] and (para[ps][:p] and para[ps][:l])
- para[ps][:p].gsub!(/^\s+/,'') if para[ps][:p]
- para[ps][:l].gsub!(/^\s+/,'') if para[ps][:l]
- if para[ps][:p] !~/\A\s*\Z/
- filename_tex_portrait.puts para[ps][:p],"\n"
- end
- if para[ps][:l] !~/\A\s*\Z/
- filename_tex_landscape.puts para[ps][:l],"\n"
- end
- elsif (para[:p] and para[:l])
- para[:p].gsub!(/^\s+/,'') if para[:p]
- para[:l].gsub!(/^\s+/,'') if para[:l]
- if para[:p] !~/\A\s*\Z/
- filename_tex_portrait.puts para[:p],"\n"
- end
- if para[:l] !~/\A\s*\Z/
- filename_tex_landscape.puts para[:l],"\n"
- end
- else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/
- end
- end
- end
- array=@array
- filename_tex_portrait.close
- filename_tex_landscape.close
- end
- @@tex_head={
- 'a4'=>{:p => nil, :l => nil},
- 'a5'=>{:p => nil, :l => nil},
- 'b5'=>{:p => nil, :l => nil},
- 'letter'=>{:p => nil, :l => nil},
- 'legal'=>{:p => nil, :l => nil},
- 'book'=>{:p => nil, :l => nil}
- }
- array=[]
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/texpdf_format.rb b/lib/sisu/v1/texpdf_format.rb
deleted file mode 100644
index 9689eccc..00000000
--- a/lib/sisu/v1/texpdf_format.rb
+++ /dev/null
@@ -1,1556 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: LaTeX formatting template, unicode utf-8 version, used for pdf
-
-=end
-module SiSU_TeX_Pdf
- @@table_pg_break_counter=1
- include SiSU_Viz
- class Format_text_object
- require 'iconv'
- require "#{SiSU_lib}/defaults"
- attr_accessor :string,:string1,:orientation,:url,:dir,:tex
- @@sys=SiSU_Env::System_call.new
- @@tex_backslash="\\\\"
- @@tilde='\\\\\\~' #?? debug crazy
- @@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/
- @@tableheader={
- 'a4' => { :p => 0, :l => 0 },
- 'a5' => { :p => 0, :l => 0 },
- 'b5' => { :p => 0, :l => 0 },
- 'letter' => { :p => 0, :l => 0 },
- 'legal' => { :p => 0, :l => 0 }
- }
- @@sys=SiSU_Env::System_call.new
- @@dp=nil
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- @title =t_o[:title] || nil
- @subtitle =t_o[:subtitle] || nil
- @ps =t_o[:paper_size] || nil
- @ocn =t_o[:ocn] || nil
- @words =t_o[:words] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- p t_o.class
- p caller
- end
- if defined? @md.image \
- and @md.image =~/center/
- @center_begin,@center_end='\begin{center}','\end{center}'
- else @center_begin,@center_end='',''
- end
- @start_table=''
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @tx=SiSU_Env::Get_init.instance.tex
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
- end
- def longtable_landscape
- @end_table='\end{longtable}'
- @row_break='\\\\\\'
- if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u]
- no_of_cols,cols_width,ocn=$1,$2,$3
- tw=case @ps
- when /a4/i; @tx.a4.landscape.w #European default, SiSU default
- when /letter/i; @tx.letter.landscape.w #U.S. default
- when /legal/i; @tx.legal.landscape.w #U.S. alternative
- when /book|b5/i; @tx.b5.landscape.w #book default - larger
- when /a5/i; @tx.a5.landscape.w
- else @tx.a4.landscape.w #default currently A4
- end
- textwidth=(tw.to_i/2) - 24
- @@tableheader[@ps][:l]=1 if @txt =~/#{Mx[:gr_o]}Th/
- w=cols_width.split(/;\s*/)
- @@number_of_cols=no_of_cols ||=@@number_of_cols
- @colW=[]
- @colW << '{'
- w.each do |x|
- x.strip!
- x=(x.to_i * textwidth)/100
- col_w=x.to_s # x.gsub(/.+/,'l\|') #unless x.nil?
- @colW << "p{#{col_w}mm}" if col_w
- end
- @colW << '}'
- @colW=@colW.join
- @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
- "\\begin{tiny}\n\\begin{longtable}#@colW\n"
- @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table")
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}")
- end
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
- if @@tableheader[@ps][:l] == 1
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u
- tablefoot=@txt[/\<!f(.+?)!\>/,1]
- @txt.gsub!(/\<!f(.+?)!\>/,'')
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&')
- @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break")
- @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
- @@tableheader[@ps][:l]=0
- end
- else
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&')
- @txt.gsub!(/&\s*$/," #@row_break")
- end
- end
- @txt=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @txt
- else @txt
- end
- end
- def longtable_portrait
- @end_table='\end{longtable}'
- @row_break='\\\\\\'
- if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u]
- no_of_cols,cols_width,ocn=$1,$2,$3
- tw=case @ps
- when /a4/i; @tx.a4.portrait.w #European default, SiSU default
- when /letter/i; @tx.letter.portrait.w #U.S. default
- when /legal/i; @tx.legal.portrait.w #U.S. alternative
- when /book|b5/i; @tx.b5.portrait.w #book default - larger
- when /a5/i; @tx.a5.portrait.w
- else @tx.a4.portrait.w #default currently A4
- end
- textwidth=tw.to_i - 20
- @@tableheader[@ps][:p]=1 if @txt =~/#{Mx[:gr_o]}Th/
- w=cols_width.split(/;\s*/)
- @@number_of_cols=no_of_cols ||=@@number_of_cols
- @colW=[]
- @colW << '{'
- w.each do |x|
- x.strip!
- x=(x.to_i * textwidth)/100 #x=(x.to_i/100.0 * 160)
- col_w=x.to_s # x.gsub(/.+/,'l\|') #unless x.nil?
- @colW << "p{#{col_w}mm}" if col_w
- end
- @colW << '}'
- @colW=@colW.join
- @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
- "\\begin{tiny}\n\\begin{longtable}#@colW\n"
- @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table)
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}")
- end
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
- if @@tableheader[@ps][:p] == 1
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u
- tablefoot=@txt[/\<!f(.+?)!\>/,1]
- @txt.gsub!(/\<!f(.+?)!\>/,'')
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&')
- @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break")
- @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
- @@tableheader[@ps][:p]=0
- end
- else
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&')
- @txt.gsub!(/&\s*$/," #@row_break")
- end
- end
- @txt=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @txt
- else @txt
- end
- end
- def scopedtable
- # some features related to headers have been incorporated in longtable that are not included yet here,
- # so until synced is broken on some input files, work needs to be done if is to work as before
- @end_table="\\end{tabular}"
- @row_break='\\\\\\\\'
- @break_page="#@row_break\n#@row_break \n"
- if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/u]
- no_of_cols,cols_width=$1,$2
- @w=cols_width.split(/;\s*/)
- @colW=[]
- @w.each do |x|
- col_w=((x.to_i*12)/100.00).to_s #unless x.nil?
- @colW << "p{#{col_w}cm}" if col_w
- end
- @start_table="\\begin{tabular}{#@colW}\n"
- @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#@start_table}")
- end
- if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table")
- @@table_pg_break_counter=1
- end
- if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u
- if @@table_pg_break_counter == 28 # taken from 34 ideal for portrait to 28 which suits landscape
- @txt="\n\n#@end_table \n#@break_page#@start_table\n"
- @@table_pg_break_counter=1
- else
- @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
- @@table_pg_break_counter+=1
- tablefoot=@txt[/\<!f(.+?)!\>/,1]
- @txt.gsub!(/\<!f(.+?)!\>/,'')
- end
- end
- if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u
- @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u,"\\1&")
- @txt.gsub!(/&\s*$/,"#@row_break")
- end
- @txt
- end
- def heading_major(para,lev) #\emph{
- title=@md.title
- para.strip! if para
- para.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1')
- cont_ln=para.dup
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{Mx[:lv_o]}#{lev}:\S*?#{Mx[:lv_c]}\s*/,'')
- if para =~/\\[Ff]ootnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
- para.gsub!(/(#{@md.lev}.*)\n?$/m, #apparently not used @md.lev does not exist
- "\\part*{\\1}
-\\addcontentsline{toc}{section}{#{cont_ln}}
-\\markboth{#{title}}\n") if (para !~/#{Mx[:lv_o]}#{lev}:/)
- para.gsub!(/^#{Mx[:lv_o]}#{lev}:\S*?#{Mx[:lv_c]}\s*(.*)\n?$/m,
- "\\part*{\\1}
-\\addcontentsline{toc}{section}{#{cont_ln}}
-\\markboth{#{title}}\n")
-para
- end
- def level1
- heading_major(@txt,1)
- end
- def level2
- heading_major(@txt,2)
- end
- def level3
- heading_major(@txt,3)
- end
- def level4
- @txt.strip! if @txt
- @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1')
- cont_ln=@txt.dup
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{@@tex_backslash*2}/,"#{@@tex_backslash*4}") # added w42
- cont_ln.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- title=@md.title
- @txt.gsub!(/#{@md.lv4}\s+(#{@md.lv4})/m,'\1')
- if @txt =~/#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|<:4-endnotes>/
- # watch exclusion removes endnotes marker from pdf 2003w03
- @txt.gsub!(/.+/m,'')
- end
- if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
- if @txt !~/#{Mx[:lv_o]}4:/
- @txt.gsub!(/(#{@md.lv4}.*)\n?$/m,"\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsection}{#{cont_ln}}
-\\markright{#{title}}")
- else
- @txt.gsub!(/^\s*#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.*)?\n?$/m,"\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsection}{#{cont_ln}}
-\\markright{#{title}}")
- end
- @txt.gsub!(/#{@md.lv4}\s*(.marginpar)/m,'\1')
- end
- def level5
- # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46
- @txt.strip! if @txt
- @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1')
- cont_ln=@txt.dup
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
- @txt.gsub!(/#{@md.lv5}\s+(#{@md.lv5})/m,'\1')
- if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
- if @txt !~/#{Mx[:lv_o]}5:/
- @txt.gsub!(/(#{@md.lv5}.*?)\n?$/m,"\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\
-}")
- else
- @txt.gsub!(/^\s*#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m,
- "\\subsubsection*{\\1}
-\\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\
-}")
- end
- @txt.gsub!(/#{@md.lv5}\s*(.marginpar)/m,'\1')
- end
- def level6
- # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46
- @txt.strip! if @txt
- @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1')
- cont_ln=@txt.dup
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- @txt.gsub!(/#{@md.lv6}\s+(#{@md.lv6})/m,'\1')
- if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
- end
- @txt.gsub!(/(#{@md.lv6}.*)\n?$/m,
- "\\subsubsection*{\\1}") if (@txt !~/#{Mx[:lv_o]}6:/)
- @txt.gsub!(/^\s*#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m,
- '\subsubsection*{\1}')
- @txt.gsub!(/#{@md.lv6}\s*(.marginpar)/m,'\1')
- #end BUGWATCH
- end
- def indent(lev)
- indent=case lev
- when /1/; '0mm'
- when /2/; '10mm'
- when /3/; '20mm'
- when /4/; '30mm'
- when /5/; '40mm'
- when /6/; '50mm'
- when /7/; '60mm'
- when /8/; '70mm'
- when /9/; '80mm'
- end
- @txt.gsub!(/#{Mx[:pa_o]}:i#{lev}#{Mx[:pa_c]}\s*(.*)/m,
- "\\begin{ParagraphIndent}{#{indent}}\\1
-\\end{ParagraphIndent}}")
- end
- def symbol_graphic
- dir=SiSU_Env::Info_env.new(@md.fns)
- image='c_' + /<:=\s*(\S+?)\s*>/m.match(@txt).captures.join + '.png' #watch
- if FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- @txt.gsub!(/<:=\s*(\S+?)\s*>/,
- "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}")
- tell.error2 unless @md.cmd =~/q/
- @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile !
- end
- end
- def image
- dir=SiSU_Env::Info_env.new(@md.fns)
- image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@txt).captures
- width=m[1] || '100'
- width=width.to_i*0.4
- image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
- dir.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
- dir.path.image_source_remote_tex
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- dir.path.image_source_tex
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}")
- tell.error2 unless @md.cmd =~/q/
- nil
- end
- if image_source
- @txt.gsub!(/#{Mx[:lnk_o]}\s*((?:https?|file|ftp):\/\/\S+)\s+(\S+).+?#{Mx[:lnk_c]}/,
- @center_begin + "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{image_source}/\\2}}" + @center_end )
- @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,
- @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end )
- else @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}')
- end
- end
- def png #fc missing image check
- dir=SiSU_Env::Info_env.new(@md.fns)
- # messy clean up
- z=@txt[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @txt =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile !
- if z #debug 2004w14
- image=z[/(\S+?\.(?:png|jpg|gif)\b)/m]
- image.gsub!(/\\/,'')
- width=if z =~ /\d+x\d*/
- w=(z[/(\d+)x\d*/,1]).to_i
- w*0.8
- else '100' #revisit, is bug for small images/icons
- end
- width='380' if width.to_i > 380
- c=z[/``(.+?)''/m]
- end
- hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace
- caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c
- image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
- dir.path.image_source_local_tex
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
- dir.path.image_source_remote_tex
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- dir.path.image_source_tex
- else
- unless image.nil? \
- or image.length < 2
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}")
- tell.error2 unless @md.cmd =~/q/
- end
- nil
- end
- if image_source
- @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile !
- "#@center_begin\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#@center_end")
- else @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'')
- end
- end
- def http_word_mode #(orientation='')
- # clean up ! - work area, testing
- dir=SiSU_Env::Info_env.new(@md.fns)
- @w=[]
- @url_generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/
- @words.each do |word|
- @w << if word=~@url_generic_rgx
- if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/
- regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/
- punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?([;.,]?(?:\s|$))/.match(word).captures.join
- else
- regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\S+)/
- punctuate=''
- end
- z,url=regx_url.match(word).captures if word =~regx_url
- url=url.strip
- if word =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/ \
- and word=~/\s+\d+x\d+(\s+|\s*#{Mx[:lnk_c]})/
- image,x,y=z.scan(/\S+/)
- image.gsub!(/\\/,'')
- width=if z =~/(\d+)x\d*/
- z[/(\d+)x\d*/,1]
- else 200
- end
- dm=case @ps # @md.papersize
- when /a4/; @tx.a4.landscape.img_px
- when /letter/; @tx.letter.landscape.img_px
- when /legal/; @tx.legal.landscape.img_px
- when /b5/; @tx.b5.landscape.img_px
- when /a5/; @tx.a5.landscape.img_px
- else @tx.a4.landscape.img_px
- end
- width=if width.to_i > dm
- dm
- else width
- end
- c=z[/``(.+?)''/m,1]
- hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace
- caption=if c
- "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}"
- else ''
- end
- elsif word =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/
- tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (& librmagick-ruby is not installed)?\n})
- tell.print_grey #unless @opt.cmd =~/q/
- end
- word=if image #most images fc etc. #% clean up !
- word=if @md.fns =~/\.(?:ssm\.)?sst$/ \
- and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")
- word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/
- "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_local_tex}/#{image}}}#{caption} #@center_end"
- end
- word
- elsif @md.fns =~/\.-ss[tm]$/ \
- and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
- word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/
- "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_remote_tex}/#{image}}}#{caption}#@center_end"
- end
- word
- elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
- word=if word =~/(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/
- "#@center_begin\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}#@center_end"
- end
- word
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}")
- tell.error2 unless @md.cmd =~/q/
- word='' if word =~ /#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/
- word
- end
- else
- link=z.strip #[/(.+?)\\/m,1]
- word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/
- word
- end
- else word
- end
- end
- @txt=@w.join
- @txt
- end
- def http
- wm=@txt.dup.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m)
- txt_obj={:words =>wm,:paper_size =>@ps}
- @txt=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http_word_mode #GET PAPER SIZE AND USE IT
- end
- def title
- @txt=SiSU_TeX_Pdf::Special_characters.new(@md,@title).special_characters_safe
- if @subtitle
- @subtitle=SiSU_TeX_Pdf::Special_characters.new(@md,@subtitle).special_characters_safe
- @subtitle.gsub!(/\$/,"\\$")
- "\n\\title{#@title#{@@tex_backslash*2} \\textbf{\\normalsize #@subtitle}\\normalsize}"
- else "\n\\title{#@txt}"
- end
- end
- def title_landscape
- title
- end
- def title_portrait
- title
- end
- def para_num
- paranumber_display=if @md.markup.inspect =~/no_ocn/ \
- or @md.mod.inspect =~/--no-ocn/
- ''
- else "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}#@ocn\\end{tiny}}}" #ocn object citation numbering
- end
- if @txt !~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/
- @txt.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect
- else
- if (@txt =~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})/) #watch - in 1-6 is suspect
- @txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #watch - in 1-6 is suspect
- #@txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\begin{bfseries}\\2 \\end{bfseries}\n") #watch - in 1-6 is suspect
- #@txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\emph{\\2}\n") #watch - in 1-6 is suspect
- @txt.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT?
- #@txt.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT?
- else
- @txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\1\n")
- #@txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\begin{bfseries}\\1 \\end{bfseries}\n")
- #@txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\emph{\\1}\n")
- end
- end
- @txt
- end
- end
- class Format_head
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class==Hash
- @txt =t_o[:txt] || nil
- #@title =t_o[:title] || nil
- @subtitle=t_o[:subtitle] || nil
- @ps=t_o[:paper_size] || nil
- @ocn=t_o[:ocn] || nil
- @layout=t_o[:orientation] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- p t_o.class
- p caller
- end
- @tx=SiSU_Env::Get_init.instance.tex
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
- @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i
- end
- def language
- @lang=if @md.language[:code]
- case @md.language[:code]
- when 'en'; 'english'
- when 'us'; 'USenglish' # depreciated, see iso-639-2
- when 'fr'; 'french'
- when 'de'; 'ngerman'
- when 'it'; 'italian'
- when 'es'; 'spanish'
- when 'pt'; 'portuges'
- #when 'br'; 'brazilian' # depreciated, see iso-639-2
- when 'sv'; 'swedish'
- when 'da'; 'danish'
- when 'fi'; 'finnish'
- when 'no'; 'norske,nynorsk'
- when 'is'; 'icelandic'
- when 'nl'; 'dutch'
- when 'et'; 'estonian'
- when 'hu'; 'magyar'
- when 'pl'; 'polish'
- when 'ro'; 'romanian'
- when 'ru'; 'russian'
- when 'gl'; 'greek'
- when 'uk'; 'ukrainian'
- when 'tr'; 'turkish'
- when 'sk'; 'slovak'
- when 'sl'; 'slovenian'
- when 'hr'; 'croatian'
- when 'cs'; 'czech'
- when 'bg'; 'bulgarian'
- else 'english'
- end
- else 'english'
- end
- end
- def tex_head_lang #babel 18n
- language
- #@md.language[:name]
- lang=if @lang =~/^(?:en)$/; @lang
- else "#@lang,english"
- end
- end
- def tex_head_encode
- case @tex2pdf
- when /xe/
- <<WOK
-\\usepackage{babel}
-\\usepackage{ucs}
-\\usepackage{fontspec}
-\\usepackage{xunicode}
-WOK
- when /pdf/
- if @md.file_encoding =~ /iso-?8859/i #% iso8859
- <<WOK
-% \\usepackage[latin1]{inputenc}
-\\usepackage{fontspec}
-WOK
- else #% utf-8 assumed
- <<WOK
-\\usepackage{babel}
-\\usepackage{ucs}
-\\usepackage[utf8x]{inputenc}
-WOK
- end
- end
- end
- def tex_head_info
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- <<WOK
-%% SiSU (Linux & Ruby - \"better ways\") LaTeX output
-%% #{generator}
-%% #{rubyv}
-%% LaTeX output
-%% #{lastdone}
-%% SiSU http://www.jus.uio.no/sisu
-WOK
- end
- def tex_head_paper_portrait(d)
- <<WOK
-#{tex_head_info}
-\\documentclass[#{d[:fontsize]},#{d[:papertype]},#{tex_head_lang},titlepage]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
-\\setlength{\\headsep}{#{d[:headsep]}}
-\\setlength{\\marginparsep}{#{d[:marginparsep]}}
-\\setlength{\\marginparwidth}{#{d[:marginparwidth]}}
-WOK
- end
- def tex_head_paper_landscape(d)
- <<WOK
-#{tex_head_info}
-\\documentclass[#{d[:fontsize]},#{d[:papertype]},#{tex_head_lang},landscape,titlepage,twocolumn]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
-\\setlength{\\headsep}{#{d[:headsep]}}
-\\setlength{\\columnsep}{#{d[:columnsep]}}
-\\setlength{\\marginparsep}{#{d[:marginparsep]}}
-\\setlength{\\marginparwidth}{#{d[:marginparwidth]}}
-WOK
- end
- def tex_head_paper_portrait_dvi(d)
- <<WOK
-#{tex_head_info}
-\\documentclass[#{d[:fontsize]},#{d[:papertype]},#{tex_head_lang},titlepage]{scrartcl} %with titlepage
-\\setlength{\\textheight}{#{d[:textheight]}mm} \\setlength{\\textwidth}{#{d[:textwidth]}mm}
-\\setlength{\\oddsidemargin}{#{d[:oddsidemargin]}} \\setlength{\\evensidemargin}{#{d[:evensidemargin]}}
-\\setlength{\\topmargin}{#{d[:topmargin]}} \\setlength{\\headheight}{#{d[:headheight]}}
-\\setlength{\\headsep}{#{d[:headsep]}}
-\\setlength{\\marginparsep}{#{d[:marginparsep]}}
-\\setlength{\\marginparwidth}{#{d[:marginparwidth]}}
-WOK
- end
- def tex_head_paper_dimensions
- d={}
- case @layout
- when /portrait/
- #textheight,textwidth=@tx.a4.portrait.h,@tx.a4.portrait.w
- d[:papertype],d[:fontsize]='a4paper','11pt'
- d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='0mm','0mm','-12pt'
- d[:headheight],d[:headsep],d[:columnsep]='12pt','35pt',''
- d[:marginparsep],d[:marginparwidth]='4mm','8mm'
- case @ps #@md.papersize
- when /a4/i #European default, SiSU default
- d[:papertype],d[:fontsize]='a4paper','12pt'
- d[:textheight],d[:textwidth]=@tx.a4.portrait.h,@tx.a4.portrait.w
- when /letter/i #U.S. default
- d[:papertype],d[:fontsize]='letterpaper','12pt'
- d[:textheight],d[:textwidth]=@tx.letter.portrait.h,@tx.letter.portrait.w
- when /legal/i #U.S. alternative
- d[:papertype],d[:fontsize]='legalpaper','12pt'
- d[:textheight],d[:textwidth]=@tx.legal.portrait.h,@tx.legal.portrait.w
- when /book|b5/i #book default - larger
- d[:papertype],d[:fontsize]='b5paper','11pt'
- d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt'
- d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt',''
- d[:textheight],d[:textwidth]=@tx.b5.portrait.h,@tx.b5.portrait.w
- when /a5/i
- d[:papertype],d[:fontsize]='a5paper','11pt'
- d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt'
- d[:headheight],d[:headsep],d[:columnsep]='8pt','12pt',''
- d[:marginparsep],d[:marginparwidth]='4mm','6mm'
- d[:textheight],d[:textwidth]=@tx.a5.portrait.h,@tx.a5.portrait.w
- else #default currently A4
- d[:papertype],d[:fontsize]='a4paper','12pt'
- d[:textheight],d[:textwidth]=@tx.a4.portrait.h,@tx.a4.portrait.w
- end
- when /landscape/
- #d[:textheight],d[:textwidth]=@tx.a4.landscape.h,@tx.a4.landscape.w
- d[:papertype],d[:fontsize]='a4paper','11pt'
- d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='6mm','6mm','-12mm'
- d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','40pt'
- d[:marginparsep],d[:marginparwidth]='4mm','8mm'
- case @ps #@md.papersize
- when /a4/i #European default, SiSU default
- d[:papertype],d[:fontsize]='a4paper','11pt'
- d[:textheight],d[:textwidth]=@tx.a4.landscape.h,@tx.a4.landscape.w
- when /letter/i #U.S. default
- d[:papertype],d[:fontsize]='letterpaper','11pt'
- d[:textheight],d[:textwidth]=@tx.letter.landscape.h,@tx.letter.landscape.w
- when /legal/i #U.S. alternative
- d[:papertype],d[:fontsize],d[:columnsep]='legalpaper','11pt','48pt'
- d[:textheight],d[:textwidth]=@tx.legal.landscape.h,@tx.legal.landscape.w
- when /book|b5/i #book default - larger
- d[:papertype],d[:fontsize],d[:columnsep]='b5paper','11pt','35pt'
- d[:textheight],d[:textwidth]=@tx.b5.landscape.h,@tx.b5.landscape.w
- when /a5/i
- d[:papertype],d[:fontsize],d[:columnsep]='a5paper','10pt','32pt'
- d[:textheight],d[:textwidth]=@tx.a5.landscape.h,@tx.a5.landscape.w
- else #default currently A4
- d[:papertype],d[:fontsize]='a4paper','12pt'
- d[:textheight],d[:textwidth]=@tx.a4.landscape.h,@tx.a4.landscape.w
- end
- end
- d
- end
- def tex_head_paper
- case @layout
- when /portrait/
- tex_head_paper_portrait(tex_head_paper_dimensions)
- when /landscape/
- tex_head_paper_landscape(tex_head_paper_dimensions)
- end
- end
- def tex_head_pdftex_dvi
- color=case @layout
- when /portrait/
- <<WOK
- colorlinks=true,
- urlcolor=myblack,
- filecolor=myblack,
- linkcolor=myblack,
-WOK
- when /landscape/
- <<WOK
- colorlinks=true,
- urlcolor=myblue, % \\href{...}{...} external url
- filecolor=mygreen, % \\href{...} local file
- linkcolor=myred, % \\href{...} and \\pageref{...}
-WOK
- end
- if @layout =~/portrait|landscape/
- <<WOK
-\\usepackage{alltt}
-\\usepackage{thumbpdf}
-\\usepackage[#{@tex2pdf},
- #{color.strip}
- pdftitle={#{@txt}},
-% pdftitle={Untitled},
- pdfauthor={LM-sisu-scribe},
- pdfsubject={law},
- pdfkeywords={law},
- pageanchor=true,
- plainpages=true,
- pdfpagelabels=true,
- pagebackref,
- bookmarks=true,
- bookmarksopen=true,
- pdfmenubar=true,
- pdfpagemode=UseOutline,
- pdffitwindow=true,
- pdfwindowui=true,
- plainpages=false,
-% pdfusetitle=true,
-% pdfpagelayout=SinglePage,
-% pdfpagelayout=TwoColumnRight,
-% pdfpagelayout=TwoColumnLeft,
-% pdfstartpage=3,
- pdfstartview=FitH
-]
-{hyperref}
-%% trace lost characters
-% \\tracinglostchars = 1
-% \\tracingonline = 1
-\\usepackage[usenames]{color}
-\\definecolor{myblack}{rgb}{0,0,0}
-\\definecolor{myred}{rgb}{0.75,0,0}
-\\definecolor{mygreen}{rgb}{0,0.5,0}
-\\definecolor{myblue}{rgb}{0,0,0.5}
-\\definecolor{mywhite}{rgb}{1,1,1}
-\\usepackage{url}
-%\\usepackage{breakurl}
-WOK
- elsif @txt =~/dvi/
- <<WOK
-\\usepackage{alltt}
- #{color.strip}
- pageanchor=true,
- plainpages=true,
- pagebackref,
- bookmarks=true,
- bookmarksopen=true,
- plainpages=false,
-]
-{hyperref}
-\\usepackage[usenames]{color}
-\\definecolor{myblack}{rgb}{0,0,0}
-\\definecolor{myred}{rgb}{0.75,0,0}
-\\definecolor{mygreen}{rgb}{0,0.5,0}
-\\definecolor{myblue}{rgb}{0,0,0.5}
-\\definecolor{mywhite}{rgb}{1,1,1}
-\\usepackage{url}
-%\\usepackage{breakurl}
-WOK
- end
- end
- def tex_head_misc
- <<WOK
-\\usepackage{textcomp}
-\\usepackage[parfill]{parskip}
-\\usepackage[normalem]{ulem}
-\\usepackage{soul}
-\\usepackage{longtable}
-\\usepackage{graphicx}
-\\makeatletter
-\\parindent0pt
-%\\usepackage{mathptmx}
-\\usepackage{amssymb}
-% amssymb used for backslash
-WOK
- end
- def document_head_with_orientation
- endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes
- language
- <<WOK
-#{tex_head_paper}
-#{tex_head_encode}
-#{tex_head_pdftex_dvi}
-#{tex_head_misc}
-\\setcounter{secnumdepth}{2}
-\\setcounter{tocdepth}{4}
-\\makeatletter
-#{endnotes}
-\\usepackage[multiple,ragged]{footmisc}
-\\setlength\\footnotemargin{12pt}
-\\usepackage[para]{manyfoot}
-\\DeclareNewFootnote{A}
-%\\DeclareNewFootnote[para]{A}
-\\newenvironment{ParagraphIndent}[1]%
-{
-\\begin{list}{}{%
-\\setlength\\topsep{0pt}%
-\\addtolength{\\leftmargin}{#1}
-\\setlength\\parsep{0pt plus 1pt}%
-}
-\\item[]
-}
-{\\end{list}}
-\\usepackage{fancyhdr}
-\\lhead{}
-\\renewcommand{\\part}{\\\@startsection
- {part}{1}{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\bfseries\\large\\upshape\\raggedright}}
-\\renewcommand{\\section}{\\\@startsection
- {section}{2}{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\bfseries\\large\\upshape\\raggedright}}
-\\renewcommand{\\subsection}{\\\@startsection
- {subsection}{3}{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\bfseries\\large\\upshape\\raggedright}}
-\\renewcommand{\\subsubsection}{\\\@startsection
- {subsubsection}{4}{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\normalfont\\normalsize\\bfseries\\raggedright}}
-\\renewcommand{\\paragraph}{\\\@startsection
- {paragraph}{5}{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\normalfont\\normalsize\\itshape\\raggedright}}
-\\renewcommand{\\subparagraph}{\\\@startsection
- {subparagraph}%{6}%{-2mm}%
- {-\\baselineskip}{0.5\\baselineskip}%
- {\\normalfont\\normalsize\\itshape\\raggedright}}
-% \\makeatother
-\\selectlanguage{#{language}}
-WOK
- end
- def a4generic
- end
- end
- class Special_characters
- @@flag_code=false
- @@tex_backslash="\\\\"
- def initialize(md,string)
- @md,@txt=md,string
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- #@tx=SiSU_Env::Get_init.instance.tex
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
- end
- def pdftex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
- #p @@utf_8.list
- #@txt=Iconv.conv('ISO-8859-1', 'UTF-8', @txt)
- word=string.scan(/#{Mx[:mk_o]}\S+?#{Mx[:mk_c]}|\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/
- para_array=[]
- string=if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless string =~/^(?:#{Rx[:meta]}|%+ |#{Mx[:gr_o]}Th?#{Mx[:tc_p]} )/um
- unless w=~/^#{Mx[:lv_o]}[1-6]:|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/
- w.gsub!(/[\\]?~/,'<=tilde>')
- #if w !~/^(\s*<:image|\}:image\s)|/
- # w.gsub!(/_/,'\_')
- #end
- end
- w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual
- #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual
- w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
- end
- para_array << w
- end
- string=para_array.join(' ')
- string=string.strip
- string
- else ''
- end
- string.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ')
- string.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- string.gsub!(/.+?<-#>/,'')
- string.gsub!(/#{Mx[:br_eof]}|#{Mx[:br_endnotes]}/,'')
- #problem sequence ->
- string.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'<=hardspace>') # < SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#nbsp#{Mx[:gl_c]}/,'<=hardspace>') # < SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<=lt>') # < SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX
- #string.gsub!(/#{Mx[:gl_o]}(#[a-z]+|#[0-9]+)#{Mx[:gl_c]}/,'\1') #i don't think so
- string.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'<=curlyopen>') # { SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'<=curlyclose>') # } SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}*
- string.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/\#/,'<=hash>')
- ##watch placement, problem sequence ^
- string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- string.gsub!(/#{Mx[:br_page]}/,'\newpage')
- string.gsub!(/#{Mx[:br_page_new]}/,'\clearpage')
- string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
- string
- end
- def pdftex_special_characters_2(string)
- string.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ')
- string.gsub!(/\$/,'\$')
- string.gsub!(/\#/,'\#')
- string.gsub!(/\%/,'\%')
- string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
- if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/
- string.gsub!(/_/,'\_')
- end
- string.gsub!(/\{/,'\{')
- #string.gsub!(/\}/,'\}')
- string.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'~') # ~ character for hardspace
- # sequence important must appear after removal of { and }
- string.gsub!(/&\S+?;/,'') #hmmm
- # sequence imortant place before removal of &
- if string=~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/; @@flag_code=true
- elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false
- end
- if @@flag_code; string.gsub!(/&/,'{\\\&}')
- else string.gsub!(/(\s+&\s+)/,' and ')
- end
- string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ')
- string.gsub!(/£/u,'\pounds')
- string.gsub!(/&\S+?;/,' ')
- string.gsub!(/<a href=".+?">/,' ')
- string.gsub!(/<\/a>/,' ')
- string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/,
- '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
- string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,
- ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case
- string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
- '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration
- unless @@flag_code
- string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
- "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
- else #code-block: angle brackets special characters, note _ already escaped
- string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}')
- string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}')
- end
- string.gsub!(/<:ee>/,'')
- string.gsub!(/<!>/,' ')
- #proposed change, insert, but may be redundant
- string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,
- ' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area
- string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}')
- #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}')
- string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}')
- string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- #string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}')
- string.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- string.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- string.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- string.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- string.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- string.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- unless @@flag_code
- string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code
- string.gsub!(/\s+"/,' “') # open "
- string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') # open "
- string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close "
- string.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') # close "
- string.gsub!(/"(\.|,)/,'”') # close "
- string.gsub!(/\s+'/,' `') # open '
- string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') # open '
- end
- string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,
- '\1 $\txtbullet$~~') #bullets - defined 2008w49 temporary absence of bullet in debian texlive \\_
- #'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_
- string.gsub!(/(<font.*?>|<\/font>)/,'')
- string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
- #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ')
- #string.gsub!(/(<sup>|<\/sup>)/,'')
- string
- end
- def pdftex_special_characters_3(string)
- string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- #problem sequence (another kludge) ->
- string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}')
- string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}')
- #string.gsub!(/<=lt>/,'\<')
- #string.gsub!(/<=gt>/,'\>')
- string.gsub!(/<=underscore>/,'\_')
- while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text
- string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
- end
- string.gsub!(/<=tilde>/,'{$\tilde$}')
- #string.gsub!(/<=tilde>/,'{$\sim$}')
- string.gsub!(/<=pipe>/,'{\textbar}')
- string.gsub!(/<=caret>/,'{\^{~}}')
- #string.gsub!(/<=caret>/,'\^{}')
- string.gsub!(/<=exclaim>/,'\Verbatim{!}')
- string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text
- string.gsub!(/<=hash>/,'{\#}')
- #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}')
- #string.gsub!(/<=slash>/,'{\slash}')
- string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005
- while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text
- string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
- end
- string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005
- #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}')
- string.gsub!(/<=slash>/,'{/}')
- string.gsub!(/<=backslash>/,'{\textbackslash}')
- #string.gsub!(/<=asterisk>/,'*')
- #string.gsub!(/<=exclaim>/,'!')
- #string.gsub!(/<=asterisk>/,'{\ast}')
- #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic
- #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
- string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,
- '^\copyright \textnormal{\1} \2') # watch likely to be problematic
- string
- end
- def xetex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
- #p @@utf_8.list
- #string=Iconv.conv('ISO-8859-1', 'UTF-8', @txt)
- word=string.scan(/\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/
- para_array=[]
- string=if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless string =~/^(?:#{Rx[:meta]}|%+ |#{Mx[:gr_o]}Th?#{Mx[:tc_p]} )/um
- unless w=~/^#{Mx[:lv_o]}[1-6]:|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/
- w.gsub!(/[\\]?~/,'<=tilde>')
- #if w !~/^(\s*<:image|\}:image\s)/
- # w.gsub!(/_/,'\_')
- #end
- end
- w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual
- #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual
- w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
- end
- para_array << w
- end
- string=para_array.join(' ')
- string=string.strip
- string
- else ''
- end
- string.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ')
- string.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'')
- string.gsub!(/.+?<-#>/,'')
- string.gsub!(/#{Mx[:br_eof]}/,'')
- string.gsub!(/#{Mx[:br_endnotes]}/,'')
- #string.gsub!(/<ENDNOTES?>/,'')
- #problem sequence ->
- string.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'<=hardspace>') # < SiSU special character also LaTeX
- string.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX
- #string.gsub!(/#{Mx[:gl_o]}(&#(?:[a-z]+|[0-9]+);)#{Mx[:gl_c]}/,'\1')
- string.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'<=curlyopen>') # { SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'<=curlyclose>') # } SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}*
- string.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX
- string.gsub!(/\#/,'<=hash>')
- ##watch placement, problem sequence ^
- string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- string.gsub!(/#{Mx[:br_page]}/,'\newpage')
- string.gsub!(/#{Mx[:br_page_new]}/,'\clearpage')
- string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
- string
- end
- def xetex_special_characters_2(string)
- string.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ')
- string.gsub!(/\$/,'\$')
- string.gsub!(/\#/,'\#')
- string.gsub!(/\%/,'\%')
- string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
- if string !~/^\s*#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\s/
- string.gsub!(/_/,'\_')
- end
- string.gsub!(/\{/,'\{')
- string.gsub!(/\}/,'\}')
- string.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'~') # ~ character for hardspace
- # sequence important must appear after removal of { and }
- string.gsub!(/&\S+?;/,'') #hmmm
- # sequence imortant place before removal of &
- if string=~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/; @@flag_code=true
- elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false
- end
- if @@flag_code; string.gsub!(/&/,'{\\\&}')
- else string.gsub!(/&/,'<=amp>')
- #else string.gsub!(/(\s+&\s+)/,' and ')
- end
- if @@flag_code;
- string.gsub!(/\\~(\\\{)/,'{$\tilde$}\1')
- string.gsub!(/(\\\})\\~/,'\1{$\tilde$}')
- string.gsub!(/\\~(\[)/,'{$\tilde$}\1')
- string.gsub!(/(\])\\~/,'\1{$\tilde$}')
- end
- string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ')
- string.gsub!(/£/u,'\pounds')
- string.gsub!(/&\S+?;/,' ')
- string.gsub!(/<a href=".+?">/,' ')
- string.gsub!(/<\/a>/,' ')
- string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/,
- '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
- string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,
- ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case
- string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/,
- '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration
- unless @@flag_code
- string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
- "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
- else #code-block: angle brackets special characters, note _ already escaped
- string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}')
- string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}')
- end
- string.gsub!(/<:ee>/,'')
- string.gsub!(/<!>/,' ')
- #proposed change, insert, but may be redundant
- string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,
- ' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area
- string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}')
- #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}')
- string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}')
- string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- #string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}')
- string.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- string.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- string.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- string.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- string.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- string.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- unless @@flag_code
- string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code
- string.gsub!(/\s+"/,' “') # open "
- string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') # open "
- string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close "
- string.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') # close "
- string.gsub!(/"(\.|,)/,'”') # close "
- string.gsub!(/\s+'/,' `') # open '
- string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') # open '
- end
- string.gsub!(/^\s*#{Mx[:gl_bullet]}\s*/,'$\txtbullet$~~')
- string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 $\txtbullet$~~')
- #string.gsub!(/^\s*#{Mx[:gl_bullet]}\s*/,'\begin{math} \bullet \end{math}~~')
- #string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 \begin{math} \bullet \end{math}~~')
- #string.gsub!(/^\s*#{Mx[:gl_bullet]}\s*/,'● ~~')
- #string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 ● ~~')
- ##string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*\\_\*\s*/,'\1 ● ~~')
- ##string.gsub!(/^\\_\*\s*/,'● ~~')
- string.gsub!(/(<font.*?>|<\/font>)/,'')
- string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
- #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ')
- #string.gsub!(/(<sup>|<\/sup>)/,'')
- string
- end
- def xetex_special_characters_3(string)
- string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- #problem sequence (another kludge) ->
- string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}')
- string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}')
- #string.gsub!(/<=lt>/,'\<')
- #string.gsub!(/<=gt>/,'\>')
- string.gsub!(/<=underscore>/,'\_')
- while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text
- string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
- end
- string.gsub!(/<=tilde>/,'{$\tilde$}')
- #string.gsub!(/<=tilde>/,'{$\sim$}')
- string.gsub!(/<=pipe>/,'{\textbar}')
- string.gsub!(/<=caret>/,'{\^{~}}')
- #string.gsub!(/<=caret>/,'\^{}')
- string.gsub!(/<=exclaim>/,'\Verbatim{!}')
- string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text
- string.gsub!(/<=hash>/,'{\#}')
- #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}')
- #string.gsub!(/<=slash>/,'{\slash}')
- string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005
- while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text
- string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
- end
- string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005
- #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}')
- string.gsub!(/<=slash>/,'{/}')
- string.gsub!(/<=backslash>/,'{\textbackslash}')
- #string.gsub!(/<=asterisk>/,'*')
- #string.gsub!(/<=exclaim>/,'!')
- #string.gsub!(/<=asterisk>/,'{\ast}')
- #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic
- #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} '
- string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,
- '^\copyright \textnormal{\1} \2') # watch likely to be problematic
- string
- end
- def special_characters_curly(string)
- string.gsub!(/<=curlyopen>/,'\{')
- string.gsub!(/<=curlyclose>/,'\}')
- string
- end
- def special_characters_unsafe_1(string) #depreciated, make obsolete
- # some substitutions are sequence sensitive, rearrange with care.
- string.gsub!(/\\backslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
- string
- end
- def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care.
- string=@txt
- case @tex2pdf
- when /pdf/
- string=pdftex_special_characters_1(string) unless string.nil?
- string=special_characters_unsafe_1(string) unless string.nil? #pdftex_special_characters_unsafe_1(@txt)
- string=pdftex_special_characters_2(string) unless string.nil?
- string=pdftex_special_characters_3(string) unless string.nil?
- when /xe/
- string=xetex_special_characters_1(string) unless string.nil?
- string=special_characters_unsafe_1(string) unless string.nil? #xetex_special_characters_unsafe_1(@txt)
- string=xetex_special_characters_2(string) unless string.nil? #issues with xetex
- string=xetex_special_characters_3(string) unless string.nil?
- end
- @txt=string
- end
- def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care.
- string=@txt
- case @tex2pdf
- when /pdf/
- string=pdftex_special_characters_1(@txt) unless string.nil?
- string=pdftex_special_characters_2(@txt) unless string.nil?
- #special_characters_3(@txt)
- when /xe/
- string=xetex_special_characters_1(@txt) unless string.nil?
- string=xetex_special_characters_2(@txt) unless string.nil? # remove this to start with, causes issues
- end
- @txt=string
- end
- end
- class Use_TeX
- attr_accessor :url,:txt,:date
- def initialize(md)
- @md=md
- @vz=SiSU_Env::Get_init.instance.skin
- @date=SiSU_Env::Info_date.new # #{@date.year}
- @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}'
- @url_brace=SiSU_Viz::Skin.new.url_decoration
- end
- def skip
- "\n\\vspace*{\\smallskipamount} \n"
- end
- def paraskip_normal
- '\setlength{\parskip}{1ex plus0.5ex minus0.2ex}'
- end
- def paraskip_small
- '\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}'
- end
- def skip_small
- #"\\smallskip{}"
- end
- def skip_small_vspace
- "\n\\vspace*{\\smallskipamount} \n"
- end
- def skip_small_footnote
- #"\n\\smallskip{}\n"
- end
- def skip_medium
- "\n\\medskip{}\n\n"
- end
- def skip_dummy
- "\n"
- end
- def header
- "\\lhead[ ]{ }\n" +
- "\\chead[ \\fancyplain{} \\bfseries \\footnotesize \\leftmark ]{ \\fancyplain{} \\bfseries \\footnotesize \\rightmark }\n" +
- "\\rhead[ ]{ }\n"
- end
- def footer
- base_prog_txt=if @md.base_program
- case @md.base_program
- when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}"
- else ''
- end
- else ''
- end
- "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" +
- "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" +
- "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n"
- end
- def site
- "\\href{#{@vz.url_home}}{#{@vz.url_txt}}"
- end
- def sitename #owners site, eg freeculture, free.for.all, gutenberg etc.
- "\\href{#{@vz.url_home}}{#{@vz.txt_home}}"
- end
- def owner_chapter
- "Contact Details for Original Promulgating Authority"
- end
- #BOOK standard dimensions - 229x156
- def newpage(orientation)
- case orientation
- when /landscape/ # using longtable latex package
-<<WOK
-\\clearpage
-WOK
- when /portrait/
-<<WOK
-\\newpage
-WOK
- end
- end
- def sisu_rights
- v=SiSU_Env::Info_version.instance.get_version
- base_prog_txt=if @md.base_program
- case @md.base_program
- when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy"
- else ''
- end
- else ''
- end
-<<WOK
-\\\\ ~
-{\\begin{footnotesize}#{base_prog_txt}
-\\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu}
-\\\\ Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved.
-\\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org}
-\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@url_brace.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@url_brace.tex_close}.
-{\\end{footnotesize}
-\\\\
-WOK
- end
- def doc_sc_info_footnote_full
-<<WOK
-\\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU \\ www.jus.uio.no/sisu }\\ \\newline \\scriptsize{Document version information: \\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}}}}
-WOK
- end
- def doc_sc_info_footnote_brief
- " \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}"
- end
- def doc_sc_info
- v=SiSU_Env::Info_version.instance.get_version
-<<WOK
-\\\\
-{\\begin{footnotesize}
-Document version information: \\\\
-\\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}} \\\\
-Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- version information: \\\\
-\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}}
-\\end{footnotesize}}&
-WOK
- end
- def doc_no_sc_info
- v=SiSU_Env::Info_version.instance.get_version
-<<WOK
-\\\\
-{\\begin{small}
-Document information: \\\\
-\\emph{sourcefile} \\uline{#{@md.fnstex}} \\\\
-Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ version information: \\
-\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}}
-
-\\end{small}}&
-WOK
- end
- def manifest_info
- url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
- fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
-<<WOK
-{\\begin{footnotesize}
-\\\\ For alternative output formats of this document check:
-\\\\ #{@url_brace.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@url_brace.tex_close}
-\\end{footnotesize}}&
-WOK
- end
- def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document"
-<<WOK
-\\subsection*{Endnotes}
-\\addcontentsline{toc}{section}{Endnotes}
-\\
-\\listofendnotes
-WOK
- end
- def doc_tail
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- v=SiSU_Env::Info_version.instance.get_version
- sisu_ico=if FileTest.file?("#{dir.path.image_source_tex}/sisu.png")
- "\\includegraphics*[width=60pt]{#{dir.path.image_source_tex}/sisu.png}"
- else
- tell=SiSU_Screen::Ansi.new(@md.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_tex}"} )
- tell.warn unless @md.cmd =~/q/
- " SiSU "
- end
- url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1')
-<<WOK
-\\subsection*{Information on this document copy and an unofficial List of Some web related information and sources}
-\\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources}
-\\\\
-\"Support Open Standards and Software Libré for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}}
-\\addcontentsline{toc}{subsection}{Information on this document copy}
-{\\begin{footnotesize}
-\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved.
-\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize}
-{\\begin{small}
-\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title} \\textbf{pdf} versions can be found at: \\\\
-{\\end{small}
-\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize} \\\\
-\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize} \\\\
-\\\\\n#{@md.title} \\textbf{html} versions may be found at: \\\\
-\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize} or \\\\
-\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize}
-\\\\
-\\\\
-\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\
-\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{#{@vz.url_root_http}/#{url}/#{@md.fnl[:pre]}sisu\\_manifest#{@md.fnl[:mid]}.html#{@md.fnl[:post]}}\\end{scriptsize}
-\\\\
-\\\\
- #{sitename} found at: \\begin{bfseries}#{site}\\end{bfseries}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:}
-\\addcontentsline{toc}{subsection}{Links that may be of interest}
-WOK
- end
- def mail_tail #not retested, the old mail_tail is commented out and appended to this program
- dir=SiSU_Env::Info_env.new(@md.fns)
-<<WOK
-\\subsection*{Mail sender details}
-\\addcontentsline{toc}{subsection}{Mail sender details}
-\\\\
-Mail from: ralph@amissah.com\\\\
-44 20 8789 3452\\\\
-44 77 9669 4448
-\\\\
- \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA
-\\subsubsection*{Information on this document copy #{site}\\copyright}
-Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_tex}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here.
-WOK
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/update.rb b/lib/sisu/v1/update.rb
deleted file mode 100644
index 64337726..00000000
--- a/lib/sisu/v1/update.rb
+++ /dev/null
@@ -1,131 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: update previous output (with similar output file type formats)
-
-=end
-module SiSU_Update_control_flag
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- class Check
- def initialize(opt)
- @opt=opt
- @md=SiSU_Param::Parameters.new(@opt).get
- end
- def read
- begin
- @env=SiSU_Env::Info_env.new(@md.fns)
- out=@env.path.output
- base_path="#{out}/#{@md.fnb}"
- tell=SiSU_Screen::Ansi.new(@md.cmd,'Checking previous output',base_path)
- tell.green_hi_blue unless @md.cmd =~/q/
- Set_CF.new(@md).set_flags
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- private
- class Set_CF
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new(@md.fns)
- out=@env.path.output
- @base_path="#{out}/#{@md.fnb}"
- end
- def set_flags #-mNhwpoabxXyv
- flag='-v'
- if FileTest.file?("#@base_path/#{@md.fn[:doc]}")==true
- flag=flag + 'a'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:toc]}")==true \
- or FileTest.file?("#@base_path/#{@md.fn[:doc]}")==true
- flag=flag + 'h'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:xhtml]}")==true
- flag=flag + 'b'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:sax]}")==true
- flag=flag + 'x'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:dom]}")==true
- flag=flag + 'X'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:odf]}")==true
- flag=flag + 'o'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:pdf_p]}")==true \
- or FileTest.file?("#@base_path/#{@md.fn[:pdf_l]}")==true
- flag=flag + 'p'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:concordance]}")==true
- flag=flag + 'w'
- end
- if FileTest.file?("#@base_path/#{@md.fn[:digest]}")==true
- flag=flag + 'N'
- end
- if FileTest.file?("#@base_path/#{@md.fns}")==true
- flag=flag + 's'
- end
- if FileTest.file?("#@base_path/sisupod.tgz")==true
- flag=flag + 'S'
- end
- puts flag
- flag
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/urls.rb b/lib/sisu/v1/urls.rb
deleted file mode 100644
index b530d0d6..00000000
--- a/lib/sisu/v1/urls.rb
+++ /dev/null
@@ -1,284 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: urls for output files
-
-=end
-module SiSU_urls
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- class Source
- attr_reader :opt
- def initialize(opt)
- @opt=opt
- end
- def read
- begin
- SiSU_urls::Output_urls.new(@opt).songsheet if @opt.fnb #fnb[/.+?\.(?:[_-]?sst|ssm)$/]
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd).error
- ensure
- end
- end
- end
- class Output_urls
- attr_reader :fns,:fnb,:cmd,:dir,:m_regular,:u
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @cmd=@opt.cmd
- @md=@particulars.md
- @env=@particulars.env
- @fnb=@env.fnb
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
- @fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
- @m_regular=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/
- @path=SiSU_Env::Info_env.new(@opt.fns)
- @webserv_url=@path.url.output_tell
- @tool=@env.program.text_editor
- @editor=@env.program.text_editor
- @browser=@env.program.web_browser
- @console_browser=@env.program.console_web_browser
- @pdf_viewer=@env.program.pdf_viewer
- @odf_viewer=@env.program.odf_viewer
- @manpage_gen=@env.program.manpage_generator
- source=if @opt.fns =~/\.sst$/; @opt.fns
- elsif @opt.fns =~/\.ssm\.sst/; "#@fnb.ssm.sst"
- else 'not recognised file'
- end
- @u ||= {
- 'a (Plain-text (footnotes))'=>@fn[:plain],
- 'A (Plain-text (footnotes) dos)'=>@fn[:plain],
- 'b (XHTML)'=>@fn[:xhtml],
- #'B (Docbook XML)'=>@fn[:docbook],
- 'D[iu] (DBI import/update postgresql)'=>'dbi psql',
- 'd[iu] (DBI import/update sqlite)'=>'dbi sqlite3',
- 'e (Plain-text (endnotes))'=>@fn[:plain],
- 'E (Plain-text (endnotes) dos)'=>@fn[:plain],
- 'h (HTML segmented)'=>@fn[:toc],
- 'H (HTML segmented)'=>@fn[:toc],
- 'h (HTML scroll)'=>@fn[:doc],
- 'H (HTML scroll)'=>@fn[:doc],
- 'I (Info file)'=>'info',
- 'i (manpage)'=>'manpage',
- 'm (Document Abstraction)'=>'dal',
- 'N (Digests md5/sha256)'=>@fn[:digest],
- 'o (ODF:ODT - Open Document)'=>@fn[:odf],
- 'p (PDF landscape)'=>@fn[:pdf_l],
- 'p (PDF portrait)'=>@fn[:pdf_p],
- 'P[iu] (DB postgresql import/update)'=>'psql',
- 's (sisu markup)'=>source,
- 'S (sisupod)'=>@fn[:sisupod],
- 'x (XML sax type)'=>@fn[:sax],
- 'X (XML dom type)'=>@fn[:dom],
- 'y (Manifest, html)'=>@fn[:manifest],
- 'Y (Sitemap, xml)'=>@fn[:sitemap],
- 'w (Concordance, html)'=>@fn[:concordance],
- }.sort {|a,b| a[0].downcase<=>b[0].downcase}
- end
- def songsheet
- begin
- urls_all if @opt.cmd=~/U/
- urls_select if @opt.cmd=~/[uvVM]/
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- def urls_maintenance(opt,x,y)
- if x=~/^([abchHmNopwxXy])/ \
- and opt.cmd =~/[abchHmNopwxXy]/ \
- and x=~/^[#{opt.cmd}]/
- m=$1
- f=y
- tool=@editor
- if x =~/^m/ \
- and @opt.cmd=~/m/ \
- and x=~/^[#{opt.cmd}]/ \
- and @opt.cmd =~/M/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@editor #{@env.path.dal}/#{@opt.fns}.meta")
- tell.maintenance unless @opt.cmd =~/q/
- end
- if x=~/^([hHw])/ \
- and @opt.cmd=~/[hHw]/ \
- and x=~/^[#{@opt.cmd}]/
- f=if x !~/segmented/; "#{y}.html"
- else "#{y}.index.html"
- end
- end
- if x=~/^p/ \
- and @opt.cmd=~/p/ \
- and x=~/^[#{@opt.cmd}]/
- tool=@pdf_viewer
- if opt.cmd =~/M/
- fns=@opt.fns.gsub(/~/,'-')
- tell=if y =~/landscape/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@editor #{@env.path.tex}/#{fns}.landscape.tex")
- else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@editor #{@env.path.tex}/#{fns}.tex")
- end
- tell.maintenance unless @opt.cmd =~/q/
- end
- end
- if x=~/^o/ \
- and @opt.cmd=~/o/ \
- and x=~/^[#{@opt.cmd}]/
- tool=@odf_viewer
- end
- #if x=~/^i/ and @opt.cmd=~/i/ and x=~/^[#{@opt.cmd}]/
- #
- #end
- if x !~/^m/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{tool} #{@env.path.output}/#@fnb/#{y}")
- tell.maintenance unless @opt.cmd =~/q/
- end
- @opt.cmd.gsub!(/#{m}/,'')
- end
- end
- def urls_select
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"URLs")
- tell.grey_title_hi unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#@fnb")
- tell.flow unless @opt.cmd =~/q/
- m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub="#@webserv_url"[m,1]
- @u.each do |x,y|
- if @opt.fns =~ @m_regular
- if x=~/^([abchHNopwxXyY])/ \
- and @opt.cmd=~/[abchHNopwxXyY]/ \
- and x=~/^[#{@opt.cmd}]/
- m=$1
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/#@fnb/#{y}")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/#{m}/,'')
- end
- if x=~/^I/ \
- and @opt.cmd =~/I/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@path.path.texinfo}; pinfo ./#@fnb.#{y}; cd -")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/I/,'')
- end
- if x=~/^D/ \
- and @opt.cmd =~/D/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#@pwd_stub::#{@opt.fns}",y)
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/D[iu]/,'')
- end
- if x=~/^d/ \
- and @opt.cmd =~/d/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/d[iu]/,'')
- end
- if x=~/^i/ \
- and @opt.cmd =~/i/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@manpage_gen #{@path.path.manpage}/#@fnb.1 |most")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/I/,'')
- end
- if x=~/^P/ \
- and @opt.cmd =~/P/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Psql","#@pwd_stub::#{@opt.fns}",y)
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/P[iu]/,'')
- end
- if x=~/^s/ \
- and @opt.cmd =~/s/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/src/#{y}")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/I/,'')
- end
- if x=~/^S/ \
- and @opt.cmd =~/[sS]/
- zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip')
- else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1')
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/pod/#{y}")
- tell.result unless @opt.cmd =~/q/
- @opt.cmd.gsub!(/I/,'')
- end
- urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/
- end
- end
- end
- def urls_all
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'URLs')
- tell.grey_title_hi unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#@fnb")
- tell.flow unless @opt.cmd =~/q/
- @u.each do |x,y|
- tell=case x
- when /^m/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@env.program.text_editor} ~#{y}/#@fnb.#{y}")
- when /^[abBcdhNopswxXy]/
- tellx=SiSU_Screen::Ansi.new(@opt.cmd,"-p (LaTeX)","#{@env.program.text_editor} ~work/tex_rz/#@fnb.tex") if y=~/landscape/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/#@fnb/#{y}")
- when /^Y/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/sitemap/#{y}")
- when /^I/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@path.path.texinfo}; pinfo ./#@fnb.#{y}; cd -")
- when /^i/
- SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@manpage_gen #{@path.path.manpage}/#@fnb.1 |most")
- end
- tellx.result if tellx
- tell.result if tell
- tellx=nil
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/webrick.rb b/lib/sisu/v1/webrick.rb
deleted file mode 100644
index e8d4ae1c..00000000
--- a/lib/sisu/v1/webrick.rb
+++ /dev/null
@@ -1,174 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: webrick share - note sisu by default does not link with file
- suffixes, see man pages for options
-
-=end
-def brick(port,get='')
- cgidir=if get=~/pwd/; Dir.pwd
- else '/usr/lib/cgi-bin' # @env.path.cgi
- end
- port=SiSU_Env::Info_port.new.webrick
- begin
- s=HTTPServer.new(
- :Port => port,
- :DocumentRoot => Dir::pwd + '/htdocs',
- :CGIPathEnv => ENV['PATH']
- )
- cgi_dir=File.expand_path(cgidir)
- @mount.each { |x,y| # mount subdirectories
- s.mount(x, HTTPServlet::FileHandler, y, true)
- }
- s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, {:FancyIndexing=>true})
- #### mount subdirectories, true added to permit dir listing
- trap("INT"){ s.shutdown }
- s.start
- rescue; SiSU_Errors::Info_error.new($!,$@,'-W',nil).error #fix
- ensure
- end
-end
-begin #%
- require 'webrick'
- include WEBrick
- require 'time'
- require 'fileutils'
- include FileUtils
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Screen
- @cX=SiSU_Screen::Ansi.new('yes').cX
- @env=SiSU_Env::Info_env.new
- port=SiSU_Env::Info_port.new
- @argv=$*
- @host=@env.url.webrick
- #@host=ENV['HOSTNAME']
- host='localhost'
- @port="#{@argv[0].to_i}"
- @port="#{port.webrick}" if @port =~ /^0$/
- @serve=[]
- Dir.foreach(@env.path.webserv) {|x| @serve << x if x !~/^\./ and FileTest.directory?("#{@env.path.webserv}/#{x}") }
- @mount=[]
- @serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
- @pwd=Dir.pwd
- @week=Time.now.strftime(%{%Yw%W})
- puts "\n"
- @mount.each { |x,y|
- puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#@host:#@port#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#@host:#@port#{x}/#{@cX.off}"
- }
- puts "#{@cX.grey}"
- #%
- wb_s2=[]
- #% writes file wb.cgi to shared directories ...
- #% wb_top
- wb_top=%q(#!/usr/bin/env ruby
- # * arch-tag: webrick info on environment, mounted directories, and contents of pwd
- require 'time'
- require 'cgi'
- require 'fcgi'
- ls=Dir.entries('./')
- dir_contents=[]
- ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
- dir_contents=dir_contents.sort.join(' ')
- #host=ENV['HOSTNAME']
- #host=%x{echo $HOSTNAME}
- )
- #% wb_s1
- wb_s1=<<WOK
-
- page=CGI.new "html3"
- page.out {
- page.html {
- page.head { page.title {"#@host Webrick Report"} } +
- page.body {
- page.h1 {"Webrick #@host"} +
- page.p {"Webrick is Ruby's built in webserver."} +
- page.center {"Host name: " + page.b{"#@host "} + "(#@host) port: " + page.b{"#@port"}} +
- page.center {"#{Time.now}"} +
- page.center {"#{Time.now.strftime(%{%Yw%W})}"} +
- #page.center { "Center " + page.em{"emphasise "} + page.i{"italicise " } + page.b{"bold "} + page.u{"underline "}} +
- page.p {''} +
- page.p {''} +
- page.p {page.b{"Webrick Served Directories: "}} +
-WOK
- #% wb_s2 (mounts)
- @mount.each do |x,y| wb_s2 <<<<WOK
- page.p {page.b{'<a href="#@host:#@port#{x}/">#{x}</a> '} + '<a href="#@host:#@port#{x}/">#@host:#@port#{x}</a> (mounts: #{y}/) <a href="#@host:#@port#{x}/wb.cgi">info (wb.cgi)</a>'} +
-WOK
-end
- #% wb_end
- wb_end=<<WOK
- page.p {page.b{"Contents of PWD (see URL): "}} +
- page.p {"#\{dir_contents}"}
- }
- }
- }
-WOK
- @mount.each { |x,y| #% wb puts
- puts y
- filename=File.new("#{y}/wb.cgi",'w')
- filename << wb_top
- filename << wb_s1
- filename << wb_s2
- filename << wb_end
- filename.close
- chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
- }
- puts " #{@cX.off}"
- get=@argv.shift if @argv[0] =~/pwd/ #% argv
- brick(@port,get)
-rescue; SiSU_Errors::Info_error.new($!,$@,'-W',nil).error #fix
-ensure
-end
diff --git a/lib/sisu/v1/wikispeak.rb b/lib/sisu/v1/wikispeak.rb
deleted file mode 100644
index 896649a2..00000000
--- a/lib/sisu/v1/wikispeak.rb
+++ /dev/null
@@ -1,407 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: wiki text generation, stripped wiki output (unix, linefeed)
-
-=end
-module SiSU_Wikispeak
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- include SiSU_Param
- include SiSU_Viz
- require "#{SiSU_lib}/plaintext_format"
- include Format
- require "#{SiSU_lib}/shared_txt"
- pwd=Dir.pwd
- @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- @@dostype='msdos footnotes'
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
- path=@env.path.output_tell
- tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}"
- else ''
- end
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Wikispeak',tool)
- tell.green_hi_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}")
- tell.flow if @opt.cmd =~/[MV]/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet
- SiSU_Env::Info_skin.new(@md).select #watch
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Split_text_object <Source
- require "#{SiSU_lib}/plaintext_format"
- include SiSU_Viz
- include Format
- @@alt_id_count=0
- @@dp=nil
- attr_reader :format,:lev,:text,:ocn,:lev_para_ocn
- def initialize(para)
- @para=para
- @format,@ocn='ordinary','ordinary'
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def lev_segname_para_ocn
- @text=nil
- if @para =~/^(\d~|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5
- elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @format,@lev,@text,@ocn=$1,$2,$3,$4
- elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @format,@text,@ocn=$1,$2,$3
- elsif /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @@alt_id_count+=1
- @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}"
- elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @@alt_id_count+=1
- @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}"
- end
- else
- if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
- @text,@ocn=$1,$2
- end
- if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06
- @text=/(.+?)/m.match(@para)[1]
- end
- if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para)
- @format,@lev,@text=$1,$2,$3
- end
- end
- format=@format.dup
- @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{#Mx[:id_c]}$/
- Format::Format_text_object.new(format,@text,@ocn)
- else
- Format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}")
- end
- self
- end
- end
- class Scroll <Source
- require "#{SiSU_lib}/shared_txt"
- include SiSU_text_utils
- @@endnotes_para=[]
- @@wiki={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
- @@dp=nil
- def initialize(data,md)
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #m # 2004w18 pb pn removal added
- @tab="\t"
- @@dostype='unix footnotes'
- @br="\n"
- #@@dostype='msdos footnotes'
- #@br="\r\n"
- end
- def songsheet
- markup
- publish
- #@data.each { |x| puts x.inspect if x =~/\[table/ }
- end
- # Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- @n=[]
- end
- def wiki_metadata(meta)
- util=SiSU_text_utils::Wrap.new(meta.text,70,15,1)
- txt=util.line_wrap
- @@wiki[:metadata] <<= if meta.type == 'meta'
- <<WOK
-
-#{@tab}#{meta.el}: #{txt}
-WOK
- else ''
- end
- end
- def wiki_tail
- SiSU_Env::Info_skin.new(@md).select
- vz=SiSU_Env::Get_init.instance.skin
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
- else ''
- end
- @@wiki[:tail] <<<<WOK
-#@br
-Other versions of this document: #@br
-manifest:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}#@br
-html:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:toc]}#@br
-pdf:
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_p]}
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_l]}#@br
-plaintext (plain text):
- #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:plain]}#@br
-at:
- #{vz.url_site}#@br
-
-#{sc}
-* #{generator}
-* #{rubyv}
-* #{lastdone}
-* SiSU #{vz.url_sisu}
-WOK
- end
- def wiki_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- extract_endnotes(para)
- para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:[\d*+]+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'<ref>\1</ref>') # endnote marker marked up
- para.gsub!(/^#{Rx[:lv]}\S*\s+/,'') # endnote marker marked up
- para.gsub!(/<\S+?>#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # endnote marker marked up
- if lv
- @@wiki[:body] << case lv
- when 1; '='*2 << para.strip << @br*2
- when 2..3; '='*2 << para.strip << @br*2
- when 4; '='*4 << para.strip << @br*2
- when 5..6; '='*4 << para.strip << @br*2
- end
- else @@wiki[:body] << para << @br*2 # main text, contents, body KEEP
- end
- end
- def markup # Used for major markup instructions
- data=@data
- dir=SiSU_Env::Info_env.new(@md.fns)
- @data_mod,@endnotes,@level,@cont,@copen,@wiki_contents_close=Array.new(6){[]}
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @wiki_contents_close[x]='' }
- wiki_tail
- table_message='[table omitted, see other document formats]'
- fix=[]
- data.each do |para|
- para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}")
- para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
- para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down
- para.gsub!(/&#169;/,'©') # bullet markup, marked down
- para.gsub!(/&amp;/,'&') # bullet markup, marked down
- para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^')
- para.gsub!(/<sub>(.+?)<\/sub>/,'[\1]')
- para.gsub!(/<i>(.+?)<\/i>/,"''\\1''")
- para.gsub!(/<b>(.+?)<\/b>/,"'''\\1'''")
- para.gsub!(/<u>(.+?)<\/u>/,'_\1_')
- para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/\S+)/,'[\2 \1]')
- para.gsub!(/(https?:\/\/\S+)/,'[\1]')
- para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'')
- para.gsub!(/<:p[bn]>/,'') # remove page breaks
- para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check
- para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- para.gsub!(/<:name#\S+?>/,'') # remove name links
- para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
- #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
- wordlist=para.scan(/\S+/)
- if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; wiki_metadata(d_meta)
- end
- end
- if para !~/(^0~|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/
- if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
- paranum=para[@regx,3]
- @p_num=Format::Paragraph_number.new(paranum)
- end
- @sto=Split_text_object.new(para).lev_segname_para_ocn
- ### problem in scroll, it appears tables are getting paragraph numbers
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m \
- and para=~/\S+/
- para=case @sto.format
- when /^(1)~(?:(\S+))?/
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body1
- when /^(2)~(?:(\S+))?/
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body2
- when /^(3)~(?:(\S+))?/
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body3
- when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body4
- when /^(5)~(?:(\S+))?/
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body5
- when /^(6)~(?:(\S+))?/
- wiki_structure(para,$1,@sto.ocn,$2)
- @sto.lev_para_ocn.heading_body6
- #when /^(i1)$/
- # #formatMono.gsubBody
- # #para=@sto[:lev_para_ocn].scrIndent1
- #when /^(i2)$/
- # formatMono.gsubBody
- # para=@sto[:lev_para_ocn].scrIndent2
- #when /^(center)$/
- # para.gsub!(/(.+)/,
- # %{<center>(\\1)</center>})
- # para=@sto[:lev_para_ocn].scrPara
- #when /^(b|bold)$/
- # para.gsub!(/(.+)/,
- # %{<b>(\\1)</b>})
- # para=@sto[:lev_para_ocn].scrPara
- #when /null/ # see whether u can improve
- # if (para !~/#{@margin.txt_0}|#{@margin.txt_1}|#{@margin.txt_2}/)
- # #formatMono.gsubBody
- # #para=@sto[:lev_para_ocn].scrPara
- # end
- else
- wiki_structure(para,nil,nil,nil) #watch may be problematic
- para
- end
- elsif para =~/#{table_message}/
- @@wiki[:body] << para << @br
- elsif para =~/(Note|Endnotes?)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit
- #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>')
- #para=formatMono.bold_para
- elsif para.include? 'Owner Details' \
- and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>')
- #@@wiki[:owner_details]=formatMono.bold_para
- #para=''
- elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables !
- elsif para =~/(.*)<!#!>(.*)/
- one,two=$1,$2
- format_text=Format_text_object.new(one,two)
- para=format_text.seg_no_paranum
- end
- if (para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- para=''
- end
- case para
- when /<:i1>/
- if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
- para=format_text.scr_indent_one_no_paranum
- end
- when /<:i2>/
- if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
- para=format_text.scr_indent_one_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=Format_text_object.new(one,two)
- para=format_text.center
- end
- para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
- para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text
- end
- end
- end
- def publish
- divider="="
- content=[]
- data=@data
- content << @@wiki[:open]
- content << @@wiki[:head]
- content << @@wiki[:body]
- #content << @@wiki[:metadata]
- #content << @@wiki[:owner_details] if @md.stmp =~/\w+/ #not used?
- #content << @@wiki[:tail]
- Output.new(content.join,@md).wiki
- @@wiki[:head],@@wiki[:body],@@wiki[:tail],@@wiki[:metadata]=[],[],[],[]
- end
- end
- class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- end
- def wiki #%wiki output
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_wiki=SiSU_Env::SiSU_file.new(@md,@md.fn[:wiki]).mkfile
- @sisu=[]
- @content.each do |para| # this is a hack
- if para =~/^\S/
- if para !~/^([*=-]|\.){5}/; filename_wiki.puts para #unix wiki
- else filename_wiki.puts para #unix wiki
- end
- else filename_wiki.puts para # if para =~/^\s/
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/xhtml.rb b/lib/sisu/v1/xhtml.rb
deleted file mode 100644
index 02201755..00000000
--- a/lib/sisu/v1/xhtml.rb
+++ /dev/null
@@ -1,465 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: xhtml output logic, flow
- ** Notes: tidy -xml scroll.xhtml >> index.tidy
-=end
-module SiSU_XHTML
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/shared_xml"
- require "#{SiSU_lib}/xml_format"
- include SiSU_XML_format
- include SiSU_XML_munge
- require "#{SiSU_lib}/rexml"
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/
- SiSU_XHTML::Source::Songsheet.new(@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- #file closed in songsheet
- end
- end
- private
- class Songsheet
- def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
- end
- def songsheet
- begin
- SiSU_XHTML::Source::Scroll.new(@particulars).songsheet
- SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:xhtml]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/css"
- include SiSU_text_utils
- @@dp=nil
- @@xml={ :body=>[],:sisu=>[],:open=>[],:close=>[],:head=>[] }
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @tab="\t"
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- protected
- def embedded_endnotes(para='')
- para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- end
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- notes.flatten.each do |e|
- s=e.to_s
- util=SiSU_text_utils::Wrap.new(s,70)
- wrap=util.line_wrap
- wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote notenumber="\\1">
-#{@tab*2}\\1. \\2
-#{@tab*1}</endnote>
-WOK
-)
- wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote symbol="\\1">
-#{@tab*2}\\1 \\2
-#{@tab*1}</endnote>
-WOK
-)
- wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote symbol="\\1.length">
-#{@tab*2}\\1 \\2
-#{@tab*1}</endnote>
-WOK
-)
-#KEEP alternative presentation of endnotes
-# wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
-##{@tab*1}<p class="endnote" notenumber="\\1">
-##{@tab*2}\\1. \\2
-##{@tab*1}</p>
-#WOK
-#)
- @endnotes << wrap
- end
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ')
- txt.gsub!(/ & /,' and ')
- el=meta.el.gsub(/\./,'_')
- el_txt=meta.el.gsub(/\./,' ')
- @@xml[:head] <<= if meta.type == 'meta'
- <<WOK
-#{@tab}<meta>#{el_txt.capitalize}:</meta>
-#{@tab}<#{el} class="#{meta.attrib}">
-#{@tab*2}#{txt}
-#{@tab}</#{el}>
-#{@tab}<br />
-WOK
- else ''
- end
- end
- def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- extract_endnotes(para)
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- @@xml[:body] << if para[@regx,3]; %{#{@tab*0}<object id="#{para[@regx,3]}">} << "\n"
- else "#{@tab*0}<object>" << "\n" if para[@regx]
- end
- #@@xml[:body] << "#{@tab*0}<object>" << "\n" if para[@regx]
- #@@xml[:body] << "#{@tab*1}<heading>#{lv}</heading>" << "\n" if lv
- @@xml[:body] << %{#{@tab*1}<text class="#{type}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} unless lv # main text, contents, body KEEP
- @@xml[:body] << %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n" if lv # main text, contents, body KEEP
- #@@xml[:body] << %{#{@tab*1}<text heading="#{lv}">\n} << "\n" if lv
- @@xml[:body] << @endnotes.compact.join if @endnotes.length > 0 # main text, endnotes KEEP
- @@xml[:body] << "#{@tab*1}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- @endnotes=[]
- end
- def group_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.strip!
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def poem_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def code_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.gsub!(/\s\s/,'&#160;&#160;')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def table_structure(table='',ocn='') #tables
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" #if para[@regx]
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n} # unless lv # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx]
- @endnotes=[]
- end
- def markup(data)
- @endnotes=[]
- @rcdc=false
- @level,@cont,@copen,@xml_contents_close=[],[],[],[]
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- data.each do |para|
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- para=@trans.markup(para)
- if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- if @rcdc==false \
- and (para =~/~metadata/ \
- or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/)
- @rcdc=true
- end
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- paranum=para[@regx,3]
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum)
- end
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml
- ### problem in scroll, it appears tables are getting paragraph numbers
- unless @rcdc
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m
- txt_obj={:txt =>@sto.text}
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body6
- else
- matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para)
- stamp,ocn=matched[0],matched[1]
- if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- poem_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- group_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- code_structure(para,ocn)
- elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para,ocn)
- para=table.table_split
- table_structure(para,ocn)
- elsif para =~ /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?#{Mx[:gl_bullet]}/
- m=$1
- para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?)#{Mx[:gl_bullet]}/,'\1')
- xml_structure(para,nil,nil,nil,"indent_bullet#{m}")
- elsif para =~ /^\s*#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- xml_structure(para,nil,nil,nil,"indent#{$1}")
- else xml_structure(para,nil,nil,nil)
- end
- #@@xml[:body] << "#{@tab*6}<object>" << "\n" if para[@regx]
- #@@xml[:body] << "#{@tab*7}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- #@@xml[:body] << "#{@tab*7}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # main text, contents, body KEEP
- #@@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx]
- end
- elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info
- txt_obj={:txt =>'<br /><a name="metadata">MetaData</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- para=format_scroll.bold_para
- elsif para =~/(Owner Details)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>'<br /><a name="owner.details">Owner Details</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- @@xml[:owner_details]=format_scroll.bold_para
- para=''
- #elsif para =~/(.*)<:#>(.*)/
- # one,two=$1,$2
- # format_text=Format_text_object.new(one,two)
- # para=format_text.seg_no_paranum
- end
- #if para =~/<a name="n\d+">/ \
- #and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- # para=''
- #end
- para=case para
- when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- if para =~/.*<:#>.*$/
- txt_obj={:txt =>para}
- format_text=Format_text_object.new(@md,txt_obj)
- format_text.scr_inden_ocn_e_no_paranum
- end
- else para
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- else #
- end
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para
- end
- end
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x] == true
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true
- end
- #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true }
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- @@xml[:head],@@xml[:body]=[],[] #added
- css=SiSU_Env::CSS_select.new(@md).xhtml
- encoding=if @sys.locale =~/utf-?8/i #% utf8
- '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else
- '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{@env.path.style}/#{css}"?>
-#{rdf.comment_xml}
-<document>
-WOK
- @@xml[:head] << %{<head>\n\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n}
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
- Output.new(content,@md).xml
- @@xml={} # check whether should be nil
- end
- end
- class Output
- def initialize(data,md)
- @data,@md=data,md
- end
- def xml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:xhtml]).mkfile
- @data.each do |para|
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'')
- para.gsub!(/^\s*\n$/,'')
- filename_xml.puts para unless para.empty?
- end
- filename_xml.close
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:xhtml]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
-<?xml version="1.0"?>
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?xml version="1.0" encoding="UTF-16" standalone="no"?>
diff --git a/lib/sisu/v1/xml.rb b/lib/sisu/v1/xml.rb
deleted file mode 100644
index c313a1e6..00000000
--- a/lib/sisu/v1/xml.rb
+++ /dev/null
@@ -1,482 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: xml output (sax style) processing
-
-=end
-module SiSU_XML_SAX
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/shared_xml"
- require "#{SiSU_lib}/xml_format"
- include SiSU_XML_format
- include SiSU_XML_munge
- require "#{SiSU_lib}/rexml"
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/
- SiSU_XML_SAX::Source::Songsheet.new(@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- #file closed in songsheet
- end
- end
- private
- class Songsheet
- def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
- end
- def songsheet
- begin
- SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet
- SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:sax]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/css"
- include SiSU_text_utils
- @@dp,@@env=nil,nil
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] }
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @tab="\t"
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- protected
- def embedded_endnotes(para='')
- para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- end
- def extract_endnotes(para='')
- notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
- notes.flatten.each do |e|
- s=e.to_s
- util=SiSU_text_utils::Wrap.new(s,70)
- wrap=util.line_wrap
- wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote notenumber="\\1">
-#{@tab*2}<number>\\1</number>
-#{@tab*2}<note>
-#{@tab*3}\\2
-#{@tab*2}</note>
-#{@tab*1}</endnote>
-WOK
-)
- wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote symbol="\\1">
-#{@tab*2}<symbol>\\1</symbol>
-#{@tab*2}<note>
-#{@tab*3}\\2
-#{@tab*2}</note>
-#{@tab*1}</endnote>
-WOK
-)
- wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
-#{@tab*1}<endnote symbol="\\1.length">
-#{@tab*2}<symbol>\\1</symbol>
-#{@tab*2}<note>
-#{@tab*3}\\2
-#{@tab*2}</note>
-#{@tab*1}</endnote>
-WOK
-)
- @endnotes << wrap
- end
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ')
- txt.gsub!(/ & /,' and ')
- el=meta.el.gsub(/\./,'_')
- el_txt=meta.el.gsub(/\./,' ')
- @@xml[:head] <<= if meta.type == 'meta'
- <<WOK
-#{@tab}<meta>#{el_txt.capitalize}:</meta>
-#{@tab}<#{el} class="#{meta.attrib}">
-#{@tab*2}#{txt}
-#{@tab}</#{el}>
-#{@tab}<br />
-WOK
- else ''
- end
- end
- def xml_sc(md='')
- sc=if @md.sc_info
- <<WOK
- <source_control>
- <meta>filename:</meta>
- <sc class="sourcefile">
- #{@md.sc_filename}
- </sc><br />
- <meta>version number:</meta>
- <sc class="number">
- #{@md.sc_number}
- </sc><br />
- <meta>version date:</meta>
- <sc class="date">
- #{@md.sc_date}
- </sc><br />
- </source_control>
-WOK
- else ''
- end
- @@xml[:sc]=sc
- end
- def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- extract_endnotes(para)
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- @@xml[:body] << if para[@regx,3]; %{#{@tab*0}<object id="#{para[@regx,3]}">} << "\n"
- else "#{@tab*0}<object>" << "\n" if para[@regx]
- end
- @@xml[:body] << "#{@tab*1}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n"
- else %{#{@tab*1}<text class="#{type}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP
- end
- @@xml[:body] << @endnotes if @endnotes
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- @endnotes=[]
- end
- def group_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'')
- extract_endnotes(para)
- para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean
- para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
- para=@trans.markup_group(para)
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- @@xml[:body] << @endnotes if @endnotes
- @endnotes=[]
- end
- def poem_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- #para.gsub!(/\s\s/,'&#160;&#160;')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def code_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.gsub!(/\s\s/,'&#160;&#160;')
- para.strip!
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*1}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*1}</text>\n}
- @@xml[:body] << "#{@tab*0}</object>" << "\n"
- end
- def table_structure(table='',ocn='') #tables
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" #if para[@regx]
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n} # unless lv # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx]
- @endnotes=[]
- end
- def markup(data)
- xml_sc(@md)
- @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- data.each do |para|
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- para=@trans.markup(para)
- if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- if @rcdc==false \
- and (para =~/~metadata/ \
- or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/)
- @rcdc=true
- end
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|#{Mx[:br_endnotes]})/
- if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- paranum=para[@regx,3]
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum)
- end
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml
- #@sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para_ocn
- unless @rcdc
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m
- txt_obj={:txt =>@sto.text}
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body1
- when /^(2):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body2
- when /^(3):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body3
- when /^(4):(\S+)/ # work on see Split_text_object
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body4
- when /^(5):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body5
- when /^(6):(\S*)/
- xml_structure(para,$1,@sto.ocn,$2)
- para=@sto.lev_para_ocn.heading_body6
- else
- matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para)
- stamp,ocn=matched[0],matched[1]
- if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- poem_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- group_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- code_structure(para,ocn)
- elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para,ocn)
- para=table.table_split
- table_structure(para)
- elsif para =~ /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?#{Mx[:gl_bullet]}/ #uncomment
- m=$1
- para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?)#{Mx[:gl_bullet]}/,'\1')
- xml_structure(para,nil,nil,nil,"indent_bullet#{m}")
- elsif para =~ /#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- xml_structure(para,nil,nil,nil,"indent#{$1}")
- else xml_structure(para,nil,nil,nil)
- end
- end
- elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info
- txt_obj={:txt =>'<br /><a name="metadata">MetaData</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- para=format_scroll.bold_para
- elsif para =~/(Owner Details)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>'<br /><a name="owner.details">Owner Details</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- @@xml[:owner_details]=format_scroll.bold_para
- para=''
- #elsif para =~/(.*)<!#!>(.*)/
- # one,two=$1,$2
- # #txt_obj={:txt =>@sto.txt}
- # format_text=Format_text_object.new(one,two)
- # para=format_text.seg_no_paranum
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if para =~/.*<:#>.*$/ #investigate removal
- para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- txt_obj={:txt =>para}
- format_text=Format_text_object.new(@md,txt_obj)
- format_text.scr_inden_ocn_e_no_paranum
- end
- end
- else #
- end
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para
- end
- end
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x] == true
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true
- end
- #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true }
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- @@xml[:head],@@xml[:body]=[],[] #added
- css=SiSU_Env::CSS_select.new(@md).xml_sax
- encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
-#{rdf.comment_xml}
-<document>
-WOK
- @@xml[:head] << "<head>\n"
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << @@xml[:sc]
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
- Output.new(content,@md).xml
- @@xml={} # check whether should be nil
- end
- end
- class Output
- include SiSU_Param
- include SiSU_Env
- def initialize(data,md)
- @data,@md=data,md
- end
- def xml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:sax]).mkfile
- @data.each do |para|
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'')
- para.gsub!(/^\s*\n$/,'')
- filename_xml.puts para unless para.empty?
- end
- filename_xml.close
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false #note values can be other than true
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:sax]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
-<?xml version="1.0"?>
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?xml version="1.0" encoding="UTF-16" standalone="no"?>
diff --git a/lib/sisu/v1/xml_dom.rb b/lib/sisu/v1/xml_dom.rb
deleted file mode 100644
index e6006c6b..00000000
--- a/lib/sisu/v1/xml_dom.rb
+++ /dev/null
@@ -1,561 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: xml (dom style) output processing
- ** Notes: tidy -xml dom.xml >> index.tidy
-=end
-module SiSU_XML_DOM
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/shared_xml"
- require "#{SiSU_lib}/xml_format"
- include SiSU_XML_format
- include SiSU_XML_munge
- require "#{SiSU_lib}/rexml"
- include SiSU_Rexml
- @@alt_id_count,@@tablehead,@@number_of_cols=0,0,0
- @@tablefoot=''
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- end
- def read
- begin
- @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
- path=@env.path.output_tell
- loc=@env.url.output_tell
- tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}"
- elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}"
- else ''
- end
- SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize unless @opt.cmd =~/q/
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/
- SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- #file closed in songsheet
- end
- end
- private
- class Songsheet
- def initialize(particulars)
- @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars
- end
- def songsheet
- begin
- SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet
- SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use
- SiSU_Rexml::Rexml.new(@md,@md.fn[:dom]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- end
- end
- end
- class Scroll
- require "#{SiSU_lib}/shared_txt"
- include SiSU_text_utils
- @@dp=nil
- @@xml={ :body=>[],:open=>[],:close=>[],:head=>[],:sc=>[] }
- def initialize(particulars)
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @vz=SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- @tab="\t"
- @trans=SiSU_XML_munge::Trans.new(@md)
- @sys=SiSU_Env::System_call.new
- end
- def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
- end
- protected
- def xml_markup(para='')
- para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,
- '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
- end
- def xml_head(meta)
- txt=meta.text
- txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ')
- txt.gsub!(/ & /,' and ')
- el=meta.el.gsub(/\./,'_')
- el_txt=meta.el.gsub(/\./,' ')
- @@xml[:head] <<= if meta.type == 'meta'
- <<WOK
-#{@tab}<header>
-#{@tab*2}<meta>#{el_txt.capitalize}:</meta>
-#{@tab*2}<#{el}>
-#{@tab*3}#{txt}
-#{@tab*2}</#{el}>
-#{@tab}</header>
-WOK
- else ''
- end
- end
- def xml_sc(md='')
- sc=if @md.sc_info
- <<WOK
- <source_control>
- <meta>filename:</meta>
- <sc class="sourcefile">
- #{@md.sc_filename}
- </sc><br />
- <meta>version number:</meta>
- <sc class="number">
- #{@md.sc_number}
- </sc><br />
- <meta>version date:</meta>
- <sc class="date">
- #{@md.sc_date}
- </sc><br />
- </source_control>
-WOK
- else ''
- end
- @@xml[:sc]=sc #<<<<WOK
-#WOK
- end
- def xml_element(lv='',ocn='',para='',hname='',tag='',xml_element='',xml_content='')
- lv=lv.to_i
- n=lv - 1
- n1=lv
- n2=lv + 1
- n3=lv + 2
- v=lv - 3
- tag=''
- tag="\n#{@tab*n3}<nametag>#{hname}</nametag>\n" if hname #!=nil
- @@xml[:body] <<<<WOK
-#{@tab*n}#{xml_element}
-#{@tab*n1}<heading>
-#{@tab*n2}<object id="#{ocn}">
-#{@tab*n3}<ocn>#{ocn}</ocn>#{tag}
-#{@tab*n3}<text>#{para[@regx,2]}</text>
-#{@tab*n2}</object>
-#{@tab*n1}</heading>#{xml_content}
-WOK
- if lv == 4
- @copen[1]=true
- @copen[2]=@copen[3]=false
- elsif lv == 5
- @copen[2]=true
- @copen[3]=false
- elsif lv == 6
- @copen[3]=true
- end
- end
- def xml_structure(lv='',ocn='',para='',hname='' )
- lv=lv.to_i
- n=lv - 1
- n1=lv
- n2=lv + 1
- n3=lv + 2
- v=lv - 3
- tag=''
- tag="\n#{@tab*n3}<nametag>#{hname}</nametag>\n" if hname !=nil
- #if para[@regx]
- # paragraph="#{para[@regx,2]}"
- # util=SiSU_text_utils::Paragraph.new(paragraph,70)
- # wrapped=util.line_wrap
- #end
- case lv
- when 1..3
- xml_element="<heading#{lv}>"
- 3.downto(lv) do |x|
- y=x - 1
- if @cont[1] \
- or @cont[2] \
- or @cont[3]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- #@@xml[:body] << "#{@tab*5}</content>\n" if @cont[1] == true or @cont[2] == true or @cont[3] == true
- @cont[1]=false if @cont[1]
- @cont[2]=false if @cont[2]
- @cont[3]=false if @cont[3]
- ####### attempt to close contents
- if @copen[3] # 6~
- [3,2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[2] # 5~
- [2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[1] # 4~
- [1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- @copen[1]=@copen[2]=@copen[3]=false
- end
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]
- @level[x]=false
- end
- when 4..6
- 6.downto(lv) do |x|
- y=x - 1
- if @level[x] == true
- u=x - 3;
- @xml_contents_close[x]=''
- end
- end
- cv=lv - 3
- xml_element="<contents#{cv}>"
- xml_content="\n#{@tab*5}<content>"
- case lv
- when 4
- @@xml[:body] << "#{@tab*5}</content>\n" if @cont[1]
- if @copen[3] == true # 6~
- [3,2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[2] == true # 5~
- [2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[1] == true # 4~
- [1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- end
- @cont[1]=true
- when 5
- if @cont[2] \
- or @cont[1]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- if @copen[3] == true #6~
- [3,2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- elsif @copen[2] == true #5~
- [2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- end
- @cont[2]=true
- when 6
- if @cont[3] \
- or @cont[2] \
- or @cont[1]
- @@xml[:body] << "#{@tab*5}</content>\n"
- end
- if @copen[3] #6{
- [3].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
- end
- @cont[3]=true
- end
- end
- xml_element(lv,ocn,para,hname,tag,xml_element,xml_content)
- @level[lv]=true
- ((lv+1)..6).each { |x| @level[x]=false }
- end
- def group_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,
- '<endnote><number>\1</number><note>\2</note></endnote> ')
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*7}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="group">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def poem_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*7}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="verse">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def code_structure(para='',ocn='')
- para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'')
- para=@trans.markup_group(para)
- para.gsub!(/\s\s/,'&#160;&#160;')
- para.strip!
- @@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n"
- @@xml[:body] << %{#{@tab*7}<ocn>#{ocn}</ocn>} << "\n"
- @@xml[:body] << %{#{@tab*7}<text class="code">#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*8}#{para}#{@tab*1}\n}
- @@xml[:body] << %{#{@tab*7}</text>\n}
- @@xml[:body] << "#{@tab*6}</object>" << "\n"
- end
- def table_structure(table='',ocn='') #tables
- @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" #if para[@regx]
- @@xml[:body] << %{#{@tab*1}#{table}\n#{@tab*1}\n} # unless lv # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx]
- @endnotes=[]
- end
- def markup(data)
- xml_sc(@md)
- @level,@cont,@copen,@xml_contents_close=[],[],[],[]
- @rcdc=false
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
- data.each do |para|
- @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8
- para=@trans.markup(para)
- if para =~/^#{Rx[:meta]}\s*(.+?)$/ # for headers
- d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta
- if d_meta; xml_head(d_meta)
- end
- end
- if @rcdc==false \
- and (para =~/~metadata/ \
- or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/)
- @rcdc=true
- end
- if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- paranum=para[@regx,3]
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum)
- end
- @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml
- ### problem in scroll, it appears tables are getting paragraph numbers
- unless @rcdc
- m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- if para =~m
- txt_obj={:txt =>@sto.text}
- format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/
- case @sto.format
- when /^(1):(\S*)/
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body1 #if para =~m
- when /^(2):(\S*)/
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body2 #if para =~m
- when /^(3):(\S*)/
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body3 #if para =~m
- when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body4 #if para =~m
- when /^(5):(\S*)/
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body5 #if para =~m
- when /^(6):(\S*)/
- xml_markup(para)
- xml_structure($1,@sto.ocn,para,$2)
- para=@sto.lev_para_ocn.heading_body6 #if para =~m
- else
- matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para)
- stamp,ocn=matched[0],matched[1]
- if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- poem_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- group_structure(para,ocn)
- elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- para.gsub!(/#{stamp}/,'')
- code_structure(para,ocn)
- elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13
- table=SiSU_Tables::Table_xml.new(para,ocn)
- para=table.table_split
- @@xml[:body] << table_structure(para,ocn)
- else #xml_structure(para, nil, nil, nil)
- type=case para
- when /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}\s*)?#{Mx[:gl_bullet]}/
- m=$1
- para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}\s*)?)#{Mx[:gl_bullet]}/,'\1')
- "indent_bullet#{m}"
- when /^\s*#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; "indent#{$1}"
- else 'norm'
- end
- xml_markup(para)
- if para[@regx] \
- and para[@regx,3]
- @@xml[:body] << %{#{@tab*6}<object id="#{para[@regx,3]}">} << "\n"
- end
- @@xml[:body] << "#{@tab*7}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- @@xml[:body] << %{#{@tab*7}<text class="#{type}">#{para[@regx,2]}</text>\n} if para[@regx,2] # main text, contents, body KEEP
- @@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx]
- end
- end
- elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- #format_scroll=MonoSiSU.new('<br /><a name="notes">Note</a>')
- #para=format_scroll.boldPara
- elsif para =~/(MetaData)/ \
- and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info
- txt_obj={:txt =>'<br /><a name="metadata">MetaData</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- para=format_scroll.bold_para
- elsif para =~/(Owner Details)/ \
- and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- txt_obj={:txt =>'<br /><a name="owner.details">Owner Details</a>'}
- format_scroll=Format_scroll.new(@md,txt_obj)
- @@xml[:owner_details]=format_scroll.bold_para
- para=''
- #elsif para =~/(.*)<:#>(.*)/
- # one,two=$1,$2
- # format_text=Format_text_object.new(one,two)
- # para=format_text.seg_no_paranum
- end
- if para =~/<a name="n\d+">/ \
- and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
- para=''
- end
- if para =~/.*<:#>.*$/
- para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
- txt_obj={:txt =>para}
- format_text=Format_text_object.new(@md,txt_obj)
- format_text.scr_inden_ocn_e_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- # i don't get the condition for no paranum
- end
- else #
- end
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para
- end
- end
- @content_flag=true
- 6.downto(4) do |x|
- y=x - 1; v=x - 3
- if @level[x] == true #2004w36 bug fix? watch/test previous logic broke on free.for.all @coontent_flag introduced
- if @content_flag==true
- @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n"
- @content_flag=false
- else
- @@xml[:body] << "\n#{@tab*y}</contents#{v}>\n"
- end
- end
- end
- 3.downto(1) do |x|
- y=x - 1
- @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true
- end
- #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true }
- end
- def pre
- rdf=SiSU_XML_tags::RDF.new(@md)
- dir=SiSU_Env::Info_env.new
- css=SiSU_Env::CSS_select.new(@md).xml_dom
- encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
- else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
- end
- @@xml[:open] =<<WOK
-#{encoding}
-<?xml-stylesheet type="text/css" href="../#{dir.path.style}/#{css}"?>
-#{rdf.comment_xml}
-<document>
-WOK
- @@xml[:head] << "<head>\n"
- @@xml[:body] << "<body>\n"
- end
- def post
- @@xml[:head] << @@xml[:sc]
- @@xml[:head] << "</head>\n"
- @@xml[:body] << "</body>\n"
- @@xml[:close] = "</document>\n"
- end
- def publish
- content=[]
- content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
- content << @@xml[:owner_details] if @md.stmp =~/\w\w/
- content << @@xml[:tail] << @@xml[:close]
- content.flatten!.compact!
- Output.new(content,@md).xml
- @@xml[:head],@@xml[:body],@@xml[:tail]=[],[],[] # check whether should be nil
- end
- end
- class Output
- include SiSU_Param
- def initialize(data,md)
- @data,@md=data,md
- end
- def xml
- SiSU_Env::SiSU_file.new(@md).mkdir
- filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:dom]).mkfile
- @data.each do |para|
- #para.strip!
- para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'')
- para="#{para}\n" unless para.empty?
- filename_xml.puts para
- end
- filename_xml.close
- end
- end
- class Tidy
- def initialize(md,dir)
- @md,@env=md,dir
- @prog=SiSU_Env::Info_program.new
- end
- def xml
- if @prog.tidy !=false
- if @md.cmd =~/[VM]/
- tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure')
- tell.colorize unless @md.cmd =~/q/
- tell.grey_open unless @md.cmd =~/q/
- tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
- tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:dom]}",tidyfile)
- tidy.well_formed?
- tell.p_off unless @md.cmd =~/q/
- end
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/xml_fictionbook.rb b/lib/sisu/v1/xml_fictionbook.rb
deleted file mode 100644
index 8f0178ea..00000000
--- a/lib/sisu/v1/xml_fictionbook.rb
+++ /dev/null
@@ -1,313 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: extract and print an XML rendition of document structure to screen
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, processing
-
-=end
-module SiSU_XML_Fictionbook
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/shared_txt"
- require "#{SiSU_lib}/shared_xml"
- include SiSU_Env
- include SiSU_Param
- include SiSU_text_utils
- include SiSU_XML_munge
- pwd=Dir.pwd
- class Source
- def initialize(opt)
- @opt=opt
- @sp=' '
- end
- def read
- begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @dal_array=SiSU_DAL::Source.new(@opt).get
- SiSU_XML_Fictionbook::Source::Scroll.new(@dal_array,@md).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- def initialize(data='',md='')
- @data,@md=data,md
- @trans=SiSU_XML_munge::Trans.new(@md)
- @dp=SiSU_Env::Info_env.new.digest.pattern
- @file_fictionbook=SiSU_Env::SiSU_file.new(@md,'fictionbook.xml').mkfile
- #@file_fictionbook=SiSU_Env::SiSU_file.new(@md,@md.fn[:fictionbook]).mkfile
- end
- def songsheet
- @t='fictionbook'
- @s=['section', #@s=['body',
- 'section',
- 'section',
- 'section',
- 'section',
- 'section',
- 'section'
- ]
- head
- extract_endnotes
- structure
- #endnotes
- tail
- end
- def head
- version=SiSU_Env::Info_version.instance.get_version
- rb_ver=SiSU_Env::Info_version.instance.rbversion
- date_available=if defined? @md.date_available; "\n <p>#{@md.date_available} Initial version</p>"
- else ''
- end
- date_modified=if defined? @md.date_available; "\n <p>#{@md.date_modified} Last Modified</p>"
- else ''
- end
- head=<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<FictionBook xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
-<description>
- <title-info>
- <genre match="100">***</genre>
- <author>
- <first-name>***</first-name>
- <middle-name>***</middle-name>
- <last-name>***</last-name>
- </author>
- <book-title>#{@md.full_title}</book-title>
- <annotation>
- </annotation>
- <date value="#{@md.date}">yyyy</date>
- </title-info>
- <document-info>
- <author>
- <first-name/>
- <last-name/>
- <nickname/>
- </author>
- <program-used>#{version[:project]} #{version[:version]} and #{rb_ver}</program-used>
- <date value="#{version[:date]}">#{version[:date]}</date>
- <src-ocr/>
- <version>1.0</version>
- <history>#{date_available}#{date_modified}
- </history>
- </document-info>
-</description>
-<body>
-WOK
- put(head)
- end
- def extract_endnotes
- @endnotes=[]
- @data.each do |para|
- @endnotes << para.scan(/~\{(.+?)<#{@dp}>\}~/m)
- end
- @endnotes.flatten!
- end
- def endnotes
- @endnotes.each do |endnote|
- endnote.strip!
- endnote=@trans.markup_fictionbook(endnote)
- endnote="<p>#{endnote}</p>"
- util=SiSU_text_utils::Wrap.new(endnote,80,10)
- endnote=util.line_wrap
- put(endnote)
- end
- end
- def tail
- tail=<<WOK
-</body>
-</FictionBook>
-WOK
- put(tail)
- end
- def markup(para,type='')
- para.strip!
- para=para.gsub(/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}\s*/,'')
- para=para.gsub(/#{Mx[:id_o]}~(\d+);(?:\d:\d+|\S\d+);\S\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'[(\1)]')
- para=@trans.markup_fictionbook(para)
- para=if type.empty?; "<p>#{para}</p>"
- else "<#{type}><p>#{para}</p></#{type}>"
- end
- util=SiSU_text_utils::Wrap.new(para,80,10)
- wrap=util.line_wrap
- end
- def put(line)
- @file_fictionbook.puts line
- puts line if @md.cmd =~/V/
- end
- def structure_build_tag_close(lev,h)
- @sp=' '
- case h[0]
- when 1
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- when 2
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- when 3
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- when 4
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- when 5
- put("#{@sp*5}</#{@s[5]}>") if (lev <= 5)
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- when 6
- put("#{@sp*6}</#{@s[6]}>") if (lev <= 6)
- put("#{@sp*5}</#{@s[5]}>") if (lev <= 5)
- put("#{@sp*4}</#{@s[4]}>") if (lev <= 4)
- put("#{@sp*3}</#{@s[3]}>") if (lev <= 3) and h[3]
- put("#{@sp*2}</#{@s[2]}>") if (lev <= 2) and h[2]
- put("#{@sp*1}</#{@s[1]}>") if (lev <= 1) and h[1]
- put("</#{@s[0]}>") if (lev == 0)
- end
- end
- def structure_build(ds)
- @h=[0,false,false,false]
- put("<#{@s[0]}>")
- ds.each_with_index do |x,i|
- @ef=false
- case x[:lev]
- when /^1/
- structure_build_tag_close(1,@h)
- #put("#{@sp*1}<#{@s[1]}>\n#{x[:para]}\n#{@sp*1}#{x[:ocn]} #{x[:lev]} #{x[:hdr]}")
- y="#{@sp*1}<#{@s[1]}>\n#{x[:para]}"
- @h=[1,true,false,false]
- when /^2/
- structure_build_tag_close(2,@h)
- y="#{@sp*2}<#{@s[2]}>\n#{x[:para]}"
- @h=[2,true,true,false]
- when /^0:0/ #endnotes and metadata
- structure_build_tag_close(2,@h)
- y="#{@sp*2}<#{@s[2]}>\n#{x[:para]}"
- @h=[2,true,true,false]
- @ef=true if x[:hdr] =~/u0/
- when /^3/
- structure_build_tag_close(3,@h)
- y="#{@sp*3}<#{@s[3]}>\n#{x[:para]}"
- @h=[3,true,true,true]
- when /^4/
- structure_build_tag_close(4,@h)
- y="#{@sp*4}<#{@s[4]}>\n#{x[:para]}"
- @h[0]=4
- when /^m2/ #metadata
- structure_build_tag_close(4,@h)
- y="#{@sp*4}<#{@s[4]}>\n#{x[:para]}"
- @h[0]=4
- #when /^0:0/ #endnotes
- # structure_build_tag_close(4,@h)
- # y="#{@sp*4}<#{@s[4]}>\n#{x[:para]}"
- # @h[0]=4
- # @ef=true
- when /^5/
- structure_build_tag_close(5,@h)
- y="#{@sp*5}<#{@s[5]}>\n#{x[:para]}"
- @h[0]=5
- when /^6/
- structure_build_tag_close(6,@h)
- y="#{@sp*6}<#{@s[6]}>\n#{x[:para]}"
- @h[0]=6
- else
- y=if @md.cmd =~/V/; "#{x[:para]}"
- else nil
- end
- end
- put(y) if y
- endnotes if @ef
- end
- structure_build_tag_close(0,@h)
- end
- def structure
- data=@data
- @ds=[]
- c=0
- data.each do |para|
- rgx_headers=/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}/
- if para =~rgx_headers
- x=(rgx_headers).match(para)
- if x[3] =~/^[hum]\d+/
- @ds[c]={}
- @ds[c][:ocn]=x[1]
- @ds[c][:lev]=x[2]
- @ds[c][:hdr]=x[3]
- @ds[c][:para]=markup(para,'title')
- #puts "#{x[1]} #{x[2]} #{x[3]}"
- else
- @ds[c]={}
- @ds[c][:para]=markup(para) if @md.cmd =~/V/
- end
- c+=1
- #puts "#{para} #{x[1]} #{x[2]} #{x[3]}"
- end
- end
- structure_build(@ds)
- @ds
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/xml_format.rb b/lib/sisu/v1/xml_format.rb
deleted file mode 100644
index 90688cb1..00000000
--- a/lib/sisu/v1/xml_format.rb
+++ /dev/null
@@ -1,357 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: xml template
- ** Notes: tidy -xml index.xml >> index.tidy
-
-=end
-module SiSU_XML_format
- require "#{SiSU_lib}/param"
- include SiSU_Param
- include SiSU_Viz
- class Paragraph_number
- def initialize(md,paranum)
- @md=md
- @paranum=/(\d+)/m.match(paranum)[1]
- end
- def display
- p_num_display=@paranum.gsub(/(\d+)/,
- '<font size="1" color="#777777">' +
- '&nbsp;&nbsp;\1</font>')
- p_num_display
- end
- def name
- p_num_name=@paranum.gsub(/(\d+)/,'<a name="\1"></a>')
- p_num_name
- end
- def goto
- p_num_goto=@paranum.gsub(/(\d+)/,'<a href="#\1">')
- p_num_goto
- end
- end
- class Head_information
- def initialize #dc rdf
- @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
- @md=@@md
- # DublinCore 1 - title
- @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
- if @md.full_title
- @full_title=%{<meta name="dc.title" content="#{seg_name}#{@md.full_title}" />\n}
- #if @md.subtitle
- # #@rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n}
- # @full_title=%{<meta name="dc.title" content="#{seg_name}#{@md.title} - #{@md.subtitle}" />\n}
- #else
- # #@rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n}
- # @full_title=%{<meta name="dc.title" content="#{seg_name}#{@md.title}" />\n}
- #end
- end
- if @md.author # DublinCore 2 - author/creator (author)
- @rdf_author=%{ dc.author="#{@md.author}"\n}
- @author=%{<meta name="dc.author" content="#{@md.author}" />\n}
- end
- if @md.subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
- @rdf_subject=%{ dc.subject="#{@md.subject}"\n}
- @subject=%{<meta name="dc.subject" content="#{@md.subject}" />\n}
- end
- if @md.description # DublinCore 4 - description
- @rdf_description=%{ dc.description="#{@md.description}"\n}
- @description=%{<meta name="dc.description" content="#{@md.description}" />\n}
- end
- if @md.publisher # DublinCore 5 - publisher (current copy published by)
- @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
- @publisher=%{<meta name="dc.publisher" content="#{@md.publisher}" />\n}
- end
- if @md.contributor # DublinCore 6 - contributor
- @rdf_contributor=%{ dc.contributor="#{@md.contributor}"\n}
- @contributor=%{<meta name="dc.contributor" content="#{@md.contributor}" />\n}
- end
- if @md.date # DublinCore 7 - date year-mm-dd
- @rdf_date=%{ dc.date="#{@md.date}"\n}
- @date=%{<meta name="dc.date" content="#{@md.date}" #{@md.date_scheme} />\n}
- end
- if @md.date_created # DublinCore 7 - date.created year-mm-dd
- @rdf_date_created=%{ dc.date.created="#{@md.date_created}"\n}
- @date_created=%{<meta name="dc.date.created" content="#{@md.date_created}" #{@md.date_created_scheme} />\n}
- end
- if @md.date_issued # DublinCore 7 - date.issued year-mm-dd
- @rdf_date_issued=%{ dc.date.issued="#{@md.date_issued}"\n}
- @date_issued=%{<meta name="dc.date.issued" content="#{@md.date_issued}" #{@md.date_issued_scheme} />\n}
- end
- if @md.date_available # DublinCore 7 - date.available year-mm-dd
- @rdf_date_available=%{ dc.date.available="#{@md.date_available}"\n}
- @date_available=%{<meta name="dc.date.available" content="#{@md.date_available}" #{@md.date_available_scheme} />\n}
- end
- if @md.date_valid # DublinCore 7 - date.valid year-mm-dd
- @rdf_date_valid=%{ dc.date.valid="#{@md.date_valid}"\n}
- @date_valid=%{<meta name="dc.date.valid" content="#{@md.date_valid}" #{@md.date_valid_scheme} />\n}
- end
- if @md.date_modified # DublinCore 7 - date.modified year-mm-dd
- @rdf_date_modified=%{ dc.date.modified="#{@md.date_modified}"\n}
- @date_modified=%{<meta name="dc.date.modified" content="#{@md.date_modified}" #{@md.date_modified_scheme} />\n}
- end
- if @md.type # DublinCore 8 - type (genre eg. report, convention etc)
- @rdf_type=%{ dc.type="#{@md.type}"\n}
- @type=%{<meta name="dc.type" content="#{@md.type}" />\n}
- end
- if @md.format # DublinCore 9 - format (use your mime type)
- @rdf_format=%{ dc.format="#{@md.format}"\n}
- @format=%{<meta name="dc.format" content="#{@md.format}" />\n}
- end
- if @md.identifier # DublinCore 10 - identifier (your identifier, could use urn which is free)
- @rdf_identifier=%{ dc.identifier="#{@md.identifier}"\n}
- @identifier=%{<meta name="dc.identifier" content="#{@md.identifier}" />\n}
- end
- if @md.source # DublinCore 11 - source (document source)
- @rdf_source=%{ dc.source="#{@md.source}"\n}
- @source=%{<meta name="dc.source" content="#{@md.source}" />\n}
- end
- if @md.language[:name] # DublinCore 12 - language (English)
- @rdf_language=%{ dc.language="#{@md.language[:name]}"\n}
- @language=%{<meta name="dc.language" content="#{@md.language[:name]}" />\n}
- end
- if @md.language_original[:name] # DublinCore 12 - language (English)
- @rdf_language_original=%{ dc.language="#{@md.language_original[:name]}"\n}
- @language_original=%{<meta name="dc.language" content="#{@md.language_original[:name]}" />\n}
- end
- if @md.relation # DublinCore 13 - relation
- @rdf_relation=%{ dc.relation="#{@md.relation}"\n}
- @relation=%{<meta name="dc.relation" content="#{@md.relation}" />\n}
- end
- if @md.coverage # DublinCore 14 - coverage
- @rdf_coverage=%{ dc.coverage="#{@md.coverage}"\n}
- @coverage=%{<meta name="dc.coverage" content="#{@md.coverage}" />\n}
- end
- if @md.rights # DublinCore 15 - rights
- @rdf_rights=%{ dc.rights="#{@md.rights}"\n}
- @rights=%{<meta name="dc.rights" content="#{@md.rights}" />\n}
- end
- @copyright=%{<meta name="copyright" content="#{@md.rights}" />\n} if @md.rights # possibly redundant see dc.rights
- @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner
- @keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords
- @vz=SiSU_Env::Get_init.instance.skin #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php
- @index=case @md.file_type
- when /php/; 'index' # @index="index.php"
- else 'index'
- end
- end
- def toc_head_escript #embedded script in this case PHP
- # %{<p>PHP or other embedded script for object persistence may go HERE</p>}
- end
- #def seg_head_escript #embedded script in this case PHP
- # # %{<p>PHP or other embedded script for object persistence may go HERE</p>}
- #end
- def table_close
- '</font> </td></tr></table>'
- end
- def buttons_home
- %{\n#{@banner.home_and_index_buttons}\n}
- end
- def copyat
- %{copy @ <a href="#{@url.home}" #{@js.home}>#{@txt.home}</a>}
- end
- def toc_head
- #<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- # xmlns:dc="http://purl.org/dc/elements/1.1/">
- # <rdf:Description rdf:about="http://www.jus.uio.no/lm/doc"
- # dc:author="Author"
- # dc:title="Title"
- # dc:description="Description if any"
- # dc:date="Publication Date"
- # />
- #</rdf:RDF>
- #Dublin Core
- <<WOK
-<html>
-<head>
-<title>#{@md.html_title}</title>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
- <rdf:Description
-#@rdfurl
-#@rdf_title
-#@rdf_subtitle
-#@rdf_author
-#@rdf_subject
-#@rdf_description
-#@rdf_publisher
-#@rdf_contributor
-#@rdf_date
-#@rdf_date_created
-#@rdf_date_issued
-#@rdf_date_available
-#@rdf_date_valid
-#@rdf_date_modified
-#@rdf_type
-#@rdf_format
-#@rdf_identifier
-#@rdf_source
-#@rdf_language
-#@rdf_relation
-#@rdf_coverage
-#@rdf_rights
- />
-</rdf:RDF>
-#@full_title
-#@author
-#@subject
-#@description
-#@publisher
-#@contributor
-#@date
-#@date_created
-#@date_issued
-#@date_available
-#@date_valid
-#@date_modified
-#@type
-#@format
-#@identifier
-#@source
-#@language
-#@relation
-#@coverage
-#@rights
-#@copyright
-#@owner
-#{@png.ico}
-#{@txt.generator}
-#{@js.head}
-\n</head>
-#{@color.body}
-#{@font.css_table_file}
-<a name="top"></a>
-<a name="up"></a>
-<a name="start"></a>
-#{@js.top}
-WOK
- end
- end
- class Format_text_object
- @@dp=nil
- attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font
- def initialize(md,t_o)
- @md,@t_o=md,t_o
- if t_o.class == Hash
- @txt =t_o[:txt] || nil
- @format =t_o[:format] || nil
- @lnk_url =t_o[:lnk_url] || nil
- @lnk_txt =t_o[:lnk_txt] || nil
- @ocn =t_o[:ocn] || nil
- #@h_name =t_o[:h_name] || nil
- #elsif t_o.class == Array
- # @txt =txt[0]
- #elsif t_o.class == String
- # @txt =txt
- else
- p t_o.class
- p caller
- end
- if @t_o[:ocn]=~/\d+/
- @paranum=/(\d+)/m.match(@t_o[:ocn])[1]
- @headname=''
- #if txt[2]=~/\d+/
- m=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/m.match(@format)
- headname=m[1] if m
- @headname=%{<a name="h#{headname}"></a>} unless headname.nil?
- @p_num=SiSU_XML_format::Paragraph_number.new(@md,@paranum)
- end
- rgx=/^[1-6-]~{1,2}/ #watch
- @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- rgx=/~\{\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}\}~/
- @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx
- @vz=SiSU_Env::Get_init.instance.skin
- end
- def scr_endnote_body
- "<endnote>#{@txt}</endnote> "
- end
- end
- class Format_scroll < Format_text_object
- def initialize(md,t_o)
- super(md,t_o)
- end
- def heading_body
- %{<p class="norm">#{@p_num.name}#{@headname}#{@txt} </p>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body1
- %{<h1 class="norm">#{@p_num.name}#{@headname}#{@txt} </h1>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body2
- %{<h2 class="norm">#{@p_num.name}#{@headname}#{@txt} </h2>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body3
- %{<h3 class="norm">#{@p_num.name}#{@headname}#{@txt} </h3>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body4
- %{<h4 class="norm">#{@p_num.name}#{@headname}#{@txt}</h4>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body5
- %{<h5 class="norm">#{@p_num.name}#{@headname}#{@txt} </h5>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- def heading_body6
- %{<h6 class="norm">#{@p_num.name}#{@headname}#{@txt} </h6>} +
- %{<p class="paranum">#{@p_num.display} </p>\n}
- end
- end
- class XML
- end
-end
-__END__
diff --git a/lib/sisu/v1/xml_md_oai_pmh_dc.rb b/lib/sisu/v1/xml_md_oai_pmh_dc.rb
deleted file mode 100644
index 73995f53..00000000
--- a/lib/sisu/v1/xml_md_oai_pmh_dc.rb
+++ /dev/null
@@ -1,211 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: summary of generated outputs and metadata
-
-=end
-module SiSU_XML_metadata
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- require "#{SiSU_lib}/param"
- include SiSU_Param
- class OAI_PMH
- def initialize(opt)
- @md=SiSU_Param::Parameters.new(opt).get
- @oai_pmh=[]
- end
- def read
- output
- end
- def pre
-<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
-<oai_dc:dc
- xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
- http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
-WOK
- end
- def body
- if @md.full_title # DublinCore 1 - title
- @oai_pmh << %{ <dc:title xml:lang="en">#{@md.full_title}</dc:title>\n}
- #@oai_pmh << %{ <dc:title xml:lang="en">#{seg_name}#{@md.title}</dc:title>\n}
- end
- if @md.author # DublinCore 2 - author/creator (author)
- txt=meta_content_clean(@md.author)
- @oai_pmh << %{ <dc:author>#{txt}</dc:author>\n}
- end
- if @md.subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
- txt=meta_content_clean(@md.subject)
- @oai_pmh << %{ <dc:subject>#{txt}</dc:subject>\n}
- end
- if @md.description # DublinCore 4 - description
- txt=meta_content_clean(@md.description)
- @oai_pmh << %{ <dc:description>#{txt}</dc:description>\n}
- end
- if @md.publisher # DublinCore 5 - publisher (current copy published by)
- txt=meta_content_clean(@md.publisher)
- @oai_pmh << %{ <dc:publisher>#{txt}</dc:publisher>\n}
- end
- if @md.contributor # DublinCore 6 - contributor
- txt=meta_content_clean(@md.contributor)
- @oai_pmh << %{ <dc:contributor>#{txt}</dc:contributor>\n}
- end
- if @md.date # DublinCore 7 - date year-mm-dd
- @oai_pmh << %{ <dc:date>#{@md.date}</dc:date>\n}
- end
- if @md.date_created # DublinCore 7 - date.created
- @oai_pmh << %{ <dc:date_created>#{@md.date_created}</dc:date_created>\n}
- end
- if @md.date_issued # DublinCore 7 - date.issued
- @oai_pmh << %{ <dc:date_issued>#{@md.date_issued}</dc:date_issued>\n}
- end
- if @md.date_available # DublinCore 7 - date.available
- @oai_pmh << %{ <dc:date_available>#{@md.date_available}</dc:date_available>\n}
- end
- if @md.date_valid # DublinCore 7 - date.valid
- @oai_pmh << %{ <dc:date_valid>#{@md.date_valid}</dc:date_valid>\n}
- end
- if @md.date_modified # DublinCore 7 - date.modified
- @oai_pmh << %{ <dc:date_modified>#{@md.date_modified}</dc:date_modified>\n}
- end
- if @md.type # DublinCore 8 - type
- txt=meta_content_clean(@md.type)
- @oai_pmh << %{ <dc:type>#{txt}</dc:type>\n}
- end
- if @md.format # DublinCore 9 - format
- txt=meta_content_clean(@md.format)
- @oai_pmh << %{ <dc:format>#{txt}</dc:format>\n}
- end
- if @md.identifier # DublinCore 10 - identifier
- txt=meta_content_clean(@md.identifier)
- @oai_pmh << %{ <dc:identifier>#{txt}</dc:identifier>\n}
- end
- if @md.source # DublinCore 11 - source
- txt=meta_content_clean(@md.source)
- @oai_pmh << %{ <dc:source>#{txt}</dc:source>\n}
- end
- if @md.language[:name] # DublinCore 12 - language (English)
- @oai_pmh << %{ <dc:language>#{@md.language[:name]}</dc:language>\n}
- end
- if @md.language_original[:name]
- @oai_pmh << %{ <dc:language>#{@md.language_original[:name]}</dc:language>\n}
- end
- if @md.relation # DublinCore 13 - relation
- txt=meta_content_clean(@md.relation)
- @oai_pmh << %{ <dc:relation>#{txt}</dc:relation>\n}
- end
- if @md.coverage # DublinCore 14 - coverage
- txt=meta_content_clean(@md.coverage)
- @oai_pmh << %{ <dc:coverage>#{txt}</dc:coverage>\n}
- end
- if @md.rights # DublinCore 15 - rights
- txt=meta_content_clean(@md.rights)
- @oai_pmh << %{ <dc:rights>#{txt}</dc:rights>\n}
- end
- if @md.keywords
- txt=meta_content_clean(@md.keywords)
- @oai_pmh << %{ <dc:keywords>#{txt}</dc:keywords>\n}
- end
- @oai_pmh
- end
- def meta_content_clean(content='')
- unless content.nil?
- content.tr!('"',"'")
- end
- content
- end
- def post
- '</oai_dc:dc>'
- end
- def output
- SiSU_Env::SiSU_file.new(@md).mkdir
- oai_pmh=SiSU_Env::SiSU_file.new(@md,@md.fn[:oai_pmh]).mkfile #implement in param
- oai_pmh << pre
- body.each do |x|
- oai_pmh << x
- end
- oai_pmh << post
- end
- end
-end
-__END__
-http://www.openarchives.org/pmh/
-http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm#dublincore
-http://es.dublincore.org/documents/usageguide/elements.shtml
-http://dublincore.org/documents/dces/
-see also http://dublincore.org/documents/dcmes-xml/
-#http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm#dublincore
-#sample implementation, e.g. 2
-<?xml version="1.0" encoding="UTF-8"?>
-<oai_dc:dc
- xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
- http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
- <dc:title xml:lang="en">Grassmann's space analysis</dc:title>
- <dc:author>Hyde, E. W. (Edward Wyllys)</dc:author>
- <dc:subject>LCSH:Ausdehnungslehre; LCCN QA205.H99</dc:subject>
- <dc:publisher>J. Wiley &amp; Sons</dc:publisher>
- <dc:date>Created: 1906; Available: 1991</dc:date>
- <dc:type>text</dc:type>
- <dc:identifier>http://resolver.library.cornell.edu/math/1796949
- </dc:identifier>
- <dc:language>english</dc:language>
- <dc:rights xml:lang="en">Public Domain</dc:rights>
-</oai_dc:dc>
diff --git a/lib/sisu/v1/xml_scaffold.rb b/lib/sisu/v1/xml_scaffold.rb
deleted file mode 100644
index f8931f10..00000000
--- a/lib/sisu/v1/xml_scaffold.rb
+++ /dev/null
@@ -1,206 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: extract and print an XML rendition of document structure to screen
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: SiSU information Structuring Universe, processing
-
-=end
-module SiSU_XML_scaffold
- require "#{SiSU_lib}/particulars"
- include SiSU_Particulars
- require "#{SiSU_lib}/dal"
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- pwd=Dir.pwd
- class Source
- def initialize(opt)
- @opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- @sp=' '
- end
- def read
- begin
- @md,@dal_array=@particulars.md,@particulars.dal_array
- SiSU_XML_scaffold::Source::Scroll.new(@dal_array,@md).songsheet
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- end
- private
- class Scroll <Source
- def initialize(data='',md='')
- @data,@md=data,md
- end
- def songsheet
- @t='docbook' #@t='fictionbook'
- @s=['book', #@s=['body',
- 'part', # 'section',
- 'subpart N/A', # 'section',
- 'sub-subpart N/A', # 'section',
- 'chapter', # 'section',
- 'sect1', # 'section',
- 'sect2' # 'section'
- ] #]
- structure
- end
- def structure_outline(ds)
- puts "\ninfo outline --->\n\n"
- ds.each {|x| puts "#{x[:ocn]} #{x[:lev]} #{x[:hdr]}" }
- end
- def structure_simple(ds)
- puts "\nheading outline --->\n\n"
- ds.each_with_index do |x,i|
- #puts "#{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- if x[:lev] =~ /^([1-6])/; puts "<#{@s[$1.to_i]}>#{x[:ocn]} #{x[:lev]} #{x[:hdr]}</#{@s[$1.to_i]}>"
- end
- end
- end
- def structure_build_tag_close(lev,h)
- @sp=' '
- case h[0]
- when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and h[1]
- puts "</#{@s[0]}>" if (lev == 0)
- end
- end
- def structure_build(ds)
- puts "\nXML [#@t type] structure outline --->\n\n"
- @h=[0,false,false,false]
- puts "<#{@s[0]}>"
- ds.each_with_index do |x,i|
- case x[:lev]
- when /^1/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*1}<#{@s[1]}>\n#{@sp*1} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h=[1,true,false,false]
- when /^2/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*2}<#{@s[2]}>\n#{@sp*2} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h=[2,true,true,false]
- when /^3/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*3}<#{@s[3]}>\n#{@sp*3} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h=[3,true,true,true]
- when /^4/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*4}<#{@s[4]}>\n#{@sp*4} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h[0]=4
- when /^5/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*5}<#{@s[5]}>\n#{@sp*5} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h[0]=5
- when /^6/
- structure_build_tag_close(x[:lev].to_i,@h)
- puts "#{@sp*6}<#{@s[6]}>\n#{@sp*6} #{x[:ocn]} #{x[:lev]} #{x[:hdr]}"
- @h[0]=6
- end
- end
- structure_build_tag_close(0,@h)
- end
- def structure
- data=@data
- @ds=[]
- c=0
- data.each do |para|
- if para =~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/
- x=(/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}/).match(para)
- if x[3] =~/^[hu]\d+/
- @ds[c]={}
- @ds[c][:ocn]=x[1]
- @ds[c][:lev]=x[2]
- @ds[c][:hdr]=x[3]
- c+=1
- #puts "#{x[1]} #{x[2]} #{x[3]}"
- end
- end
- end
- structure_outline(@ds) if @md.cmd =~/V/
- structure_simple(@ds) if @md.cmd =~/V/
- structure_build(@ds)
- @ds
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v1/xml_tables.rb b/lib/sisu/v1/xml_tables.rb
deleted file mode 100644
index f5267b97..00000000
--- a/lib/sisu/v1/xml_tables.rb
+++ /dev/null
@@ -1,213 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: common file for xml table generation
-
-=end
-module SiSU_Tables
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- class Table #_xml
- @@tablehead=0
- @@tablefoot=[] #watch #bug??? #check was @@tablefoot
- def initialize(one,ocn='')
- @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::Get_init.instance.skin
- end
- def table_split #% used but, no longer operational, revisit
- @new_content=[]
- @one.split(/\n/).each do |parablock|
- table=Table_xml.new("#{parablock}\n")
- @new_content << table.table
- end
- @new_content.join
- end
- end
- class Table_xml <Table
- @@tablehead=0
- @@tablefoot=[]
- @@dp=nil
- def initialize(one,ocn='')
- @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Env::Get_init.instance.skin
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- end
- def table
- m=@parablock[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- @parablock.gsub!(/<!f.+?!>/,'')
- @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u,
- %{\n<ocn>#@ocn</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})
- end
- if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- tablefoot=[]
- #bug table footers need rethink, removed for now
- @@tablefoot.each {|x| tablefoot << ''}
- @@tablefoot=[]
- @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,"</table>\n") # +
- @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s*/,"</table>\n")
- end
- if @@tablehead == 1
- if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>})
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</b></td><td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>})
- @parablock.gsub!(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>")
- @@tablehead=0
- end
- @parablock
- else
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}})
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{
- </td>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}})
- @parablock.gsub!(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n")
- end
- @parablock
- end
- end
- class Table_xml_exp <Table
- @@tablehead=0
- @@tablefoot=[]
- def initialize(one)
- @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin
- end
- def table_head(inf)
- %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">
- <tr>
- <td valign="top" align="justify">
- <a name="#{inf}"></a>
- </td>
- <td>
-<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}
- end
- def table_end(tablefoot='')
- %{</table>#{@vz.margin_numless}#{@vz.margin_numless}&nbsp;#{@vz.table_close}
-#{tablefoot}}
- end
- def table_row(inf,h=false)
- bold=if h; '<b>'
- else ''
- end
- %{
-<tr>
- <td width="#{inf}%" valign="top">#{bold}}
- end
- def table_cell(inf,h=false)
- if h; %{</b></td><td width="#{inf}%" valign="top"><b>}
- else %{</td><td width="#{inf}%" valign="top">}
- end
- end
- def table_row_close(h=false)
- bold_close=if h; '</b>'
- else ''
- end
- "#{bold_close}</td></tr>"
- end
- def table
- m=@parablock[/<!f(.+?)!>/,1]
- @@tablefoot << m if m
- @parablock.gsub!(/<!f.+?!>/,'')
- @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
- if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1)
- end
- if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- tablefoot=[]
- @@tablefoot.each {|x| tablefoot << ''}
- @@tablefoot=[]
- if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end
- end
- end
- if @@tablehead == 1
- if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
- if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true))
- end
- if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true))
- end
- if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true))
- end
- @@tablehead=0
- end
- @parablock
- else
- if @parablock =~/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1))
- end
- if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u
- @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1))
- end
- if @parablock =~/#{Mx[:tc_c]}/
- @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close)
- end
- @parablock
- end
- @parablock
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v1/zap.rb b/lib/sisu/v1/zap.rb
deleted file mode 100644
index 4351e81e..00000000
--- a/lib/sisu/v1/zap.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: zap wipe clean previous output of the type specified
-
-=end
-module SiSU_Zap
- require "#{SiSU_lib}/sysenv"
- include SiSU_Env
- pwd=Dir.pwd
- class Source
- def initialize(opt)
- @opt=opt
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @zap_path="#{@env.path.output}/#{@env.fnb}"
- @zap=SiSU_Env::Clean_output.new(@opt)
- end
- def read
- if SiSU_Env::Info_settings.new.permission?('zap')
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #@zap_path")
- @zap.zap
- @zap.zap_map
- else tell=SiSU_Screen::Ansi.new(@opt.cmd,'use of -Z (zap) has not enabled in sisurc.yml')
- end
- tell.warn unless @opt.cmd =~/q/
- end
- end
-end
-__END__
diff --git a/lib/sisu/v3/air.rb b/lib/sisu/v3/air.rb
index abe0ee6c..3b456f8c 100644
--- a/lib/sisu/v3/air.rb
+++ b/lib/sisu/v3/air.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/author_format.rb b/lib/sisu/v3/author_format.rb
index dee83eb6..d98376bf 100644
--- a/lib/sisu/v3/author_format.rb
+++ b/lib/sisu/v3/author_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/cgi.rb b/lib/sisu/v3/cgi.rb
index a375282f..561bf404 100644
--- a/lib/sisu/v3/cgi.rb
+++ b/lib/sisu/v3/cgi.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb
index 7a948366..5271175c 100644
--- a/lib/sisu/v3/cgi_pgsql.rb
+++ b/lib/sisu/v3/cgi_pgsql.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb
index 1b043f00..7e911a00 100644
--- a/lib/sisu/v3/cgi_sql_common.rb
+++ b/lib/sisu/v3/cgi_sql_common.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -78,7 +78,7 @@ module SiSU_CGI_sql
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -553,7 +553,7 @@ module SiSU_CGI_sql
<br />
<a href="http://www.jus.uio.no/sisu" >
<b>#{v[:project]}</b></a> <sup>&copy;</sup> Ralph Amissah
- 1993, current 2010.
+ 1993, current 2011.
All Rights Reserved.
<br />
<a href="http://www.jus.uio.no/sisu" >
@@ -589,7 +589,7 @@ module SiSU_CGI_sql
<br />Standard SiSU meta-markup syntax, and the
<br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system)
<br />
- <sup>&copy;</sup> Ralph Amissah 1997, current 2010.
+ <sup>&copy;</sup> Ralph Amissah 1997, current 2011.
All Rights Reserved.
</font></p>
</td></tr>
diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb
index 5c20b072..a2fb45d8 100644
--- a/lib/sisu/v3/cgi_sqlite.rb
+++ b/lib/sisu/v3/cgi_sqlite.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/character_encoding.rb b/lib/sisu/v3/character_encoding.rb
index 5d19a61f..b785a715 100644
--- a/lib/sisu/v3/character_encoding.rb
+++ b/lib/sisu/v3/character_encoding.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb
index 1a801e58..174d0a81 100644
--- a/lib/sisu/v3/composite.rb
+++ b/lib/sisu/v3/composite.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb
index 9b62b441..e8d414a2 100644
--- a/lib/sisu/v3/concordance.rb
+++ b/lib/sisu/v3/concordance.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v3/conf.rb
index f3f978db..7af523c2 100644
--- a/lib/sisu/v3/conf.rb
+++ b/lib/sisu/v3/conf.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb
index c8cac1f6..df529d31 100644
--- a/lib/sisu/v3/constants.rb
+++ b/lib/sisu/v3/constants.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/css.rb b/lib/sisu/v3/css.rb
index d9727a83..37211ecc 100644
--- a/lib/sisu/v3/css.rb
+++ b/lib/sisu/v3/css.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb
index 1c989a18..9f1d5372 100644
--- a/lib/sisu/v3/dal.rb
+++ b/lib/sisu/v3/dal.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_character_check.rb b/lib/sisu/v3/dal_character_check.rb
index a843f202..81f4e16b 100644
--- a/lib/sisu/v3/dal_character_check.rb
+++ b/lib/sisu/v3/dal_character_check.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb
index feb5d2c1..0f501a79 100644
--- a/lib/sisu/v3/dal_doc_objects.rb
+++ b/lib/sisu/v3/dal_doc_objects.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb
index 209fc1dd..6415f7dd 100644
--- a/lib/sisu/v3/dal_doc_str.rb
+++ b/lib/sisu/v3/dal_doc_str.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_endnotes.rb b/lib/sisu/v3/dal_endnotes.rb
index 95176516..6811722f 100644
--- a/lib/sisu/v3/dal_endnotes.rb
+++ b/lib/sisu/v3/dal_endnotes.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v3/dal_expand_insertions.rb
index f7adb76e..1bc66a84 100644
--- a/lib/sisu/v3/dal_expand_insertions.rb
+++ b/lib/sisu/v3/dal_expand_insertions.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb
index a78c54f1..87cf4738 100644
--- a/lib/sisu/v3/dal_hash_digest.rb
+++ b/lib/sisu/v3/dal_hash_digest.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb
index 7c00be3c..ee37690c 100644
--- a/lib/sisu/v3/dal_idx.rb
+++ b/lib/sisu/v3/dal_idx.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb
index 76a94dab..693d7e9c 100644
--- a/lib/sisu/v3/dal_images.rb
+++ b/lib/sisu/v3/dal_images.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_metadata.rb b/lib/sisu/v3/dal_metadata.rb
index 77b58f86..e7614fc4 100644
--- a/lib/sisu/v3/dal_metadata.rb
+++ b/lib/sisu/v3/dal_metadata.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb
index 4bfb7da3..94ff2328 100644
--- a/lib/sisu/v3/dal_numbering.rb
+++ b/lib/sisu/v3/dal_numbering.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_substitutions_and_insertions.rb b/lib/sisu/v3/dal_substitutions_and_insertions.rb
index e1326232..bb6e9d24 100644
--- a/lib/sisu/v3/dal_substitutions_and_insertions.rb
+++ b/lib/sisu/v3/dal_substitutions_and_insertions.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb
index 34ac65e2..6620c3ad 100644
--- a/lib/sisu/v3/dal_syntax.rb
+++ b/lib/sisu/v3/dal_syntax.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb
index c1fb6109..61febc54 100644
--- a/lib/sisu/v3/db_columns.rb
+++ b/lib/sisu/v3/db_columns.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb
index 2676542e..2d4aee0b 100644
--- a/lib/sisu/v3/db_create.rb
+++ b/lib/sisu/v3/db_create.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_dbi.rb b/lib/sisu/v3/db_dbi.rb
index 1a3825b9..3c59afa0 100644
--- a/lib/sisu/v3/db_dbi.rb
+++ b/lib/sisu/v3/db_dbi.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_drop.rb b/lib/sisu/v3/db_drop.rb
index edd08345..c2a32179 100644
--- a/lib/sisu/v3/db_drop.rb
+++ b/lib/sisu/v3/db_drop.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb
index 41515747..2c4c9bad 100644
--- a/lib/sisu/v3/db_import.rb
+++ b/lib/sisu/v3/db_import.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v3/db_indexes.rb
index abd90409..0f77c96d 100644
--- a/lib/sisu/v3/db_indexes.rb
+++ b/lib/sisu/v3/db_indexes.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb
index f1af99a0..8beed2a6 100644
--- a/lib/sisu/v3/db_load_tuple.rb
+++ b/lib/sisu/v3/db_load_tuple.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb
index 364f5fc7..a3acbc5a 100644
--- a/lib/sisu/v3/db_remove.rb
+++ b/lib/sisu/v3/db_remove.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb
index 04d12acb..4ac6e75d 100644
--- a/lib/sisu/v3/db_select.rb
+++ b/lib/sisu/v3/db_select.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v3/db_sqltxt.rb
index 4e451e2a..31e44667 100644
--- a/lib/sisu/v3/db_sqltxt.rb
+++ b/lib/sisu/v3/db_sqltxt.rb
@@ -9,7 +9,7 @@
* Author: Ralph Amissah
* Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010 Ralph Amissah All Rights Reserved.
+ 2007, 2008, 2009, 2011 Ralph Amissah All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/db_tests.rb b/lib/sisu/v3/db_tests.rb
index 55ea2e0b..9854f8b6 100644
--- a/lib/sisu/v3/db_tests.rb
+++ b/lib/sisu/v3/db_tests.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb
index 191d5099..10374a37 100644
--- a/lib/sisu/v3/dbi.rb
+++ b/lib/sisu/v3/dbi.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb
index 19941d48..6286ed17 100644
--- a/lib/sisu/v3/defaults.rb
+++ b/lib/sisu/v3/defaults.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb
index 77c593ac..38b79ae1 100644
--- a/lib/sisu/v3/digests.rb
+++ b/lib/sisu/v3/digests.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb
index afdfd5a7..51742957 100644
--- a/lib/sisu/v3/embedded.rb
+++ b/lib/sisu/v3/embedded.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb
index aa4ede99..0da90712 100644
--- a/lib/sisu/v3/epub.rb
+++ b/lib/sisu/v3/epub.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb
index 301d34a2..88a1109f 100644
--- a/lib/sisu/v3/epub_concordance.rb
+++ b/lib/sisu/v3/epub_concordance.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb
index c189eb3a..893b6015 100644
--- a/lib/sisu/v3/epub_format.rb
+++ b/lib/sisu/v3/epub_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb
index bd13b08b..7eb43eec 100644
--- a/lib/sisu/v3/epub_segments.rb
+++ b/lib/sisu/v3/epub_segments.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb
index 23b0acf0..b98f9caf 100644
--- a/lib/sisu/v3/epub_tune.rb
+++ b/lib/sisu/v3/epub_tune.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/errors.rb b/lib/sisu/v3/errors.rb
index d761e1db..aafc6d02 100644
--- a/lib/sisu/v3/errors.rb
+++ b/lib/sisu/v3/errors.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb
index 2a2db20c..00cd1e67 100644
--- a/lib/sisu/v3/git.rb
+++ b/lib/sisu/v3/git.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb
index 2a01910e..82a87ba3 100644
--- a/lib/sisu/v3/harvest.rb
+++ b/lib/sisu/v3/harvest.rb
@@ -9,7 +9,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb
index 53003bb4..656d11d0 100644
--- a/lib/sisu/v3/harvest_authors.rb
+++ b/lib/sisu/v3/harvest_authors.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb
index 948965dd..00471184 100644
--- a/lib/sisu/v3/harvest_topics.rb
+++ b/lib/sisu/v3/harvest_topics.rb
@@ -9,7 +9,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb
index b23d8066..65bbedef 100644
--- a/lib/sisu/v3/help.rb
+++ b/lib/sisu/v3/help.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -159,7 +159,7 @@ module SiSU_Help
end
def summary
print <<WOK
- SiSU, Copyright (C) 1997 - 2010 Ralph Amissah
+ SiSU, Copyright (C) 1997 - 2011 Ralph Amissah
License GPL version 3 or Later. This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it under the conditions of the GPL3 or later.
For more license detail type/enter: "sisu --help license"
@@ -1792,7 +1792,7 @@ WOK
SiSU, a framework for document structuring, publishing and search
- Copyright (C) 1997 - 2010 Ralph Amissah
+ Copyright (C) 1997 - 2011 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
@@ -1839,7 +1839,7 @@ WOK
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
-© Ralph Amissah 1997, current 2010.
+© Ralph Amissah 1997, current 2011.
All Rights Reserved.
Information on these may be obtained from:
diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb
index ebfd15bf..ade1a801 100644
--- a/lib/sisu/v3/html.rb
+++ b/lib/sisu/v3/html.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb
index 0a5e6e45..15345ca0 100644
--- a/lib/sisu/v3/html_format.rb
+++ b/lib/sisu/v3/html_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_minitoc.rb b/lib/sisu/v3/html_minitoc.rb
index 00b6e384..c0731bd2 100644
--- a/lib/sisu/v3/html_minitoc.rb
+++ b/lib/sisu/v3/html_minitoc.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb
index 3a564f1c..20b5de6c 100644
--- a/lib/sisu/v3/html_promo.rb
+++ b/lib/sisu/v3/html_promo.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb
index 01819647..aa33ca9c 100644
--- a/lib/sisu/v3/html_scroll.rb
+++ b/lib/sisu/v3/html_scroll.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb
index fbcdf10f..03a095ae 100644
--- a/lib/sisu/v3/html_segments.rb
+++ b/lib/sisu/v3/html_segments.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_table.rb b/lib/sisu/v3/html_table.rb
index 4eab0219..515bc77f 100644
--- a/lib/sisu/v3/html_table.rb
+++ b/lib/sisu/v3/html_table.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb
index 4e01968e..0ab2e50d 100644
--- a/lib/sisu/v3/html_tune.rb
+++ b/lib/sisu/v3/html_tune.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 6a05ca6c..5e86ea76 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/i18n.rb b/lib/sisu/v3/i18n.rb
index c43daabe..1c5efe0a 100644
--- a/lib/sisu/v3/i18n.rb
+++ b/lib/sisu/v3/i18n.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb
index 98d589ed..c9fb8e04 100644
--- a/lib/sisu/v3/manifest.rb
+++ b/lib/sisu/v3/manifest.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb
index bdcb2322..1227399f 100644
--- a/lib/sisu/v3/manpage.rb
+++ b/lib/sisu/v3/manpage.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/manpage_format.rb b/lib/sisu/v3/manpage_format.rb
index 98428c4a..4d58712f 100644
--- a/lib/sisu/v3/manpage_format.rb
+++ b/lib/sisu/v3/manpage_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb
index 75767dd7..8a1c5322 100644
--- a/lib/sisu/v3/odf.rb
+++ b/lib/sisu/v3/odf.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/odf_format.rb b/lib/sisu/v3/odf_format.rb
index 6d34b3f8..bd169a34 100644
--- a/lib/sisu/v3/odf_format.rb
+++ b/lib/sisu/v3/odf_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index fa1fc973..7aee2e7d 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -63,9 +63,47 @@ module SiSU_commandline
class Options
attr_accessor :cmd,:mod,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:what
def initialize(a)
- @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','','',''
- @f_pths,@files,@paths,@mod,m,f,pth,z,ca=[],[],[],[],[],[],[],[],[]
+ @a=a
+ @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what='','','','','','','','',''
+ @f_pths,@files,@paths,@mod=[],[],[],[]
@env=SiSU_Env::Info_env.new
+ r=Px[:lng_lst].join('|')
+ #r.gsub!(/\|en\|/,'|')
+ @lang_regx=%r{(?:#{r})}
+ if a.inspect =~/"(?:-\S|--\S+?)"/ \
+ and a.inspect =~/"#{@lang_regx}"/ \
+ and a.inspect =~/"en\/\S+?\.ss[tm]"/
+ init_po
+ end
+ init
+ end
+ def init_po
+ a=@a
+ if a.inspect =~/"(?:-\S|--\S+?)"/ \
+ and a.inspect =~/"#{@lang_regx}"/ \
+ and a.inspect =~/"en\/\S+?\.ss[tm]"/
+ x,z=[],[]
+ l=nil
+ a.each do |y|
+ if y =~/^(?:-\S|--\S+?)$/
+ x << y
+ elsif y =~/^en\/(\S+?\.ss[tm])$/
+ l=$1
+ x << y
+ elsif y =~/^#{@lang_regx}$/
+ z = x.dup
+ z << y + '/' + l
+ SiSU_commandline::Options.new(z)
+ z=[]
+ end
+ end
+ end
+ self
+ end
+ def init
+ a=@a
+ c,w,s='','',''
+ m,f,pth,z,ca=[],[],[],[],[]
shortcut=SiSU_Env::Info_processing_flag.new
a.each do |x|
y=case x
@@ -203,6 +241,7 @@ module SiSU_commandline
end
end
@files
+ self
end
def cmd
@cmd
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb
index ed3e3003..be870235 100644
--- a/lib/sisu/v3/param.rb
+++ b/lib/sisu/v3/param.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/param_identify_markup.rb b/lib/sisu/v3/param_identify_markup.rb
index 97b6d888..85c93a35 100644
--- a/lib/sisu/v3/param_identify_markup.rb
+++ b/lib/sisu/v3/param_identify_markup.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/particulars.rb b/lib/sisu/v3/particulars.rb
index 32f9c4e4..39219534 100644
--- a/lib/sisu/v3/particulars.rb
+++ b/lib/sisu/v3/particulars.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb
index c9d0afef..004705f3 100644
--- a/lib/sisu/v3/plaintext.rb
+++ b/lib/sisu/v3/plaintext.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/plaintext_format.rb b/lib/sisu/v3/plaintext_format.rb
index ca690260..74059157 100644
--- a/lib/sisu/v3/plaintext_format.rb
+++ b/lib/sisu/v3/plaintext_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb
index 37290881..ea5a5eeb 100644
--- a/lib/sisu/v3/po4a.rb
+++ b/lib/sisu/v3/po4a.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/po4a_set.rb b/lib/sisu/v3/po4a_set.rb
index 1b84e173..289ea95e 100644
--- a/lib/sisu/v3/po4a_set.rb
+++ b/lib/sisu/v3/po4a_set.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/relaxng.rb b/lib/sisu/v3/relaxng.rb
index 71efe258..b3921d00 100644
--- a/lib/sisu/v3/relaxng.rb
+++ b/lib/sisu/v3/relaxng.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -70,13 +70,13 @@ module SiSU_relaxng
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010 Ralph Amissah All Rights Reserved.
+ * Copyright: (C) 1997 - 2011 Ralph Amissah All Rights Reserved.
* License: GPL 3 or later:
SiSU, a framework for document structuring, publishing and search
- Copyright: (C) 1997 - 2010 Ralph Amissah
+ Copyright: (C) 1997 - 2011 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
diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb
index 32bc336d..37dcd471 100644
--- a/lib/sisu/v3/remote.rb
+++ b/lib/sisu/v3/remote.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/response.rb b/lib/sisu/v3/response.rb
index 8fad9fc9..0b2bc107 100644
--- a/lib/sisu/v3/response.rb
+++ b/lib/sisu/v3/response.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/rexml.rb b/lib/sisu/v3/rexml.rb
index f6851b78..ba7ea5d1 100644
--- a/lib/sisu/v3/rexml.rb
+++ b/lib/sisu/v3/rexml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb
index 2ebe46fa..e583551b 100644
--- a/lib/sisu/v3/screen_text_color.rb
+++ b/lib/sisu/v3/screen_text_color.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v3/share_src.rb
index feb57a2e..421ccf9f 100644
--- a/lib/sisu/v3/share_src.rb
+++ b/lib/sisu/v3/share_src.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/share_src_kdissert.rb b/lib/sisu/v3/share_src_kdissert.rb
index 4c37f3ff..1fbdc6f5 100644
--- a/lib/sisu/v3/share_src_kdissert.rb
+++ b/lib/sisu/v3/share_src_kdissert.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_html.rb b/lib/sisu/v3/shared_html.rb
index dfffc5c9..2f8deaea 100644
--- a/lib/sisu/v3/shared_html.rb
+++ b/lib/sisu/v3/shared_html.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_html_lite.rb b/lib/sisu/v3/shared_html_lite.rb
index 02b4dcc2..2ac4b01a 100644
--- a/lib/sisu/v3/shared_html_lite.rb
+++ b/lib/sisu/v3/shared_html_lite.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_markup_alt.rb b/lib/sisu/v3/shared_markup_alt.rb
index cbd1846b..8eebea29 100644
--- a/lib/sisu/v3/shared_markup_alt.rb
+++ b/lib/sisu/v3/shared_markup_alt.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_metadata.rb b/lib/sisu/v3/shared_metadata.rb
index ebb0bc4e..1a3bd0a9 100644
--- a/lib/sisu/v3/shared_metadata.rb
+++ b/lib/sisu/v3/shared_metadata.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v3/shared_sem.rb
index 4ffae2f5..cb3ef2b4 100644
--- a/lib/sisu/v3/shared_sem.rb
+++ b/lib/sisu/v3/shared_sem.rb
@@ -8,7 +8,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v3/shared_txt.rb
index 598fc52d..998736a1 100644
--- a/lib/sisu/v3/shared_txt.rb
+++ b/lib/sisu/v3/shared_txt.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_xhtml.rb b/lib/sisu/v3/shared_xhtml.rb
index 84f8be80..0b167424 100644
--- a/lib/sisu/v3/shared_xhtml.rb
+++ b/lib/sisu/v3/shared_xhtml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/shared_xml.rb b/lib/sisu/v3/shared_xml.rb
index c8a92693..afc0b855 100644
--- a/lib/sisu/v3/shared_xml.rb
+++ b/lib/sisu/v3/shared_xml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb
index f0aa835a..5607bb1f 100644
--- a/lib/sisu/v3/sisupod_make.rb
+++ b/lib/sisu/v3/sisupod_make.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb
index 4981b788..57d36590 100644
--- a/lib/sisu/v3/sitemaps.rb
+++ b/lib/sisu/v3/sitemaps.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/spell.rb b/lib/sisu/v3/spell.rb
index fed55cab..76f92e0b 100644
--- a/lib/sisu/v3/spell.rb
+++ b/lib/sisu/v3/spell.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sst_convert_markup.rb b/lib/sisu/v3/sst_convert_markup.rb
index 161d7aed..6849a9af 100644
--- a/lib/sisu/v3/sst_convert_markup.rb
+++ b/lib/sisu/v3/sst_convert_markup.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb
index 88d4570a..e9154c6d 100644
--- a/lib/sisu/v3/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v3/sst_do_inline_footnotes.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sst_from_xml.rb b/lib/sisu/v3/sst_from_xml.rb
index b41934d8..f07f6a31 100644
--- a/lib/sisu/v3/sst_from_xml.rb
+++ b/lib/sisu/v3/sst_from_xml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sst_identify_markup.rb b/lib/sisu/v3/sst_identify_markup.rb
index a6f2a550..ba7d5826 100644
--- a/lib/sisu/v3/sst_identify_markup.rb
+++ b/lib/sisu/v3/sst_identify_markup.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v3/sst_to_s_xml_sax.rb
index 54bde02c..15289779 100644
--- a/lib/sisu/v3/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v3/sst_to_s_xml_sax.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 7f6aae4c..00e3f030 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -87,7 +87,7 @@ module SiSU_Env
@t.month
end
def year_static
- '2010'
+ '2011'
end
end
class Info_system
diff --git a/lib/sisu/v3/termsheet.rb b/lib/sisu/v3/termsheet.rb
index 8640f9a9..b08b57c0 100644
--- a/lib/sisu/v3/termsheet.rb
+++ b/lib/sisu/v3/termsheet.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb
index 4cf796af..fcd4a5b3 100644
--- a/lib/sisu/v3/texinfo.rb
+++ b/lib/sisu/v3/texinfo.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/texinfo_format.rb b/lib/sisu/v3/texinfo_format.rb
index 79b0fd6f..69d98240 100644
--- a/lib/sisu/v3/texinfo_format.rb
+++ b/lib/sisu/v3/texinfo_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb
index 8ce56534..8b0ba8c6 100644
--- a/lib/sisu/v3/texpdf.rb
+++ b/lib/sisu/v3/texpdf.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb
index dcea7e52..7264f29b 100644
--- a/lib/sisu/v3/texpdf_format.rb
+++ b/lib/sisu/v3/texpdf_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v3/update.rb
index 21b766e2..8a65c99e 100644
--- a/lib/sisu/v3/update.rb
+++ b/lib/sisu/v3/update.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb
index eee4d4c3..c2b694a2 100644
--- a/lib/sisu/v3/urls.rb
+++ b/lib/sisu/v3/urls.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/webrick.rb b/lib/sisu/v3/webrick.rb
index ff228a65..ba324fff 100644
--- a/lib/sisu/v3/webrick.rb
+++ b/lib/sisu/v3/webrick.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/wikispeak.rb b/lib/sisu/v3/wikispeak.rb
index 1646df9e..8e64b08e 100644
--- a/lib/sisu/v3/wikispeak.rb
+++ b/lib/sisu/v3/wikispeak.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb
index a7bc5112..94243c48 100644
--- a/lib/sisu/v3/xhtml.rb
+++ b/lib/sisu/v3/xhtml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xhtml_table.rb b/lib/sisu/v3/xhtml_table.rb
index 25db60c8..6d8ef7a2 100644
--- a/lib/sisu/v3/xhtml_table.rb
+++ b/lib/sisu/v3/xhtml_table.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb
index 80da16c1..f0e62de9 100644
--- a/lib/sisu/v3/xml.rb
+++ b/lib/sisu/v3/xml.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb
index ff885988..b4feb949 100644
--- a/lib/sisu/v3/xml_dom.rb
+++ b/lib/sisu/v3/xml_dom.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_fictionbook.rb b/lib/sisu/v3/xml_fictionbook.rb
index 045fdb93..6463c0ec 100644
--- a/lib/sisu/v3/xml_fictionbook.rb
+++ b/lib/sisu/v3/xml_fictionbook.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb
index c98c2111..7771717f 100644
--- a/lib/sisu/v3/xml_format.rb
+++ b/lib/sisu/v3/xml_format.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_md_oai_pmh_dc.rb b/lib/sisu/v3/xml_md_oai_pmh_dc.rb
index 5851a36b..c885068f 100644
--- a/lib/sisu/v3/xml_md_oai_pmh_dc.rb
+++ b/lib/sisu/v3/xml_md_oai_pmh_dc.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_scaffold.rb b/lib/sisu/v3/xml_scaffold.rb
index d85acd7e..621c3d5d 100644
--- a/lib/sisu/v3/xml_scaffold.rb
+++ b/lib/sisu/v3/xml_scaffold.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/xml_tables.rb b/lib/sisu/v3/xml_tables.rb
index 71bcb37e..7e0fb51f 100644
--- a/lib/sisu/v3/xml_tables.rb
+++ b/lib/sisu/v3/xml_tables.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
diff --git a/lib/sisu/v3/zap.rb b/lib/sisu/v3/zap.rb
index 4e925813..4c4b18bb 100644
--- a/lib/sisu/v3/zap.rb
+++ b/lib/sisu/v3/zap.rb
@@ -7,7 +7,7 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later: