sisu 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,170 @@
|
|
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_loop_markup_files.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Hub_Loops
|
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_options' # hub_options.rb
|
64
|
+
require_relative 'dp' # dp.rb
|
65
|
+
include SiSU_Param
|
66
|
+
require_relative 'utils' # utils.rb
|
67
|
+
begin
|
68
|
+
require 'uri'
|
69
|
+
rescue LoadError
|
70
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
71
|
+
error('uri NOT FOUND (LoadError)')
|
72
|
+
end
|
73
|
+
class OptionLoopFiles
|
74
|
+
attr_reader :opt
|
75
|
+
def initialize(opt)
|
76
|
+
@opt=opt
|
77
|
+
@r=Px[:lng_lst_rgx]
|
78
|
+
end
|
79
|
+
def loop_files_on_given_option
|
80
|
+
@opt.files.each_with_index do |fno,i|
|
81
|
+
@opt.fno,@opt.fns=fno,fno
|
82
|
+
@opt.f_pth=@opt.f_pths[i]
|
83
|
+
if fno !~/\.-sst$/
|
84
|
+
@opt.pth=@opt.paths[i]
|
85
|
+
@opt.lng=@opt.lngs[i]
|
86
|
+
end
|
87
|
+
@@pwd=@opt.pth
|
88
|
+
@opt.pth=@opt.f_pths[i][:pth]
|
89
|
+
@opt.lng=@opt.f_pths[i][:lng]
|
90
|
+
Dir.chdir(@opt.f_pth[:pth]) #watch
|
91
|
+
SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track
|
92
|
+
@env=SiSU_Env::InfoEnv.new(fno)
|
93
|
+
yield
|
94
|
+
end
|
95
|
+
end
|
96
|
+
def loop_files_on_given_option_bundle
|
97
|
+
@files_bundle={}
|
98
|
+
@opt.files.each_with_index do |fno,i|
|
99
|
+
fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
|
100
|
+
unless @files_bundle[fn_base_bundle]
|
101
|
+
@files_bundle[fn_base_bundle]={ status: :todo }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
@opt.files.each_with_index do |fno,i|
|
105
|
+
fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
|
106
|
+
unless @files_bundle[fn_base_bundle][:status] == :done
|
107
|
+
@files_bundle[fn_base_bundle][:status] = :done
|
108
|
+
@opt.fns=fno
|
109
|
+
@opt.fno=fno
|
110
|
+
@opt.f_pth=@opt.f_pths[i]
|
111
|
+
if fno !~/\.-sst$/
|
112
|
+
@opt.pth=@opt.paths[i]
|
113
|
+
@opt.lng=@opt.lngs[i]
|
114
|
+
end
|
115
|
+
@@pwd=@opt.pth
|
116
|
+
@opt.pth=@opt.f_pths[i][:pth]
|
117
|
+
@opt.lng=@opt.f_pths[i][:lng]
|
118
|
+
Dir.chdir(@opt.f_pth[:pth]) #watch
|
119
|
+
@env=SiSU_Env::InfoEnv.new(fno)
|
120
|
+
yield
|
121
|
+
else next
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
def manifest_on_files_translated
|
126
|
+
number_of_files={}
|
127
|
+
@opt.files.each_with_index do |fns,i|
|
128
|
+
fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
|
129
|
+
(number_of_files[fn].is_a?(Array)) \
|
130
|
+
? (number_of_files[fn] << i)
|
131
|
+
: (number_of_files.store(fn,[i]))
|
132
|
+
end
|
133
|
+
files_translated_idx=[]
|
134
|
+
number_of_files.each do |x|
|
135
|
+
if x[1].length > 1
|
136
|
+
files_translated_idx << x[1]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
#files_translated_idx=number_of_files.select do |x|
|
140
|
+
# x[1] if x[1].length > 1
|
141
|
+
#end
|
142
|
+
if files_translated_idx.flatten.length > 1
|
143
|
+
SiSU_Screen::Ansi.new(
|
144
|
+
@opt.act[:color_state][:set],
|
145
|
+
'Manifest re-run on (currently generated) translated files',
|
146
|
+
''
|
147
|
+
).grey_title_hi unless @opt.act[:quiet][:set] ==:on
|
148
|
+
files_translated_idx.flatten.each do |i|
|
149
|
+
@opt.fns=@opt.files[i]
|
150
|
+
@opt.f_pth=@opt.f_pths[i]
|
151
|
+
if @opt.fns =~/\.-sst$/
|
152
|
+
@opt.pth=Dir.pwd
|
153
|
+
@opt.lng='en'
|
154
|
+
elsif @opt.fno =~/\.txz$/
|
155
|
+
@opt.pth=@opt.f_pths[i][:pth]
|
156
|
+
@opt.lng=@opt.f_pths[i][:lng]
|
157
|
+
else
|
158
|
+
@opt.pth=@opt.f_pths[i][:pth]
|
159
|
+
@opt.lng=@opt.f_pths[i][:lng]
|
160
|
+
end
|
161
|
+
@@pwd=@opt.pth
|
162
|
+
Dir.chdir(@opt.pth) #watch
|
163
|
+
@env=SiSU_Env::InfoEnv.new(@opt.fns)
|
164
|
+
yield
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
__END__
|
@@ -0,0 +1,1695 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** hub, command line options parsing
|
8
|
+
|
9
|
+
*** hub
|
10
|
+
|
11
|
+
** Author: Ralph Amissah
|
12
|
+
<ralph@amissah.com>
|
13
|
+
<ralph.amissah@gmail.com>
|
14
|
+
|
15
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
16
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
17
|
+
All Rights Reserved.
|
18
|
+
|
19
|
+
** License: GPL 3 or later:
|
20
|
+
|
21
|
+
SiSU, a framework for document structuring, publishing and search
|
22
|
+
|
23
|
+
Copyright (C) Ralph Amissah
|
24
|
+
|
25
|
+
This program is free software: you can redistribute it and/or modify it
|
26
|
+
under the terms of the GNU General Public License as published by the Free
|
27
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
28
|
+
any later version.
|
29
|
+
|
30
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
31
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
32
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
33
|
+
more details.
|
34
|
+
|
35
|
+
You should have received a copy of the GNU General Public License along with
|
36
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
37
|
+
|
38
|
+
If you have Internet connection, the latest version of the GPL should be
|
39
|
+
available at these locations:
|
40
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
41
|
+
<http://www.gnu.org/licenses/gpl.html>
|
42
|
+
|
43
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
44
|
+
|
45
|
+
** SiSU uses:
|
46
|
+
* Standard SiSU markup syntax,
|
47
|
+
* Standard SiSU meta-markup syntax, and the
|
48
|
+
* Standard SiSU object citation numbering and system
|
49
|
+
|
50
|
+
** Hompages:
|
51
|
+
<http://www.jus.uio.no/sisu>
|
52
|
+
<http://www.sisudoc.org>
|
53
|
+
|
54
|
+
** Git
|
55
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
56
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/hub_options.rb;hb=HEAD>
|
57
|
+
|
58
|
+
=end
|
59
|
+
module SiSU_Commandline
|
60
|
+
begin
|
61
|
+
require 'pathname'
|
62
|
+
rescue LoadError
|
63
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
64
|
+
error('pathname NOT FOUND (LoadError)')
|
65
|
+
end
|
66
|
+
require_relative 'se' # se.rb
|
67
|
+
require_relative 'dp_make' # dp_make.rb
|
68
|
+
class HeaderCommon
|
69
|
+
def sisu_document_make_instructions(make_instruct_array=:nil)
|
70
|
+
@pagenew=
|
71
|
+
@pagebreak=
|
72
|
+
@pageline=
|
73
|
+
@toc=
|
74
|
+
@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=
|
75
|
+
@num_top=
|
76
|
+
@i18n=
|
77
|
+
@man_section=
|
78
|
+
@emphasis_set_to=
|
79
|
+
@bold_match_list=
|
80
|
+
@italics_match_list=
|
81
|
+
@substitution_match_list=
|
82
|
+
@footer_links=
|
83
|
+
@home_button_links=
|
84
|
+
@links=
|
85
|
+
nil
|
86
|
+
make_instruct_array=make_instruct_array==:nil \
|
87
|
+
? SiSU_Env::GetInit.new.sisu_document_make.makefile_read
|
88
|
+
: make_instruct_array
|
89
|
+
@makeset=false
|
90
|
+
if make_instruct_array
|
91
|
+
make_instruct_array.each do |para| #% scan document
|
92
|
+
if para =~/^(?:@make:|@links:)[+-]?\s/
|
93
|
+
case para
|
94
|
+
when /^@make:(.+)/m #% header processing - make
|
95
|
+
@env=SiSU_Env::InfoEnv.new
|
96
|
+
@make=SiSU_Param_Make::MdMake.new($1.strip,@opt,@env).make
|
97
|
+
makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct
|
98
|
+
@makeset=true
|
99
|
+
@pagenew=makes[:pagenew]
|
100
|
+
@pagebreak=makes[:pagenew]
|
101
|
+
@pageline=makes[:pageline]
|
102
|
+
@toc=makes[:toc]
|
103
|
+
@lv1=makes[:lv1]
|
104
|
+
@lv2=makes[:lv2]
|
105
|
+
@lv3=makes[:lv3]
|
106
|
+
@lv4=makes[:lv4]
|
107
|
+
@lv5=makes[:lv5]
|
108
|
+
@lv6=makes[:lv6]
|
109
|
+
@num_top=makes[:num_top]
|
110
|
+
@i18n=makes[:i18n]
|
111
|
+
@man_section=makes[:man_section]
|
112
|
+
@emphasis_set_to=makes[:emphasis_set_to]
|
113
|
+
@bold_match_list=makes[:bold_match_list]
|
114
|
+
@italics_match_list=makes[:italics_match_list]
|
115
|
+
@substitution_match_list=makes[:substitution_match_list]
|
116
|
+
@footer_links=makes[:footer_links]
|
117
|
+
@home_button_links=makes[:home_button_links]
|
118
|
+
@home_button_image=makes[:home_button_image]
|
119
|
+
@cover_image=makes[:cover_image]
|
120
|
+
when /^@links:(.+)/m #% header processing - make
|
121
|
+
make_links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links
|
122
|
+
@links,@links_append=make_links.links,make_links.append?
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end #% here endeth the common header loop
|
126
|
+
end
|
127
|
+
{ makeset: @makeset,
|
128
|
+
pagenew: @pagenew,
|
129
|
+
pagebreak: @pagebreak,
|
130
|
+
pageline: @pageline,
|
131
|
+
toc: @toc,
|
132
|
+
lv1: @lv1,
|
133
|
+
lv2: @lv2,
|
134
|
+
lv3: @lv3,
|
135
|
+
lv4: @lv4,
|
136
|
+
lv5: @lv5,
|
137
|
+
lv6: @lv6,
|
138
|
+
num_top: @num_top,
|
139
|
+
i18n: @i18n,
|
140
|
+
man_section: @man_section,
|
141
|
+
emphasis_set_to: @emphasis_set_to,
|
142
|
+
bold_match_list: @bold_match_list,
|
143
|
+
italics_match_list: @italics_match_list,
|
144
|
+
substitution_match_list: @substitution_match_list,
|
145
|
+
footer_links: @footer_links,
|
146
|
+
home_button_links: @home_button_links,
|
147
|
+
home_button_image: @home_button_image,
|
148
|
+
cover_image: @cover_image,
|
149
|
+
links: @links,
|
150
|
+
links_append: @links_append
|
151
|
+
}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
class Options
|
155
|
+
attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod,:sisu_run_path,:sisu_install_type
|
156
|
+
@@act=nil
|
157
|
+
def initialize(a,sisu_runtime)
|
158
|
+
@opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
|
159
|
+
@f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
|
160
|
+
@select_str=nil
|
161
|
+
@env=SiSU_Env::InfoEnv.new
|
162
|
+
@lng_base=@env.language_default_set
|
163
|
+
@dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
|
164
|
+
@lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
|
165
|
+
@sisu_run_from=sisu_runtime[:runtime_path]
|
166
|
+
@sisu_install_type=sisu_runtime[:runtime_type]
|
167
|
+
@call_path=sisu_runtime[:call_path]
|
168
|
+
pth=SiSU_Utils::Path.new(call_path)
|
169
|
+
@base_path=pth.base_markup
|
170
|
+
@base_stub=pth.base_markup_stub
|
171
|
+
@image_src_path=pth.image_src
|
172
|
+
@a=sisu_glob_rules(a)
|
173
|
+
@a.freeze
|
174
|
+
@make_instructions=HeaderCommon.new.sisu_document_make_instructions
|
175
|
+
@make_instructions_pod=nil
|
176
|
+
init
|
177
|
+
end
|
178
|
+
def sisu_called_from?
|
179
|
+
@call_path
|
180
|
+
end
|
181
|
+
def sisu_bin_filepath?
|
182
|
+
@sisu_run_from
|
183
|
+
end
|
184
|
+
def sisu_install_type?
|
185
|
+
@sisu_install_type
|
186
|
+
end
|
187
|
+
def sisu_lib_dir?
|
188
|
+
File.dirname(__FILE__)
|
189
|
+
end
|
190
|
+
def sisu_data_dir?
|
191
|
+
env=RbConfig::CONFIG
|
192
|
+
if sisu_install_type? ==:full_path_to_sisu_bin_in_sisu_dir_tree
|
193
|
+
sisu_bin_filepath?.gsub(/\/bin\/sisu\S*/,'/data/sisu')
|
194
|
+
#sisu_lib_dir?.gsub(/\/lib\/sisu\/(?:current|develop)\S*/,'/data/sisu')
|
195
|
+
elsif sisu_install_type? ==:gem_install
|
196
|
+
#sisu_run_from?.gsub(/\/bin\/.+/,'/data/sisu')
|
197
|
+
env['datadir']
|
198
|
+
elsif sisu_install_type? ==:system_install
|
199
|
+
#SiSU_Info_Env::InfoEnv.new.path.share
|
200
|
+
env['datadir']
|
201
|
+
else
|
202
|
+
env['datadir']
|
203
|
+
end
|
204
|
+
end
|
205
|
+
def find_all(find_flag,opt)
|
206
|
+
if find_flag
|
207
|
+
x=Dir.glob('*.ss[tm]')
|
208
|
+
Px[:lng_lst].each do |d|
|
209
|
+
if FileTest.directory?(d)
|
210
|
+
x << Dir.glob("#{d}/*.ss[tm]")
|
211
|
+
end
|
212
|
+
end
|
213
|
+
x=x.flatten
|
214
|
+
opt + x
|
215
|
+
end
|
216
|
+
end
|
217
|
+
def find_select(find_flag,opt)
|
218
|
+
if find_flag
|
219
|
+
x=[]
|
220
|
+
if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/
|
221
|
+
opt.each do |g|
|
222
|
+
x <<=if g =~/.ss[tm]/
|
223
|
+
Dir.glob("*#{g}")
|
224
|
+
else
|
225
|
+
Dir.glob("*#{g}*.ss[tm]")
|
226
|
+
end
|
227
|
+
Px[:lng_lst].each do |d|
|
228
|
+
if FileTest.directory?(d)
|
229
|
+
x <<=if g =~/.ss[tm]/
|
230
|
+
Dir.glob("#{d}/*#{g}")
|
231
|
+
else
|
232
|
+
Dir.glob("#{d}/*#{g}*.ss[tm]")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
x.flatten
|
239
|
+
end
|
240
|
+
end
|
241
|
+
def sisu_glob_rules(a)
|
242
|
+
a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \
|
243
|
+
or a.inspect =~/"--find"|"--glob"/
|
244
|
+
b,f=[],[]
|
245
|
+
find_flag=false
|
246
|
+
a.each do |y|
|
247
|
+
if y =~ /^-/
|
248
|
+
if y =~/^-/ \
|
249
|
+
&& y =~/[fG]|--find|--glob/
|
250
|
+
find_flag=true
|
251
|
+
end
|
252
|
+
b << y
|
253
|
+
end
|
254
|
+
if find_flag \
|
255
|
+
&& y !~ /^-/ \
|
256
|
+
&& y =~ /\S+/
|
257
|
+
if y !~/\//
|
258
|
+
f << y
|
259
|
+
else
|
260
|
+
find_flag=false
|
261
|
+
puts %{sub-directories "#{y}" cannot be provided for --find or --glob at this time}
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
r=Px[:lng_lst_rgx].gsub(/\|#{lng_base}\|/,'|')
|
266
|
+
@lang_regx=%r{(?:#{r})}
|
267
|
+
if find_flag
|
268
|
+
(f.length > 0) \
|
269
|
+
? (b + find_select(find_flag,f))
|
270
|
+
: find_all(find_flag,b)
|
271
|
+
elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \
|
272
|
+
&& a.inspect =~/"#{@lang_regx}\/?"/ \
|
273
|
+
&& a.inspect =~/"#{lng_base}\/\S+?\.ss[tm]"/
|
274
|
+
init_selected_lang_dirs(a)
|
275
|
+
else b
|
276
|
+
end
|
277
|
+
else a
|
278
|
+
end
|
279
|
+
end
|
280
|
+
def init_selected_lang_dirs(a)
|
281
|
+
@z=a.each.map do |y|
|
282
|
+
if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/
|
283
|
+
@fn=$1
|
284
|
+
y
|
285
|
+
elsif y =~/^#{@lang_regx}\/?$/
|
286
|
+
"#{y}/#{@fn}"
|
287
|
+
else y
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
def init
|
292
|
+
a=@a
|
293
|
+
s=expand_numeric_shortcuts(a)
|
294
|
+
q=set_files_and_paths_and_general_extract(s)
|
295
|
+
files=(q[:files].length > 0) ? :true : :false
|
296
|
+
@select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files)
|
297
|
+
if a.length > 0
|
298
|
+
@what=q[:what] unless q[:what].empty?
|
299
|
+
@paths = q[:paths]
|
300
|
+
@files = q[:files]
|
301
|
+
@f_pths = q[:f_pths]
|
302
|
+
@lngs = q[:lngs]
|
303
|
+
if @files.length > 0 \
|
304
|
+
and @opt_ch.empty? \
|
305
|
+
and @select_arr.length==0 #% if no other action called on filename given, default is sisu --v5 -0 [filename(s)] configured as flag default
|
306
|
+
shortcut=SiSU_Env::InfoProcessingFlag.new
|
307
|
+
@select_arr=['--v5']
|
308
|
+
@select_arr << shortcut.act_0.arr #+ ' --dal'
|
309
|
+
end
|
310
|
+
if @select_arr.inspect =~/--verbose/ \
|
311
|
+
&& @opt_ch !~/-[ku]*v[ku]*$/
|
312
|
+
SiSU_Screen::Ansi.new(
|
313
|
+
@opt_ch,
|
314
|
+
"\tsisu " + @opt_ch + ' ' + @select_arr.join(' ') + ' ' + @files.join(' ') + "\n"
|
315
|
+
).print_brown
|
316
|
+
end
|
317
|
+
end
|
318
|
+
@@act ? @act=@@act : @@act=@act=opt_act
|
319
|
+
self
|
320
|
+
end
|
321
|
+
def sisu_document_make_pod
|
322
|
+
def makefile_name
|
323
|
+
SiSU_Env::GetInit.new.sisu_document_make.makefile_name
|
324
|
+
end
|
325
|
+
def makefile(pod_make_path)
|
326
|
+
"#{pod_make_path}/#{makefile_name}"
|
327
|
+
end
|
328
|
+
def makefile_read(pod_make_path)
|
329
|
+
if FileTest.file?(makefile(pod_make_path))
|
330
|
+
sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8')
|
331
|
+
sisu_doc_makefile.split(/\s*\n\s*\n/m)
|
332
|
+
else nil
|
333
|
+
end
|
334
|
+
end
|
335
|
+
self
|
336
|
+
end
|
337
|
+
def set_files_and_paths_and_general_extract(s)
|
338
|
+
c,w='',''
|
339
|
+
m,f,pth,lng,lngs=[],[],[],[],[]
|
340
|
+
lng_is=''
|
341
|
+
a=(s.nil?) \
|
342
|
+
? ['-v']
|
343
|
+
: s.split(/\s+/)
|
344
|
+
r_l=Px[:lng_lst].join('|')
|
345
|
+
a.uniq.each do |x|
|
346
|
+
if x =~/^-[a-z0-5]+/i \
|
347
|
+
or x =~/^--\S+/
|
348
|
+
if x =~/^-([a-z0-5]+)/i
|
349
|
+
c << $1
|
350
|
+
end
|
351
|
+
if x =~/^--\S+/
|
352
|
+
m << x
|
353
|
+
end
|
354
|
+
elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/
|
355
|
+
if x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/
|
356
|
+
if x =~/^(?:https?|file):\/\/\S+/ #\
|
357
|
+
end
|
358
|
+
pwd=Dir.pwd
|
359
|
+
fn_pod=x.gsub(/([^\/]+)\.txz$/,'\1')
|
360
|
+
fullname=@env.processing_path.processing + '/sisupod/' + fn_pod
|
361
|
+
pt=Pathname.new(fullname)
|
362
|
+
FileUtils::mkdir_p(pt.to_s)
|
363
|
+
pod_make_path=fullname + '/sisupod/doc/_sisu'
|
364
|
+
make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)
|
365
|
+
@make_instructions_pod=
|
366
|
+
HeaderCommon.new.sisu_document_make_instructions(make_instruct_array)
|
367
|
+
Dir.chdir(pt.realpath)
|
368
|
+
system("
|
369
|
+
chdir #{fullname}
|
370
|
+
tar xaf #{pwd}/#{x}
|
371
|
+
chdir #{pwd}
|
372
|
+
")
|
373
|
+
Dir.chdir(pt.realpath.to_s + '/sisupod/doc')
|
374
|
+
r=Px[:lng_lst_rgx]
|
375
|
+
Dir.entries("#{fullname}/sisupod/doc").each do |d_lng|
|
376
|
+
if d_lng =~/^(?:#{r})$/
|
377
|
+
Dir.chdir(pt.realpath.to_s + "/sisupod/doc/#{d_lng}")
|
378
|
+
filenames=Dir.glob("*.ss[mt]")
|
379
|
+
filenames.each do |fn|
|
380
|
+
f_pths << {
|
381
|
+
pth: "#{fullname}/sisupod/doc/#{d_lng}",
|
382
|
+
f: "#{fn}",
|
383
|
+
pth_stub: 'doc',
|
384
|
+
lng: d_lng,
|
385
|
+
lng_is: d_lng,
|
386
|
+
url_base: '',
|
387
|
+
url: ''
|
388
|
+
}
|
389
|
+
Dir.chdir(pwd)
|
390
|
+
f << fn
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
elsif x =~/^(?:https?|file):\/\/\S+/ \
|
395
|
+
and x =~/\S+?\.ss[mt]$/
|
396
|
+
r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\//
|
397
|
+
url_base = (x[r_url,1])
|
398
|
+
url = x
|
399
|
+
y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'')
|
400
|
+
t=/(#{r_l})\/[^\/]+?\.ss[tm]$/
|
401
|
+
l_p = (y[t,1]) \
|
402
|
+
? y[t,1]
|
403
|
+
: nil
|
404
|
+
lng << l_p
|
405
|
+
lngs << if l_p
|
406
|
+
l_p
|
407
|
+
elsif x =~/~(#{r_l})\.ss[tm]/
|
408
|
+
$1
|
409
|
+
else lng_base
|
410
|
+
end
|
411
|
+
r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/
|
412
|
+
fn = (y[r_f,1]) \
|
413
|
+
? y[r_f,1]
|
414
|
+
: y
|
415
|
+
fn=fn.gsub(/\.((?:ssm\.)?sst)/,'.-\1')
|
416
|
+
fullname=Dir.pwd + '/' + fn
|
417
|
+
pt=Pathname.new(fullname)
|
418
|
+
pth << Dir.pwd
|
419
|
+
r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
|
420
|
+
lng_is =if l_p
|
421
|
+
l_p
|
422
|
+
elsif x =~/~(#{r_l})\.ss[tm]/
|
423
|
+
$1
|
424
|
+
else lng_base
|
425
|
+
end
|
426
|
+
f_pths << {
|
427
|
+
pth: pt.split[0].realpath.to_s,
|
428
|
+
f: pt.split[1].to_s,
|
429
|
+
pth_stub: pt.split[0].realpath.to_s[r_u,1],
|
430
|
+
lng: (pt.split[0].realpath.to_s[t,1]) \
|
431
|
+
? pt.split[0].realpath.to_s[t,1]
|
432
|
+
: nil,
|
433
|
+
lng_is: lng_is,
|
434
|
+
url_base: url_base,
|
435
|
+
url: url
|
436
|
+
}
|
437
|
+
f << fn
|
438
|
+
elsif FileTest.file?(x)
|
439
|
+
pt=Pathname.new(x)
|
440
|
+
pth << pt.split[0].realpath.to_s #remove?
|
441
|
+
f << pt.split[1].to_s #remove?
|
442
|
+
r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
|
443
|
+
t=/.+\/(#{r_l})$/
|
444
|
+
l_p = (pt.split[0].realpath.to_s[t,1]) \
|
445
|
+
? pt.split[0].realpath.to_s[t,1]
|
446
|
+
: nil
|
447
|
+
lngs << lng_is = if l_p
|
448
|
+
l_p
|
449
|
+
elsif x =~/~(#{r_l})\.ss[tm]/
|
450
|
+
$1
|
451
|
+
else lng_base
|
452
|
+
end
|
453
|
+
f_pths << {
|
454
|
+
pth: pt.split[0].realpath.to_s,
|
455
|
+
f: pt.split[1].to_s,
|
456
|
+
pth_stub: pt.split[0].realpath.to_s[r_u,1],
|
457
|
+
lng: lng_is,
|
458
|
+
lng_is: lng_is,
|
459
|
+
url_base: nil,
|
460
|
+
url: nil,
|
461
|
+
}
|
462
|
+
else puts "file not found: #{x}"
|
463
|
+
end
|
464
|
+
elsif x =~ /\.termsheet\.rb$/
|
465
|
+
(FileTest.file?(x)) \
|
466
|
+
? (f << x)
|
467
|
+
: (puts "file not found: #{x}")
|
468
|
+
else w=x
|
469
|
+
puts "#{x} in #{a.join(' ')}?"
|
470
|
+
end
|
471
|
+
end
|
472
|
+
{
|
473
|
+
opt_ch: c,
|
474
|
+
selections: m,
|
475
|
+
what: w,
|
476
|
+
paths: pth,
|
477
|
+
files: f,
|
478
|
+
f_pths: f_pths,
|
479
|
+
lng: lng_is,
|
480
|
+
lngs: lngs,
|
481
|
+
}
|
482
|
+
end
|
483
|
+
def expand_numeric_shortcuts(a)
|
484
|
+
s=''
|
485
|
+
a.each do |x|
|
486
|
+
y=case x
|
487
|
+
when /0/
|
488
|
+
(x=~/^-0\S+/) \
|
489
|
+
? x.gsub(/^-0(\S+)/,'--act0' + ' -\1')
|
490
|
+
: x.gsub(/^-0/,'--act0' + ' ')
|
491
|
+
when /1/
|
492
|
+
(x=~/^-1\S+/) \
|
493
|
+
? x.gsub(/^-1(\S+)/,'--act1' + ' -\1')
|
494
|
+
: x.gsub(/^-1/,'--act1' + ' ')
|
495
|
+
when /2/
|
496
|
+
(x=~/^-2\S+/) \
|
497
|
+
? x.gsub(/^-2(\S+)/,'--act2' + ' -\1')
|
498
|
+
: x.gsub(/^-2/,'--act2' + ' ')
|
499
|
+
when /3/
|
500
|
+
(x=~/^-3\S+/) \
|
501
|
+
? x.gsub(/^-3(\S+)/,'--act3' + ' -\1')
|
502
|
+
: x.gsub(/^-3/,'--act3' + ' ')
|
503
|
+
when /4/
|
504
|
+
(x=~/^-4\S+/) \
|
505
|
+
? x.gsub(/^-4(\S+)/,'--act4' + ' -\1')
|
506
|
+
: x.gsub(/^-4/,'--act4' + ' ')
|
507
|
+
when /5/
|
508
|
+
(x=~/^-5\S+/) \
|
509
|
+
? x.gsub(/^-5(\S+)/,'--act5' + ' -\1')
|
510
|
+
: x.gsub(/^-5/,'--act5' + ' ')
|
511
|
+
when /6/
|
512
|
+
(x=~/^-6\S+/) \
|
513
|
+
? x.gsub(/^-6(\S+)/,'--act6' + ' -\1')
|
514
|
+
: x.gsub(/^-6/,'--act6' + ' ')
|
515
|
+
when /7/
|
516
|
+
(x=~/^-7\S+/) \
|
517
|
+
? x.gsub(/^-7(\S+)/,'--act7' + ' -\1')
|
518
|
+
: x.gsub(/^-7/,'--act7' + ' ')
|
519
|
+
when /8/
|
520
|
+
(x=~/^-8\S+/) \
|
521
|
+
? x.gsub(/^-8(\S+)/,'--act8' + ' -\1')
|
522
|
+
: x.gsub(/^-8/,'--act8' + ' ')
|
523
|
+
when /9/
|
524
|
+
(x=~/^-9\S+/) \
|
525
|
+
? x.gsub(/^-9(\S+)/,'--act9' + ' -\1')
|
526
|
+
: x.gsub(/^-9/,'--act9' + ' ')
|
527
|
+
else x
|
528
|
+
end
|
529
|
+
s << " #{y}" unless y.empty?
|
530
|
+
end
|
531
|
+
s.strip!
|
532
|
+
end
|
533
|
+
def opt_cmd_and_mod_adjust(ch,select_arr,files)
|
534
|
+
select_arr=select_arr.flatten
|
535
|
+
sel_init=select_arr.flatten
|
536
|
+
shortcut=SiSU_Env::InfoProcessingFlag.new
|
537
|
+
if files ==:true
|
538
|
+
if not sel_init.empty? \
|
539
|
+
and sel_init.inspect =~/"--act[s0-9]?/
|
540
|
+
sel_init.each do |s|
|
541
|
+
select_arr <<=case s
|
542
|
+
when /--act0/ then shortcut.act_0.arr
|
543
|
+
when /--act1/ then shortcut.act_1.arr
|
544
|
+
when /--act2/ then shortcut.act_2.arr
|
545
|
+
when /--act3/ then shortcut.act_3.arr
|
546
|
+
when /--act4/ then shortcut.act_4.arr
|
547
|
+
when /--act5/ then shortcut.act_5.arr
|
548
|
+
when /--act6/ then shortcut.act_6.arr
|
549
|
+
when /--act7/ then shortcut.act_7.arr
|
550
|
+
when /--act8/ then shortcut.act_8.arr
|
551
|
+
when /--act9/ then shortcut.act_9.arr
|
552
|
+
when /--act/ then shortcut.act_info
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
556
|
+
if not sel_init.empty? \
|
557
|
+
and sel_init.inspect =~/"--pdf-/
|
558
|
+
select_arr << '--pdf'
|
559
|
+
sel_init.each do |s|
|
560
|
+
if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/
|
561
|
+
select_arr << '--landscape'
|
562
|
+
end
|
563
|
+
if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/
|
564
|
+
select_arr << '--portrait'
|
565
|
+
end
|
566
|
+
if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/
|
567
|
+
if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/
|
568
|
+
select_arr << '--papersize-a4'
|
569
|
+
end
|
570
|
+
if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/
|
571
|
+
select_arr << '--papersize-a5'
|
572
|
+
end
|
573
|
+
if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/
|
574
|
+
select_arr << '--papersize-b5'
|
575
|
+
end
|
576
|
+
if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/
|
577
|
+
select_arr << '--papersize-letter'
|
578
|
+
end
|
579
|
+
if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/
|
580
|
+
select_arr << '--papersize-legal'
|
581
|
+
end
|
582
|
+
end
|
583
|
+
end
|
584
|
+
select_arr=select_arr.uniq
|
585
|
+
end
|
586
|
+
if ch.empty? \
|
587
|
+
and sel_init.length == 0
|
588
|
+
select_arr << shortcut.act_0.arr ################ & --flag empty
|
589
|
+
elsif not ch.empty?
|
590
|
+
if ch =~/c/ then select_arr << '--color-toggle'
|
591
|
+
ch=ch.gsub(/[c]/,'')
|
592
|
+
end
|
593
|
+
if ch =~/k/ then select_arr << '--color-off'
|
594
|
+
ch=ch.gsub(/[k]/,'')
|
595
|
+
end
|
596
|
+
if ch =~/C/ then select_arr << '--config'
|
597
|
+
ch=ch.gsub(/[C]+/,'')
|
598
|
+
end
|
599
|
+
if ch =~/m/ then select_arr << '--dal'
|
600
|
+
ch=ch.gsub(/[m]/,'')
|
601
|
+
end
|
602
|
+
if ch =~/t/ then select_arr << '--txt'
|
603
|
+
ch=ch.gsub(/[t]/,'')
|
604
|
+
end
|
605
|
+
if ch =~/h/ then select_arr << '--html'
|
606
|
+
ch=ch.gsub(/[h]/,'')
|
607
|
+
end
|
608
|
+
if ch =~/e/ then select_arr << '--epub'
|
609
|
+
ch=ch.gsub(/[e]/,'')
|
610
|
+
end
|
611
|
+
if ch =~/o/ then select_arr << '--odt'
|
612
|
+
ch=ch.gsub(/[o]/,'')
|
613
|
+
end
|
614
|
+
if ch =~/d/ then select_arr << '--docbook'
|
615
|
+
ch=ch.gsub(/[d]/,'')
|
616
|
+
end
|
617
|
+
if ch =~/p/ then select_arr << '--pdf'
|
618
|
+
ch=ch.gsub(/[p]/,'')
|
619
|
+
end
|
620
|
+
if ch =~/w/ then select_arr << '--concordance'
|
621
|
+
ch=ch.gsub(/[w]/,'')
|
622
|
+
end
|
623
|
+
if ch =~/i/ then select_arr << '--manpage'
|
624
|
+
ch=ch.gsub(/[i]/,'')
|
625
|
+
end
|
626
|
+
if ch =~/I/ then select_arr << '--texinfo'
|
627
|
+
ch=ch.gsub(/[I]/,'')
|
628
|
+
end
|
629
|
+
if ch =~/b/ then select_arr << '--xhtml'
|
630
|
+
ch=ch.gsub(/[b]/,'')
|
631
|
+
end
|
632
|
+
if ch =~/x/ then select_arr << '--xml-sax'
|
633
|
+
ch=ch.gsub(/[x]/,'')
|
634
|
+
end
|
635
|
+
if ch =~/X/ then select_arr << '--xml-dom'
|
636
|
+
ch=ch.gsub(/[X]/,'')
|
637
|
+
end
|
638
|
+
if ch =~/j/ then select_arr << '--images'
|
639
|
+
ch=ch.gsub(/[j]/,'')
|
640
|
+
end
|
641
|
+
if ch =~/N/ then select_arr << '--digests'
|
642
|
+
ch=ch.gsub(/[N]/,'')
|
643
|
+
end
|
644
|
+
if ch =~/P/ then select_arr << '--po4a-sst'
|
645
|
+
ch=ch.gsub(/[P]/,'')
|
646
|
+
end
|
647
|
+
if ch =~/d/ then select_arr << '--sqlite'
|
648
|
+
ch=ch.gsub(/[d]/,'')
|
649
|
+
end
|
650
|
+
if ch =~/D/ then select_arr << '--pg'
|
651
|
+
ch=ch.gsub(/[D]/,'')
|
652
|
+
end
|
653
|
+
if ch =~/Q/ then select_arr << '--qrcode'
|
654
|
+
ch=ch.gsub(/[Q]/,'')
|
655
|
+
end
|
656
|
+
if ch =~/s/ then select_arr << '--source'
|
657
|
+
ch=ch.gsub(/[s]/,'')
|
658
|
+
end
|
659
|
+
if ch =~/S/ then select_arr << '--sisupod'
|
660
|
+
ch=ch.gsub(/[S]/,'')
|
661
|
+
end
|
662
|
+
if ch =~/m/ then select_arr << '--manifest'
|
663
|
+
ch=ch.gsub(/[m]/,'')
|
664
|
+
end
|
665
|
+
if ch =~/R/ then select_arr << '--rsync'
|
666
|
+
ch=ch.gsub(/[R]/,'')
|
667
|
+
end
|
668
|
+
if ch =~/r/ then select_arr << '--scp'
|
669
|
+
ch=ch.gsub(/[r]/,'')
|
670
|
+
end
|
671
|
+
if ch =~/g/ then select_arr << '--git'
|
672
|
+
ch=ch.gsub(/[g]/,'')
|
673
|
+
end
|
674
|
+
if ch =~/U/ then select_arr << '--urls'
|
675
|
+
ch=ch.gsub(/[u]/,'')
|
676
|
+
end
|
677
|
+
if ch =~/Z/ then select_arr << '--zap'
|
678
|
+
ch=ch.gsub(/[Z]/,'')
|
679
|
+
end
|
680
|
+
if ch =~/F/ then select_arr << '--sample-search-form'
|
681
|
+
ch=ch.gsub(/[F]/,'')
|
682
|
+
end
|
683
|
+
if ch =~/W/ then select_arr << '--webrick'
|
684
|
+
ch=ch.gsub(/[w]/,'')
|
685
|
+
end
|
686
|
+
if ch =~/M/ then select_arr << '--maintenance'
|
687
|
+
ch=ch.gsub(/[M]/,'')
|
688
|
+
end
|
689
|
+
if ch =~/V/ then select_arr << '--very-verbose'
|
690
|
+
ch=ch.gsub(/[V]/,'')
|
691
|
+
end
|
692
|
+
if ch =~/v/ then select_arr << '--verbose'
|
693
|
+
ch=ch.gsub(/[v]/,'')
|
694
|
+
end
|
695
|
+
if ch =~/q/ then select_arr << '--quiet'
|
696
|
+
ch=ch.gsub(/[q]/,'')
|
697
|
+
end
|
698
|
+
if select_arr.inspect !~/--urls/ \
|
699
|
+
and select_arr.inspect \
|
700
|
+
!~/"--harvest/
|
701
|
+
select_arr << '--urls'
|
702
|
+
end
|
703
|
+
if select_arr.inspect !~/--dal/ \
|
704
|
+
and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
|
705
|
+
select_arr << '--dal'
|
706
|
+
end
|
707
|
+
if select_arr.inspect !~/--manifest/ \
|
708
|
+
and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
|
709
|
+
select_arr << '--manifest'
|
710
|
+
end
|
711
|
+
if select_arr.inspect !~/--images/ \
|
712
|
+
and select_arr.inspect =~/html|odt|docbook|xml|qrcode/
|
713
|
+
select_arr << '--images'
|
714
|
+
end
|
715
|
+
end
|
716
|
+
else
|
717
|
+
if not sel_init.empty? \
|
718
|
+
and sel_init.inspect =~/"--acts?/
|
719
|
+
shortcut.act_info
|
720
|
+
exit
|
721
|
+
end
|
722
|
+
if ch =~/c/ then select_arr << '--color-toggle'
|
723
|
+
ch=ch.gsub(/[c]/,'')
|
724
|
+
end
|
725
|
+
if ch =~/k/ then select_arr << '--color-off'
|
726
|
+
ch=ch.gsub(/[k]/,'')
|
727
|
+
end
|
728
|
+
if ch =~/C/ then select_arr << '--config'
|
729
|
+
ch=ch.gsub(/[C]+/,'')
|
730
|
+
end
|
731
|
+
if sel_init.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"/
|
732
|
+
if ch =~/d/ then select_arr << '--sqlite'
|
733
|
+
ch=ch.gsub(/[d]/,'')
|
734
|
+
end
|
735
|
+
if ch =~/D/ then select_arr << '--pg'
|
736
|
+
ch=ch.gsub(/[D]/,'')
|
737
|
+
end
|
738
|
+
end
|
739
|
+
if ch =~/W/ then select_arr << '--webrick'
|
740
|
+
ch=ch.gsub(/[w]/,'')
|
741
|
+
end
|
742
|
+
if ch =~/v/ then select_arr << '--version'
|
743
|
+
ch=ch.gsub(/[v]/,'')
|
744
|
+
end
|
745
|
+
if ch =~/M/ then select_arr << '--maintenance'
|
746
|
+
ch=ch.gsub(/[M]/,'')
|
747
|
+
end
|
748
|
+
if ch =~/V/ then select_arr << '--very-verbose'
|
749
|
+
ch=ch.gsub(/[V]/,'')
|
750
|
+
end
|
751
|
+
if ch =~/q/ then select_arr << '--quiet'
|
752
|
+
ch=ch.gsub(/[q]/,'')
|
753
|
+
end
|
754
|
+
end
|
755
|
+
select_arr=select_arr.flatten.compact.uniq.sort
|
756
|
+
end
|
757
|
+
def opt_act
|
758
|
+
select_arr=@select_arr
|
759
|
+
@@act=if @@act
|
760
|
+
@act=@@act
|
761
|
+
else
|
762
|
+
act={}
|
763
|
+
act[:no_stop]=if select_arr.inspect \
|
764
|
+
=~/"--no-stop"|"--errors-as-warnings"/
|
765
|
+
{ bool: true, set: :on }
|
766
|
+
else
|
767
|
+
{ bool: false, set: :na }
|
768
|
+
end
|
769
|
+
act[:license]=(select_arr.inspect \
|
770
|
+
=~/"--license/) \
|
771
|
+
? { bool: true, set: :on }
|
772
|
+
: { bool: false, set: :na }
|
773
|
+
act[:site_init]=(select_arr.inspect \
|
774
|
+
=~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \
|
775
|
+
? { bool: true, set: :on }
|
776
|
+
: { bool: false, set: :na }
|
777
|
+
act[:rc]=if select_arr.inspect \
|
778
|
+
=~/"--rc=/
|
779
|
+
x=Dir.pwd + '/' + select_arr.join.gsub(/--rc=/,'')
|
780
|
+
{ bool: true, set: :on, inst: x }
|
781
|
+
else
|
782
|
+
{ bool: false, set: :na, inst: '' }
|
783
|
+
end
|
784
|
+
act[:processing_path]=if select_arr.inspect \
|
785
|
+
=~/"--processing-path=/
|
786
|
+
base_pth=select_arr.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
|
787
|
+
{ bool: true, set: :on, inst: base_pth }
|
788
|
+
elsif select_arr.inspect \
|
789
|
+
=~/"--processing-path/
|
790
|
+
{ bool: true, set: :on, inst: @base_path }
|
791
|
+
else
|
792
|
+
{ bool: false, set: :na, inst: nil }
|
793
|
+
end
|
794
|
+
act[:dump]=if select_arr.inspect \
|
795
|
+
=~/"--dump=/
|
796
|
+
base_pth=select_arr.join(';').
|
797
|
+
gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
|
798
|
+
{ bool: true, set: :on, inst: base_pth }
|
799
|
+
elsif select_arr.inspect =~/"--dump/
|
800
|
+
{ bool: true, set: :on, inst: @base_path }
|
801
|
+
else
|
802
|
+
{ bool: false, set: :na, inst: nil }
|
803
|
+
end
|
804
|
+
act[:redirect]=if select_arr.inspect \
|
805
|
+
=~/"--redirect=/
|
806
|
+
base_pth=select_arr.join(';').
|
807
|
+
gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
|
808
|
+
{ bool: true, set: :on, inst: base_pth }
|
809
|
+
elsif select_arr.inspect \
|
810
|
+
=~/"--redirect/
|
811
|
+
{ bool: true, set: :on, inst: @base_path }
|
812
|
+
else
|
813
|
+
{ bool: false, set: :na, inst: nil }
|
814
|
+
end
|
815
|
+
act[:switch]=if select_arr.inspect \
|
816
|
+
=~/"--switch-off=/
|
817
|
+
off_list=select_arr.join(';').
|
818
|
+
gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
|
819
|
+
off_list=off_list.scan(/[^,;\s]+/)
|
820
|
+
{ bool: false, set: :off, off: off_list}
|
821
|
+
else { bool: true, set: :na, off: [] }
|
822
|
+
end
|
823
|
+
act[:default_language]=if select_arr.inspect \
|
824
|
+
=~/"--(?:default-)?language[-=](\S{2})"/
|
825
|
+
{ set: :on, code: $1 }
|
826
|
+
elsif lng_base
|
827
|
+
{ set: :on, code: lng_base }
|
828
|
+
else { set: :na, code: 'en' }
|
829
|
+
end
|
830
|
+
act[:i18n]=if select_arr.inspect \
|
831
|
+
=~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected
|
832
|
+
@lingual=:mono
|
833
|
+
{ set: :mono }
|
834
|
+
elsif select_arr.inspect \
|
835
|
+
=~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/
|
836
|
+
@lingual=:multi
|
837
|
+
{ set: :multi }
|
838
|
+
else { set: :na }
|
839
|
+
end
|
840
|
+
act[:output_by]=if select_arr.inspect \
|
841
|
+
=~/"--(?:output-)?by-language"/
|
842
|
+
@dir_structure_by=:language
|
843
|
+
{ set: :language }
|
844
|
+
elsif select_arr.inspect \
|
845
|
+
=~/"--(?:output-)?by-filename"/
|
846
|
+
@dir_structure_by=:filename
|
847
|
+
{ set: :filename }
|
848
|
+
elsif select_arr.inspect \
|
849
|
+
=~/"--(?:output-)?by-filetype"/
|
850
|
+
@dir_structure_by=:filetype
|
851
|
+
{ set: :filetype }
|
852
|
+
else { set: :na }
|
853
|
+
end
|
854
|
+
act[:ocn]=if select_arr.inspect \
|
855
|
+
=~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/
|
856
|
+
{ bool: true, set: :on }
|
857
|
+
elsif select_arr.inspect \
|
858
|
+
=~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ \
|
859
|
+
|| act[:switch][:off].inspect =~/"ocn"|"--numbering"/
|
860
|
+
{ bool: false, set: :off }
|
861
|
+
else { bool: true, set: :na }
|
862
|
+
end
|
863
|
+
act[:toc]=if select_arr.inspect \
|
864
|
+
=~/"--inc-toc"/
|
865
|
+
{ bool: true, set: :on }
|
866
|
+
elsif select_arr.inspect \
|
867
|
+
=~/"--(?:exc|no)-toc"/ \
|
868
|
+
|| act[:switch][:off].inspect =~/"toc"/
|
869
|
+
{ bool: false, set: :off }
|
870
|
+
else { bool: true, set: :na }
|
871
|
+
end
|
872
|
+
act[:minitoc]=if select_arr.inspect \
|
873
|
+
=~/"--inc-minitoc"/
|
874
|
+
{ bool: true, set: :on }
|
875
|
+
elsif select_arr.inspect \
|
876
|
+
=~/"--(?:exc|no)-minitoc"/ \
|
877
|
+
|| act[:switch][:off].inspect =~/"minitoc"/
|
878
|
+
{ bool: false, set: :off }
|
879
|
+
else { bool: true, set: :na }
|
880
|
+
end
|
881
|
+
act[:links_to_manifest]=if select_arr.inspect \
|
882
|
+
=~/"--inc-links-to-manifest"|"--inc-manifest-links"/
|
883
|
+
{ bool: true, set: :on }
|
884
|
+
elsif select_arr.inspect \
|
885
|
+
=~/"--(?:exc|no)-manifest"/ \
|
886
|
+
|| act[:switch][:off].inspect =~/"manifest"/ #place lower
|
887
|
+
{ bool: false, set: :off }
|
888
|
+
elsif select_arr.inspect \
|
889
|
+
=~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
|
890
|
+
|| act[:switch][:off].inspect \
|
891
|
+
=~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
|
892
|
+
|| select_arr.inspect \
|
893
|
+
=~/"--(?:redirect|dump)/
|
894
|
+
{ bool: false, set: :off }
|
895
|
+
else { bool: true, set: :na }
|
896
|
+
end
|
897
|
+
act[:manifest_minitoc]=if select_arr.inspect \
|
898
|
+
=~/"--inc-manifest-minitoc"|"--inc-minitoc"/
|
899
|
+
{ bool: true, set: :on }
|
900
|
+
elsif select_arr.inspect \
|
901
|
+
=~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
|
902
|
+
|| act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
|
903
|
+
{ bool: false, set: :off }
|
904
|
+
else { bool: true, set: :na }
|
905
|
+
end
|
906
|
+
act[:metadata]=if select_arr.inspect \
|
907
|
+
=~/"--inc-metadata"/
|
908
|
+
{ bool: true, set: :on }
|
909
|
+
elsif select_arr.inspect \
|
910
|
+
=~/"--(?:exc|no)-metadata"/ \
|
911
|
+
|| act[:switch][:off].inspect =~/"metadata"/
|
912
|
+
{ bool: false, set: :off }
|
913
|
+
else { bool: true, set: :na }
|
914
|
+
end
|
915
|
+
act[:html_minitoc]=if select_arr.inspect \
|
916
|
+
=~/"--inc-html-minitoc"|"--inc-minitoc"/
|
917
|
+
{ bool: true, set: :on }
|
918
|
+
elsif select_arr.inspect \
|
919
|
+
=~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
|
920
|
+
|| act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
|
921
|
+
{ bool: false, set: :off }
|
922
|
+
else { bool: true, set: :na }
|
923
|
+
end
|
924
|
+
act[:html_navigation]=if select_arr.inspect \
|
925
|
+
=~/"--inc-html-navigation"|"--inc-navigation"/
|
926
|
+
{ bool: true, set: :on }
|
927
|
+
elsif select_arr.inspect \
|
928
|
+
=~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
|
929
|
+
|| act[:switch][:off].inspect =~/"html_navigation"|"nav"/
|
930
|
+
{ bool: false, set: :off }
|
931
|
+
else { bool: true, set: :na }
|
932
|
+
end
|
933
|
+
act[:html_navigation_bar]=if select_arr.inspect \
|
934
|
+
=~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
|
935
|
+
{ bool: true, set: :on }
|
936
|
+
elsif select_arr.inspect \
|
937
|
+
=~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
|
938
|
+
|| act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
|
939
|
+
{ bool: false, set: :off }
|
940
|
+
else { bool: false, set: :na }
|
941
|
+
end
|
942
|
+
act[:segsubtoc]=if select_arr.inspect \
|
943
|
+
=~/"--inc-segsubtoc"/
|
944
|
+
{ bool: true, set: :on }
|
945
|
+
elsif select_arr.inspect \
|
946
|
+
=~/"--(?:exc|no)-segsubtoc"/ \
|
947
|
+
|| act[:switch][:off].inspect =~/"segsubtoc"/
|
948
|
+
{ bool: false, set: :off }
|
949
|
+
else { bool: true, set: :na }
|
950
|
+
end
|
951
|
+
act[:search_form]=if select_arr.inspect \
|
952
|
+
=~/"--inc-search-form"/
|
953
|
+
{ bool: true, set: :on }
|
954
|
+
elsif select_arr.inspect \
|
955
|
+
=~/"--(?:exc|no)-search-form"/ \
|
956
|
+
|| act[:switch][:off].inspect =~/"search_form"|"search"/
|
957
|
+
{ bool: false, set: :off }
|
958
|
+
else { bool: true, set: :na }
|
959
|
+
end
|
960
|
+
act[:html_search_form]=if select_arr.inspect \
|
961
|
+
=~/"--inc-html-search-form"|"--inc-search-form"/
|
962
|
+
{ bool: true, set: :on }
|
963
|
+
elsif select_arr.inspect \
|
964
|
+
=~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \
|
965
|
+
|| act[:switch][:off].inspect \
|
966
|
+
=~/"html_search_form"|"search_form"|"search"/
|
967
|
+
{ bool: false, set: :off }
|
968
|
+
else { bool: true, set: :na }
|
969
|
+
end
|
970
|
+
act[:html_right_pane]=if select_arr.inspect \
|
971
|
+
=~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/
|
972
|
+
{ bool: true, set: :on }
|
973
|
+
elsif select_arr.inspect \
|
974
|
+
=~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \
|
975
|
+
|| act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/
|
976
|
+
{ bool: false, set: :off }
|
977
|
+
else { bool: true, set: :na }
|
978
|
+
end
|
979
|
+
act[:html_top_band]=if select_arr.inspect \
|
980
|
+
=~/"--inc-html-top-band"|"--inc-top-band"/
|
981
|
+
{ bool: true, set: :on }
|
982
|
+
elsif select_arr.inspect \
|
983
|
+
=~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
|
984
|
+
|| act[:switch][:off].inspect =~/"html-top-band"|"top-band"/
|
985
|
+
{ bool: false, set: :off }
|
986
|
+
else { bool: true, set: :na }
|
987
|
+
end
|
988
|
+
act[:html]=if select_arr.inspect \
|
989
|
+
=~/"--html-strict"/ \
|
990
|
+
or ((select_arr.inspect \
|
991
|
+
=~/"--html"/) \
|
992
|
+
&& select_arr.inspect \
|
993
|
+
=~/"--strict"/)
|
994
|
+
act[:html_strict]={ bool: true, set: :on }
|
995
|
+
act[:html_scroll]={ bool: true, set: :on }
|
996
|
+
act[:html_seg]={ bool: true, set: :on }
|
997
|
+
{ bool: true, set: :on }
|
998
|
+
elsif (select_arr.inspect \
|
999
|
+
=~/"--html"/)
|
1000
|
+
act[:html_strict]={ bool: false, set: :off }
|
1001
|
+
act[:html_scroll]={ bool: true, set: :on }
|
1002
|
+
act[:html_seg]={ bool: true, set: :on }
|
1003
|
+
{ bool: true, set: :on }
|
1004
|
+
else
|
1005
|
+
act[:html_strict]=(select_arr.inspect \
|
1006
|
+
=~/"--strict"/) \
|
1007
|
+
? { bool: true, set: :on }
|
1008
|
+
: { bool: false, set: :na }
|
1009
|
+
act[:html_scroll]=(select_arr.inspect \
|
1010
|
+
=~/"--html-scroll"/) \
|
1011
|
+
? { bool: true, set: :on }
|
1012
|
+
: { bool: false, set: :na }
|
1013
|
+
act[:html_seg]=(select_arr.inspect \
|
1014
|
+
=~/"--html-seg"/) \
|
1015
|
+
? { bool: true, set: :on }
|
1016
|
+
: { bool: false, set: :na }
|
1017
|
+
{ bool: false, set: :na }
|
1018
|
+
end
|
1019
|
+
act[:concordance]=(select_arr.inspect \
|
1020
|
+
=~/"--concordance"/) \
|
1021
|
+
? { bool: true, set: :on }
|
1022
|
+
: { bool: false, set: :na }
|
1023
|
+
act[:images]=(select_arr.inspect \
|
1024
|
+
=~/"--images"/) \
|
1025
|
+
? { bool: true, set: :on }
|
1026
|
+
: { bool: false, set: :na }
|
1027
|
+
if select_arr.inspect \
|
1028
|
+
=~/"--pdf"/
|
1029
|
+
if select_arr.inspect \
|
1030
|
+
=~/"--portrait"/
|
1031
|
+
act[:pdf]= { bool: false, set: :na }
|
1032
|
+
act[:pdf_l]={ bool: false, set: :na }
|
1033
|
+
act[:pdf_p]={ bool: true, set: :on }
|
1034
|
+
elsif select_arr.inspect \
|
1035
|
+
=~/"--landscape"/
|
1036
|
+
act[:pdf]= { bool: false, set: :na }
|
1037
|
+
act[:pdf_l]={ bool: true, set: :on }
|
1038
|
+
act[:pdf_p]={ bool: false, set: :na }
|
1039
|
+
else
|
1040
|
+
act[:pdf]= { bool: true, set: :on }
|
1041
|
+
act[:pdf_l]={ bool: true, set: :on }
|
1042
|
+
act[:pdf_p]={ bool: true, set: :on }
|
1043
|
+
end
|
1044
|
+
else
|
1045
|
+
act[:pdf]= { bool: false, set: :na }
|
1046
|
+
act[:pdf_p]= { bool: false, set: :na }
|
1047
|
+
act[:pdf_l]= { bool: false, set: :na }
|
1048
|
+
act[:pdf_a4]= { bool: false, set: :na }
|
1049
|
+
act[:pdf_a5]= { bool: false, set: :na }
|
1050
|
+
act[:pdf_b5]= { bool: false, set: :na }
|
1051
|
+
act[:pdf_letter]={ bool: false, set: :na }
|
1052
|
+
act[:pdf_legal]= { bool: false, set: :na }
|
1053
|
+
end
|
1054
|
+
if act[:pdf][:set]==:on \
|
1055
|
+
or act[:pdf_p][:set]==:on \
|
1056
|
+
or act[:pdf_l][:set]==:on
|
1057
|
+
act[:pdf_a4]=if select_arr.inspect \
|
1058
|
+
=~/"--a4"|--papersize-a4"/ \
|
1059
|
+
or select_arr.inspect \
|
1060
|
+
=~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5
|
1061
|
+
{ bool: true, set: :on }
|
1062
|
+
else
|
1063
|
+
{ bool: false, set: :na }
|
1064
|
+
end
|
1065
|
+
act[:pdf_a5]=if select_arr.inspect \
|
1066
|
+
=~/"--a5"|"--papersize-a5"/ \
|
1067
|
+
or select_arr.inspect \
|
1068
|
+
=~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5
|
1069
|
+
{ bool: true, set: :on }
|
1070
|
+
else
|
1071
|
+
{ bool: false, set: :na }
|
1072
|
+
end
|
1073
|
+
act[:pdf_b5]=if select_arr.inspect \
|
1074
|
+
=~/"--b5"|"--papersize-b5"/ \
|
1075
|
+
or select_arr.inspect \
|
1076
|
+
=~/"--papersize=\S*b5\b\S*"/
|
1077
|
+
{ bool: true, set: :on }
|
1078
|
+
else
|
1079
|
+
{ bool: false, set: :na }
|
1080
|
+
end
|
1081
|
+
act[:pdf_letter]=if select_arr.inspect \
|
1082
|
+
=~/"--letter"|"--papersize-letter"/ \
|
1083
|
+
or select_arr.inspect \
|
1084
|
+
=~/"--papersize=\S*letter\b\S*"/
|
1085
|
+
{ bool: true, set: :on }
|
1086
|
+
else
|
1087
|
+
{ bool: false, set: :na }
|
1088
|
+
end
|
1089
|
+
act[:pdf_legal]=if select_arr.inspect \
|
1090
|
+
=~/"--legal"|"--papersize-legal"/ \
|
1091
|
+
or select_arr.inspect \
|
1092
|
+
=~/"--papersize=\S*legal\b\S*"/
|
1093
|
+
{ bool: true, set: :on }
|
1094
|
+
else
|
1095
|
+
{ bool: false, set: :na }
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
act[:epub]=(select_arr.inspect \
|
1099
|
+
=~/"--epub"/) \
|
1100
|
+
? { bool: true, set: :on }
|
1101
|
+
: { bool: false, set: :na }
|
1102
|
+
act[:odt]=if select_arr.inspect \
|
1103
|
+
=~/"--odt"|"--odf"|"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/
|
1104
|
+
act[:odt_ocn]=if (select_arr.inspect \
|
1105
|
+
=~/"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ \
|
1106
|
+
or select_arr.inspect \
|
1107
|
+
=~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
|
1108
|
+
{ bool: true, set: :on }
|
1109
|
+
elsif select_arr.inspect \
|
1110
|
+
=~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
|
1111
|
+
{ bool: false, set: :off }
|
1112
|
+
else
|
1113
|
+
{ bool: false, set: :na }
|
1114
|
+
end
|
1115
|
+
{ bool: true, set: :on }
|
1116
|
+
else
|
1117
|
+
{ bool: false, set: :na }
|
1118
|
+
end
|
1119
|
+
act[:xml_sax]=(select_arr.inspect \
|
1120
|
+
=~/"--xml-sax"|"--sax"/) \
|
1121
|
+
? { bool: true, set: :on }
|
1122
|
+
: { bool: false, set: :na }
|
1123
|
+
act[:xml_dom]=(select_arr.inspect \
|
1124
|
+
=~/"--xml-dom"|"--dom"/) \
|
1125
|
+
? { bool: true, set: :on }
|
1126
|
+
: { bool: false, set: :na }
|
1127
|
+
act[:xml_docbook_book]=(select_arr.inspect \
|
1128
|
+
=~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
|
1129
|
+
? { bool: true, set: :on }
|
1130
|
+
: { bool: false, set: :na }
|
1131
|
+
act[:xml_fictionbook]=(select_arr.inspect \
|
1132
|
+
=~/"--fictionbook"|"--xml-fictionbook"/) \
|
1133
|
+
? { bool: true, set: :on }
|
1134
|
+
: { bool: false, set: :na }
|
1135
|
+
act[:xml_scaffold_structure_sisu]=select_arr.inspect \
|
1136
|
+
=~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \
|
1137
|
+
? { bool: true, set: :on }
|
1138
|
+
: { bool: false, set: :na }
|
1139
|
+
act[:xml_scaffold_structure_collapse]=select_arr.inspect \
|
1140
|
+
=~/"--xml-scaffold-collapse"/ \
|
1141
|
+
? { bool: true, set: :on }
|
1142
|
+
: { bool: false, set: :na }
|
1143
|
+
act[:xhtml]=(select_arr.inspect \
|
1144
|
+
=~/"--xhtml"/) \
|
1145
|
+
? { bool: true, set: :on }
|
1146
|
+
: { bool: false, set: :na }
|
1147
|
+
act[:txt]=if select_arr.inspect \
|
1148
|
+
=~/"--txt"|"--text"|"--plaintext"|"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/
|
1149
|
+
act[:txt_ocn]=if (select_arr.inspect \
|
1150
|
+
=~/"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ \
|
1151
|
+
or select_arr.inspect \
|
1152
|
+
=~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
|
1153
|
+
{ bool: true, set: :on }
|
1154
|
+
elsif select_arr.inspect \
|
1155
|
+
=~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
|
1156
|
+
{ bool: false, set: :off }
|
1157
|
+
else
|
1158
|
+
{ bool: false, set: :na }
|
1159
|
+
end
|
1160
|
+
{ bool: true, set: :on }
|
1161
|
+
else
|
1162
|
+
{ bool: false, set: :na }
|
1163
|
+
end
|
1164
|
+
act[:txt_textile]=(select_arr.inspect \
|
1165
|
+
=~/"--textile"/) \
|
1166
|
+
? { bool: true, set: :on }
|
1167
|
+
: { bool: false, set: :na }
|
1168
|
+
act[:txt_asciidoc]=(select_arr.inspect \
|
1169
|
+
=~/"--asciidoc"/) \
|
1170
|
+
? { bool: true, set: :on }
|
1171
|
+
: { bool: false, set: :na }
|
1172
|
+
act[:txt_markdown]=(select_arr.inspect \
|
1173
|
+
=~/"--markdown"/) \
|
1174
|
+
? { bool: true, set: :on }
|
1175
|
+
: { bool: false, set: :na }
|
1176
|
+
act[:txt_rst]=(select_arr.inspect \
|
1177
|
+
=~/"--rst"|"--rest"|"--restructuredtext"/) \
|
1178
|
+
? { bool: true, set: :on }
|
1179
|
+
: { bool: false, set: :na }
|
1180
|
+
act[:txt_orgmode]=(select_arr.inspect \
|
1181
|
+
=~/"--org"|"--orgmode"/) \
|
1182
|
+
? { bool: true, set: :on }
|
1183
|
+
: { bool: false, set: :na }
|
1184
|
+
act[:manpage]=(select_arr.inspect \
|
1185
|
+
=~/"--manpage"|"--man"/) \
|
1186
|
+
? { bool: true, set: :on }
|
1187
|
+
: { bool: false, set: :na }
|
1188
|
+
act[:texinfo]=(select_arr.inspect \
|
1189
|
+
=~/"--texinfo"/) \
|
1190
|
+
? { bool: true, set: :on }
|
1191
|
+
: { bool: false, set: :na }
|
1192
|
+
act[:psql]=if select_arr.inspect \
|
1193
|
+
=~/"--pg-\S+"/ \
|
1194
|
+
or ((select_arr.inspect =~/"--pg"/) \
|
1195
|
+
&& (select_arr.inspect \
|
1196
|
+
=~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
|
1197
|
+
act[:psql_createdb]=if select_arr.inspect \
|
1198
|
+
=~/"--pg-createdb"|"--createdb"/
|
1199
|
+
{ bool: true, set: :on }
|
1200
|
+
else
|
1201
|
+
{ bool: false, set: :na }
|
1202
|
+
end
|
1203
|
+
if select_arr.inspect \
|
1204
|
+
=~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/
|
1205
|
+
act[:psql_drop]={ bool: true, set: :on }
|
1206
|
+
act[:psql_create]={ bool: true, set: :on }
|
1207
|
+
else
|
1208
|
+
act[:psql_drop]=if select_arr.inspect \
|
1209
|
+
=~/"--pg-dropall"|"--dropall"/
|
1210
|
+
{ bool: true, set: :on }
|
1211
|
+
else
|
1212
|
+
{ bool: false, set: :na }
|
1213
|
+
end
|
1214
|
+
act[:psql_create]=if select_arr.inspect \
|
1215
|
+
=~/"--pg-create(?:all)?"|"--create(?:all)?"/
|
1216
|
+
{ bool: true, set: :on }
|
1217
|
+
else
|
1218
|
+
{ bool: false, set: :na }
|
1219
|
+
end
|
1220
|
+
end
|
1221
|
+
act[:psql_import]=if select_arr.inspect \
|
1222
|
+
=~/"--pg-import"|"--import"/
|
1223
|
+
{ bool: true, set: :on }
|
1224
|
+
else
|
1225
|
+
{ bool: false, set: :na }
|
1226
|
+
end
|
1227
|
+
act[:psql_update]=if select_arr.inspect \
|
1228
|
+
=~/"--pg-update"|"--update"/
|
1229
|
+
act[:psql_remove]={ bool: true, set: :on }
|
1230
|
+
{ bool: true, set: :on }
|
1231
|
+
else
|
1232
|
+
act[:psql_remove]=if select_arr.inspect \
|
1233
|
+
=~/"--pg-remove"|"--remove"/
|
1234
|
+
{ bool: true, set: :on }
|
1235
|
+
else
|
1236
|
+
{ bool: false, set: :na }
|
1237
|
+
end
|
1238
|
+
{ bool: false, set: :na }
|
1239
|
+
end
|
1240
|
+
{ bool: true, set: :on }
|
1241
|
+
else
|
1242
|
+
act[:psql_createdb]=
|
1243
|
+
{ bool: false, set: :na }
|
1244
|
+
act[:psql_drop]=
|
1245
|
+
{ bool: false, set: :na }
|
1246
|
+
act[:psql_create]=
|
1247
|
+
{ bool: false, set: :na }
|
1248
|
+
act[:psql_import]=
|
1249
|
+
{ bool: false, set: :na }
|
1250
|
+
act[:psql_update]=
|
1251
|
+
{ bool: false, set: :na }
|
1252
|
+
act[:psql_remove]=
|
1253
|
+
{ bool: false, set: :na }
|
1254
|
+
{ bool: false, set: :na }
|
1255
|
+
end
|
1256
|
+
act[:sqlite]=if select_arr.inspect \
|
1257
|
+
=~/"--sqlite-\S+"/ \
|
1258
|
+
or (select_arr.inspect \
|
1259
|
+
=~/"--sqlite"/ \
|
1260
|
+
&& select_arr.inspect \
|
1261
|
+
=~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)
|
1262
|
+
act[:sqlite_createdb]=if select_arr.inspect \
|
1263
|
+
=~/"--sqlite-createdb"|"--createdb"/
|
1264
|
+
{ bool: true, set: :on }
|
1265
|
+
else
|
1266
|
+
{ bool: false, set: :na }
|
1267
|
+
end
|
1268
|
+
if select_arr.inspect \
|
1269
|
+
=~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/
|
1270
|
+
act[:sqlite_drop]={ bool: true, set: :on }
|
1271
|
+
act[:sqlite_create]={ bool: true, set: :on }
|
1272
|
+
else
|
1273
|
+
act[:sqlite_create]=if select_arr.inspect \
|
1274
|
+
=~/"--sqlite-create(?:all)?"|"--create(?:all)?"/
|
1275
|
+
{ bool: true, set: :on }
|
1276
|
+
else
|
1277
|
+
{ bool: false, set: :na }
|
1278
|
+
end
|
1279
|
+
act[:sqlite_drop]=if select_arr.inspect \
|
1280
|
+
=~/"--sqlite-dropall"|"--dropall"/
|
1281
|
+
{ bool: true, set: :on }
|
1282
|
+
else
|
1283
|
+
{ bool: false, set: :na }
|
1284
|
+
end
|
1285
|
+
end
|
1286
|
+
act[:sqlite_import]=if select_arr.inspect \
|
1287
|
+
=~/"--sqlite-import"|"--import"/
|
1288
|
+
{ bool: true, set: :on }
|
1289
|
+
else
|
1290
|
+
{ bool: false, set: :na }
|
1291
|
+
end
|
1292
|
+
act[:sqlite_update]=if select_arr.inspect \
|
1293
|
+
=~/"--sqlite-update"|"--update"/
|
1294
|
+
act[:sqlite_remove]={ bool: true, set: :on }
|
1295
|
+
{ bool: true, set: :on }
|
1296
|
+
else
|
1297
|
+
act[:sqlite_remove]=if select_arr.inspect \
|
1298
|
+
=~/"--sqlite-remove"|"--sqlite-remove"/
|
1299
|
+
{ bool: true, set: :on }
|
1300
|
+
else
|
1301
|
+
{ bool: false, set: :na }
|
1302
|
+
end
|
1303
|
+
{ bool: false, set: :na }
|
1304
|
+
end
|
1305
|
+
{ bool: true, set: :on }
|
1306
|
+
else
|
1307
|
+
act[:sqlite_createdb]=
|
1308
|
+
{ bool: false, set: :na }
|
1309
|
+
act[:sqlite_drop]=
|
1310
|
+
{ bool: false, set: :na }
|
1311
|
+
act[:sqlite_create]=
|
1312
|
+
{ bool: false, set: :na }
|
1313
|
+
act[:sqlite_import]=
|
1314
|
+
{ bool: false, set: :na }
|
1315
|
+
act[:sqlite_update]=
|
1316
|
+
{ bool: false, set: :na }
|
1317
|
+
act[:sqlite_remove]=
|
1318
|
+
{ bool: false, set: :na }
|
1319
|
+
{ bool: false, set: :na }
|
1320
|
+
end
|
1321
|
+
act[:sqlite_discrete]=select_arr.inspect \
|
1322
|
+
=~/"--sql"|"--sqlite"/ \
|
1323
|
+
&& (select_arr.inspect \
|
1324
|
+
!~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
|
1325
|
+
? { bool: true, set: :on }
|
1326
|
+
: { bool: false, set: :na }
|
1327
|
+
act[:harvest]=(select_arr.inspect \
|
1328
|
+
=~/"--harvest"/) \
|
1329
|
+
? { bool: true, set: :on }
|
1330
|
+
: { bool: false, set: :na }
|
1331
|
+
act[:po4a_sstm]=(select_arr.inspect \
|
1332
|
+
=~/"--po4a-ss[tm]"/) \
|
1333
|
+
? { bool: true, set: :on }
|
1334
|
+
: { bool: false, set: :na }
|
1335
|
+
act[:po4a_sst_ao_sst]=(select_arr.inspect \
|
1336
|
+
=~/"--po4a-ao(?:-ss[tm])?"/) \
|
1337
|
+
? { bool: true, set: :on }
|
1338
|
+
: { bool: false, set: :na }
|
1339
|
+
act[:po4a_shelf]=(select_arr.inspect \
|
1340
|
+
=~/"--po4a-shelf"|"--pot?-shelf"/) \
|
1341
|
+
? { bool: true, set: :on }
|
1342
|
+
: { bool: false, set: :na }
|
1343
|
+
if act[:po4a_shelf][:set]==:on \
|
1344
|
+
or act[:po4a_sst_ao_sst][:set]==:on \
|
1345
|
+
or act[:po4a_sstm][:set]==:on
|
1346
|
+
act[:po4a_lang]=if select_arr.inspect \
|
1347
|
+
=~/"--(?:trans|init)-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
|
1348
|
+
lng_src,lng_trn=$1,$2.split(',')
|
1349
|
+
{ bool: true, set: :on, src: lng_src, trn: lng_trn }
|
1350
|
+
elsif select_arr.inspect \
|
1351
|
+
=~/"--trans"/
|
1352
|
+
{ bool: true, set: :on }
|
1353
|
+
{ bool: true, set: :on, src: 'en', trn: [] }
|
1354
|
+
else
|
1355
|
+
{ bool: false, set: :na }
|
1356
|
+
end
|
1357
|
+
act[:po4a_lang_trans]=if select_arr.inspect \
|
1358
|
+
=~/"--trans-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
|
1359
|
+
lng_src,lng_trn=$1,$2.split(',')
|
1360
|
+
{ bool: true, set: :on, src: lng_src, trn: lng_trn }
|
1361
|
+
elsif select_arr.inspect \
|
1362
|
+
=~/"--trans"/
|
1363
|
+
{ bool: true, set: :on }
|
1364
|
+
{ bool: true, set: :on, src: 'en', trn: [] }
|
1365
|
+
else
|
1366
|
+
{ bool: false, set: :na }
|
1367
|
+
end
|
1368
|
+
act[:po4a_lang_init]=if select_arr.inspect \
|
1369
|
+
=~/"--init-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
|
1370
|
+
lng_src,lng_trn=$1,$2.split(',')
|
1371
|
+
{ bool: true, set: :on, src: lng_src, trn: lng_trn }
|
1372
|
+
else
|
1373
|
+
{ bool: false, set: :na }
|
1374
|
+
end
|
1375
|
+
else
|
1376
|
+
act[:po4a_lang_trans]= \
|
1377
|
+
{ bool: false, set: :na }
|
1378
|
+
act[:po4a_lang_init]= \
|
1379
|
+
{ bool: false, set: :na }
|
1380
|
+
end
|
1381
|
+
act[:git]=(select_arr.inspect \
|
1382
|
+
=~/"--git"/) \
|
1383
|
+
? { bool: true, set: :on }
|
1384
|
+
: { bool: false, set: :na }
|
1385
|
+
act[:hash_digests]=(select_arr.inspect \
|
1386
|
+
=~/"--digests?"|"--hash-digests"/) \
|
1387
|
+
? { bool: true, set: :on }
|
1388
|
+
: { bool: false, set: :na }
|
1389
|
+
act[:pdf_font_size]=if select_arr.inspect \
|
1390
|
+
=~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/
|
1391
|
+
$1
|
1392
|
+
else :na
|
1393
|
+
end
|
1394
|
+
act[:pdf_hyperlink_colors]=if select_arr.inspect \
|
1395
|
+
=~/"--pdf-hyperlinks-(?:mono(?:chrome)?|no-color)"/
|
1396
|
+
:mono
|
1397
|
+
elsif select_arr.inspect \
|
1398
|
+
=~/"--pdf-hyperlinks-color"/
|
1399
|
+
:color
|
1400
|
+
else :na
|
1401
|
+
end
|
1402
|
+
act[:hash_digest_algo]=if select_arr.inspect \
|
1403
|
+
=~/"--hash-(?:sha)?512"/
|
1404
|
+
:sha512
|
1405
|
+
elsif select_arr.inspect \
|
1406
|
+
=~/"--hash-(?:sha)?256"/
|
1407
|
+
:sha256
|
1408
|
+
elsif select_arr.inspect \
|
1409
|
+
=~/"--hash-md5"/
|
1410
|
+
:md5
|
1411
|
+
else :na
|
1412
|
+
end
|
1413
|
+
act[:sample_search_form]=if select_arr.inspect \
|
1414
|
+
=~/"--sample-search-form"/
|
1415
|
+
if select_arr.inspect \
|
1416
|
+
=~/"--db[-=]pg"/
|
1417
|
+
{ bool: true, set: :on, db: :pg }
|
1418
|
+
elsif select_arr.inspect \
|
1419
|
+
=~/"--db[-=]sqlite"/
|
1420
|
+
{ bool: true, set: :on, db: :sqlite }
|
1421
|
+
else
|
1422
|
+
{ bool: true, set: :on, db: :na }
|
1423
|
+
end
|
1424
|
+
else
|
1425
|
+
{ bool: false, set: :na, db: :na }
|
1426
|
+
end
|
1427
|
+
act[:webrick]=select_arr.inspect \
|
1428
|
+
=~/"--webrick"/ \
|
1429
|
+
? { bool: true, set: :on }
|
1430
|
+
: { bool: false, set: :na }
|
1431
|
+
act[:share_source]=select_arr.inspect \
|
1432
|
+
=~/"--source"/ \
|
1433
|
+
? { bool: true, set: :on }
|
1434
|
+
: { bool: false, set: :na }
|
1435
|
+
act[:sisupod]=select_arr.inspect \
|
1436
|
+
=~/"--sisupod"/ \
|
1437
|
+
? { bool: true, set: :on }
|
1438
|
+
: { bool: false, set: :na }
|
1439
|
+
act[:scp]=select_arr.inspect \
|
1440
|
+
=~/"--scp"/ \
|
1441
|
+
? { bool: true, set: :on }
|
1442
|
+
: { bool: false, set: :na }
|
1443
|
+
act[:rsync]=select_arr.inspect \
|
1444
|
+
=~/"--rsync"|"--remote"/ \
|
1445
|
+
? { bool: true, set: :on }
|
1446
|
+
: { bool: false, set: :na }
|
1447
|
+
act[:zap]=select_arr.inspect \
|
1448
|
+
=~/"--zap"|"--delete"/ \
|
1449
|
+
? { bool: true, set: :on }
|
1450
|
+
: { bool: false, set: :na }
|
1451
|
+
act[:urls_all]=select_arr.inspect \
|
1452
|
+
=~/"--urls-all"/ \
|
1453
|
+
? { bool: true, set: :on }
|
1454
|
+
: { bool: false, set: :na }
|
1455
|
+
act[:urls_selected]=if select_arr.inspect \
|
1456
|
+
=~/"--urls"/
|
1457
|
+
{ bool: true, set: :on }
|
1458
|
+
elsif select_arr.inspect \
|
1459
|
+
=~/"--harvest/
|
1460
|
+
{ bool: false, set: :off }
|
1461
|
+
elsif select_arr.inspect \
|
1462
|
+
=~/"--verbose"|"--maintenance"/
|
1463
|
+
{ bool: true, set: :on }
|
1464
|
+
else
|
1465
|
+
{ bool: false, set: :na }
|
1466
|
+
end
|
1467
|
+
act[:sitemap]=select_arr.inspect \
|
1468
|
+
=~/"--sitemap"/ \
|
1469
|
+
? { bool: true, set: :on }
|
1470
|
+
: { bool: false, set: :na }
|
1471
|
+
act[:qrcode]=select_arr.inspect \
|
1472
|
+
=~/"--qrcode"/ \
|
1473
|
+
? { bool: true, set: :on }
|
1474
|
+
: { bool: false, set: :na }
|
1475
|
+
act[:help]=select_arr.inspect \
|
1476
|
+
=~/"--help/ \
|
1477
|
+
? { bool: true, set: :on }
|
1478
|
+
: { bool: false, set: :na }
|
1479
|
+
act[:ao]=if select_arr.inspect \
|
1480
|
+
=~/"--ao"|"--dal"/
|
1481
|
+
{ bool: true, set: :on }
|
1482
|
+
elsif (act[:txt][:set]==:on \
|
1483
|
+
|| act[:txt_textile][:set]==:on \
|
1484
|
+
|| act[:txt_asciidoc][:set]==:on \
|
1485
|
+
|| act[:txt_markdown][:set]==:on \
|
1486
|
+
|| act[:txt_rst][:set]==:on \
|
1487
|
+
|| act[:txt_orgmode][:set]==:on \
|
1488
|
+
|| act[:xhtml][:set]==:on \
|
1489
|
+
|| act[:epub][:set]==:on \
|
1490
|
+
|| act[:html][:set]==:on \
|
1491
|
+
|| act[:html_seg][:set]==:on \
|
1492
|
+
|| act[:html_scroll][:set]==:on \
|
1493
|
+
|| act[:texinfo][:set]==:on \
|
1494
|
+
|| act[:manpage][:set]==:on \
|
1495
|
+
|| act[:hash_digests][:set]==:on \
|
1496
|
+
|| act[:odt][:set]==:on \
|
1497
|
+
|| act[:pdf][:set]==:on \
|
1498
|
+
|| act[:pdf_p][:set]==:on \
|
1499
|
+
|| act[:pdf_l][:set]==:on \
|
1500
|
+
|| act[:qrcode][:set]==:on \
|
1501
|
+
|| act[:sisupod][:set]==:on \
|
1502
|
+
|| act[:share_source][:set]==:on \
|
1503
|
+
|| act[:po4a_sstm][:set]==:on \
|
1504
|
+
|| act[:concordance][:set]==:on \
|
1505
|
+
|| act[:sqlite_discrete][:set]==:on \
|
1506
|
+
|| act[:sqlite_import][:set]==:on \
|
1507
|
+
|| act[:sqlite_update][:set]==:on \
|
1508
|
+
|| act[:sqlite_remove][:set]==:on \
|
1509
|
+
|| act[:psql_import][:set]==:on \
|
1510
|
+
|| act[:psql_update][:set]==:on \
|
1511
|
+
|| act[:psql_remove][:set]==:on \
|
1512
|
+
|| act[:xml_dom][:set]==:on \
|
1513
|
+
|| act[:xml_sax][:set]==:on \
|
1514
|
+
|| act[:xml_docbook_book][:set]==:on \
|
1515
|
+
|| act[:xml_fictionbook][:set]==:on \
|
1516
|
+
|| act[:xml_scaffold_structure_sisu][:set]==:on \
|
1517
|
+
|| act[:xml_scaffold_structure_collapse][:set]==:on )
|
1518
|
+
{ bool: true, set: :on }
|
1519
|
+
else
|
1520
|
+
{ bool: false, set: :na }
|
1521
|
+
end
|
1522
|
+
act[:manifest]=if select_arr.inspect \
|
1523
|
+
=~/"--inc-manifest"/
|
1524
|
+
{ bool: true, set: :on }
|
1525
|
+
elsif select_arr.inspect \
|
1526
|
+
=~/"--(?:exc|no)-manifest"/ \
|
1527
|
+
|| act[:switch][:off].inspect =~/"manifest"/
|
1528
|
+
{ bool: false, set: :off }
|
1529
|
+
elsif select_arr.inspect \
|
1530
|
+
=~/"--manifest"/
|
1531
|
+
{ bool: true, set: :on }
|
1532
|
+
elsif (act[:txt][:set]==:on \
|
1533
|
+
|| act[:txt_textile][:set]==:on \
|
1534
|
+
|| act[:txt_asciidoc][:set]==:on \
|
1535
|
+
|| act[:txt_markdown][:set]==:on \
|
1536
|
+
|| act[:txt_rst][:set]==:on \
|
1537
|
+
|| act[:txt_orgmode][:set]==:on \
|
1538
|
+
|| act[:xhtml][:set]==:on \
|
1539
|
+
|| act[:epub][:set]==:on \
|
1540
|
+
|| act[:html][:set]==:on \
|
1541
|
+
|| act[:html_seg][:set]==:on \
|
1542
|
+
|| act[:html_scroll][:set]==:on \
|
1543
|
+
|| act[:texinfo][:set]==:on \
|
1544
|
+
|| act[:manpage][:set]==:on \
|
1545
|
+
|| act[:hash_digests][:set]==:on \
|
1546
|
+
|| act[:odt][:set]==:on \
|
1547
|
+
|| act[:pdf][:set]==:on \
|
1548
|
+
|| act[:pdf_p][:set]==:on \
|
1549
|
+
|| act[:pdf_l][:set]==:on \
|
1550
|
+
|| act[:qrcode][:set]==:on \
|
1551
|
+
|| act[:sisupod][:set]==:on \
|
1552
|
+
|| act[:share_source][:set]==:on \
|
1553
|
+
|| act[:po4a_sstm][:set]==:on \
|
1554
|
+
|| act[:concordance][:set]==:on \
|
1555
|
+
|| act[:xml_dom][:set]==:on \
|
1556
|
+
|| act[:xml_sax][:set]==:on \
|
1557
|
+
|| act[:xml_docbook_book][:set]==:on \
|
1558
|
+
|| act[:xml_fictionbook][:set]==:on \
|
1559
|
+
|| act[:xml_scaffold_structure_sisu][:set]==:on \
|
1560
|
+
|| act[:xml_scaffold_structure_collapse][:set]==:on )
|
1561
|
+
{ bool: true, set: :on }
|
1562
|
+
else { bool: true, set: :na }
|
1563
|
+
end
|
1564
|
+
act[:console_messages] = ''
|
1565
|
+
act[:verbose]=if select_arr.inspect \
|
1566
|
+
=~/"--verbose"/
|
1567
|
+
act[:console_messages] << ' --verbose '
|
1568
|
+
{ bool: true, set: :on }
|
1569
|
+
else
|
1570
|
+
{ bool: false, set: :na }
|
1571
|
+
end
|
1572
|
+
act[:verbose_plus]=if select_arr.inspect \
|
1573
|
+
=~/"--very-verbose"|"--verbose-very"/
|
1574
|
+
act[:console_messages] << ' --very-verbose '
|
1575
|
+
{ bool: true, set: :on }
|
1576
|
+
else
|
1577
|
+
{ bool: false, set: :na }
|
1578
|
+
end
|
1579
|
+
act[:version_info]=if select_arr.inspect \
|
1580
|
+
=~/"--version"|"--verbose"|"--maintenance"/
|
1581
|
+
act[:console_messages] << ' --maintenance '
|
1582
|
+
{ bool: true, set: :on }
|
1583
|
+
else
|
1584
|
+
{ bool: false, set: :na }
|
1585
|
+
end
|
1586
|
+
act[:quiet]=if (select_arr.inspect =~/"--quiet"/)
|
1587
|
+
act[:console_messages] << ' --quiet '
|
1588
|
+
{ bool: true, set: :on }
|
1589
|
+
else
|
1590
|
+
{ bool: false, set: :na }
|
1591
|
+
end
|
1592
|
+
act[:color_state]=if select_arr.inspect =~/"--color-on"|"--color"/
|
1593
|
+
act[:console_messages] << ' --color-on '
|
1594
|
+
{ bool: true, set: :on }
|
1595
|
+
elsif (select_arr.inspect =~/"--color-off"/)
|
1596
|
+
act[:console_messages] << ' --color-off '
|
1597
|
+
{ bool: false, set: :off }
|
1598
|
+
else { bool: true, set: :na } #fix default color
|
1599
|
+
end
|
1600
|
+
# act[:color_toggle]=if select_arr.inspect =~/"--color-toggle"/
|
1601
|
+
# true
|
1602
|
+
# else false
|
1603
|
+
# end
|
1604
|
+
act[:maintenance]=if (select_arr.inspect =~/"--maintenance|--keep-processing-files"/)
|
1605
|
+
act[:console_messages] << ' --maintenance '
|
1606
|
+
{ bool: true, set: :on }
|
1607
|
+
else
|
1608
|
+
{ bool: false, set: :na }
|
1609
|
+
end
|
1610
|
+
act[:profile]=if (select_arr.inspect =~/"--profile"/)
|
1611
|
+
act[:console_messages] << ' --color-off '
|
1612
|
+
{ bool: true, set: :on }
|
1613
|
+
else
|
1614
|
+
{ bool: false, set: :na }
|
1615
|
+
end
|
1616
|
+
@act=act
|
1617
|
+
end
|
1618
|
+
end
|
1619
|
+
def opt_ch
|
1620
|
+
@opt_ch
|
1621
|
+
end
|
1622
|
+
def selections
|
1623
|
+
def arr
|
1624
|
+
@select_arr.sort
|
1625
|
+
end
|
1626
|
+
def str
|
1627
|
+
@select_str ||= arr.join(' ')
|
1628
|
+
end
|
1629
|
+
self
|
1630
|
+
end
|
1631
|
+
def act
|
1632
|
+
@@act
|
1633
|
+
end
|
1634
|
+
def files_mod
|
1635
|
+
files_mod=files
|
1636
|
+
@files_mod=files_mod
|
1637
|
+
end
|
1638
|
+
def files
|
1639
|
+
@files
|
1640
|
+
end
|
1641
|
+
def f_pth
|
1642
|
+
@f_pth
|
1643
|
+
end
|
1644
|
+
def pth
|
1645
|
+
@pth
|
1646
|
+
end
|
1647
|
+
def sub_location
|
1648
|
+
pth.gsub(/#{base_path}/,'')
|
1649
|
+
end
|
1650
|
+
def lng
|
1651
|
+
@lng
|
1652
|
+
end
|
1653
|
+
def lng_base
|
1654
|
+
@lng_base
|
1655
|
+
end
|
1656
|
+
def fno
|
1657
|
+
@fno=(fns.nil? || fns.empty?) \
|
1658
|
+
? '' \
|
1659
|
+
: (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1])
|
1660
|
+
end
|
1661
|
+
def fng
|
1662
|
+
@fng=(fno.nil? || fno.empty?) \
|
1663
|
+
? '' \
|
1664
|
+
: (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1'))
|
1665
|
+
end
|
1666
|
+
def fns
|
1667
|
+
@fns
|
1668
|
+
end
|
1669
|
+
def fnl
|
1670
|
+
@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2")
|
1671
|
+
end
|
1672
|
+
def what
|
1673
|
+
@what
|
1674
|
+
end
|
1675
|
+
def fnb
|
1676
|
+
(fns.nil? || fns.empty?) \
|
1677
|
+
? '' \
|
1678
|
+
: (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1])
|
1679
|
+
end
|
1680
|
+
def fnc
|
1681
|
+
@fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \
|
1682
|
+
? fnb + '.ssm.sst'
|
1683
|
+
: @fns
|
1684
|
+
end
|
1685
|
+
def fncb
|
1686
|
+
@fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \
|
1687
|
+
? fnb + '.ssm.sst'
|
1688
|
+
: @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
|
1689
|
+
end
|
1690
|
+
end
|
1691
|
+
end
|
1692
|
+
__END__
|
1693
|
+
note usually named @opt is carried in dp document parameters (usually as @md.opt), @opt is a
|
1694
|
+
subset of @md where @md is passed, contents of @opt are available as @md.opt
|
1695
|
+
passing @opt as well is duplication check for fns & fnb
|