sisu 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sisu +367 -0
  3. data/bin/sisugem +367 -0
  4. data/data/sisu/image/arrow_next_red.png +0 -0
  5. data/data/sisu/image/arrow_prev_red.png +0 -0
  6. data/data/sisu/image/arrow_up_red.png +0 -0
  7. data/data/sisu/image/b_bluebell.png +0 -0
  8. data/data/sisu/image/b_doc.png +0 -0
  9. data/data/sisu/image/b_epub.png +0 -0
  10. data/data/sisu/image/b_home.png +0 -0
  11. data/data/sisu/image/b_info.png +0 -0
  12. data/data/sisu/image/b_odf.png +0 -0
  13. data/data/sisu/image/b_pdf.png +0 -0
  14. data/data/sisu/image/b_search.png +0 -0
  15. data/data/sisu/image/b_toc.png +0 -0
  16. data/data/sisu/image/bullet_08.png +0 -0
  17. data/data/sisu/image/bullet_09.png +0 -0
  18. data/data/sisu/image/bullet_10.png +0 -0
  19. data/data/sisu/image/bullet_11.png +0 -0
  20. data/data/sisu/image/bullet_12.png +0 -0
  21. data/data/sisu/image/bullet_doc.png +0 -0
  22. data/data/sisu/image/bullet_red.png +0 -0
  23. data/data/sisu/image/dot_clear.png +0 -0
  24. data/data/sisu/image/dot_white.png +0 -0
  25. data/data/sisu/image/gplv3.png +0 -0
  26. data/data/sisu/image/gplv3_free_software.png +0 -0
  27. data/data/sisu/image/next.png +0 -0
  28. data/data/sisu/image/previous.png +0 -0
  29. data/data/sisu/image/rb7.ico +0 -0
  30. data/data/sisu/image/sisu.png +0 -0
  31. data/data/sisu/image/toctoc.png +0 -0
  32. data/data/sisu/version.yml +5 -0
  33. data/lib/sisu.rb +94 -0
  34. data/lib/sisu/air.rb +80 -0
  35. data/lib/sisu/ao.rb +590 -0
  36. data/lib/sisu/ao_character_check.rb +102 -0
  37. data/lib/sisu/ao_composite.rb +286 -0
  38. data/lib/sisu/ao_doc_objects.rb +565 -0
  39. data/lib/sisu/ao_doc_str.rb +2269 -0
  40. data/lib/sisu/ao_endnotes.rb +136 -0
  41. data/lib/sisu/ao_expand_insertions.rb +514 -0
  42. data/lib/sisu/ao_hash_digest.rb +174 -0
  43. data/lib/sisu/ao_idx.rb +422 -0
  44. data/lib/sisu/ao_images.rb +187 -0
  45. data/lib/sisu/ao_metadata.rb +86 -0
  46. data/lib/sisu/ao_misc_arrange.rb +207 -0
  47. data/lib/sisu/ao_numbering.rb +720 -0
  48. data/lib/sisu/ao_persist.rb +194 -0
  49. data/lib/sisu/ao_references.rb +502 -0
  50. data/lib/sisu/ao_syntax.rb +640 -0
  51. data/lib/sisu/cgi.rb +84 -0
  52. data/lib/sisu/cgi_pgsql.rb +270 -0
  53. data/lib/sisu/cgi_sql_common.rb +986 -0
  54. data/lib/sisu/cgi_sqlite.rb +244 -0
  55. data/lib/sisu/conf.rb +287 -0
  56. data/lib/sisu/constants.rb +388 -0
  57. data/lib/sisu/css.rb +3484 -0
  58. data/lib/sisu/db_columns.rb +1997 -0
  59. data/lib/sisu/db_create.rb +689 -0
  60. data/lib/sisu/db_dbi.rb +90 -0
  61. data/lib/sisu/db_drop.rb +207 -0
  62. data/lib/sisu/db_import.rb +877 -0
  63. data/lib/sisu/db_indexes.rb +146 -0
  64. data/lib/sisu/db_load_tuple.rb +323 -0
  65. data/lib/sisu/db_remove.rb +182 -0
  66. data/lib/sisu/db_select.rb +230 -0
  67. data/lib/sisu/db_sqltxt.rb +173 -0
  68. data/lib/sisu/db_tests.rb +114 -0
  69. data/lib/sisu/dbi.rb +166 -0
  70. data/lib/sisu/dbi_discrete.rb +206 -0
  71. data/lib/sisu/digests.rb +306 -0
  72. data/lib/sisu/dp.rb +1606 -0
  73. data/lib/sisu/dp_identify_markup.rb +161 -0
  74. data/lib/sisu/dp_make.rb +668 -0
  75. data/lib/sisu/embedded.rb +149 -0
  76. data/lib/sisu/errors.rb +84 -0
  77. data/lib/sisu/generic_parts.rb +131 -0
  78. data/lib/sisu/git.rb +277 -0
  79. data/lib/sisu/html.rb +775 -0
  80. data/lib/sisu/html_concordance.rb +391 -0
  81. data/lib/sisu/html_format.rb +1348 -0
  82. data/lib/sisu/html_harvest.rb +109 -0
  83. data/lib/sisu/html_harvest_author_format.rb +111 -0
  84. data/lib/sisu/html_harvest_authors.rb +466 -0
  85. data/lib/sisu/html_harvest_topics.rb +893 -0
  86. data/lib/sisu/html_lite_shared.rb +324 -0
  87. data/lib/sisu/html_manifest.rb +1032 -0
  88. data/lib/sisu/html_minitoc.rb +230 -0
  89. data/lib/sisu/html_parts.rb +437 -0
  90. data/lib/sisu/html_persist.rb +237 -0
  91. data/lib/sisu/html_promo.rb +440 -0
  92. data/lib/sisu/html_scroll.rb +235 -0
  93. data/lib/sisu/html_segments.rb +716 -0
  94. data/lib/sisu/html_shared.rb +62 -0
  95. data/lib/sisu/html_table.rb +64 -0
  96. data/lib/sisu/html_tune.rb +301 -0
  97. data/lib/sisu/hub.rb +277 -0
  98. data/lib/sisu/hub_actions.rb +1122 -0
  99. data/lib/sisu/hub_loop_markup_files.rb +170 -0
  100. data/lib/sisu/hub_options.rb +1695 -0
  101. data/lib/sisu/i18n.rb +702 -0
  102. data/lib/sisu/manpage.rb +377 -0
  103. data/lib/sisu/manpage_format.rb +85 -0
  104. data/lib/sisu/object_munge.rb +307 -0
  105. data/lib/sisu/prog_text_translation.rb +1702 -0
  106. data/lib/sisu/qrcode.rb +754 -0
  107. data/lib/sisu/relaxng.rb +1153 -0
  108. data/lib/sisu/remote.rb +246 -0
  109. data/lib/sisu/rexml.rb +148 -0
  110. data/lib/sisu/se.rb +158 -0
  111. data/lib/sisu/se_cleanoutput.rb +145 -0
  112. data/lib/sisu/se_clear.rb +105 -0
  113. data/lib/sisu/se_createsite.rb +273 -0
  114. data/lib/sisu/se_css.rb +221 -0
  115. data/lib/sisu/se_date.rb +92 -0
  116. data/lib/sisu/se_db.rb +214 -0
  117. data/lib/sisu/se_envcall.rb +326 -0
  118. data/lib/sisu/se_file_op.rb +2758 -0
  119. data/lib/sisu/se_filemap.rb +247 -0
  120. data/lib/sisu/se_get_init.rb +238 -0
  121. data/lib/sisu/se_hub_particulars.rb +234 -0
  122. data/lib/sisu/se_info_env.rb +2179 -0
  123. data/lib/sisu/se_info_port.rb +70 -0
  124. data/lib/sisu/se_info_system.rb +202 -0
  125. data/lib/sisu/se_load.rb +108 -0
  126. data/lib/sisu/se_processing.rb +659 -0
  127. data/lib/sisu/se_programs.rb +394 -0
  128. data/lib/sisu/se_remotes.rb +553 -0
  129. data/lib/sisu/se_standardise_lang.rb +176 -0
  130. data/lib/sisu/se_version.rb +174 -0
  131. data/lib/sisu/shared_images.rb +137 -0
  132. data/lib/sisu/shared_markup_alt.rb +336 -0
  133. data/lib/sisu/shared_metadata.rb +1361 -0
  134. data/lib/sisu/shared_sem.rb +156 -0
  135. data/lib/sisu/sisu_thor_lib.rb +407 -0
  136. data/lib/sisu/sitemaps.rb +224 -0
  137. data/lib/sisu/src_kdissert_share.rb +102 -0
  138. data/lib/sisu/src_po4a_share.rb +309 -0
  139. data/lib/sisu/src_po4a_shelf.rb +1217 -0
  140. data/lib/sisu/src_po4a_shelf_set.rb +297 -0
  141. data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
  142. data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
  143. data/lib/sisu/src_po4a_sstm.rb +135 -0
  144. data/lib/sisu/src_shared.rb +347 -0
  145. data/lib/sisu/src_sisupod_make.rb +171 -0
  146. data/lib/sisu/src_sisupod_sstm.rb +109 -0
  147. data/lib/sisu/sst_convert_markup.rb +323 -0
  148. data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
  149. data/lib/sisu/sst_from_xml.rb +178 -0
  150. data/lib/sisu/sst_identify_markup.rb +482 -0
  151. data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
  152. data/lib/sisu/termsheet.rb +163 -0
  153. data/lib/sisu/texinfo.rb +430 -0
  154. data/lib/sisu/texinfo_format.rb +541 -0
  155. data/lib/sisu/texpdf.rb +1162 -0
  156. data/lib/sisu/texpdf_format.rb +1689 -0
  157. data/lib/sisu/texpdf_parts.rb +235 -0
  158. data/lib/sisu/txt_asciidoc.rb +354 -0
  159. data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
  160. data/lib/sisu/txt_markdown.rb +389 -0
  161. data/lib/sisu/txt_markdown_decorate.rb +207 -0
  162. data/lib/sisu/txt_orgmode.rb +376 -0
  163. data/lib/sisu/txt_orgmode_decorate.rb +186 -0
  164. data/lib/sisu/txt_output.rb +86 -0
  165. data/lib/sisu/txt_plain.rb +410 -0
  166. data/lib/sisu/txt_plain_decorate.rb +189 -0
  167. data/lib/sisu/txt_read.rb +109 -0
  168. data/lib/sisu/txt_rst.rb +371 -0
  169. data/lib/sisu/txt_rst_decorate.rb +186 -0
  170. data/lib/sisu/txt_shared.rb +241 -0
  171. data/lib/sisu/txt_textile.rb +367 -0
  172. data/lib/sisu/txt_textile_decorate.rb +186 -0
  173. data/lib/sisu/update.rb +141 -0
  174. data/lib/sisu/urls.rb +696 -0
  175. data/lib/sisu/utils.rb +232 -0
  176. data/lib/sisu/utils_composite.rb +115 -0
  177. data/lib/sisu/utils_response.rb +114 -0
  178. data/lib/sisu/utils_screen_text_color.rb +472 -0
  179. data/lib/sisu/utils_spell.rb +99 -0
  180. data/lib/sisu/webrick.rb +191 -0
  181. data/lib/sisu/wikispeak.rb +375 -0
  182. data/lib/sisu/xhtml.rb +472 -0
  183. data/lib/sisu/xhtml_epub2.rb +890 -0
  184. data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
  185. data/lib/sisu/xhtml_epub2_format.rb +2272 -0
  186. data/lib/sisu/xhtml_epub2_persist.rb +278 -0
  187. data/lib/sisu/xhtml_epub2_segments.rb +599 -0
  188. data/lib/sisu/xhtml_epub2_tune.rb +330 -0
  189. data/lib/sisu/xhtml_parts.rb +183 -0
  190. data/lib/sisu/xhtml_shared.rb +62 -0
  191. data/lib/sisu/xhtml_table.rb +97 -0
  192. data/lib/sisu/xml_docbook5.rb +376 -0
  193. data/lib/sisu/xml_dom.rb +624 -0
  194. data/lib/sisu/xml_fictionbook2.rb +389 -0
  195. data/lib/sisu/xml_format.rb +865 -0
  196. data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
  197. data/lib/sisu/xml_odf_odt.rb +887 -0
  198. data/lib/sisu/xml_odf_odt_format.rb +674 -0
  199. data/lib/sisu/xml_parts.rb +191 -0
  200. data/lib/sisu/xml_persist.rb +126 -0
  201. data/lib/sisu/xml_sax.rb +521 -0
  202. data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
  203. data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
  204. data/lib/sisu/xml_shared.rb +665 -0
  205. data/lib/sisu/xml_tables.rb +261 -0
  206. data/lib/sisu/zap.rb +90 -0
  207. metadata +251 -0
@@ -0,0 +1,326 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
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/se_envcall.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Env_Call
58
+ begin
59
+ require 'singleton'
60
+ rescue LoadError
61
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
62
+ error('singleton NOT FOUND (LoadError)')
63
+ end
64
+ class EnvCall
65
+ @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil
66
+ @@ad={}
67
+ attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad
68
+ def initialize(fns='')
69
+ @fns=fns
70
+ @sys=SiSU_Info_Sys::InfoSystem.instance
71
+ get_init=SiSU_Env::GetInit.new
72
+ @rc=get_init.sisu_yaml.rc
73
+ @ad=get_init.ads
74
+ if @fns \
75
+ and @fns != '' \
76
+ and @fns !=@@fns
77
+ @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil
78
+ end
79
+ if @fns \
80
+ and @fns != '' #watch
81
+ m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/
82
+ @@fnn ||=@fns[m,1]
83
+ @@fnb ||=@fns[m,2]
84
+ @@fnt ||=@fns[m,3]
85
+ @@flv ||=document_language_versions_found[:f]
86
+ unless @@fns =~/\S+?\.txz/
87
+ @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz'
88
+ elsif @@fnb; @@fnb + '.sst.txz'
89
+ else '' # e.g. termsheet
90
+ end
91
+ end
92
+ end
93
+ @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
94
+ end
95
+ def default_language?
96
+ if @rc \
97
+ && defined? @rc['language_default']
98
+ if (@rc['language_default'].is_a?(String)) \
99
+ && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/)
100
+ @rc['language_default']
101
+ else 'en'
102
+ end
103
+ else 'en'
104
+ end
105
+ end
106
+ def mono_multi_lingual?
107
+ if @rc \
108
+ && defined? @rc['output_dir_structure_by']
109
+ if @rc['output_dir_structure_by'] \
110
+ =~/dump/
111
+ :mono
112
+ elsif @rc['output_dir_structure_by'] \
113
+ =~/language|redirect/
114
+ :multi
115
+ elsif @rc['output_dir_structure_by'] \
116
+ =~/monolingual|filetype_mono|filenaneme_mono/
117
+ :mono
118
+ else :multi
119
+ end
120
+ else :multi
121
+ end
122
+ end
123
+ def output_dir_structure
124
+ def by?
125
+ output_structure=:filename #set default output structure
126
+ if @rc \
127
+ && defined? @rc['output_dir_structure_by']
128
+ output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \
129
+ or ((defined? @rc['output_structure']['dump']) \
130
+ && @rc['output_structure']['dump'] ==true)
131
+ :dump
132
+ elsif (@rc['output_dir_structure_by'] =~/redirect/) \
133
+ or ((defined? @rc['output_structure']['redirect']) \
134
+ && @rc['output_structure']['redirect'] ==true)
135
+ :redirect
136
+ elsif (@rc['output_dir_structure_by'] =~/language/) \
137
+ or ((defined? @rc['output_structure']['by_language']) \
138
+ && @rc['output_structure']['by_language'] ==true)
139
+ :language
140
+ elsif (@rc['output_dir_structure_by'] =~/filetype/) \
141
+ or ((defined? @rc['output_structure']['by_filetype']) \
142
+ && @rc['output_structure']['by_filetype'] ==true)
143
+ :filetype
144
+ elsif (@rc['output_dir_structure_by'] =~/filename/) \
145
+ or ((defined? @rc['output_structure']['by_filename']) \
146
+ && @rc['output_structure']['by_filename'] ==true)
147
+ :filename
148
+ else #set default
149
+ :language
150
+ end
151
+ else #set default
152
+ :language
153
+ end
154
+ end
155
+ def dump?
156
+ ((by?) ==:dump) \
157
+ ? true
158
+ : false
159
+ end
160
+ def redirect?
161
+ ((by?) ==:redirect) \
162
+ ? true
163
+ : false
164
+ end
165
+ def by_language_code?
166
+ ((by?) ==:language) \
167
+ ? true
168
+ : false
169
+ end
170
+ def by_filetype?
171
+ ((by?) ==:filetype) \
172
+ ? true
173
+ : false
174
+ end
175
+ def by_filename?
176
+ ((by?) ==:filename) \
177
+ ? true
178
+ : false
179
+ end
180
+ def multilingual?
181
+ by_language_code?
182
+ end
183
+ self
184
+ end
185
+ def document_language_versions_found #REVISIT
186
+ @fn={}
187
+ filename=(@fns =~/\.ssm\.sst$/) \
188
+ ? @fns.gsub(/\.ssm\.sst$/,'.ssm')
189
+ : @fns
190
+ if filename.is_a?(String) \
191
+ and not filename.empty?
192
+ if output_dir_structure.by_language_code?
193
+ m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/
194
+ @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3]
195
+ else m=/(.+?)\.(sst|ssm)$/
196
+ @fn[:b]=@fn[:m]=filename[m,1]
197
+ @fn[:t]=filename[m,2]
198
+ end
199
+ end
200
+ lng_base=SiSU_Env::InfoEnv.new.language_default_set
201
+ lang=SiSU_Env::StandardiseLanguage.new
202
+ langs=lang.codes
203
+ x=[]
204
+ if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}")
205
+ n=@fn[:m].gsub(/^.+?\//,'')
206
+ n =n + '.' + @fn[:t]
207
+ x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n }
208
+ end
209
+ langs.each do |l|
210
+ lng=SiSU_Env::StandardiseLanguage.new(l)
211
+ if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
212
+ x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
213
+ elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
214
+ x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
215
+ end
216
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
217
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
218
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
219
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
220
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
221
+ end
222
+ end
223
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
224
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
225
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
226
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
227
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
228
+ end
229
+ end
230
+ end
231
+ @fn[:f]=x
232
+ @fn
233
+ end
234
+ def published_manifests?(output_base)
235
+ @fn={}
236
+ @m=[]
237
+ unless (@fns.nil? \
238
+ or @fns.empty?)
239
+ if output_dir_structure.by_language_code?
240
+ m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
241
+ @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
242
+ else m=/(.+?)\.((?:-|ssm\.)?sst$)/
243
+ @fn[:b]=@fn[:m]=@fns[m,1]
244
+ @fn[:t]=@fns[m,2]
245
+ end
246
+ end
247
+ lang=SiSU_Env::StandardiseLanguage.new
248
+ langs=lang.codes
249
+ x=[]
250
+ if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
251
+ end
252
+ dir=SiSU_Env::InfoEnv.new(@fns)
253
+ @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language
254
+ langs.each do |l|
255
+ lng=SiSU_Env::StandardiseLanguage.new(l)
256
+ fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
257
+ fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
258
+ if FileTest.file?(fns_c)
259
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new.
260
+ file_to_language(fns_c) #reconsider file_to_language
261
+ lng=fn_set_lang[:n]
262
+ fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c])
263
+ @m << { m: fn[:manifest], l: lng }
264
+ elsif FileTest.file?(fns_l)
265
+ fn_set_lang=SiSU_Env::StandardiseLanguage.new.
266
+ file_to_language(fns_l) #reconsider file_to_language
267
+ @fnl=dir.i18n.lang_filename(fn_set_lang[:c])
268
+ fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c])
269
+ @m << { m: fn[:manifest], l: lng }
270
+ end
271
+ end
272
+ @m=@m.uniq
273
+ end
274
+ def filename(code,name,suffix)
275
+ "#{name}#{suffix}"
276
+ end
277
+ def lang(code)
278
+ {
279
+ html: filename(code,'','.html'),
280
+ book_index: filename(code,'book_index','.html'),
281
+ concordance: filename(code,'concordance','.html'),
282
+ sax: filename(code,'sax','.xml'),
283
+ dom: filename(code,'dom','.xml'),
284
+ docbook: filename(code,'docbook','.xml'),
285
+ xhtml: filename(code,'scroll','.xhtml'),
286
+ pdf_l: filename(code,'','.pdf'),
287
+ pdf_p: filename(code,'','.pdf'),
288
+ pdf_l_a4: filename(code,"a4",'.pdf'),
289
+ pdf_p_a4: filename(code,"a4",'.pdf'),
290
+ pdf_l_a5: filename(code,"a5",'.pdf'),
291
+ pdf_p_a5: filename(code,"a5",'.pdf'),
292
+ pdf_l_b5: filename(code,"b5",'.pdf'),
293
+ pdf_p_b5: filename(code,"b5",'.pdf'),
294
+ pdf_l_letter: filename(code,"letter",'.pdf'),
295
+ pdf_p_letter: filename(code,"letter",'.pdf'),
296
+ pdf_l_legal: filename(code,"legal",'.pdf'),
297
+ pdf_p_legal: filename(code,"legal",'.pdf'),
298
+ toc: filename(code,'toc','.html'),
299
+ doc: filename(code,fnb,'.html'),
300
+ index: filename(code,'index','.html'),
301
+ po: filename(code,@fns,'.po'),
302
+ pot: filename(code,@fns,'.pot'),
303
+ odf: filename(code,'','.odt'),
304
+ epub: filename(code,'','.epub'),
305
+ plain: filename(code,'','.txt'),
306
+ qrcode: filename(code,'','.jpg'),
307
+ manpage: filename(code,'','.1'), #fix, section number
308
+ wiki: filename(code,'wiki','.txt'),
309
+ digest: filename(code,'digest','.txt'),
310
+ metadata: filename(code,'metadata','.html'), #chk
311
+ manifest: filename(code,'manifest','.html'),
312
+ oai_pmh: filename(code,'oai_pmh','.xml'),
313
+ sitemap: filename(code,'sitemap','.xml'),
314
+ sitemap_touch: filename(code,"sitemap_#{fnb}",'.xml'),
315
+ sxs: filename(code,fnb,'.sxs.xml'),
316
+ sxd: filename(code,fnb,'.sxd.xml'),
317
+ sxn: filename(code,fnb,'.sxn.xml'),
318
+ sisupod: filename(nil,@fnz,''),
319
+ book_idx_html: filename(code,'book_index','.html'),
320
+ book_idx_epub: filename(code,'book_index','.xhtml'),
321
+ epub_concord: filename(code,'concordance','.xhtml'),
322
+ }
323
+ end
324
+ end
325
+ end
326
+ __END__
@@ -0,0 +1,2758 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
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/se_file_op.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Info_File
58
+ require_relative 'utils' # utils.rb
59
+ require_relative 'se_info_env' # se_info_env.rb
60
+ begin
61
+ require 'fileutils'
62
+ include FileUtils::Verbose
63
+ rescue LoadError
64
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
65
+ error('fileutils NOT FOUND (LoadError)')
66
+ end
67
+ class InfoFile < SiSU_Info_Env::InfoEnv # se_info_env.rb
68
+ #todo unify with FileOp
69
+ def initialize(fns)
70
+ begin
71
+ super(fns)
72
+ @fns=fns
73
+ @env=SiSU_Env::InfoEnv.new(@fns)
74
+ m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/
75
+ @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
76
+ rescue
77
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
78
+ __LINE__.to_s + ':' + __FILE__
79
+ end
80
+ ensure
81
+ end
82
+ end
83
+ def basefilename #Remove if possible
84
+ m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
85
+ @fns[m,1]
86
+ end
87
+ def make_file(path,filename)
88
+ (File.writable?("#{path}/.")) \
89
+ ? File.new("#{path}/#{filename}",'w+')
90
+ : (SiSU_Screen::Ansi.new(
91
+ '',
92
+ "*WARN* is the file or directory writable?, could not create #{filename}"
93
+ ).warn)
94
+ end
95
+ def touch_file(path,filename)
96
+ if File.writable?("#{path}/.");
97
+ FileUtils::touch("#{path}/#{filename}")
98
+ else
99
+ SiSU_Screen::Ansi.new(
100
+ '',
101
+ "*WARN* is the file or directory writable?, could not create #{filename}"
102
+ ).warn
103
+ end
104
+ end
105
+ def make_path(path)
106
+ FileUtils::mkdir_p(path) unless FileTest.directory?(path)
107
+ end
108
+ def marshal
109
+ def ao_content
110
+ @env.processing_path.ao + '/' \
111
+ + @fns + '.content.rbm'
112
+ end
113
+ def ao_idx_sst_rel_html_seg
114
+ @env.processing_path.ao + '/' \
115
+ + @fns + '.idx_sst.rbm'
116
+ end
117
+ def ao_idx_sst_rel #used by tex & odf
118
+ @env.processing_path.ao + '/' \
119
+ + @fns + '.idx_raw.rbm'
120
+ end
121
+ def ao_idx_html
122
+ @env.processing_path.ao + '/' \
123
+ + @fns + '.idx_html.rbm'
124
+ end
125
+ def ao_idx_xhtml
126
+ @env.processing_path.ao + '/' \
127
+ + @fns + '.idx_xhtml.rbm'
128
+ end
129
+ def ao_metadata
130
+ @env.processing_path.ao + '/' \
131
+ + @fns + '.metadata.rbm'
132
+ end
133
+ def ao_map_nametags
134
+ @env.processing_path.ao + '/' \
135
+ + @fns + '.map_name_tags.rbm'
136
+ end
137
+ def ao_map_ocn_htmlseg
138
+ @env.processing_path.ao + '/' \
139
+ + @fns + '.map_ocn_htmlseg.rbm'
140
+ end
141
+ def html_tune
142
+ @env.processing_path.tune + '/' \
143
+ + @fns + '.marshal_tune'
144
+ end
145
+ def xhtml_tune
146
+ @env.processing_path.tune + '/' \
147
+ + @fns + '.marshal_tune'
148
+ end
149
+ self
150
+ end
151
+ def write_file_processing
152
+ def html_tune
153
+ File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+')
154
+ end
155
+ self
156
+ end
157
+ def mkdir #check moved from FileOp, existing mkdir
158
+ def processing
159
+ def ao
160
+ FileUtils::mkdir_p(@env.processing_path.ao) \
161
+ unless FileTest.directory?(@env.processing_path.ao)
162
+ end
163
+ def tune
164
+ FileUtils::mkdir_p(@env.processing_path.tune) \
165
+ unless FileTest.directory?(@env.processing_path.tune)
166
+ end
167
+ self
168
+ end
169
+ end
170
+ end
171
+ end
172
+ module SiSU_File_Op
173
+ require_relative 'constants' # constants.rb
174
+ require_relative 'utils' # utils.rb
175
+ begin
176
+ require 'fileutils'
177
+ include FileUtils::Verbose
178
+ rescue LoadError
179
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
180
+ error('fileutils NOT FOUND (LoadError)')
181
+ end
182
+ class FileOp < SiSU_Info_File::InfoFile
183
+ #todo unify with CreateFile
184
+ def initialize(md,fno='')
185
+ begin
186
+ @md,@fno=md,fno
187
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
188
+ rescue
189
+ SiSU_Screen::Ansi.new(md.opt.selections.str,$!,$@).rescue do
190
+ __LINE__.to_s + ':' + __FILE__
191
+ end
192
+ ensure
193
+ end
194
+ end
195
+ def output_dir_structure
196
+ SiSU_Env::ProcessingSettings.new(@md).output_dir_structure
197
+ end
198
+ def mkdir_initialize # not used but consider using
199
+ FileUtils::mkdir_p(output_path.base.dir) \
200
+ unless FileTest.directory?(output_path.base.dir)
201
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") \
202
+ unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}")
203
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \
204
+ unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}")
205
+ FileUtils::mkdir_p(@env.processing_path.ao) \
206
+ unless FileTest.directory?(@env.processing_path.ao)
207
+ FileUtils::mkdir_p(@env.processing_path.tune) \
208
+ unless FileTest.directory?(@env.processing_path.tune)
209
+ end
210
+ def path_rel_links
211
+ def html_scroll_2
212
+ if output_dir_structure.by_language_code?
213
+ '../../'
214
+ elsif output_dir_structure.by_filetype?
215
+ '../'
216
+ else
217
+ '../'
218
+ end
219
+ end
220
+ def html_seg_2
221
+ if output_dir_structure.by_language_code?
222
+ '../../../'
223
+ elsif output_dir_structure.by_filetype?
224
+ '../../'
225
+ else
226
+ '../'
227
+ end
228
+ end
229
+ def html_scroll_1
230
+ if output_dir_structure.by_language_code?
231
+ '../'
232
+ elsif output_dir_structure.by_filetype?
233
+ '../'
234
+ else
235
+ './'
236
+ end
237
+ end
238
+ def html_seg_1
239
+ if output_dir_structure.by_language_code?
240
+ '../../'
241
+ elsif output_dir_structure.by_filetype?
242
+ '../../'
243
+ else
244
+ './'
245
+ end
246
+ end
247
+ def default_output_css
248
+ if (@md.opt.opt_act[:dump][:bool] \
249
+ && @md.opt.opt_act[:dump][:inst]) \
250
+ || (@md.opt.opt_act[:redirect][:bool] \
251
+ && @md.opt.opt_act[:redirect][:inst])
252
+ './'
253
+ elsif output_dir_structure.by_language_code?
254
+ '../../'
255
+ elsif output_dir_structure.by_filetype?
256
+ '../'
257
+ else
258
+ '../'
259
+ end
260
+ end
261
+ def html_scroll_css
262
+ default_output_css
263
+ end
264
+ def xhtml_css
265
+ default_output_css
266
+ end
267
+ def xml_css
268
+ default_output_css
269
+ end
270
+ def html_seg_css
271
+ if output_dir_structure.by_language_code?
272
+ '../../../'
273
+ elsif output_dir_structure.by_filetype?
274
+ '../../'
275
+ else
276
+ '../'
277
+ end
278
+ end
279
+ def manifest_css
280
+ if output_dir_structure.by_language_code?
281
+ '../../_sisu/css'
282
+ elsif output_dir_structure.by_filetype?
283
+ ''
284
+ else
285
+ '../'
286
+ end
287
+ end
288
+ self
289
+ end
290
+ def mkdir
291
+ def output
292
+ def base
293
+ FileUtils::mkdir_p(output_path.base.dir) \
294
+ unless FileTest.directory?(output_path.base.dir)
295
+ end
296
+ def css
297
+ FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \
298
+ unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}")
299
+ end
300
+ def epub
301
+ path=output_path.epub.dir
302
+ make_path(path)
303
+ end
304
+ self
305
+ end
306
+ self
307
+ end
308
+ def mkfile #consider using more
309
+ path="#{output_path.base.dir}/#{@md.fnb}"
310
+ make_path(path)
311
+ filename=@fno
312
+ make_file(path,filename)
313
+ end
314
+ def mkfile_pwd
315
+ path=Dir.pwd
316
+ filename=@fno
317
+ make_file(path,filename)
318
+ end
319
+ def write_file
320
+ def txt
321
+ path=output_path.txt.dir
322
+ make_path(path)
323
+ fn=base_filename.txt
324
+ make_file(path,fn)
325
+ end
326
+ def textile
327
+ path=output_path.textile.dir
328
+ make_path(path)
329
+ fn=base_filename.textile
330
+ make_file(path,fn)
331
+ end
332
+ def asciidoc
333
+ path=output_path.asciidoc.dir
334
+ make_path(path)
335
+ fn=base_filename.asciidoc
336
+ make_file(path,fn)
337
+ end
338
+ def markdown
339
+ path=output_path.markdown.dir
340
+ make_path(path)
341
+ fn=base_filename.markdown
342
+ make_file(path,fn)
343
+ end
344
+ def rst
345
+ path=output_path.rst.dir
346
+ make_path(path)
347
+ fn=base_filename.rst
348
+ make_file(path,fn)
349
+ end
350
+ def orgmode
351
+ path=output_path.orgmode.dir
352
+ make_path(path)
353
+ fn=base_filename.orgmode
354
+ make_file(path,fn)
355
+ end
356
+ def html_scroll
357
+ pth=output_path.html.dir
358
+ make_path(pth)
359
+ p_fn=place_file.html_scroll.dir
360
+ File.new(p_fn,'w+')
361
+ end
362
+ def html_seg_index
363
+ pth=((output_dir_structure.by_filename?) \
364
+ || (output_dir_structure.dump?)) \
365
+ ? "#{output_path.html.dir}"
366
+ : "#{output_path.html.dir}/#{@md.fnb}"
367
+ make_path(pth)
368
+ p_fn=place_file.html_seg_index.dir
369
+ File.new(p_fn,'w+')
370
+ end
371
+ def html_segtoc
372
+ pth=((output_dir_structure.by_filename?) \
373
+ || (output_dir_structure.dump?) \
374
+ || (output_dir_structure.redirect?)) \
375
+ ? "#{output_path.html.dir}"
376
+ : "#{output_path.html.dir}/#{@md.fnb}"
377
+ make_path(pth)
378
+ p_fn=place_file.html_segtoc.dir
379
+ File.new(p_fn,'w+')
380
+ end
381
+ def xhtml
382
+ path=output_path.xhtml.dir
383
+ make_path(path)
384
+ fn=base_filename.xhtml
385
+ make_file(path,fn)
386
+ end
387
+ def xml_sax
388
+ path=output_path.xml.dir
389
+ make_path(path)
390
+ fn=base_filename.xml_sax
391
+ make_file(path,fn)
392
+ end
393
+ def xml_dom
394
+ path=output_path.xml.dir
395
+ make_path(path)
396
+ fn=base_filename.xml_dom
397
+ make_file(path,fn)
398
+ end
399
+ def xml_docbook_book
400
+ path=output_path.xml_docbook_book.dir
401
+ make_path(path)
402
+ fn=base_filename.xml_docbook_book
403
+ make_file(path,fn)
404
+ end
405
+ def xml_fictionbook
406
+ path=output_path.xml_fictionbook.dir
407
+ make_path(path)
408
+ fn=base_filename.xml_fictionbook
409
+ make_file(path,fn)
410
+ end
411
+ def xml_scaffold_structure_sisu
412
+ path=output_path.xml_scaffold_structure_sisu.dir
413
+ make_path(path)
414
+ fn=base_filename.xml_scaffold_structure_sisu
415
+ make_file(path,fn)
416
+ end
417
+ def xml_scaffold_structure_collapse
418
+ path=output_path.xml_scaffold_structure_collapse.dir
419
+ make_path(path)
420
+ fn=base_filename.xml_scaffold_structure_collapse
421
+ make_file(path,fn)
422
+ end
423
+ def manpage
424
+ path=output_path.manpage.dir
425
+ make_path(path)
426
+ fn=base_filename.manpage
427
+ make_file(path,fn)
428
+ end
429
+ def texinfo
430
+ path=output_path.texinfo.dir
431
+ make_path(path)
432
+ fn=base_filename.texinfo
433
+ make_file(path,fn)
434
+ end
435
+ def info
436
+ path=output_path.texinfo.dir
437
+ make_path(path)
438
+ fn=base_filename.info
439
+ make_file(path,fn)
440
+ end
441
+ def hash_digest
442
+ path=output_path.hash_digest.dir
443
+ make_path(path)
444
+ fn=base_filename.hash_digest
445
+ make_file(path,fn)
446
+ end
447
+ def qrcode
448
+ path=output_path.qrcode.dir
449
+ make_path(path)
450
+ fn=base_filename.qrcode
451
+ make_file(path,fn)
452
+ end
453
+ def manifest
454
+ path=output_path.manifest.dir
455
+ make_path(path)
456
+ fn=base_filename.manifest
457
+ make_file(path,fn)
458
+ end
459
+ def manifest_txt
460
+ path=output_path.manifest.dir
461
+ make_path(path)
462
+ fn=base_filename.manifest_txt
463
+ make_file(path,fn)
464
+ end
465
+ def po4a_cfg
466
+ path=output_path.po4a.dir
467
+ make_path(path)
468
+ fn=base_filename.po4a_cfg
469
+ make_file(path,fn)
470
+ end
471
+ def pot
472
+ path=output_path.pot.dir
473
+ make_path(path)
474
+ fn=base_filename.pot
475
+ make_file(path,fn)
476
+ end
477
+ def po(lng=@md.opt.lng)
478
+ path=output_path.po(lng).dir
479
+ make_path(path)
480
+ fn=base_filename.po
481
+ make_file(path,fn)
482
+ end
483
+ def po4a_sst(lng=@md.opt.lng)
484
+ path=output_path.po4a_sst(lng).dir
485
+ make_path(path)
486
+ fn=base_filename.po4a_sst
487
+ make_file(path,fn)
488
+ end
489
+ self
490
+ end
491
+ def place_file
492
+ def txt
493
+ def dir
494
+ output_path.txt.dir + '/' \
495
+ + base_filename.txt
496
+ end
497
+ def rel
498
+ output_path.txt.rel + '/' \
499
+ + base_filename.txt
500
+ end
501
+ self
502
+ end
503
+ def textile
504
+ def dir
505
+ output_path.textile.dir + '/' \
506
+ + base_filename.textile
507
+ end
508
+ def rel
509
+ output_path.textile.rel + '/' \
510
+ + base_filename.textile
511
+ end
512
+ self
513
+ end
514
+ def asciidoc
515
+ def dir
516
+ output_path.asciidoc.dir + '/' \
517
+ + base_filename.asciidoc
518
+ end
519
+ def rel
520
+ output_path.asciidoc.rel + '/' \
521
+ + base_filename.asciidoc
522
+ end
523
+ self
524
+ end
525
+ def markdown
526
+ def dir
527
+ output_path.markdown.dir + '/' \
528
+ + base_filename.markdown
529
+ end
530
+ def rel
531
+ output_path.markdown.rel + '/' \
532
+ + base_filename.markdown
533
+ end
534
+ self
535
+ end
536
+ def rst
537
+ def dir
538
+ output_path.rst.dir + '/' \
539
+ + base_filename.rst
540
+ end
541
+ def rel
542
+ output_path.rst.rel + '/' \
543
+ + base_filename.rst
544
+ end
545
+ self
546
+ end
547
+ def orgmode
548
+ def dir
549
+ output_path.orgmode.dir + '/' \
550
+ + base_filename.orgmode
551
+ end
552
+ def rel
553
+ output_path.orgmode.rel + '/' \
554
+ + base_filename.orgmode
555
+ end
556
+ self
557
+ end
558
+ def html_scroll
559
+ def dir
560
+ output_path.html_scroll.dir + '/' \
561
+ + base_filename.html_scroll
562
+ end
563
+ def rel
564
+ output_path.html_scroll.rel + '/' \
565
+ + base_filename.html_scroll
566
+ end
567
+ self
568
+ end
569
+ def html_seg_index
570
+ def dir
571
+ output_path.html_seg.dir + '/' \
572
+ + base_filename.html_seg_index
573
+ end
574
+ def rel
575
+ output_path.html_seg.rel + '/' \
576
+ + base_filename.html_seg_index
577
+ end
578
+ self
579
+ end
580
+ def html_segtoc
581
+ def dir
582
+ output_path.html_seg.dir + '/' \
583
+ + base_filename.html_segtoc
584
+ end
585
+ def rel
586
+ output_path.html_seg.rel + '/' \
587
+ + base_filename.html_segtoc
588
+ end
589
+ self
590
+ end
591
+ def html_book_index
592
+ def dir
593
+ output_path.html_seg.dir + '/' \
594
+ + base_filename.html_book_index
595
+ end
596
+ def rel
597
+ output_path.html_seg.rel + '/' \
598
+ + base_filename.html_book_index
599
+ end
600
+ self
601
+ end
602
+ def html_concordance
603
+ def dir
604
+ output_path.html_seg.dir + '/' \
605
+ + base_filename.html_concordance
606
+ end
607
+ def rel
608
+ output_path.html_seg.rel + '/' \
609
+ + base_filename.html_concordance
610
+ end
611
+ self
612
+ end
613
+ def odt
614
+ def dir
615
+ output_path.odt.dir + '/' \
616
+ + base_filename.odt
617
+ end
618
+ def rel
619
+ output_path.odt.rel + '/' \
620
+ + base_filename.odt
621
+ end
622
+ self
623
+ end
624
+ def epub
625
+ def dir
626
+ output_path.epub.dir + '/' \
627
+ + base_filename.epub
628
+ end
629
+ def rel
630
+ output_path.epub.rel + '/' \
631
+ + base_filename.epub
632
+ end
633
+ self
634
+ end
635
+ def pdf_p
636
+ STDERR.puts 'ERROR not available due to multiple page format sizes'
637
+ end
638
+ def pdf_l
639
+ STDERR.puts 'ERROR not available due to multiple page format sizes'
640
+ end
641
+ def xhtml
642
+ def dir
643
+ output_path.xhtml.dir + '/' \
644
+ + base_filename.xhtml
645
+ end
646
+ def rel
647
+ output_path.xhtml.rel + '/' \
648
+ + base_filename.xhtml
649
+ end
650
+ self
651
+ end
652
+ def xml_sax
653
+ def dir
654
+ output_path.xml.dir + '/' \
655
+ + base_filename.xml_sax
656
+ end
657
+ def rel
658
+ output_path.xml.rel + '/' \
659
+ + base_filename.xml_sax
660
+ end
661
+ self
662
+ end
663
+ def xml_dom
664
+ def dir
665
+ output_path.xml.dir + '/' \
666
+ + base_filename.xml_dom
667
+ end
668
+ def rel
669
+ output_path.xml.rel + '/' \
670
+ + base_filename.xml_dom
671
+ end
672
+ self
673
+ end
674
+ def xml_docbook_book
675
+ def dir
676
+ output_path.xml_docbook.dir + '/' \
677
+ + base_filename.xml_docbook_book
678
+ end
679
+ def rel
680
+ output_path.xml_docbook.rel + '/' \
681
+ + base_filename.xml_docbook_book
682
+ end
683
+ self
684
+ end
685
+ def xml_fictionbook
686
+ def dir
687
+ output_path.xml_fictionbook.dir + '/' \
688
+ + base_filename.xml_fictionbook
689
+ end
690
+ def rel
691
+ output_path.xml_fictionbook.rel + '/' \
692
+ + base_filename.xml_fictionbook
693
+ end
694
+ self
695
+ end
696
+ def xml_scaffold_structure_sisu
697
+ def dir
698
+ output_path.xml.dir + '/' \
699
+ + base_filename.xml_scaffold_structure_sisu
700
+ end
701
+ def rel
702
+ output_path.xml.rel + '/' \
703
+ + base_filename.xml_scaffold_structure_sisu
704
+ end
705
+ self
706
+ end
707
+ def xml_scaffold_structure_collapse
708
+ def dir
709
+ output_path.xml.dir + '/' \
710
+ + base_filename.xml_scaffold_structure_collapse
711
+ end
712
+ def rel
713
+ output_path.xml.rel + '/' \
714
+ + base_filename.xml_scaffold_structure_collapse
715
+ end
716
+ self
717
+ end
718
+ def sqlite_discrete
719
+ def dir
720
+ output_path.sqlite_discrete.dir + '/' \
721
+ + base_filename.sqlite_discrete
722
+ end
723
+ def rel
724
+ output_path.sqlite_discrete.rel + '/' \
725
+ + base_filename.sqlite_discrete
726
+ end
727
+ self
728
+ end
729
+ def hash_digest
730
+ def dir
731
+ output_path.hash_digest.dir + '/' \
732
+ + base_filename.hash_digest
733
+ end
734
+ def rel
735
+ output_path.hash_digest.rel + '/' \
736
+ + base_filename.hash_digest
737
+ end
738
+ self
739
+ end
740
+ def src
741
+ def dir
742
+ output_path.src.dir + '/' \
743
+ + base_filename.src
744
+ end
745
+ def rel
746
+ output_path.src.rel + '/' \
747
+ + base_filename.src
748
+ end
749
+ self
750
+ end
751
+ def sisupod
752
+ def dir
753
+ output_path.sisupod.dir + '/' \
754
+ + base_filename.sisupod
755
+ end
756
+ def rel
757
+ output_path.sisupod.rel + '/' \
758
+ + base_filename.sisupod
759
+ end
760
+ self
761
+ end
762
+ def po
763
+ def dir
764
+ output_path.po.dir + '/' \
765
+ + base_filename.po
766
+ end
767
+ def rel
768
+ output_path.po.rel + '/' \
769
+ + base_filename.po
770
+ end
771
+ self
772
+ end
773
+ def pot
774
+ def dir
775
+ output_path.pot.dir + '/' \
776
+ + base_filename.pot
777
+ end
778
+ def rel
779
+ output_path.pot.rel + '/' \
780
+ + base_filename.pot
781
+ end
782
+ self
783
+ end
784
+ def po_git
785
+ def dir
786
+ output_path.po_git + '/' \
787
+ + base_filename.po
788
+ end
789
+ def rel
790
+ #output_path.po_git + '/' + base_filename.po
791
+ end
792
+ self
793
+ end
794
+ def pot_git
795
+ def dir
796
+ output_path.pot_git + '/' \
797
+ + base_filename.pot
798
+ end
799
+ def rel
800
+ #output_path.pot_git + '/' + base_filename.pot
801
+ end
802
+ self
803
+ end
804
+ def manpage
805
+ def dir
806
+ output_path.manpage.dir + '/' \
807
+ + base_filename.manpage
808
+ end
809
+ def rel
810
+ output_path.manpage.rel + '/' \
811
+ + base_filename.manpage
812
+ end
813
+ self
814
+ end
815
+ def texinfo
816
+ def dir
817
+ output_path.texinfo.dir + '/' \
818
+ + base_filename.texinfo
819
+ end
820
+ def rel
821
+ output_path.texinfo.rel + '/' \
822
+ + base_filename.texinfo
823
+ end
824
+ self
825
+ end
826
+ def info
827
+ def dir
828
+ output_path.texinfo.dir + '/' \
829
+ + base_filename.info
830
+ end
831
+ def rel
832
+ output_path.texinfo.rel + '/' \
833
+ + base_filename.info
834
+ end
835
+ self
836
+ end
837
+ def qrcode_title
838
+ def dir
839
+ output_path.qrcode.dir + '/' \
840
+ + base_filename.qrcode_title
841
+ end
842
+ def rel
843
+ output_path.qrcode.rel + '/' \
844
+ + base_filename.qrcode_title
845
+ end
846
+ self
847
+ end
848
+ def qrcode_md
849
+ def dir
850
+ output_path.qrcode.dir + '/' \
851
+ + base_filename.qrcode_md
852
+ end
853
+ def rel
854
+ output_path.qrcode.rel + '/' \
855
+ + base_filename.qrcode_md
856
+ end
857
+ self
858
+ end
859
+ def manifest
860
+ def dir
861
+ output_path.manifest.dir + '/' \
862
+ + base_filename.manifest
863
+ end
864
+ def rel
865
+ output_path.manifest.rel + '/' \
866
+ + base_filename.manifest
867
+ end
868
+ self
869
+ end
870
+ self
871
+ end
872
+ def base_filename
873
+ def i18n(f)
874
+ f=default_hash.merge(f)
875
+ f[:lng] ||=@md.lang_code_insert
876
+ f[:fn] + f[:lng] + f[:ft]
877
+ end
878
+ def default_hash
879
+ {
880
+ fn: @md.fnb,
881
+ lng: @md.lang_code_insert,
882
+ }
883
+ end
884
+ def default_hash_build(fh,sfx)
885
+ if fh.is_a?(Hash)
886
+ fh[:fn] ||=@md.fnb
887
+ fh[:lng] ||= @md.lang_code_insert
888
+ fh[:ft]=sfx
889
+ fh
890
+ else
891
+ {
892
+ fn: @md.fnb,
893
+ lng: @md.lang_code_insert,
894
+ ft: sfx,
895
+ }
896
+ end
897
+ end
898
+ def lang_code?(lng)
899
+ (output_dir_structure.by_language_code?) \
900
+ ? ''
901
+ : (lng ||=@md.lang_code_insert)
902
+ end
903
+ def txt(fh=nil)
904
+ fh=default_hash_build(fh,Sfx[:txt])
905
+ fh[:lng]=lang_code?(fh[:lng])
906
+ fnh=if output_dir_structure.by_filename?
907
+ {
908
+ fn: 'plain',
909
+ ft: fh[:ft],
910
+ lng: fh[:lng],
911
+ }
912
+ else
913
+ {
914
+ fn: fh[:fn],
915
+ ft: fh[:ft],
916
+ lng: fh[:lng],
917
+ }
918
+ end
919
+ i18n(fnh)
920
+ end
921
+ def textile(fh=nil)
922
+ fh=default_hash_build(fh,Sfx[:txt_textile])
923
+ fh[:lng]=lang_code?(fh[:lng])
924
+ fnh=if output_dir_structure.by_filename?
925
+ {
926
+ fn: 'plain',
927
+ ft: fh[:ft],
928
+ lng: fh[:lng],
929
+ }
930
+ else
931
+ {
932
+ fn: fh[:fn],
933
+ ft: fh[:ft],
934
+ lng: fh[:lng],
935
+ }
936
+ end
937
+ i18n(fnh)
938
+ end
939
+ def asciidoc(fh=nil)
940
+ fh=default_hash_build(fh,Sfx[:txt_asciidoc])
941
+ fh[:lng]=lang_code?(fh[:lng])
942
+ fnh=if output_dir_structure.by_filename?
943
+ {
944
+ fn: 'plain',
945
+ ft: fh[:ft],
946
+ lng: fh[:lng],
947
+ }
948
+ else
949
+ {
950
+ fn: fh[:fn],
951
+ ft: fh[:ft],
952
+ lng: fh[:lng],
953
+ }
954
+ end
955
+ i18n(fnh)
956
+ end
957
+ def markdown(fh=nil)
958
+ fh=default_hash_build(fh,Sfx[:txt_markdown])
959
+ fh[:lng]=lang_code?(fh[:lng])
960
+ fnh=if output_dir_structure.by_filename?
961
+ {
962
+ fn: 'plain',
963
+ ft: fh[:ft],
964
+ lng: fh[:lng],
965
+ }
966
+ else
967
+ {
968
+ fn: fh[:fn],
969
+ ft: fh[:ft],
970
+ lng: fh[:lng],
971
+ }
972
+ end
973
+ i18n(fnh)
974
+ end
975
+ def rst(fh=nil)
976
+ fh=default_hash_build(fh,Sfx[:txt_rst])
977
+ fh[:lng]=lang_code?(fh[:lng])
978
+ fnh=if output_dir_structure.by_filename?
979
+ {
980
+ fn: 'plain',
981
+ ft: fh[:ft],
982
+ lng: fh[:lng],
983
+ }
984
+ else
985
+ {
986
+ fn: fh[:fn],
987
+ ft: fh[:ft],
988
+ lng: fh[:lng],
989
+ }
990
+ end
991
+ i18n(fnh)
992
+ end
993
+ def orgmode(fh=nil)
994
+ fh=default_hash_build(fh,Sfx[:txt_orgmode])
995
+ fh[:lng]=lang_code?(fh[:lng])
996
+ fnh=if output_dir_structure.by_filename?
997
+ {
998
+ fn: 'plain',
999
+ ft: fh[:ft],
1000
+ lng: fh[:lng],
1001
+ }
1002
+ else
1003
+ {
1004
+ fn: fh[:fn],
1005
+ ft: fh[:ft],
1006
+ lng: fh[:lng],
1007
+ }
1008
+ end
1009
+ i18n(fnh)
1010
+ end
1011
+ def html_scroll(fh=nil)
1012
+ fh=default_hash_build(fh,Sfx[:html])
1013
+ fh[:lng]=lang_code?(fh[:lng])
1014
+ fnh=if output_dir_structure.by_filename?
1015
+ {
1016
+ fn: 'scroll',
1017
+ ft: fh[:ft],
1018
+ lng: fh[:lng],
1019
+ }
1020
+ else
1021
+ {
1022
+ fn: fh[:fn],
1023
+ ft: fh[:ft],
1024
+ lng: fh[:lng],
1025
+ }
1026
+ end
1027
+ i18n(fnh)
1028
+ end
1029
+ def html_seg_index(fh=nil)
1030
+ fh=default_hash_build(fh,Sfx[:html])
1031
+ fh[:lng]=lang_code?(fh[:lng])
1032
+ fnh={
1033
+ fn: 'index',
1034
+ ft: fh[:ft],
1035
+ lng: fh[:lng],
1036
+ }
1037
+ i18n(fnh)
1038
+ end
1039
+ def html_segtoc(fh=nil)
1040
+ fh=default_hash_build(fh,Sfx[:html])
1041
+ fnh=if output_dir_structure.dump_or_redirect?
1042
+ {
1043
+ fn: fh[:fn] + '.toc',
1044
+ ft: fh[:ft],
1045
+ }
1046
+ else
1047
+ {
1048
+ fn: 'toc',
1049
+ ft: fh[:ft],
1050
+ lng: lang_code?(fh[:lng]),
1051
+ }
1052
+ end
1053
+ i18n(fnh)
1054
+ end
1055
+ def html_seg(fh)
1056
+ fh=default_hash_build(fh,Sfx[:html])
1057
+ fh[:lng]=lang_code?(fh[:lng])
1058
+ fnh={
1059
+ fn: fh[:fn],
1060
+ ft: fh[:ft],
1061
+ lng: fh[:lng],
1062
+ }
1063
+ i18n(fnh)
1064
+ end
1065
+ def html_book_index(fh=nil)
1066
+ fh=default_hash_build(fh,Sfx[:html])
1067
+ fh[:lng]=lang_code?(fh[:lng])
1068
+ fnh={
1069
+ fn: 'book_index',
1070
+ ft: fh[:ft],
1071
+ lng: fh[:lng],
1072
+ }
1073
+ i18n(fnh)
1074
+ end
1075
+ def html_concordance(fh=nil)
1076
+ fh=default_hash_build(fh,Sfx[:html])
1077
+ fh[:lng]=lang_code?(fh[:lng])
1078
+ fnh=if output_dir_structure.dump_or_redirect?
1079
+ {
1080
+ fn: 'concordance',
1081
+ ft: fh[:ft],
1082
+ }
1083
+ else
1084
+ {
1085
+ fn: 'concordance',
1086
+ ft: fh[:ft],
1087
+ lng: fh[:lng],
1088
+ }
1089
+ end
1090
+ i18n(fnh)
1091
+ end
1092
+ def xhtml(fh=nil)
1093
+ fh=default_hash_build(fh,Sfx[:xhtml])
1094
+ fh[:lng]=lang_code?(fh[:lng])
1095
+ fnh=if output_dir_structure.by_filename?
1096
+ {
1097
+ fn: 'scroll',
1098
+ ft: fh[:ft],
1099
+ lng: fh[:lng],
1100
+ }
1101
+ else
1102
+ {
1103
+ fn: fh[:fn],
1104
+ ft: fh[:ft],
1105
+ lng: fh[:lng],
1106
+ }
1107
+ end
1108
+ i18n(fnh)
1109
+ end
1110
+ def epub(fh=nil)
1111
+ fh=default_hash_build(fh,Sfx[:epub])
1112
+ fh[:lng]=lang_code?(fh[:lng])
1113
+ fnh={
1114
+ fn: fh[:fn],
1115
+ ft: fh[:ft],
1116
+ lng: fh[:lng],
1117
+ }
1118
+ i18n(fnh)
1119
+ end
1120
+ def odt(fh=nil)
1121
+ fh=default_hash_build(fh,Sfx[:odt])
1122
+ fh[:lng]=lang_code?(fh[:lng])
1123
+ fnh=if output_dir_structure.by_filename?
1124
+ {
1125
+ fn: 'opendocument',
1126
+ ft: fh[:ft],
1127
+ lng: fh[:lng],
1128
+ }
1129
+ else
1130
+ {
1131
+ fn: fh[:fn],
1132
+ ft: fh[:ft],
1133
+ lng: fh[:lng],
1134
+ }
1135
+ end
1136
+ i18n(fnh)
1137
+ end
1138
+ def xml_sax(fh=nil)
1139
+ fh=default_hash_build(fh,Sfx[:xml_sax])
1140
+ fh[:lng]=lang_code?(fh[:lng])
1141
+ fnh=if output_dir_structure.by_filename?
1142
+ {
1143
+ fn: 'scroll',
1144
+ ft: fh[:ft],
1145
+ lng: fh[:lng],
1146
+ }
1147
+ else
1148
+ {
1149
+ fn: fh[:fn],
1150
+ ft: fh[:ft],
1151
+ lng: fh[:lng],
1152
+ }
1153
+ end
1154
+ i18n(fnh)
1155
+ end
1156
+ def xml_dom(fh=nil)
1157
+ fh=default_hash_build(fh,Sfx[:xml_dom])
1158
+ fh[:lng]=lang_code?(fh[:lng])
1159
+ fnh=if output_dir_structure.by_filename?
1160
+ {
1161
+ fn: 'scroll',
1162
+ ft: fh[:ft],
1163
+ lng: fh[:lng],
1164
+ }
1165
+ else
1166
+ {
1167
+ fn: fh[:fn],
1168
+ ft: fh[:ft],
1169
+ lng: fh[:lng],
1170
+ }
1171
+ end
1172
+ i18n(fnh)
1173
+ end
1174
+ def xml_docbook_book(fh=nil)
1175
+ fh=default_hash_build(fh,Sfx[:xml_docbook_book])
1176
+ fh[:lng]=lang_code?(fh[:lng])
1177
+ fnh=if output_dir_structure.by_filename?
1178
+ {
1179
+ fn: 'scroll',
1180
+ ft: fh[:ft],
1181
+ lng: fh[:lng],
1182
+ }
1183
+ else
1184
+ {
1185
+ fn: fh[:fn],
1186
+ ft: fh[:ft],
1187
+ lng: fh[:lng],
1188
+ }
1189
+ end
1190
+ i18n(fnh)
1191
+ end
1192
+ def xml_fictionbook(fh=nil)
1193
+ fh=default_hash_build(fh,Sfx[:xml_fictionbook])
1194
+ fh[:lng]=lang_code?(fh[:lng])
1195
+ fnh=if output_dir_structure.by_filename?
1196
+ {
1197
+ fn: 'scroll',
1198
+ ft: fh[:ft],
1199
+ lng: fh[:lng],
1200
+ }
1201
+ else
1202
+ {
1203
+ fn: fh[:fn],
1204
+ ft: fh[:ft],
1205
+ lng: fh[:lng],
1206
+ }
1207
+ end
1208
+ i18n(fnh)
1209
+ end
1210
+ def xml_scaffold_structure_sisu(fh=nil)
1211
+ fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu])
1212
+ fh[:lng]=lang_code?(fh[:lng])
1213
+ fnh=if output_dir_structure.by_filename?
1214
+ {
1215
+ fn: 'scroll',
1216
+ ft: fh[:ft],
1217
+ lng: fh[:lng],
1218
+ }
1219
+ else
1220
+ {
1221
+ fn: fh[:fn],
1222
+ ft: fh[:ft],
1223
+ lng: fh[:lng],
1224
+ }
1225
+ end
1226
+ i18n(fnh)
1227
+ end
1228
+ def xml_scaffold_structure_collapse(fh=nil)
1229
+ fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse])
1230
+ fh[:lng]=lang_code?(fh[:lng])
1231
+ fnh=if output_dir_structure.by_filename?
1232
+ {
1233
+ fn: 'scroll',
1234
+ ft: fh[:ft],
1235
+ lng: fh[:lng],
1236
+ }
1237
+ else
1238
+ {
1239
+ fn: fh[:fn],
1240
+ ft: fh[:ft],
1241
+ lng: fh[:lng],
1242
+ }
1243
+ end
1244
+ i18n(fnh)
1245
+ end
1246
+ def pdf_p(fh=nil)
1247
+ fh=default_hash_build(fh,Sfx[:pdf])
1248
+ fh[:lng]=lang_code?(fh[:lng])
1249
+ if output_dir_structure.by_filename?
1250
+ 'portrait' + fh[:lng] + '.'
1251
+ else
1252
+ fh[:fn] + '.portrait' + fh[:lng] + '.'
1253
+ end
1254
+ end
1255
+ def pdf_l(fh=nil)
1256
+ fh=default_hash_build(fh,Sfx[:pdf])
1257
+ fh[:lng]=lang_code?(fh[:lng])
1258
+ if output_dir_structure.by_filename?
1259
+ 'landscape' + fh[:lng] + '.'
1260
+ else
1261
+ fh[:fn] + '.landscape' + fh[:lng] + '.'
1262
+ end
1263
+ end
1264
+ def pdf_p_a4(fh=nil)
1265
+ pdf_p(fh) + @md.fn[:pdf_p_a4]
1266
+ end
1267
+ def pdf_p_a5(fh=nil)
1268
+ pdf_p(fh) + @md.fn[:pdf_p_a5]
1269
+ end
1270
+ def pdf_p_b5(fh=nil)
1271
+ pdf_p(fh) + @md.fn[:pdf_p_b5]
1272
+ end
1273
+ def pdf_p_letter(fh=nil)
1274
+ pdf_p(fh) + @md.fn[:pdf_p_letter]
1275
+ end
1276
+ def pdf_p_legal(fh=nil)
1277
+ pdf_p(fh) + @md.fn[:pdf_p_legal]
1278
+ end
1279
+ def pdf_l_a4(fh=nil)
1280
+ pdf_l(fh) + @md.fn[:pdf_l_a4]
1281
+ end
1282
+ def pdf_l_a5(fh=nil)
1283
+ pdf_l(fh) + @md.fn[:pdf_l_a5]
1284
+ end
1285
+ def pdf_l_b5(fh=nil)
1286
+ pdf_l(fh) + @md.fn[:pdf_l_b5]
1287
+ end
1288
+ def pdf_l_letter(fh=nil)
1289
+ pdf_l(fh) + @md.fn[:pdf_l_letter]
1290
+ end
1291
+ def pdf_l_legal(fh=nil)
1292
+ pdf_l(fh) + @md.fn[:pdf_l_legal]
1293
+ end
1294
+ def manpage(fh=nil)
1295
+ fh=default_hash_build(fh,Sfx[:manpage])
1296
+ fh[:lng]=lang_code?(fh[:lng])
1297
+ fnh={
1298
+ fn: fh[:fn],
1299
+ ft: fh[:ft],
1300
+ lng: fh[:lng],
1301
+ }
1302
+ i18n(fnh)
1303
+ end
1304
+ def info(fh=nil)
1305
+ fh=default_hash_build(fh,Sfx[:info])
1306
+ fh[:lng]=lang_code?(fh[:lng])
1307
+ fnh={
1308
+ fn: fh[:fn],
1309
+ ft: fh[:ft],
1310
+ lng: fh[:lng],
1311
+ }
1312
+ i18n(fnh)
1313
+ end
1314
+ def texinfo(fh=nil)
1315
+ fh=default_hash_build(fh,Sfx[:texinfo])
1316
+ fh[:lng]=lang_code?(fh[:lng])
1317
+ fnh={
1318
+ fn: fh[:fn],
1319
+ ft: fh[:ft],
1320
+ lng: fh[:lng],
1321
+ }
1322
+ i18n(fnh)
1323
+ end
1324
+ def sqlite_discrete(fh=nil)
1325
+ fh=default_hash_build(fh,Sfx[:sql])
1326
+ fh[:lng]=lang_code?(fh[:lng])
1327
+ fnh={
1328
+ fn: fh[:fn],
1329
+ ft: fh[:ft],
1330
+ lng: fh[:lng],
1331
+ }
1332
+ i18n(fnh)
1333
+ end
1334
+ def hash_digest(fh=nil)
1335
+ fh=default_hash_build(fh,Sfx[:txt])
1336
+ fh[:lng]=lang_code?(fh[:lng])
1337
+ fnh=if output_dir_structure.by_language_code?
1338
+ {
1339
+ fn: fh[:fn] + '.hash_digest',
1340
+ ft: fh[:ft],
1341
+ }
1342
+ elsif output_dir_structure.by_filetype?
1343
+ {
1344
+ fn: fh[:fn],
1345
+ ft: fh[:ft],
1346
+ lng: fh[:lng],
1347
+ }
1348
+ else
1349
+ {
1350
+ fn: 'digest',
1351
+ ft: fh[:ft],
1352
+ lng: fh[:lng],
1353
+ }
1354
+ end
1355
+ i18n(fnh)
1356
+ end
1357
+ def sitemap(fh=nil)
1358
+ fh=default_hash_build(fh,Sfx[:xml])
1359
+ fh[:lng]=lang_code?(fh[:lng])
1360
+ fnh=if output_dir_structure.by_language_code?
1361
+ {
1362
+ fn: fh[:fn] + '.sitemap',
1363
+ ft: fh[:ft],
1364
+ }
1365
+ elsif output_dir_structure.by_filetype?
1366
+ {
1367
+ fn: fh[:fn],
1368
+ ft: fh[:ft],
1369
+ lng: fh[:lng],
1370
+ }
1371
+ else
1372
+ {
1373
+ fn: 'sitemap',
1374
+ ft: fh[:ft],
1375
+ lng: fh[:lng],
1376
+ }
1377
+ end
1378
+ i18n(fnh)
1379
+ end
1380
+ def qrcode_title(fh=nil)
1381
+ fh=default_hash_build(fh,'.title.png')
1382
+ fh[:lng]=lang_code?(fh[:lng])
1383
+ fnh=if output_dir_structure.by_filename?
1384
+ {
1385
+ fn: 'sisu_manifest',
1386
+ ft: fh[:ft],
1387
+ lng: fh[:lng],
1388
+ }
1389
+ else
1390
+ {
1391
+ fn: fh[:fn],
1392
+ ft: fh[:ft],
1393
+ lng: fh[:lng],
1394
+ }
1395
+ end
1396
+ i18n(fnh)
1397
+ end
1398
+ def qrcode_md #check name below
1399
+ fh=default_hash_build(fh,'.md.png')
1400
+ fh[:lng]=lang_code?(fh[:lng])
1401
+ fnh=if output_dir_structure.by_filename?
1402
+ {
1403
+ fn: 'sisu_manifest',
1404
+ ft: fh[:ft],
1405
+ lng: fh[:lng],
1406
+ }
1407
+ else
1408
+ {
1409
+ fn: fh[:fn],
1410
+ ft: fh[:ft],
1411
+ lng: fh[:lng],
1412
+ }
1413
+ end
1414
+ i18n(fnh)
1415
+ end
1416
+ def manifest_txt(fh=nil)
1417
+ fh=default_hash_build(fh,Sfx[:txt])
1418
+ fh[:lng]=lang_code?(fh[:lng])
1419
+ fnh=if output_dir_structure.by_filename?
1420
+ {
1421
+ fn: 'sisu_manifest',
1422
+ ft: fh[:ft],
1423
+ lng: fh[:lng],
1424
+ }
1425
+ else
1426
+ {
1427
+ fn: fh[:fn],
1428
+ ft: fh[:ft],
1429
+ lng: fh[:lng],
1430
+ }
1431
+ end
1432
+ i18n(fnh)
1433
+ end
1434
+ def manifest(fh=nil)
1435
+ fh=default_hash_build(fh,Sfx[:html])
1436
+ fh[:lng]=lang_code?(fh[:lng])
1437
+ fnh=if output_dir_structure.dump_or_redirect?
1438
+ {
1439
+ fn: fh[:fn] + '.manifest',
1440
+ ft: fh[:ft],
1441
+ lng: fh[:lng],
1442
+ }
1443
+ elsif output_dir_structure.by_filename?
1444
+ {
1445
+ fn: 'sisu_manifest',
1446
+ ft: fh[:ft],
1447
+ lng: fh[:lng],
1448
+ }
1449
+ else
1450
+ {
1451
+ fn: fh[:fn],
1452
+ ft: fh[:ft],
1453
+ lng: fh[:lng],
1454
+ }
1455
+ end
1456
+ i18n(fnh)
1457
+ end
1458
+ def src
1459
+ @md.fno
1460
+ end
1461
+ def po4a_cfg
1462
+ 'po4a.cfg'
1463
+ end
1464
+ def po #check
1465
+ (@fno.empty?) \
1466
+ ? (@md.fn[:po])
1467
+ : (@fno + '.po')
1468
+ end
1469
+ def pot
1470
+ (@fno.empty?) \
1471
+ ? (@md.fn[:pot])
1472
+ : (@fno + '.pot')
1473
+ end
1474
+ def po4a_sst #check
1475
+ @fno
1476
+ end
1477
+ def sisupod
1478
+ (@md.fns =~/\.ssm\.sst$/) \
1479
+ ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz')
1480
+ : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz')
1481
+ end
1482
+ self
1483
+ end
1484
+ def set_path(ft)
1485
+ @ft=ft
1486
+ def dir
1487
+ def abc
1488
+ if output_dir_structure.redirect?
1489
+ @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb
1490
+ elsif output_dir_structure.dump?
1491
+ @md.opt.opt_act[:dump][:inst]
1492
+ elsif output_dir_structure.by_language_code?
1493
+ output_path.base.dir + '/' + @md.opt.lng + '/' + @ft
1494
+ elsif output_dir_structure.by_filetype?
1495
+ output_path.base.dir + '/' + @ft
1496
+ else
1497
+ output_path.base.dir + '/' + @md.fnb
1498
+ end
1499
+ end
1500
+ def ab
1501
+ if output_dir_structure.redirect?
1502
+ @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb
1503
+ elsif output_dir_structure.dump?
1504
+ @md.opt.opt_act[:dump][:inst]
1505
+ elsif output_dir_structure.by_language_code?
1506
+ output_path.base.dir + '/' + @md.opt.lng + '/' + @ft
1507
+ else
1508
+ output_path.base.dir + '/' + @ft
1509
+ end
1510
+ end
1511
+ def ab_src
1512
+ if output_dir_structure.redirect?
1513
+ @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb
1514
+ elsif output_dir_structure.dump?
1515
+ @md.opt.opt_act[:dump][:inst]
1516
+ else
1517
+ output_path.base.dir + '/' \
1518
+ + @ft + '/' \
1519
+ + @md.opt.fng + '/' \
1520
+ + Gt[:sisupod] + '/' \
1521
+ + Gt[:doc] + '/' \
1522
+ + @md.opt.lng
1523
+ end
1524
+ end
1525
+ def ab_pod
1526
+ if output_dir_structure.redirect?
1527
+ @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb
1528
+ elsif output_dir_structure.dump?
1529
+ @md.opt.opt_act[:dump][:inst]
1530
+ else
1531
+ output_path.base.dir + '/' + @ft
1532
+ end
1533
+ end
1534
+ self
1535
+ end
1536
+ def url
1537
+ def abc
1538
+ if output_dir_structure.by_language_code?
1539
+ output_path.base.url + '/' + @md.opt.lng + '/' + @ft
1540
+ elsif output_dir_structure.by_filetype?
1541
+ output_path.base.url + '/' + @ft
1542
+ else
1543
+ output_path.base.url + '/' + @md.fnb
1544
+ end
1545
+ end
1546
+ def ab
1547
+ if output_dir_structure.by_language_code?
1548
+ output_path.base.url + '/' + @md.opt.lng + '/' + @ft
1549
+ else
1550
+ output_path.base.url + '/' + @ft
1551
+ end
1552
+ end
1553
+ def ab_src
1554
+ output_path.base.url + '/' \
1555
+ + @ft + '/' \
1556
+ + @md.opt.fng + '/' \
1557
+ + Gt[:sisupod] + '/' \
1558
+ + Gt[:doc] + '/' \
1559
+ + @md.opt.lng
1560
+ end
1561
+ def ab_pod
1562
+ output_path.base.url + '/' + @ft
1563
+ end
1564
+ self
1565
+ end
1566
+ def rel
1567
+ def abc
1568
+ if output_dir_structure.by_language_code?
1569
+ @md.opt.lng + '/' + @ft
1570
+ elsif output_dir_structure.by_filetype?
1571
+ @ft
1572
+ else
1573
+ @md.fnb
1574
+ end
1575
+ end
1576
+ def ab
1577
+ if output_dir_structure.by_language_code?
1578
+ @md.opt.lng + '/' + @ft
1579
+ else
1580
+ @ft
1581
+ end
1582
+ end
1583
+ def ab_src
1584
+ @ft
1585
+ end
1586
+ def ab_pod
1587
+ @ft
1588
+ end
1589
+ self
1590
+ end
1591
+ def rel_sm
1592
+ def abc
1593
+ if output_dir_structure.by_language_code?
1594
+ @md.opt.lng + '/' + @ft
1595
+ elsif output_dir_structure.by_filetype?
1596
+ @ft
1597
+ else
1598
+ @md.fnb
1599
+ end
1600
+ end
1601
+ def ab
1602
+ if output_dir_structure.dump_or_redirect?
1603
+ '.'
1604
+ elsif output_dir_structure.by_language_code? \
1605
+ or output_dir_structure.by_filetype?
1606
+ '../' + @ft
1607
+ else '.'
1608
+ end
1609
+ end
1610
+ def ab_src
1611
+ locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
1612
+ if output_dir_structure.dump_or_redirect?
1613
+ '.'
1614
+ elsif output_dir_structure.by_language_code?
1615
+ '../../' + locate
1616
+ else
1617
+ '../' + locate
1618
+ end
1619
+ end
1620
+ def ab_pod
1621
+ if output_dir_structure.dump_or_redirect?
1622
+ '.'
1623
+ elsif output_dir_structure.by_language_code?
1624
+ '../../' + @ft
1625
+ else
1626
+ '../' + @ft
1627
+ end
1628
+ end
1629
+ self
1630
+ end
1631
+ def rcp
1632
+ def abc
1633
+ if output_dir_structure.by_language_code?
1634
+ output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft
1635
+ elsif output_dir_structure.by_filetype?
1636
+ output_path.stub.rcp + '/' + @ft
1637
+ else
1638
+ output_path.stub.rcp + '/' + @md.fnb
1639
+ end
1640
+ end
1641
+ def ab
1642
+ if output_dir_structure.by_language_code?
1643
+ output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft
1644
+ else
1645
+ output_path.stub.rcp + '/' + @ft
1646
+ end
1647
+ end
1648
+ self
1649
+ end
1650
+ self
1651
+ end
1652
+ def output_path
1653
+ def web_base
1654
+ def dir
1655
+ @env.path.webserv
1656
+ end
1657
+ def url
1658
+ #"#{@env.url.root}"
1659
+ end
1660
+ def rel
1661
+ '.'
1662
+ end
1663
+ def rcp
1664
+ '.'
1665
+ end
1666
+ self
1667
+ end
1668
+ def stub
1669
+ def dir
1670
+ @md.opt.f_pth[:pth_stub]
1671
+ end
1672
+ #def url
1673
+ # "#{@env.url.root}"
1674
+ #end
1675
+ def rel
1676
+ './' + @md.opt.f_pth[:pth_stub]
1677
+ end
1678
+ def rcp
1679
+ @md.opt.f_pth[:pth_stub]
1680
+ end
1681
+ self
1682
+ end
1683
+ def webserver_path
1684
+ if output_dir_structure.dump?
1685
+ @md.opt.opt_act[:dump][:inst]
1686
+ elsif output_dir_structure.redirect?
1687
+ @md.opt.opt_act[:redirect][:inst]
1688
+ else
1689
+ @env.path.webserv
1690
+ end
1691
+ end
1692
+ def base
1693
+ def dir
1694
+ webserver_path + '/' + @md.opt.f_pth[:pth_stub]
1695
+ end
1696
+ def url
1697
+ @env.url.webserv + '/' + @md.opt.f_pth[:pth_stub]
1698
+ end
1699
+ def rel
1700
+ './' + @md.opt.f_pth[:pth_stub]
1701
+ end
1702
+ def rcp
1703
+ './' + @md.opt.f_pth[:pth_stub]
1704
+ end
1705
+ self
1706
+ end
1707
+ def sisugit
1708
+ def dir
1709
+ output_path.base.dir + '/git'
1710
+ end
1711
+ def url
1712
+ output_path.base.url + '/git'
1713
+ end
1714
+ def rel
1715
+ output_path.base.rel + '/git'
1716
+ end
1717
+ def rcp
1718
+ output_path.base.rcp + '/git'
1719
+ end
1720
+ self
1721
+ end
1722
+ #def pod
1723
+ # ft='pod'
1724
+ # path=set_path(ft).dir.ab
1725
+ #end
1726
+ def src
1727
+ def ft
1728
+ Gt[:src]
1729
+ end
1730
+ def dir
1731
+ set_path(ft).dir.ab_src
1732
+ end
1733
+ def url
1734
+ set_path(ft).url.ab_src
1735
+ end
1736
+ def rel
1737
+ set_path(ft).rel.ab_src
1738
+ end
1739
+ def rcp
1740
+ set_path(ft).rcp.ab_src
1741
+ end
1742
+ def rel_sm
1743
+ set_path(ft).rel_sm.ab_src
1744
+ end
1745
+ self
1746
+ end
1747
+ def sisupod
1748
+ def ft
1749
+ Gt[:src]
1750
+ end
1751
+ def dir
1752
+ set_path(ft).dir.ab_pod
1753
+ end
1754
+ def url
1755
+ set_path(ft).url.ab_pod
1756
+ end
1757
+ def rel
1758
+ set_path(ft).rel.ab_pod
1759
+ end
1760
+ def rcp
1761
+ set_path(ft).rcp.ab_pod
1762
+ end
1763
+ def rel_sm
1764
+ set_path(ft).rel_sm.ab_pod
1765
+ end
1766
+ self
1767
+ end
1768
+ def po4a
1769
+ def dir
1770
+ output_path.base.dir + '/' \
1771
+ + Gt[:src] + '/' \
1772
+ + @md.opt.fng + '/po4a'
1773
+ end
1774
+ def url
1775
+ output_path.base.url + '/po4a/' \
1776
+ + @md.fnb
1777
+ end
1778
+ def rcp
1779
+ #p "#{output_path.base.dir}/po4a/#{@md.fnb}"
1780
+ end
1781
+ self
1782
+ end
1783
+ def po(lng=@md.opt.lng)
1784
+ @lng=lng
1785
+ def dir
1786
+ output_path.base.dir + '/' \
1787
+ + Gt[:src] + '/' \
1788
+ + @md.opt.fng + '/po4a/po/' \
1789
+ + @lng
1790
+ end
1791
+ def url
1792
+ output_path.base.url + '/po4a/' \
1793
+ + @md.fnb + '/po/' \
1794
+ + @lng
1795
+ end
1796
+ self
1797
+ end
1798
+ def pot
1799
+ def dir
1800
+ output_path.base.dir + '/' \
1801
+ + Gt[:src] + '/' \
1802
+ + @md.opt.fng + '/po4a/pot'
1803
+ end
1804
+ def url
1805
+ output_path.base.url + '/po4a/' \
1806
+ + @md.fnb + '/pot'
1807
+ end
1808
+ def rcp
1809
+ #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot"
1810
+ end
1811
+ self
1812
+ end
1813
+ def po_git # consider !!!
1814
+ def ft
1815
+ Gt[:po]
1816
+ end
1817
+ def dir
1818
+ pth=@env.processing_path.git + '/' \
1819
+ + @md.fnb + '/' \
1820
+ + ft + '/' \
1821
+ + @md.opt.lng
1822
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
1823
+ pth
1824
+ end
1825
+ self
1826
+ end
1827
+ def pot_git # consider !!!
1828
+ def ft
1829
+ Gt[:pot]
1830
+ end
1831
+ def dir
1832
+ @env.processing_path.git + '/' \
1833
+ + @md.fnb + '/' \
1834
+ + ft
1835
+ end
1836
+ self
1837
+ end
1838
+ def po4a_sst(lng=@md.opt.lng)
1839
+ @lng=lng
1840
+ def dir
1841
+ output_path.base.dir + '/' \
1842
+ + Gt[:src] + '/' \
1843
+ + @md.opt.fng + '/po4a/' \
1844
+ + @lng
1845
+ end
1846
+ def url
1847
+ output_path.base.url + '/po4a/' \
1848
+ + @md.fnb \
1849
+ + @lng
1850
+ end
1851
+ self
1852
+ end
1853
+ def md_harvest
1854
+ manifest
1855
+ self
1856
+ end
1857
+ def txt
1858
+ def ft
1859
+ 'txt'
1860
+ end
1861
+ def dir
1862
+ set_path(ft).dir.abc
1863
+ end
1864
+ def url
1865
+ set_path(ft).url.abc
1866
+ end
1867
+ def rel
1868
+ set_path(ft).rel.abc
1869
+ end
1870
+ def rcp
1871
+ set_path(ft).rcp.abc
1872
+ end
1873
+ def rel_sm
1874
+ set_path(ft).rel_sm.ab
1875
+ end
1876
+ self
1877
+ end
1878
+ def textile
1879
+ def ft
1880
+ 'textile' \
1881
+ + DEVELOPER[:under_construction]
1882
+ end
1883
+ def dir
1884
+ set_path(ft).dir.abc
1885
+ end
1886
+ def url
1887
+ set_path(ft).url.abc
1888
+ end
1889
+ def rel
1890
+ set_path(ft).rel.abc
1891
+ end
1892
+ def rcp
1893
+ set_path(ft).rcp.abc
1894
+ end
1895
+ def rel_sm
1896
+ set_path(ft).rel_sm.ab
1897
+ end
1898
+ self
1899
+ end
1900
+ def asciidoc
1901
+ def ft
1902
+ 'asciidoc' \
1903
+ + DEVELOPER[:under_construction]
1904
+ end
1905
+ def dir
1906
+ set_path(ft).dir.abc
1907
+ end
1908
+ def url
1909
+ set_path(ft).url.abc
1910
+ end
1911
+ def rel
1912
+ set_path(ft).rel.abc
1913
+ end
1914
+ def rcp
1915
+ set_path(ft).rcp.abc
1916
+ end
1917
+ def rel_sm
1918
+ set_path(ft).rel_sm.ab
1919
+ end
1920
+ self
1921
+ end
1922
+ def markdown
1923
+ def ft
1924
+ 'markdown' \
1925
+ + DEVELOPER[:under_construction]
1926
+ end
1927
+ def dir
1928
+ set_path(ft).dir.abc
1929
+ end
1930
+ def url
1931
+ set_path(ft).url.abc
1932
+ end
1933
+ def rel
1934
+ set_path(ft).rel.abc
1935
+ end
1936
+ def rcp
1937
+ set_path(ft).rcp.abc
1938
+ end
1939
+ def rel_sm
1940
+ set_path(ft).rel_sm.ab
1941
+ end
1942
+ self
1943
+ end
1944
+ def rst
1945
+ def ft
1946
+ 'rst' \
1947
+ + DEVELOPER[:under_construction]
1948
+ end
1949
+ def dir
1950
+ set_path(ft).dir.abc
1951
+ end
1952
+ def url
1953
+ set_path(ft).url.abc
1954
+ end
1955
+ def rel
1956
+ set_path(ft).rel.abc
1957
+ end
1958
+ def rcp
1959
+ set_path(ft).rcp.abc
1960
+ end
1961
+ def rel_sm
1962
+ set_path(ft).rel_sm.ab
1963
+ end
1964
+ self
1965
+ end
1966
+ def orgmode
1967
+ def ft
1968
+ 'orgmode' \
1969
+ + DEVELOPER[:under_construction]
1970
+ end
1971
+ def dir
1972
+ set_path(ft).dir.abc
1973
+ end
1974
+ def url
1975
+ set_path(ft).url.abc
1976
+ end
1977
+ def rel
1978
+ set_path(ft).rel.abc
1979
+ end
1980
+ def rcp
1981
+ set_path(ft).rcp.abc
1982
+ end
1983
+ def rel_sm
1984
+ set_path(ft).rel_sm.ab
1985
+ end
1986
+ self
1987
+ end
1988
+ def html_scroll
1989
+ def ft
1990
+ 'html'
1991
+ end
1992
+ def dir
1993
+ set_path(ft).dir.abc
1994
+ end
1995
+ def url
1996
+ set_path(ft).url.abc
1997
+ end
1998
+ def rel
1999
+ set_path(ft).rel.abc
2000
+ end
2001
+ def rcp
2002
+ set_path(ft).rcp.abc
2003
+ end
2004
+ def rel_sm
2005
+ set_path(ft).rel_sm.ab
2006
+ end
2007
+ def rel_image
2008
+ if output_dir_structure.dump_or_redirect?
2009
+ './image'
2010
+ elsif output_dir_structure.by_language_code?
2011
+ '../../_sisu/image'
2012
+ elsif output_dir_structure.by_filetype?
2013
+ '../_sisu/image'
2014
+ else
2015
+ '../_sisu/image'
2016
+ end
2017
+ end
2018
+ self
2019
+ end
2020
+ def html_seg
2021
+ def ft
2022
+ 'html/' + @md.fnb
2023
+ end
2024
+ def dir
2025
+ set_path(ft).dir.abc
2026
+ end
2027
+ def url
2028
+ set_path(ft).url.abc
2029
+ end
2030
+ def rel
2031
+ set_path(ft).rel.abc
2032
+ end
2033
+ def rcp
2034
+ set_path(ft).rcp.abc
2035
+ end
2036
+ def rel_sm
2037
+ set_path(ft).rel_sm.ab
2038
+ end
2039
+ def rel_image
2040
+ if output_dir_structure.dump_or_redirect?
2041
+ './image'
2042
+ elsif output_dir_structure.by_language_code?
2043
+ '../../../_sisu/image'
2044
+ elsif output_dir_structure.by_filetype?
2045
+ '../../_sisu/image'
2046
+ else
2047
+ '../_sisu/image'
2048
+ end
2049
+ end
2050
+ self
2051
+ end
2052
+ def html_concordance
2053
+ html_seg
2054
+ self
2055
+ end
2056
+ def html
2057
+ def ft
2058
+ 'html'
2059
+ end
2060
+ def dir
2061
+ set_path(ft).dir.abc
2062
+ end
2063
+ def url
2064
+ set_path(ft).url.abc
2065
+ end
2066
+ def rel
2067
+ set_path(ft).url.abc
2068
+ end
2069
+ def rcp
2070
+ set_path(ft).rcp.abc
2071
+ end
2072
+ def rel_sm
2073
+ set_path(ft).rel_sm.ab
2074
+ end
2075
+ def rel_image
2076
+ if output_dir_structure.by_language_code?
2077
+ '../../_sisu/image'
2078
+ elsif output_dir_structure.by_filetype?
2079
+ '../_sisu/image'
2080
+ else
2081
+ '../_sisu/image'
2082
+ end
2083
+ end
2084
+ self
2085
+ end
2086
+ def xhtml
2087
+ def ft
2088
+ 'xhtml'
2089
+ end
2090
+ def dir
2091
+ set_path(ft).dir.abc
2092
+ end
2093
+ def url
2094
+ set_path(ft).url.abc
2095
+ end
2096
+ def rel
2097
+ set_path(ft).rel.abc
2098
+ end
2099
+ def rcp
2100
+ set_path(ft).rcp.abc
2101
+ end
2102
+ def rel_sm
2103
+ set_path(ft).rel_sm.ab
2104
+ end
2105
+ def rel_image
2106
+ '../../_sisu/image'
2107
+ end
2108
+ self
2109
+ end
2110
+ def epub
2111
+ def ft
2112
+ 'epub'
2113
+ end
2114
+ def dir
2115
+ set_path(ft).dir.ab
2116
+ end
2117
+ def url
2118
+ set_path(ft).url.ab
2119
+ end
2120
+ def rel
2121
+ set_path(ft).rel.ab
2122
+ end
2123
+ def rcp
2124
+ set_path(ft).rcp.ab
2125
+ end
2126
+ def rel_sm
2127
+ set_path(ft).rel_sm.ab
2128
+ end
2129
+ def rel_image
2130
+ './image'
2131
+ end
2132
+ self
2133
+ end
2134
+ def odt
2135
+ def ft
2136
+ 'odt'
2137
+ end
2138
+ def dir
2139
+ set_path(ft).dir.abc
2140
+ end
2141
+ def url
2142
+ set_path(ft).url.abc
2143
+ end
2144
+ def rel
2145
+ set_path(ft).rel.abc
2146
+ end
2147
+ def rcp
2148
+ set_path(ft).rcp.abc
2149
+ end
2150
+ def rel_sm
2151
+ set_path(ft).rel_sm.ab
2152
+ end
2153
+ self
2154
+ end
2155
+ def xml
2156
+ def ft
2157
+ 'xml'
2158
+ end
2159
+ def dir
2160
+ set_path(ft).dir.abc
2161
+ end
2162
+ def url
2163
+ set_path(ft).url.abc
2164
+ end
2165
+ def rel
2166
+ set_path(ft).rel.abc
2167
+ end
2168
+ def rcp
2169
+ set_path(ft).rcp.abc
2170
+ end
2171
+ def rel_sm
2172
+ set_path(ft).rel_sm.ab
2173
+ end
2174
+ def rel_image
2175
+ '../../_sisu/image'
2176
+ end
2177
+ self
2178
+ end
2179
+ def xml_sax
2180
+ xml
2181
+ self
2182
+ end
2183
+ def xml_dom
2184
+ xml
2185
+ self
2186
+ end
2187
+ def xml_docbook
2188
+ def ft
2189
+ 'docbook'
2190
+ end
2191
+ def dir
2192
+ set_path(ft).dir.abc
2193
+ end
2194
+ def url
2195
+ set_path(ft).url.abc
2196
+ end
2197
+ def rel
2198
+ set_path(ft).rel.abc
2199
+ end
2200
+ def rcp
2201
+ set_path(ft).rcp.abc
2202
+ end
2203
+ def rel_sm
2204
+ set_path(ft).rel_sm.ab
2205
+ end
2206
+ def rel_image
2207
+ '../../_sisu/image'
2208
+ end
2209
+ self
2210
+ end
2211
+ def xml_docbook_article
2212
+ def ft
2213
+ 'docbook' \
2214
+ + DEVELOPER[:under_construction]
2215
+ end
2216
+ def dir
2217
+ set_path(ft).dir.abc
2218
+ end
2219
+ def url
2220
+ set_path(ft).url.abc
2221
+ end
2222
+ def rel
2223
+ set_path(ft).rel.abc
2224
+ end
2225
+ def rcp
2226
+ set_path(ft).rcp.abc
2227
+ end
2228
+ def rel_sm
2229
+ set_path(ft).rel_sm.ab
2230
+ end
2231
+ def rel_image
2232
+ '../../_sisu/image'
2233
+ end
2234
+ self
2235
+ end
2236
+ def xml_docbook_book
2237
+ def ft
2238
+ 'docbook'
2239
+ end
2240
+ def dir
2241
+ set_path(ft).dir.abc
2242
+ end
2243
+ def url
2244
+ set_path(ft).url.abc
2245
+ end
2246
+ def rel
2247
+ set_path(ft).rel.abc
2248
+ end
2249
+ def rcp
2250
+ set_path(ft).rcp.abc
2251
+ end
2252
+ def rel_sm
2253
+ set_path(ft).rel_sm.ab
2254
+ end
2255
+ def rel_image
2256
+ '../../_sisu/image'
2257
+ end
2258
+ self
2259
+ end
2260
+ def xml_fictionbook
2261
+ def ft
2262
+ 'fictionbook' \
2263
+ + DEVELOPER[:under_construction]
2264
+ end
2265
+ def dir
2266
+ set_path(ft).dir.abc
2267
+ end
2268
+ def url
2269
+ set_path(ft).url.abc
2270
+ end
2271
+ def rel
2272
+ set_path(ft).rel.abc
2273
+ end
2274
+ def rcp
2275
+ set_path(ft).rcp.abc
2276
+ end
2277
+ def rel_sm
2278
+ set_path(ft).rel_sm.ab
2279
+ end
2280
+ def rel_image
2281
+ '../../_sisu/image'
2282
+ end
2283
+ self
2284
+ end
2285
+ def xml_scaffold_structure_sisu
2286
+ def ft
2287
+ 'sisu.scaffold.xml'
2288
+ #'xml'
2289
+ end
2290
+ def dir
2291
+ set_path(ft).dir.abc
2292
+ end
2293
+ def url
2294
+ set_path(ft).url.abc
2295
+ end
2296
+ def rel
2297
+ set_path(ft).rel.abc
2298
+ end
2299
+ def rcp
2300
+ set_path(ft).rcp.abc
2301
+ end
2302
+ def rel_sm
2303
+ set_path(ft).rel_sm.ab
2304
+ end
2305
+ def rel_image
2306
+ '../../_sisu/image'
2307
+ end
2308
+ self
2309
+ end
2310
+ def xml_scaffold_structure_collapse
2311
+ def ft
2312
+ 'collapsed.scaffold.xml'
2313
+ #'xml'
2314
+ end
2315
+ def dir
2316
+ set_path(ft).dir.abc
2317
+ end
2318
+ def url
2319
+ set_path(ft).url.abc
2320
+ end
2321
+ def rel
2322
+ set_path(ft).rel.abc
2323
+ end
2324
+ def rcp
2325
+ set_path(ft).rcp.abc
2326
+ end
2327
+ def rel_sm
2328
+ set_path(ft).rel_sm.ab
2329
+ end
2330
+ def rel_image
2331
+ '../../_sisu/image'
2332
+ end
2333
+ self
2334
+ end
2335
+ def pdf
2336
+ def ft
2337
+ 'pdf'
2338
+ end
2339
+ def dir
2340
+ set_path(ft).dir.abc
2341
+ end
2342
+ def url
2343
+ set_path(ft).url.abc
2344
+ end
2345
+ def rel
2346
+ set_path(ft).rel.abc
2347
+ end
2348
+ def rcp
2349
+ set_path(ft).rcp.abc
2350
+ end
2351
+ def rel_sm
2352
+ set_path(ft).rel_sm.ab
2353
+ end
2354
+ self
2355
+ end
2356
+ def sqlite_discrete
2357
+ def ft
2358
+ 'sql'
2359
+ end
2360
+ def dir
2361
+ set_path(ft).dir.ab
2362
+ end
2363
+ def url
2364
+ set_path(ft).url.ab
2365
+ end
2366
+ def rel
2367
+ set_path(ft).rel.ab
2368
+ end
2369
+ def rcp
2370
+ set_path(ft).rcp.ab
2371
+ end
2372
+ def rel_sm
2373
+ set_path(ft).rel_sm.ab
2374
+ end
2375
+ self
2376
+ end
2377
+ def hash_digest
2378
+ def ft
2379
+ 'hashes'
2380
+ end
2381
+ def dir
2382
+ set_path(ft).dir.abc
2383
+ end
2384
+ def url
2385
+ set_path(ft).url.abc
2386
+ end
2387
+ def rel
2388
+ set_path(ft).rel.abc
2389
+ end
2390
+ def rcp
2391
+ set_path(ft).rcp.abc
2392
+ end
2393
+ def rel_sm
2394
+ set_path(ft).rel_sm.ab
2395
+ end
2396
+ self
2397
+ end
2398
+ def manifest
2399
+ def ft
2400
+ 'manifest'
2401
+ end
2402
+ def dir
2403
+ set_path(ft).dir.abc
2404
+ end
2405
+ def url
2406
+ set_path(ft).url.abc
2407
+ end
2408
+ def rel
2409
+ set_path(ft).rel.abc
2410
+ end
2411
+ def rel_image
2412
+ if output_dir_structure.dump_or_redirect?
2413
+ './image'
2414
+ elsif output_dir_structure.by_language_code?
2415
+ '../../_sisu/image'
2416
+ elsif output_dir_structure.by_filetype?
2417
+ '../_sisu/image'
2418
+ else
2419
+ '../_sisu/image'
2420
+ end
2421
+ end
2422
+ def rcp
2423
+ set_path(ft).rcp.abc
2424
+ end
2425
+ self
2426
+ end
2427
+ def qrcode
2428
+ def ft
2429
+ 'manifest/qrcode'
2430
+ end
2431
+ def dir
2432
+ set_path(ft).dir.abc
2433
+ end
2434
+ def url
2435
+ set_path(ft).url.abc
2436
+ end
2437
+ def rel
2438
+ set_path(ft).rel.abc
2439
+ end
2440
+ def rcp
2441
+ set_path(ft).rcp.abc
2442
+ end
2443
+ def rel_sm
2444
+ set_path(ft).rel_sm.ab
2445
+ end
2446
+ self
2447
+ end
2448
+ def harvest
2449
+ def ft
2450
+ 'site_metadata'
2451
+ end
2452
+ def dir
2453
+ set_path(ft).dir.ab
2454
+ end
2455
+ def url
2456
+ set_path(ft).url.ab
2457
+ end
2458
+ def rel
2459
+ set_path(ft).rel.ab
2460
+ end
2461
+ def rcp
2462
+ set_path(ft).rcp.ab
2463
+ end
2464
+ def rel_sm
2465
+ if output_dir_structure.by_language_code?
2466
+ ''
2467
+ elsif output_dir_structure.by_filetype?
2468
+ ''
2469
+ else
2470
+ ''
2471
+ end
2472
+ end
2473
+ self
2474
+ end
2475
+ def manpage
2476
+ def ft
2477
+ 'man'
2478
+ end
2479
+ def dir
2480
+ set_path(ft).dir.ab
2481
+ end
2482
+ def url
2483
+ set_path(ft).url.ab
2484
+ end
2485
+ def rel
2486
+ set_path(ft).rel.ab
2487
+ end
2488
+ def rcp
2489
+ set_path(ft).rcp.ab
2490
+ end
2491
+ def rel_sm
2492
+ set_path(ft).rel_sm.ab
2493
+ end
2494
+ self
2495
+ end
2496
+ def texinfo
2497
+ def ft
2498
+ 'texinfo'
2499
+ end
2500
+ def dir
2501
+ set_path(ft).dir.ab
2502
+ end
2503
+ def url
2504
+ set_path(ft).url.ab
2505
+ end
2506
+ def rel
2507
+ set_path(ft).rel.ab
2508
+ end
2509
+ def rcp
2510
+ set_path(ft).rcp.ab
2511
+ end
2512
+ def rel_sm
2513
+ set_path(ft).rel_sm.ab
2514
+ end
2515
+ self
2516
+ end
2517
+ def sitemaps
2518
+ def ft
2519
+ 'sitemaps'
2520
+ end
2521
+ def dir
2522
+ set_path(ft).dir.ab
2523
+ end
2524
+ def url
2525
+ set_path(ft).url.ab
2526
+ end
2527
+ def rel
2528
+ set_path(ft).rel.ab
2529
+ end
2530
+ def rcp
2531
+ set_path(ft).rcp.ab
2532
+ end
2533
+ self
2534
+ end
2535
+ def sqlite #check url
2536
+ def dir
2537
+ output_path.base.dir
2538
+ end
2539
+ def url
2540
+ output_path.base.url
2541
+ end
2542
+ def rel
2543
+ output_path.base.rel
2544
+ end
2545
+ def rcp
2546
+ output_path.base.rcp
2547
+ end
2548
+ self
2549
+ end
2550
+ #def cgi
2551
+ #end
2552
+ def css
2553
+ @d='_sisu/css'
2554
+ def dir
2555
+ output_path.base.dir + '/' + @d
2556
+ end
2557
+ def url
2558
+ output_path.base.url + '/' + @d
2559
+ end
2560
+ def rel
2561
+ @d
2562
+ #output_path.base.rel + '/' + @d
2563
+ end
2564
+ def rcp
2565
+ output_path.stub.rcp + '/' + @d
2566
+ end
2567
+ self
2568
+ end
2569
+ def images
2570
+ @d='_sisu/image'
2571
+ def dir
2572
+ output_path.base.dir + '/' + @d
2573
+ end
2574
+ def url
2575
+ output_path.base.url + '/' + @d
2576
+ end
2577
+ def rel
2578
+ @d
2579
+ #output_path.base.rel + '/' + @d
2580
+ end
2581
+ def rcp
2582
+ output_path.stub.rcp + '/' + @d
2583
+ end
2584
+ self
2585
+ end
2586
+ def images_external
2587
+ @d='_sisu/image_external'
2588
+ def dir
2589
+ output_path.base.dir + '/' + @d
2590
+ end
2591
+ def url
2592
+ output_path.base.url + '/' + @d
2593
+ end
2594
+ def rel
2595
+ output_path.base.rel + '/' + @d
2596
+ end
2597
+ def rcp
2598
+ output_path.base.rcp + '/' + @d
2599
+ end
2600
+ self
2601
+ end
2602
+ #def css
2603
+ # #"#{@env.path.output}/#{@env.path.style}"
2604
+ #end
2605
+ self
2606
+ end
2607
+ end
2608
+ end
2609
+ module SiSU_Create_File
2610
+ require_relative 'constants' # constants.rb
2611
+ require_relative 'utils' # utils.rb
2612
+ require_relative 'se_info_env' # se_info_env.rb
2613
+ class CreateFile < SiSU_Info_Env::InfoEnv # se_info_env.rb
2614
+ #todo unify with FileOp
2615
+ def initialize(fns)
2616
+ begin
2617
+ super(fns)
2618
+ @env=SiSU_Env::InfoEnv.new(fns)
2619
+ rescue
2620
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
2621
+ __LINE__.to_s + ':' + __FILE__
2622
+ end
2623
+ ensure
2624
+ end
2625
+ end
2626
+ def html_root
2627
+ #@env.path.output
2628
+ end
2629
+ def mkdir_pdf
2630
+ Dir.mkdir(@env.processing_path.tex) \
2631
+ unless FileTest.directory?(@env.processing_path.tex)
2632
+ end
2633
+ def file_generic(output_file='')
2634
+ fn=@env.path.output + '/' \
2635
+ + @fnb + '/' \
2636
+ + output_file
2637
+ File.new(fn,'w+')
2638
+ end
2639
+ def file_error
2640
+ fn='/tmp/errorlog.sisu'
2641
+ File.new(fn,'w+')
2642
+ end
2643
+ def file_txt
2644
+ fn=@env.processing_path.ao + '/' \
2645
+ + @fns + '.txt'
2646
+ File.new(fn,'w+')
2647
+ end
2648
+ def file_debug
2649
+ fn=@env.processing_path.ao + '/' \
2650
+ + @fns + '.debug.txt'
2651
+ File.new(fn,'w+')
2652
+ end
2653
+ def metaverse
2654
+ def file_meta
2655
+ fn=@env.processing_path.ao + '/' \
2656
+ + @fns + '.meta'
2657
+ File.new(fn,'w+')
2658
+ end
2659
+ def file_meta_idx_html
2660
+ fn=@env.processing_path.ao + '/' \
2661
+ + @fns + '.idx.html'
2662
+ File.new(fn,'w+')
2663
+ end
2664
+ self
2665
+ end
2666
+ def file_note
2667
+ fn=Dir.pwd + '/' \
2668
+ + @fns + '.fn'
2669
+ File.new(fn,'w+')
2670
+ end
2671
+ def meta
2672
+ @env.processing_path.ao + '/' \
2673
+ + @fns + '.meta'
2674
+ end
2675
+ def file_semantic
2676
+ fn='./semantic.yaml'
2677
+ File.new(fn,'w+')
2678
+ end
2679
+ def file_rss
2680
+ fn='./semantic.xml'
2681
+ File.new(fn,'w+')
2682
+ end
2683
+ def epub
2684
+ @pth=@env.processing_path.epub
2685
+ def xhtml_index
2686
+ fn=@pth + '/' \
2687
+ + Ep[:d_oebps] + '/index.xhtml'
2688
+ File.new(fn,'w+')
2689
+ end
2690
+ def xhtml_cover_image
2691
+ fn=@pth + '/' \
2692
+ + Ep[:d_oebps] + '/cover_image.xhtml'
2693
+ File.new(fn,'w+')
2694
+ end
2695
+ def xhtml_segtoc
2696
+ fn=@pth + '/' \
2697
+ + Ep[:d_oebps] + '/toc.xhtml'
2698
+ File.new(fn,'w+')
2699
+ end
2700
+ def mimetype #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype
2701
+ File.new("#{@pth}/mimetype",'w')
2702
+ end
2703
+ def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf
2704
+ fn=@pth + '/' \
2705
+ + Ep[:d_oebps] + '/' \
2706
+ + Ep[:f_opf]
2707
+ File.new(fn,'w')
2708
+ end
2709
+ def toc_ncx #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx
2710
+ fn=@pth + '/' \
2711
+ + Ep[:d_oebps] + '/' \
2712
+ + Ep[:f_ncx]
2713
+ File.new(fn,'w')
2714
+ end
2715
+ def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml
2716
+ fn=@pth + '/META-INF/container.xml'
2717
+ File.new(fn,'w')
2718
+ end
2719
+ def xhtml_css #fixed epub xhtml css
2720
+ fn=@pth + '/' \
2721
+ + Ep[:d_oebps] + '/css/xhtml.css'
2722
+ File.new(fn,'w')
2723
+ end
2724
+ self
2725
+ end
2726
+ def file_texinfo
2727
+ fn=@env.processing_path.texinfo + '/' \
2728
+ + @fnb + '.texinfo'
2729
+ File.new(fn,'w+')
2730
+ end
2731
+ end
2732
+ end
2733
+ module SiSU_Filename_Lang
2734
+ require_relative 'constants' # constants.rb
2735
+ require_relative 'utils' # utils.rb
2736
+ class FilenameLanguageCodeInsert
2737
+ def initialize(opt,lng=nil)
2738
+ @opt=opt
2739
+ @lng=lng ||=opt.lng
2740
+ end
2741
+ def language_code_insert
2742
+ if @opt.dir_structure_by ==:language \
2743
+ or ((@opt.dir_structure_by ==:filetype \
2744
+ || @opt.dir_structure_by ==:filename) \
2745
+ and (@opt.lingual ==:mono \
2746
+ && @lng == @opt.act[:default_language][:code]))
2747
+ ''
2748
+ elsif (@opt.dir_structure_by ==:filetype \
2749
+ || @opt.dir_structure_by ==:filename) \
2750
+ and not @opt.lingual ==:mono
2751
+ '.' + @lng
2752
+ else
2753
+ '.' + @lng
2754
+ end
2755
+ end
2756
+ end
2757
+ end
2758
+ __END__