sisu 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** shared html parts
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/html_shared.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_HTML_Shared
|
|
58
|
+
require_relative 'html_table' # html_table.rb
|
|
59
|
+
class TableHTML < SiSU_HTML_Table::TableHTML
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
__END__
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** shared html parts, table
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/html_table.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_HTML_Table
|
|
58
|
+
require_relative 'xhtml_table' # xhtml_table.rb
|
|
59
|
+
require_relative 'html_parts' # html_parts.rb
|
|
60
|
+
class TableHTML < SiSU_XHTML_Table::TableXHTML
|
|
61
|
+
include SiSU_Parts_HTML
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
__END__
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** html generation, html pre-processing
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/html_tune.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
require_relative 'dp' # dp.rb
|
|
58
|
+
module SiSU_HTML_Tune
|
|
59
|
+
require_relative 'se' # se.rb
|
|
60
|
+
include SiSU_Env; include SiSU_Screen
|
|
61
|
+
require_relative 'html_parts' # html_parts.rb
|
|
62
|
+
require_relative 'html_format' # html_format.rb #watch
|
|
63
|
+
@@line_mode=''
|
|
64
|
+
@@endnote_array=[]
|
|
65
|
+
@@endnote_call_counter=1
|
|
66
|
+
@@table_align='<table summary='' width="96%" border="0" cellpadding="0" col="3">
|
|
67
|
+
<tr ...><td width="2%" align="right">
|
|
68
|
+
 \;</td>
|
|
69
|
+
<td width="94%" valign="top" align="justify">'
|
|
70
|
+
@@table_align_close='</td>
|
|
71
|
+
<td width="4%" align="right" valign="top">
|
|
72
|
+
<font size="1" color="#777777">
|
|
73
|
+
</font> </td></tr></table>'
|
|
74
|
+
@@counter,@@column,@columns=0,0,0
|
|
75
|
+
class Output
|
|
76
|
+
def initialize(data,md)
|
|
77
|
+
@data,@md=data,md
|
|
78
|
+
@file=SiSU_Env::InfoFile.new(@md.fns)
|
|
79
|
+
@cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX
|
|
80
|
+
end
|
|
81
|
+
def hard_output
|
|
82
|
+
@filename_tune=@file.write_file_processing.html_tune
|
|
83
|
+
data=[]
|
|
84
|
+
@data.each do |x|
|
|
85
|
+
unless x.obj.empty?
|
|
86
|
+
x.obj=x.obj.strip
|
|
87
|
+
data << x
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
data.each do |dob|
|
|
91
|
+
@filename_tune.puts dob, "\n"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
def marshal
|
|
95
|
+
File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)}
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
class CleanHTML
|
|
99
|
+
def initialize(html='')
|
|
100
|
+
@html=html
|
|
101
|
+
end
|
|
102
|
+
def clean_for_html
|
|
103
|
+
html=@html
|
|
104
|
+
str=if html.is_a?(String)
|
|
105
|
+
html
|
|
106
|
+
else html.obj
|
|
107
|
+
end
|
|
108
|
+
str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
|
|
109
|
+
gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
|
|
110
|
+
gsub(/[<]/m,'<').gsub(/[>]/m,'>')
|
|
111
|
+
end
|
|
112
|
+
def clean
|
|
113
|
+
html=@html
|
|
114
|
+
str=if html.is_a?(String)
|
|
115
|
+
html
|
|
116
|
+
else html.obj
|
|
117
|
+
end
|
|
118
|
+
str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
|
|
119
|
+
gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
|
|
120
|
+
gsub(/[\\]{2}/m,'<br>')
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
class Tune
|
|
124
|
+
include SiSU_Parts_HTML
|
|
125
|
+
def initialize(data,md)
|
|
126
|
+
@data,@md=data,md
|
|
127
|
+
@sys=SiSU_Env::SystemCall.new
|
|
128
|
+
@env=SiSU_Env::InfoEnv.new(@md.fns,@md)
|
|
129
|
+
end
|
|
130
|
+
def songsheet
|
|
131
|
+
begin
|
|
132
|
+
@cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX
|
|
133
|
+
if (@md.opt.act[:verbose][:set]==:on \
|
|
134
|
+
|| @md.opt.act[:verbose_plus][:set]==:on \
|
|
135
|
+
|| @md.opt.act[:maintenance][:set]==:on)
|
|
136
|
+
SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey
|
|
137
|
+
end
|
|
138
|
+
songsheet_array(@data)
|
|
139
|
+
#data=songsheet_array(@data)
|
|
140
|
+
if @md.opt.act[:maintenance][:set]==:on #Hard Output Tune Optional on/off here
|
|
141
|
+
SiSU_HTML_Tune::Output.new(@data,@md).hard_output
|
|
142
|
+
SiSU_HTML_Tune::Output.new(@data,@md).marshal
|
|
143
|
+
end
|
|
144
|
+
SiSU_HTML_Tune::Tune.new(@data,@md).output
|
|
145
|
+
rescue
|
|
146
|
+
SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
|
|
147
|
+
__LINE__.to_s + ':' + __FILE__
|
|
148
|
+
end
|
|
149
|
+
ensure
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
def songsheet_array(data)
|
|
153
|
+
data_tuned=[]
|
|
154
|
+
data.each do |dob|
|
|
155
|
+
dob=amp_angle_brackets(dob)
|
|
156
|
+
dob=endnotes_html(dob)
|
|
157
|
+
dob=url_markup(dob)
|
|
158
|
+
dob=markup(dob)
|
|
159
|
+
data_tuned << dob
|
|
160
|
+
end
|
|
161
|
+
data_tuned
|
|
162
|
+
end
|
|
163
|
+
def urls(data)
|
|
164
|
+
@words=data.each.map do |word|
|
|
165
|
+
if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
|
|
166
|
+
http_=true
|
|
167
|
+
if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
|
|
168
|
+
m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
|
|
169
|
+
elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/
|
|
170
|
+
#http_=false
|
|
171
|
+
m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/.match(word).captures
|
|
172
|
+
u="#{Xx[:html_relative2]}/" + u
|
|
173
|
+
elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
|
|
174
|
+
http_=false
|
|
175
|
+
m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
|
|
176
|
+
elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
|
|
177
|
+
m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
|
|
178
|
+
end
|
|
179
|
+
case m
|
|
180
|
+
when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/
|
|
181
|
+
w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
|
|
182
|
+
w=%{width="#{w}"} if w
|
|
183
|
+
h=%{height="#{h}"} if h
|
|
184
|
+
c=m[/"(.+?)"/m,1]
|
|
185
|
+
caption=%{<br><p class="caption">#{c}</p>} if c
|
|
186
|
+
png=m.scan(/\S+/)[0]
|
|
187
|
+
image_path=@md.file.output_path.html_seg.rel_image
|
|
188
|
+
#image_path=(@md.fns =~/\.-ss[tm]$/) \
|
|
189
|
+
#? @env.url.images_external
|
|
190
|
+
#: @env.url.images_local
|
|
191
|
+
ins=if u \
|
|
192
|
+
and u.strip !~/^image$/
|
|
193
|
+
%{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
|
|
194
|
+
else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
|
|
195
|
+
end
|
|
196
|
+
word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
|
|
197
|
+
else
|
|
198
|
+
link=m[/(.+)/m]
|
|
199
|
+
png=m.scan(/\S+/)[0].strip
|
|
200
|
+
link=link.strip
|
|
201
|
+
u=u.gsub(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace
|
|
202
|
+
ins=%{<a href="#{u}">#{link}</a>}
|
|
203
|
+
word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
|
|
204
|
+
gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
|
|
205
|
+
end
|
|
206
|
+
word
|
|
207
|
+
else word
|
|
208
|
+
end
|
|
209
|
+
end.join(' ')
|
|
210
|
+
end
|
|
211
|
+
def url_markup(dob)
|
|
212
|
+
unless dob.is==:code
|
|
213
|
+
if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
|
|
214
|
+
@word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)
|
|
215
|
+
words=urls(@word_mode)
|
|
216
|
+
dob.obj=dob.obj.gsub(/.+/m,words)
|
|
217
|
+
end #consider change, do a while loop
|
|
218
|
+
dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>©</sup>})
|
|
219
|
+
if (dob.obj !~/\<:ad\s+\.\.\//)
|
|
220
|
+
dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,
|
|
221
|
+
%{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
|
|
222
|
+
else
|
|
223
|
+
dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,
|
|
224
|
+
%{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})
|
|
225
|
+
end
|
|
226
|
+
dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_choice}" alt="stellar">}).
|
|
227
|
+
gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_new}" alt="new">}).
|
|
228
|
+
gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>').
|
|
229
|
+
gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ').
|
|
230
|
+
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
|
|
231
|
+
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}).
|
|
232
|
+
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="\\1" target="_top">\\1</a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration
|
|
233
|
+
if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \
|
|
234
|
+
and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/
|
|
235
|
+
dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'<a href="\1">\1</a>')
|
|
236
|
+
end
|
|
237
|
+
if dob.obj =~/..\/\S+/ \
|
|
238
|
+
and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/
|
|
239
|
+
dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>})
|
|
240
|
+
end
|
|
241
|
+
dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{the_url.site}/}).
|
|
242
|
+
gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}).
|
|
243
|
+
gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{the_url.site}/})
|
|
244
|
+
else
|
|
245
|
+
dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>')
|
|
246
|
+
end
|
|
247
|
+
dob
|
|
248
|
+
end
|
|
249
|
+
def amp_angle_brackets(dob)
|
|
250
|
+
dob.obj=dob.obj.
|
|
251
|
+
gsub(/&/u,'&').
|
|
252
|
+
gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}").
|
|
253
|
+
gsub(/</u,'<').gsub(/>/u,'>')
|
|
254
|
+
dob
|
|
255
|
+
end
|
|
256
|
+
def endnotes_html(dob)
|
|
257
|
+
unless dob.is ==:code
|
|
258
|
+
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
|
|
259
|
+
%{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } +
|
|
260
|
+
%{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}).
|
|
261
|
+
gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
|
|
262
|
+
%{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } +
|
|
263
|
+
%{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}).
|
|
264
|
+
gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
|
|
265
|
+
%{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } +
|
|
266
|
+
%{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2</sup></note></a> \\3 \\4})
|
|
267
|
+
end
|
|
268
|
+
dob
|
|
269
|
+
end
|
|
270
|
+
def markup(dob)
|
|
271
|
+
dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
|
|
272
|
+
gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
|
|
273
|
+
dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless dob.is==:table
|
|
274
|
+
dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
|
|
275
|
+
gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
|
|
276
|
+
gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
|
|
277
|
+
gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
|
|
278
|
+
gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
|
|
279
|
+
gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
|
|
280
|
+
gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
|
|
281
|
+
gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
|
|
282
|
+
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
|
|
283
|
+
gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
|
|
284
|
+
gsub(/#{Mx[:gl_bullet]}/m,'● ').
|
|
285
|
+
gsub(/#{Mx[:nbsp]}/,' ').
|
|
286
|
+
gsub(/<(p|br) \/>/,'<\1>')
|
|
287
|
+
dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean
|
|
288
|
+
dob
|
|
289
|
+
end
|
|
290
|
+
def output
|
|
291
|
+
data=@data
|
|
292
|
+
@tuned_file=data.each.map do |dob|
|
|
293
|
+
dob.obj=dob.obj.strip.chomp
|
|
294
|
+
dob
|
|
295
|
+
end
|
|
296
|
+
@tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove
|
|
297
|
+
@tuned_file
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
__END__
|
data/lib/sisu/hub.rb
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** hub
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/hub.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU
|
|
58
|
+
require_relative 'constants' # constants.rb
|
|
59
|
+
require_relative 'se' # se.rb
|
|
60
|
+
include SiSU_Env
|
|
61
|
+
include SiSU_Screen
|
|
62
|
+
require_relative 'hub_actions' # hub_actions.rb
|
|
63
|
+
require_relative 'hub_loop_markup_files' # hub_loop_markup_files.rb
|
|
64
|
+
require_relative 'hub_options' # hub_options.rb
|
|
65
|
+
require_relative 'dp' # dp.rb
|
|
66
|
+
include SiSU_Param
|
|
67
|
+
require_relative 'utils' # utils.rb
|
|
68
|
+
begin
|
|
69
|
+
require 'uri'
|
|
70
|
+
rescue LoadError
|
|
71
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
72
|
+
error('uri NOT FOUND (LoadError)')
|
|
73
|
+
end
|
|
74
|
+
class HubMaster
|
|
75
|
+
def initialize(argv,sisu_runtime)
|
|
76
|
+
begin
|
|
77
|
+
opt=SiSU_Commandline::Options.new(argv,sisu_runtime)
|
|
78
|
+
SiSU::Processing.new(opt).actions_without_files
|
|
79
|
+
SiSU::Processing.new(opt).actions_on_files
|
|
80
|
+
SiSU::Processing.new(opt).actions_without_files_post
|
|
81
|
+
rescue
|
|
82
|
+
selection=(opt ? opt.selections.src : argv)
|
|
83
|
+
SiSU_Screen::Ansi.new(selection,$!,$@).rescue do
|
|
84
|
+
__LINE__.to_s + ':' + __FILE__
|
|
85
|
+
end
|
|
86
|
+
ensure
|
|
87
|
+
Dir.chdir(sisu_runtime[:call_path])
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
class Processing
|
|
92
|
+
begin
|
|
93
|
+
require 'fileutils'
|
|
94
|
+
include FileUtils
|
|
95
|
+
rescue LoadError
|
|
96
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
97
|
+
error('fileutils NOT FOUND (LoadError)')
|
|
98
|
+
end
|
|
99
|
+
@@env=nil
|
|
100
|
+
attr_accessor :op
|
|
101
|
+
def initialize(opt)
|
|
102
|
+
@opt=opt
|
|
103
|
+
@@env=@env=SiSU_Env::InfoEnv.new
|
|
104
|
+
@msg,@msgs='',nil
|
|
105
|
+
@tell=lambda {
|
|
106
|
+
SiSU_Screen::Ansi.new(
|
|
107
|
+
@opt.selections.str,
|
|
108
|
+
@msg,
|
|
109
|
+
"#{@msgs.inspect if @msgs}"
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
end
|
|
113
|
+
def remove_skipped_files_if_any_from_processing_files_array
|
|
114
|
+
if @remove_faulty_markup_files_array.length > 0
|
|
115
|
+
@opt.files = (@opt.files - @remove_faulty_markup_files_array)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
def print_error_message_if_files_skipped
|
|
119
|
+
if @remove_faulty_markup_files_array.length > 0
|
|
120
|
+
puts '---'
|
|
121
|
+
STDERR.puts 'ERROR with file(s), did not process: ' +
|
|
122
|
+
@remove_faulty_markup_files_array.join(',')
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
def do_each_file_loop_check_and_perform_selected_actions(opt)
|
|
126
|
+
actions=SiSU_Hub_Actions::HubActions.new(opt)
|
|
127
|
+
actions.outputs.each_file.abstract_objects?
|
|
128
|
+
actions.outputs.each_file.qrcode?
|
|
129
|
+
actions.outputs.each_file.hash_digests?
|
|
130
|
+
actions.outputs.each_file.text?
|
|
131
|
+
actions.outputs.each_file.html?
|
|
132
|
+
actions.outputs.each_file.xhtml?
|
|
133
|
+
actions.outputs.each_file.xml?
|
|
134
|
+
actions.outputs.each_file.pdf?
|
|
135
|
+
actions.outputs.each_file.man_or_info?
|
|
136
|
+
actions.outputs.each_file.po4a_make?
|
|
137
|
+
actions.outputs.each_file.sqlite_discrete?
|
|
138
|
+
actions.outputs.each_file.manifest?
|
|
139
|
+
end
|
|
140
|
+
def do_each_file_loop_options
|
|
141
|
+
if @opt.files.length > 0
|
|
142
|
+
@opt.files.each_with_index do |fno,i|
|
|
143
|
+
@opt.fno=fno
|
|
144
|
+
@opt.fns=fno.
|
|
145
|
+
gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
|
|
146
|
+
gsub(/\.ssm$/,'.ssm.sst')
|
|
147
|
+
@opt.f_pth=@opt.f_pths[i]
|
|
148
|
+
if @opt.fns !~/\.-sst$/
|
|
149
|
+
@opt.pth=@opt.f_pths[i][:pth]
|
|
150
|
+
@opt.lng=@opt.f_pths[i][:lng]
|
|
151
|
+
else
|
|
152
|
+
@opt.pth=Dir.pwd
|
|
153
|
+
@opt.lng='en'
|
|
154
|
+
end
|
|
155
|
+
unless @opt.pth.nil?
|
|
156
|
+
@@pwd=@opt.pth
|
|
157
|
+
Dir.chdir(@opt.pth) #watch
|
|
158
|
+
end
|
|
159
|
+
#@env=SiSU_Env::InfoEnv.new(@opt.fns)
|
|
160
|
+
do_each_file_loop_check_and_perform_selected_actions(@opt)
|
|
161
|
+
end
|
|
162
|
+
else
|
|
163
|
+
do_each_file_loop_check_and_perform_selected_actions(@opt)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
def do_loop_files_on_given_option_pre
|
|
167
|
+
begin
|
|
168
|
+
if @opt.act[:zap][:set]==:on #% --zap, -Z
|
|
169
|
+
SiSU_Hub_Loops::OptionLoopFiles.new(@opt).loop_files_on_given_option do
|
|
170
|
+
require_relative 'zap'
|
|
171
|
+
SiSU_Zap::Source.new(@opt).read # -Z zap.rb
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
ensure
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
def do_loop_files_on_given_option_post
|
|
178
|
+
actions=SiSU_Hub_Actions::HubActions.new(@opt)
|
|
179
|
+
if defined? actions.outputs.loop_files.share_source?
|
|
180
|
+
actions.outputs.loop_files.share_source?
|
|
181
|
+
end
|
|
182
|
+
if defined? actions.outputs.loop_files.run_termsheet?
|
|
183
|
+
actions.outputs.loop_files.run_termsheet?
|
|
184
|
+
end
|
|
185
|
+
if defined? actions.outputs.loop_files.po4a_setup?
|
|
186
|
+
actions.outputs.loop_files.po4a_setup?
|
|
187
|
+
end
|
|
188
|
+
if defined? actions.outputs.loop_files.sql?
|
|
189
|
+
actions.outputs.loop_files.sql?
|
|
190
|
+
end
|
|
191
|
+
SiSU_Hub_Actions::Operations.new.counter
|
|
192
|
+
if defined? actions.outputs.loop_files.manifest?
|
|
193
|
+
actions.outputs.loop_files.manifest?
|
|
194
|
+
end
|
|
195
|
+
if defined? actions.outputs.loop_files.sitemaps?
|
|
196
|
+
actions.outputs.loop_files.sitemaps?
|
|
197
|
+
end
|
|
198
|
+
if defined? actions.outputs.loop_files.urls?
|
|
199
|
+
actions.outputs.loop_files.urls?
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
def actions_without_files
|
|
203
|
+
actions=SiSU_Hub_Actions::HubActions.new(@opt)
|
|
204
|
+
actions.report.version_info?
|
|
205
|
+
actions.report.version_info_extra?
|
|
206
|
+
actions.prepare.site?
|
|
207
|
+
actions.prepare.sql?
|
|
208
|
+
end
|
|
209
|
+
def actions_without_files_post
|
|
210
|
+
actions=SiSU_Hub_Actions::HubActions.new(@opt)
|
|
211
|
+
actions.prepare.remote_site?
|
|
212
|
+
actions.prepare.search_form?
|
|
213
|
+
actions.prepare.webrick?
|
|
214
|
+
end
|
|
215
|
+
def actions_on_files
|
|
216
|
+
if @opt.act[:profile][:set]==:on
|
|
217
|
+
begin
|
|
218
|
+
require 'profile'
|
|
219
|
+
rescue LoadError
|
|
220
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
221
|
+
error('profile NOT FOUND (LoadError)')
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
actions=SiSU_Hub_Actions::HubActions.new(@opt)
|
|
225
|
+
actions.outputs.each_file.harvest?
|
|
226
|
+
actions.outputs.init?
|
|
227
|
+
do_loop_files_on_given_option_pre
|
|
228
|
+
do_each_file_loop_options
|
|
229
|
+
#remove_skipped_files_if_any_from_processing_files_array # NEEDS WORK
|
|
230
|
+
do_loop_files_on_given_option_post
|
|
231
|
+
#print_error_message_if_files_skipped
|
|
232
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
233
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
234
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
235
|
+
@msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil
|
|
236
|
+
end
|
|
237
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
238
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
239
|
+
|| @opt.act[:maintenance][:set]==:on \
|
|
240
|
+
|| @opt.act[:urls_selected][:set]==:on \
|
|
241
|
+
|| @opt.act[:urls_all][:set]==:on)
|
|
242
|
+
@tell.call.print_brown unless @opt.files.join.empty?
|
|
243
|
+
end
|
|
244
|
+
if defined? @@env.processing_path.processing \
|
|
245
|
+
and @@env.user \
|
|
246
|
+
and FileTest.directory?(@@env.processing_path.processing) \
|
|
247
|
+
and @@env.processing_path.processing =~/#{@@env.user}$/
|
|
248
|
+
#clean tmp processing dir of content as is located in public area
|
|
249
|
+
if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
|
|
250
|
+
FileUtils::cd(@@env.processing_path.processing_base_tmp) do
|
|
251
|
+
FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
class HubClose
|
|
258
|
+
def initialize(call_path,argv)
|
|
259
|
+
begin
|
|
260
|
+
env=SiSU_Env::InfoEnv.new
|
|
261
|
+
rescue
|
|
262
|
+
ensure
|
|
263
|
+
if FileTest.directory?(env.processing_path.processing) \
|
|
264
|
+
and FileTest.directory?(env.processing_path.processing_base_tmp) \
|
|
265
|
+
and env.processing_path.processing_base_tmp =~/#{env.processing_path.processing}/ \
|
|
266
|
+
and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \
|
|
267
|
+
and not argv.inspect =~/"--maintenance"|"-M"/
|
|
268
|
+
FileUtils::cd(env.processing_path.processing_base_tmp) do
|
|
269
|
+
FileUtils::rm_rf('.')
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
Dir.chdir(call_path)
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
__END__
|