1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
# encoding: utf-8
=begin
* Name: SiSU
* Description: a framework for document structuring, publishing and search
* Author: Ralph Amissah
* Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah,
All Rights Reserved.
* License: GPL 3 or later:
SiSU, a framework for document structuring, publishing and search
Copyright (C) Ralph Amissah
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
If you have Internet connection, the latest version of the GPL should be
available at these locations:
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
* Hompages:
<http://www.jus.uio.no/sisu>
<http://www.sisudoc.org>
* Download:
<http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
<http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_filemap.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
** Description: system environment, resource control and configuration details
=end
module SiSU_File_Map
require_relative 'constants' # constants.rb
require_relative 'utils' # utils.rb
require_relative 'se_info_env' # se_info_env.rb
class FileMap < SiSU_Info_Env::InfoEnv # se_info_env.rb
attr_accessor :local_sisu_source
def initialize(opt='') #watch / REVIEW
super()
@opt=opt #,opt.fns,opt.selections.str
@env=(@opt.fns && !(@opt.fns.empty?) \
? (SiSU_Env::InfoEnv.new(@opt.fns))
: (SiSU_Env::InfoEnv.new('dummy.sst')))
ft=[]
if @opt.act[:ao][:set]==:on
@md=SiSU_Param::Parameters.new(@opt).get
if @md \
and defined? @md.fn \
and @md.fn # used for by_language_code?
if @md.opt.act[:html][:set]==:on #% --html, -h -H
ft << @md.fn[:html]
end
if @md.opt.act[:concordance][:set]==:on #% --concordance, -w
ft << @md.fn[:concordance]
end
if @md.opt.act[:manifest][:set]==:on #% --manifest, -y
ft << @md.fn[:manifest]
end
if @md.opt.act[:txt][:set]==:on #% --txt, -t -a
ft << @md.fn[:plain]
end
if @md.opt.act[:txt_textile][:set]==:on #% --textile
ft << @md.fn[:txt_textile]
end
if @md.opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
ft << @md.fn[:txt_asciidoc]
end
if @md.opt.act[:txt_markdown][:set]==:on #% --markdown
ft << @md.fn[:txt_markdown]
end
if @md.opt.act[:txt_rst][:set]==:on #% --rst, --rest
ft << @md.fn[:txt_rst]
end
if @md.opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
ft << @md.fn[:xhtml]
end
if @md.opt.act[:epub][:set]==:on #% --epub, -e
ft << @md.fn[:epub]
end
if @md.opt.act[:manpage][:set]==:on #% --manpage, -i
ft << @md.fn[:manpage]
end
if @md.opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
ft << @md.fn[:digest]
end
if @md.opt.act[:odt][:set]==:on #% --odt, -o opendocument
ft << @md.fn[:odf]
end
if @md.opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
end
if @md.opt.act[:share_source][:set]==:on
ft << @md.fns
end
if @md.opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
ft << @md.fn[:sisupod]
end
if @md.opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
ft << @md.fn[:sax]
end
if @md.opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
ft << @md.fn[:dom]
end
if @md.opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook-book
ft << @md.fn[:xml_docbook_book]
end
if @md.opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook
ft << @md.fn[:xml_fictionbook]
end
if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
ft << @md.fn[:xml_scaffold_structure_sisu]
end
if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
ft << @md.fn[:xml_scaffold_structure_collapse]
end
@fnb=@md.fnb
else # still needed where/when dp document param is not parsed
if @opt.act[:html][:set]==:on #% --html, -h -H
ft << '.html' << '.html.??'
end
if @opt.act[:concordance][:set]==:on #% --concordance, -w
ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html'
end
if @opt.act[:manifest][:set]==:on #% --manifest, -y
ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html'
end
if @opt.act[:txt][:set]==:on #% --txt, -t -a
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.act[:txt_textile][:set]==:on #% --textile
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.act[:txt_markdown][:set]==:on #% --markdown
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
end
if @opt.act[:epub][:set]==:on #% --epub, -e
ft << @fnb << '.epub'
end
if @opt.act[:manpage][:set]==:on #% --manpage, -i
ft << '.1' << '??.man.1' << 'man.??.1'
end
if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt'
end
if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt'
end
if @opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf'
end
if @opt.act[:share_source][:set]==:on
ft << '.sst' << '.ssi' << '.ssm'
end
if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
ft << '.zip'
end
if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml'
end
if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml'
end
if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook-book
ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml'
end
if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook
ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml'
end
if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml'
end
if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml'
end
end
ft=ft.uniq
filetypes=ft.join(',')
@filetypes=if filetypes !~/..+/ then '' # -r called alone, copy all
elsif @opt.selections.str =~/u/ then '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u
elsif filetypes =~/\S+?,\S+/ then '*{' + filetypes + '}' # more than one relevant file type
else '*' + filetypes # one relevant file type
end
@source_path=(@fnb && !(@fnb.empty?) \
? "#{@env.path.output}/#{@fnb}"
: @env.path.output)
@source_path_epub=(@fnb && !(@fnb.empty?) \
? "#{@env.path.output}/epub"
: @env.path.output_epub)
@source_path_src=(@fnb && !(@fnb.empty?) \
? "#{@env.path.output}/src"
: @env.path.output_src)
@source_path_pod=(@fnb && !(@fnb.empty?) \
? "#{@env.path.output}/pod"
: @env.path.output_pod)
@source_path_harvest=(@fnb && !(@fnb.empty?) \
? "#{@env.path.output}/manifest"
: @env.path.output_harvest)
@local_sisu_source=(@filetypes =~/\S/) \
? "#{@source_path}/#{@filetypes}"
: @source_path
end
if @opt.act[:rsync][:set]==:on
end
end
end
end
__END__
|