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,284 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** po4a
|
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/src_po4a_sst_ao_sst_set.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Po4aUtils
|
58
|
+
class Wrap
|
59
|
+
def initialize(md,orig='',trans='',n_char_max=76,n_indent=0,n_hang=nil)
|
60
|
+
@md,@orig,@trans,@n_char_max,@n_indent=
|
61
|
+
md, orig, trans, n_char_max, n_indent
|
62
|
+
@n_char_max_extend = n_char_max
|
63
|
+
@br="\n"
|
64
|
+
@n_hang=n_hang ? n_hang : @n_indent
|
65
|
+
@po4a_identify_type='type: SiSU doc'
|
66
|
+
#@po4a_identify_type='type: Plain text'
|
67
|
+
end
|
68
|
+
def line_wrap
|
69
|
+
space=' '
|
70
|
+
spaces_indent,spaces_hang=
|
71
|
+
"#{@br}#{space*@n_indent}",space*@n_hang
|
72
|
+
pot,i=[],0
|
73
|
+
pot_array=(@trans.empty?) ? [@orig] : [@orig,@trans]
|
74
|
+
pot_array.each do |pa|
|
75
|
+
line=0
|
76
|
+
out=[]
|
77
|
+
out[line]=''
|
78
|
+
@oldword='' #REMOVE @oldword
|
79
|
+
pa=pa.gsub(/<br>/,' <br> ').
|
80
|
+
gsub(/#{Mx[:br_nl]}/,"\n\n")
|
81
|
+
words=pa.scan(/\n\n|\\\\\\|<br>|\S+/m)
|
82
|
+
while words != ''
|
83
|
+
word=words.shift
|
84
|
+
if not word
|
85
|
+
out[line] unless out[line].empty? #check
|
86
|
+
break
|
87
|
+
elsif word =~/\n\n/
|
88
|
+
word="\n"
|
89
|
+
@n_char_max_extend = @n_char_max + out[line].length
|
90
|
+
line=line
|
91
|
+
elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \
|
92
|
+
and out[line] =~/\S+/
|
93
|
+
@n_char_max_extend = @n_char_max
|
94
|
+
out[line].squeeze!(' ')
|
95
|
+
line += 1
|
96
|
+
end
|
97
|
+
if word
|
98
|
+
out[line]=if out[line] \
|
99
|
+
and out[line] !~/\S+$/m
|
100
|
+
"#{out[line]}#{word}"
|
101
|
+
elsif out[line] \
|
102
|
+
and out[line] =~/\S+/
|
103
|
+
"#{out[line]} #{word}"
|
104
|
+
else "#{word.strip}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
@oldword=word if word =~/\S+/
|
108
|
+
end
|
109
|
+
x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang)
|
110
|
+
z=[]
|
111
|
+
x.split(/\n/).each do |y|
|
112
|
+
z << y
|
113
|
+
end
|
114
|
+
pot[i]=z.join("\n")
|
115
|
+
i +=1
|
116
|
+
pot
|
117
|
+
end
|
118
|
+
trans=(pot.length == 2) ? pot[1] : ''
|
119
|
+
po_str=<<WOK
|
120
|
+
#{pot[0]}
|
121
|
+
WOK
|
122
|
+
#{trans}
|
123
|
+
po_str
|
124
|
+
end
|
125
|
+
def no_line_wrap_block
|
126
|
+
pot,i=[],0
|
127
|
+
pot_array=(@trans.empty?) ? [@orig] : [@orig,@trans]
|
128
|
+
pot_array.each do |pa|
|
129
|
+
z=[]
|
130
|
+
pa.split(/\n\n/).each do |y|
|
131
|
+
z << y if not y.empty?
|
132
|
+
end
|
133
|
+
pot[i]=z.join("\n")
|
134
|
+
i +=1
|
135
|
+
pot
|
136
|
+
end
|
137
|
+
trans=(pot.length == 2) ? pot[1] : ''
|
138
|
+
po_str=<<WOK
|
139
|
+
#{pot[0]}
|
140
|
+
WOK
|
141
|
+
#{trans}
|
142
|
+
po_str
|
143
|
+
end
|
144
|
+
def line_wrap_indent1
|
145
|
+
@n_indent,@n_hang=2,2
|
146
|
+
line_wrap
|
147
|
+
end
|
148
|
+
def line_wrap_endnote
|
149
|
+
@n_indent,@n_hang=4,2
|
150
|
+
line_wrap
|
151
|
+
end
|
152
|
+
def array_wrap
|
153
|
+
if @orig.is_a?(Array)
|
154
|
+
@arr=[]
|
155
|
+
@orig.each do |line|
|
156
|
+
@arr << SiSU_TextUtils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
|
157
|
+
end
|
158
|
+
end
|
159
|
+
@arr
|
160
|
+
end
|
161
|
+
end
|
162
|
+
class HeaderScan
|
163
|
+
def initialize(md,para)
|
164
|
+
@md,@p=md,para
|
165
|
+
end
|
166
|
+
def extract(tag,tag_content,type,attrib)
|
167
|
+
if dc_tag \
|
168
|
+
and dc_content
|
169
|
+
[dc_tag,dc_content,{dc_tag=>dc_content}]
|
170
|
+
else nil
|
171
|
+
end
|
172
|
+
end
|
173
|
+
def header(tag,tag_content,type='',attrib='') #this will break stuff and must be tested thoroughly 20060825
|
174
|
+
@tag,@tag_content,@type,@attrib=tag,tag_content,type,attrib
|
175
|
+
def label #element
|
176
|
+
@tag
|
177
|
+
end
|
178
|
+
def type
|
179
|
+
@type
|
180
|
+
end
|
181
|
+
def text
|
182
|
+
@tag_content
|
183
|
+
end
|
184
|
+
def info #element text
|
185
|
+
@tag_content
|
186
|
+
end
|
187
|
+
def attribute
|
188
|
+
@attrib
|
189
|
+
end
|
190
|
+
def element
|
191
|
+
@tag
|
192
|
+
end
|
193
|
+
def attrib
|
194
|
+
@attrib
|
195
|
+
end
|
196
|
+
def el
|
197
|
+
@tag
|
198
|
+
end
|
199
|
+
self
|
200
|
+
end
|
201
|
+
def start_is_match
|
202
|
+
case @p
|
203
|
+
when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,@md.title.full,'meta','dc') #dc 1
|
204
|
+
when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/ then header('creator',$2,'meta','dc') #dc 2
|
205
|
+
when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 3
|
206
|
+
when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 4
|
207
|
+
when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 5
|
208
|
+
when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 6
|
209
|
+
when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 7
|
210
|
+
when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
211
|
+
when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
212
|
+
when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
213
|
+
when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
214
|
+
when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
215
|
+
when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 8
|
216
|
+
when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 9
|
217
|
+
when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 10
|
218
|
+
when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 11
|
219
|
+
when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 12
|
220
|
+
when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 13
|
221
|
+
when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 14
|
222
|
+
when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','dc') #dc 15
|
223
|
+
when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
224
|
+
when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
225
|
+
when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('translator',$2)
|
226
|
+
when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/ then header('illustrator',$2)
|
227
|
+
when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
228
|
+
when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
229
|
+
when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
230
|
+
when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
231
|
+
when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
232
|
+
when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'meta','extra')
|
233
|
+
when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_loc',$2,'meta','extra')
|
234
|
+
when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_dewey',$2,'meta','extra')
|
235
|
+
when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_pg',$2,'meta','extra')
|
236
|
+
when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/ then header('classify_isbn',$2,'meta','extra')
|
237
|
+
when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/ then header('structure',$2,'process','instruct')
|
238
|
+
when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/ then header('markup',$2,'process','instruct')
|
239
|
+
when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct')
|
240
|
+
when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/ then header('italicize',$2,'process','instruct')
|
241
|
+
when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/ then header('vocabulary',$2,'process','instruct')
|
242
|
+
when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/ then header('css',$2,'process','instruct')
|
243
|
+
when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct')
|
244
|
+
when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct') #add a & b
|
245
|
+
when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct')
|
246
|
+
when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct')
|
247
|
+
when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/ then header($1,$2,'process','instruct')
|
248
|
+
when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/ then header('version',$2,'process','instruct')
|
249
|
+
else nil
|
250
|
+
end
|
251
|
+
end
|
252
|
+
def dublin
|
253
|
+
(@p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/) \
|
254
|
+
? start_is_match
|
255
|
+
: nil
|
256
|
+
end
|
257
|
+
def meta
|
258
|
+
(@p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/) \
|
259
|
+
? start_is_match
|
260
|
+
: nil
|
261
|
+
end
|
262
|
+
end
|
263
|
+
class ParagraphNumber
|
264
|
+
def initialize(paranum)
|
265
|
+
@paranum=/(\d+)/m.match(paranum)[1]
|
266
|
+
end
|
267
|
+
def display
|
268
|
+
@paranum.gsub(/(\d+)/,'#\1')
|
269
|
+
end
|
270
|
+
end
|
271
|
+
class PotNumber
|
272
|
+
@@n=0
|
273
|
+
def initialize
|
274
|
+
@@n +=2
|
275
|
+
end
|
276
|
+
def num
|
277
|
+
@@n
|
278
|
+
end
|
279
|
+
def reset
|
280
|
+
@@n=0
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
__END__
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** share sisu source markup file, copy it to output directory!
|
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/src_po4a_sstm.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Markup
|
58
|
+
require_relative 'src_shared' # src_shared.rb
|
59
|
+
include SiSU_Source
|
60
|
+
require_relative 'src_po4a_share' # src_po4a_share.rb
|
61
|
+
require_relative 'se' # se.rb
|
62
|
+
include SiSU_Env
|
63
|
+
class Source_Po4a < SiSU_Source::SiSUpodSource
|
64
|
+
def initialize(opt,build=nil,place=nil)
|
65
|
+
super(opt,build,place)
|
66
|
+
@opt=opt
|
67
|
+
md=SiSU_Param::Parameters.new(opt).get
|
68
|
+
@file=SiSU_Env::FileOp.new(md,opt.fno)
|
69
|
+
end
|
70
|
+
def dir_mk(dir)
|
71
|
+
unless FileTest.directory?(dir)
|
72
|
+
FileUtils::mkdir_p(dir)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
def make_paths
|
76
|
+
dir_mk(@file.output_path.pot.dir)
|
77
|
+
dir_mk(@file.output_path.po.dir)
|
78
|
+
end
|
79
|
+
def language
|
80
|
+
def source_language_selected_str
|
81
|
+
@opt.act[:po4a_lang][:src] \
|
82
|
+
? @opt.act[:po4a_lang][:src]
|
83
|
+
: 'en'
|
84
|
+
end
|
85
|
+
self
|
86
|
+
end
|
87
|
+
def read
|
88
|
+
unless @opt.act[:quiet][:set]==:on
|
89
|
+
(@opt.act[:verbose][:set]==:on \
|
90
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
91
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
92
|
+
? SiSU_Screen::Ansi.new(
|
93
|
+
@opt.act[:color_state][:set],
|
94
|
+
'Share document markup text source',
|
95
|
+
@opt.fns
|
96
|
+
).cyan_hi_blue
|
97
|
+
: SiSU_Screen::Ansi.new(
|
98
|
+
@opt.act[:color_state][:set],
|
99
|
+
'Share document markup text source',
|
100
|
+
@opt.fns
|
101
|
+
).cyan_title_hi
|
102
|
+
end
|
103
|
+
make_paths
|
104
|
+
if FileTest.directory?(@path_pod[:fnb])
|
105
|
+
FileUtils::mkdir_p(@file.output_path.src.dir) \
|
106
|
+
unless FileTest.directory?(@file.output_path.src.dir)
|
107
|
+
v=(@opt.act[:maintenance][:set]==:on) \
|
108
|
+
? 'v' : ''
|
109
|
+
system(%{
|
110
|
+
#rsync -a#{v} #{@path_pod[:fnb]}/sisupod/doc/* #{@file.output_path.po4a.dir}
|
111
|
+
rsync -a#{v} #{@path_pod[:fnb]}/sisupod/doc/#{language.source_language_selected_str}* #{@file.output_path.po4a.dir}
|
112
|
+
chbk=`pwd`
|
113
|
+
cd #{@file.output_path.sisupod.dir}
|
114
|
+
for I in `find -type d` ; do chmod 755 $I ; done
|
115
|
+
for I in `find -type f` ; do chmod 644 $I ; done
|
116
|
+
cd ${chbk}
|
117
|
+
})
|
118
|
+
md=SiSU_Param::Parameters.new(@opt).get
|
119
|
+
file=SiSU_Env::FileOp.new(md)
|
120
|
+
SiSU_Po4a_Project::Po4aCfg.new(@opt,file).song
|
121
|
+
SiSU_Po4a_Project::Po4aProject.new(@opt,file).song
|
122
|
+
else
|
123
|
+
if (@opt.act[:verbose][:set]==:on \
|
124
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
125
|
+
|| @opt.act[:maintenance][:set]==:on)
|
126
|
+
SiSU_Screen::Ansi.new(
|
127
|
+
'',
|
128
|
+
"#{@opt.fno} not available"
|
129
|
+
).blue_tab
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
__END__
|
@@ -0,0 +1,347 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** create sisupod filetype and copy it to output directory!
|
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/src_shared.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Source
|
58
|
+
include SiSU_Env
|
59
|
+
class SiSUpodSource
|
60
|
+
require_relative 'se' # se.rb
|
61
|
+
require_relative 'se_hub_particulars' # se_hub_particulars.rb
|
62
|
+
require_relative 'utils_composite' # utils_composite.rb
|
63
|
+
include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test
|
64
|
+
def initialize(opt,build=nil,place=nil)
|
65
|
+
@opt=opt
|
66
|
+
@date=SiSU_Env::InfoDate.new.dt
|
67
|
+
@env=SiSU_Env::InfoEnv.new(opt.fns)
|
68
|
+
#@ver=SiSU_Env::InfoVersion.instance.get_version
|
69
|
+
@v=(@opt.act[:verbose_plus][:set]==:on \
|
70
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
71
|
+
? 'v' : ''
|
72
|
+
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
|
73
|
+
@file=@particulars.file
|
74
|
+
@local_path="#{@file.output_path.sisupod.dir}"
|
75
|
+
processing_sisupod=@env.processing_path.processing_sisupod(opt)
|
76
|
+
processing_sisupod.make
|
77
|
+
path_pod=processing_sisupod.paths[:sisupod]
|
78
|
+
path_pod_fnb=processing_sisupod.paths[:fnb]
|
79
|
+
FileUtils::mkdir_p(path_pod) unless FileTest.directory?(path_pod)
|
80
|
+
@path_pod={
|
81
|
+
fnb: path_pod_fnb,
|
82
|
+
pod: path_pod,
|
83
|
+
doc: path_pod + '/' + Gt[:doc] + '/' + opt.lng,
|
84
|
+
po: path_pod + '/' + Gt[:po] + '/' + opt.lng,
|
85
|
+
pot: path_pod + '/' + Gt[:pot],
|
86
|
+
conf: path_pod + '/' + Gt[:conf],
|
87
|
+
image: path_pod + '/' + Gt[:image],
|
88
|
+
audio: path_pod + '/' + Gt[:audio],
|
89
|
+
video: path_pod + '/' + Gt[:video],
|
90
|
+
}
|
91
|
+
end
|
92
|
+
def read
|
93
|
+
unless @opt.act[:quiet][:set]==:on
|
94
|
+
(@opt.act[:verbose][:set]==:on \
|
95
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
96
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
97
|
+
? SiSU_Screen::Ansi.new(
|
98
|
+
@opt.act[:color_state][:set],
|
99
|
+
'Assemble SiSU source',
|
100
|
+
"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").
|
101
|
+
green_hi_blue
|
102
|
+
: ''
|
103
|
+
end
|
104
|
+
unless @opt.fns.empty?
|
105
|
+
directories
|
106
|
+
doc_import_list=composite_and_imported_filenames_array(@opt.fno)
|
107
|
+
doc_import_list=[@opt.fno, doc_import_list].flatten
|
108
|
+
image_extraction(doc_import_list)
|
109
|
+
language_versions
|
110
|
+
end
|
111
|
+
end
|
112
|
+
def images_extract(f,images) # consider using param info
|
113
|
+
rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
|
114
|
+
if f !~/^%+\s/ \
|
115
|
+
and f =~rgx_image
|
116
|
+
images << f.scan(rgx_image).uniq
|
117
|
+
end
|
118
|
+
images.flatten
|
119
|
+
end
|
120
|
+
def image_extraction(doc_import_list)
|
121
|
+
@rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/
|
122
|
+
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
|
123
|
+
doc_import_dir=@opt.sub_location
|
124
|
+
images=[]
|
125
|
+
if doc_import_list.length > 0
|
126
|
+
doc_import_list=doc_import_list.uniq.flatten
|
127
|
+
doc_import_list.each do |fn|
|
128
|
+
file_array=IO.readlines(fn,'')
|
129
|
+
file_array.each do |f| #% work area
|
130
|
+
f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
|
131
|
+
if f !~/^%+\s/ \
|
132
|
+
and f =~@rgx_image
|
133
|
+
images=images_extract(f,images)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
gi=SiSU_Env::GetInit.new
|
139
|
+
unless FileTest.file?("#{@path_pod[:conf]}/#{gi.makefile_name}")
|
140
|
+
if gi.makefile \
|
141
|
+
&& FileTest.file?(gi.makefile)
|
142
|
+
FileUtils::mkdir_p(@path_pod[:conf]) \
|
143
|
+
unless FileTest.directory?(@path_pod[:conf])
|
144
|
+
FileUtils::cp(gi.makefile,"#{@path_pod[:conf]}/#{gi.makefile_name}")
|
145
|
+
end
|
146
|
+
#get images from makefile, consider placing in param
|
147
|
+
end
|
148
|
+
if images \
|
149
|
+
and images.length > 1
|
150
|
+
images=images.flatten.uniq
|
151
|
+
images.delete_if {|x| x =~/https?:\/\// }
|
152
|
+
#images=images.sort
|
153
|
+
FileUtils::mkdir_p(@path_pod[:image])
|
154
|
+
images_pwd=@opt.image_src_path
|
155
|
+
##sequence copies base images, defaults used in all html outputs
|
156
|
+
#image_source_base='/usr/share/sisu/image'
|
157
|
+
#dir_pwd=Dir.pwd
|
158
|
+
#Dir.chdir(image_source_base)
|
159
|
+
#base_images=Dir.glob('*')
|
160
|
+
#base_images.each do |i|
|
161
|
+
# FileUtils::cp_r(i,"#{images_path_pod}/#{i}")
|
162
|
+
#end
|
163
|
+
#Dir.chdir(dir_pwd)
|
164
|
+
if FileTest.directory?(images_pwd)
|
165
|
+
images=images.uniq
|
166
|
+
images.each do |i|
|
167
|
+
if FileTest.file?("#{images_pwd}/#{i}")
|
168
|
+
FileUtils::cp(
|
169
|
+
"#{images_pwd}/#{i}",
|
170
|
+
"#{@path_pod[:image]}/#{i}"
|
171
|
+
)
|
172
|
+
else
|
173
|
+
STDERR.puts \
|
174
|
+
%{\t*WARN* did not find image - } \
|
175
|
+
+ %{"#{images_pwd}/#{i}" } \
|
176
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else
|
180
|
+
STDERR.puts \
|
181
|
+
%{\t*WARN* did not find - } \
|
182
|
+
+ %{#{images_pwd} #{@path_pod[:image]} } \
|
183
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
184
|
+
end
|
185
|
+
end
|
186
|
+
if doc_import_list.length > 0 \
|
187
|
+
and @opt.fno =~/\.ssm$/
|
188
|
+
doc_import_list.each do |f|
|
189
|
+
if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f}")
|
190
|
+
FileUtils::cp(
|
191
|
+
"#{@opt.base_path}#{doc_import_dir}/#{f}",
|
192
|
+
"#{@path_pod[:doc]}/#{f}"
|
193
|
+
)
|
194
|
+
else
|
195
|
+
STDERR.puts \
|
196
|
+
%{\t*WARN* did not find image - } \
|
197
|
+
+ %{"#{@opt.base_path}#{doc_import_dir}/#{f}" } \
|
198
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
def language_versions
|
204
|
+
x=@env.document_language_versions_found #check multiple document language versions (param not used)
|
205
|
+
doc_import_dir=@opt.sub_location
|
206
|
+
if x[:f] \
|
207
|
+
and x[:f].length > 0 #store multiple document language versions, sisupod
|
208
|
+
x[:f].each do |f|
|
209
|
+
FileUtils::mkdir_p(@path_pod[:doc]) \
|
210
|
+
unless FileTest.directory?(@path_pod[:doc])
|
211
|
+
if f[:f] =~/\~(\S{2,3})\.ss[tm]$/
|
212
|
+
lng_f=$1
|
213
|
+
if @opt.lng == lng_f
|
214
|
+
if @opt.fno =~/\.ssm$/
|
215
|
+
if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
|
216
|
+
FileUtils::cp(
|
217
|
+
"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
|
218
|
+
"#{@path_pod[:doc]}/#{f[:n]}"
|
219
|
+
)
|
220
|
+
else
|
221
|
+
STDERR.puts \
|
222
|
+
%{\t*WARN* did not find - } \
|
223
|
+
+ %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \
|
224
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
225
|
+
end
|
226
|
+
else
|
227
|
+
if FileTest.file?("#{@opt.base_path}/#{f[:f]}")
|
228
|
+
cpy= :no
|
229
|
+
cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
|
230
|
+
or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
|
231
|
+
:yes
|
232
|
+
elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
|
233
|
+
and @opt.f_pth[:lng_is] == 'en'
|
234
|
+
:yes
|
235
|
+
else :no
|
236
|
+
end
|
237
|
+
if cpy == :yes
|
238
|
+
FileUtils::cp(
|
239
|
+
"#{@opt.base_path}/#{f[:f]}",
|
240
|
+
"#{@path_pod[:doc]}/#{f[:n]}"
|
241
|
+
)
|
242
|
+
end
|
243
|
+
else
|
244
|
+
STDERR.puts \
|
245
|
+
%{\t*WARN* did not find - } \
|
246
|
+
+ %{"#{@opt.base_path}/#{f[:f]}" } \
|
247
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
else
|
252
|
+
if @opt.fno =~/\.ssm$/
|
253
|
+
if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
|
254
|
+
FileUtils::cp_r(
|
255
|
+
"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
|
256
|
+
"#{@path_pod[:doc]}/#{f[:n]}"
|
257
|
+
)
|
258
|
+
else
|
259
|
+
STDERR.puts \
|
260
|
+
%{\t*WARN* did not find - } \
|
261
|
+
+ %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \
|
262
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
263
|
+
end
|
264
|
+
else
|
265
|
+
if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
|
266
|
+
cpy= :no
|
267
|
+
cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
|
268
|
+
or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
|
269
|
+
:yes
|
270
|
+
elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
|
271
|
+
and @opt.f_pth[:lng_is] == 'en'
|
272
|
+
:yes
|
273
|
+
else :no
|
274
|
+
end
|
275
|
+
if cpy == :yes
|
276
|
+
FileUtils::cp(
|
277
|
+
"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
|
278
|
+
"#{@path_pod[:doc]}/#{f[:n]}"
|
279
|
+
)
|
280
|
+
end
|
281
|
+
else
|
282
|
+
STDERR.puts \
|
283
|
+
%{\t*WARN* did not find - } \
|
284
|
+
+ %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \
|
285
|
+
+ %{[#{__FILE__}:#{__LINE__}]}
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
|
291
|
+
end
|
292
|
+
def directories
|
293
|
+
SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
__END__
|
298
|
+
question?: should you permit the packing of multiple documents in single .xz ?
|
299
|
+
|
300
|
+
open @opt.fns, parse file
|
301
|
+
extract from file content:
|
302
|
+
images and copy each image from whatever image source to _sisu/sisupod/sisu/_sisu/image
|
303
|
+
|
304
|
+
remove previously existing contents of _/sisu/sisupod &
|
305
|
+
make directory structure:
|
306
|
+
|
307
|
+
v3 -->
|
308
|
+
_sisu
|
309
|
+
sisupod
|
310
|
+
doc
|
311
|
+
manifest.txt
|
312
|
+
en/content.sst [file content]
|
313
|
+
fr/content.sst
|
314
|
+
_sisu
|
315
|
+
conf
|
316
|
+
image (ln -s ../../image)
|
317
|
+
audio (ln -s ../../audio)
|
318
|
+
video (ln -s ../../video)
|
319
|
+
image [all images for specific document gathered here]
|
320
|
+
audio
|
321
|
+
video
|
322
|
+
|
323
|
+
v2 -->
|
324
|
+
_sisu
|
325
|
+
sisupod
|
326
|
+
content.sst [file content]
|
327
|
+
filename.sst [link to content.sst]
|
328
|
+
_sisu/
|
329
|
+
image/ [all images for specific document gathered here]
|
330
|
+
|
331
|
+
sisu
|
332
|
+
_sisu
|
333
|
+
sisurc.yml
|
334
|
+
convert/
|
335
|
+
standard_terms/
|
336
|
+
image
|
337
|
+
processing
|
338
|
+
ao/
|
339
|
+
tex/
|
340
|
+
texinfo/
|
341
|
+
tune/
|
342
|
+
sisupod
|
343
|
+
|
344
|
+
special case
|
345
|
+
|
346
|
+
composite file (master), e.g.
|
347
|
+
SiSU.ssm
|