sisu 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,754 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** summary of generated outputs and metadata
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/qrcode.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_QRcode
58
+ require_relative 'se' # se.rb
59
+ include SiSU_Env
60
+ require_relative 'prog_text_translation' # prog_text_translation.rb
61
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
62
+ include SiSU_Particulars
63
+ require_relative 'html' # html.rb
64
+ require_relative 'dp' # dp.rb
65
+ include SiSU_Param
66
+ require_relative 'generic_parts' # generic_parts.rb
67
+ require_relative 'i18n' # i18n.rb
68
+ class Source
69
+ def initialize(opt)
70
+ @opt=opt
71
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
72
+ l=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
73
+ @doc_language=l[:n]
74
+ end
75
+ def read
76
+ begin
77
+ @env=SiSU_Env::InfoEnv.new(@opt.fns,@opt)
78
+ @md=SiSU_Param::Parameters.new(@opt).get
79
+ xbrowser=@env.program.web_browser
80
+ browser=@env.program.console_web_browser
81
+ unless @opt.act[:quiet][:set]==:on
82
+ url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
83
+ (@opt.act[:verbose][:set]==:on \
84
+ || @opt.act[:verbose_plus][:set]==:on \
85
+ || @opt.act[:maintenance][:set]==:on) \
86
+ ? SiSU_Screen::Ansi.new(
87
+ @opt.act[:color_state][:set],
88
+ 'QR code',
89
+ "#{xbrowser} #{url_html}"
90
+ ).green_hi_blue
91
+ : SiSU_Screen::Ansi.new(
92
+ @opt.act[:color_state][:set],
93
+ 'QR code',
94
+ "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}"
95
+ ).green_title_hi
96
+ if (@opt.act[:verbose][:set]==:on \
97
+ || @opt.act[:verbose_plus][:set]==:on \
98
+ || @opt.act[:maintenance][:set]==:on)
99
+ SiSU_Screen::Ansi.new(
100
+ @opt.act[:color_state][:set],
101
+ "#{browser} #{url_html}"
102
+ ).grey_tab
103
+ end
104
+ end
105
+ data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
106
+ OutputInfo.new(@md).check_output(data)
107
+ rescue
108
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
109
+ __LINE__.to_s + ':' + __FILE__
110
+ end
111
+ ensure
112
+ end
113
+ end
114
+ private
115
+ class OutputInfo <Source
116
+ include SiSU_Parts_Generic
117
+ def initialize(md)
118
+ @manifest={ txt: [], txt_title: [] }
119
+ @md,@fns=md,md.fns
120
+ @env=SiSU_Env::InfoEnv.new(@md.fns,@md.opt)
121
+ @fnb=@md.fnb
122
+ @base_url="#{@env.url.root}/#{@fnb}"
123
+ @f=SiSU_Env::FileOp.new(@md)
124
+ @base_path=@f.output_path.manifest.dir
125
+ @@dg ||=SiSU_Env::InfoEnv.new.digest(@md.opt).type
126
+ @dg=@@dg
127
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
128
+ @language=l[:n]
129
+ @translate=SiSU_Translate::Source.new(@md,@language)
130
+ @f.make_path(@f.output_path.qrcode.dir)
131
+ end
132
+ def spaces
133
+ Ax[:spaces]
134
+ end
135
+ def output_metadata
136
+ fn=@f.base_filename.manifest_txt
137
+ mn=''
138
+ if @md.opt.act[:maintenance][:set]==:on
139
+ fn=@f.base_filename.manifest_txt
140
+ manifest=@f.write_file.manifest_txt
141
+ end
142
+ @manifest[:txt].each do |x|
143
+ x=x.gsub(/\\\\/m,"\n")
144
+ puts x if @md.opt.act[:verbose_plus][:set]==:on
145
+ manifest << x if @md.opt.act[:maintenance][:set]==:on
146
+ mn += x
147
+ end
148
+ manifest.close if @md.opt.act[:maintenance][:set]==:on
149
+ cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_md.dir,@md.opt.selections.str)
150
+ cmd.qrencode
151
+ end
152
+ def output_metadata_short
153
+ mn=''
154
+ @manifest[:txt_title].each do |x|
155
+ mn += x
156
+ end
157
+ cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_title.dir,@md.opt.selections.str)
158
+ cmd.qrencode
159
+ end
160
+ def summarize(id,file,pth='',rel='',url='',img='● ')
161
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
162
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
163
+ @manifest[:txt] <<<<WOK
164
+ #{id} #{kb}
165
+ #{the_text.url_open}#{url}/#{file}#{the_text.url_close}
166
+ WOK
167
+ end
168
+ def summarize_html_seg(id,file,pth='',rel='',url='',img='● ')
169
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
170
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
171
+ @manifest[:txt] <<<<WOK
172
+ #{id} #{kb}
173
+ #{the_text.url_open}#{url}/#{file}#{the_text.url_close}
174
+ WOK
175
+ end
176
+ def summarize_sources(id,file,pth,rel,url)
177
+ sys=SiSU_Env::SystemCall.new
178
+ dgst=case @dg
179
+ when :sha512
180
+ (sys.sha512("#{pth}/#{file}")) #check
181
+ when :md5
182
+ (sys.md5("#{pth}/#{file}"))
183
+ else
184
+ (sys.sha256("#{pth}/#{file}"))
185
+ end
186
+ dgst=dgst ? dgst : [ '', 'n/a' ]
187
+ if (@md.opt.act[:verbose][:set]==:on \
188
+ || @md.opt.act[:verbose_plus][:set]==:on \
189
+ || @md.opt.act[:maintenance][:set]==:on)
190
+ SiSU_Screen::Ansi.new(
191
+ @md.opt.selections.str,
192
+ "#{dgst[1]} #{file}"
193
+ ).warn
194
+ end
195
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
196
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
197
+ @manifest[:txt] <<<<WOK
198
+ #{id} #{dgst[1]} #{kb}
199
+ #{the_text.url_open}#{url}/#{file}#{the_text.url_close}
200
+ WOK
201
+ end
202
+ def published_manifests?
203
+ @f=SiSU_Env::FileOp.new(@md) #.base_filename
204
+ @m=[]
205
+ url=@f.output_path.base.url
206
+ manifests={}
207
+ mp,mn,mt=nil,nil,nil
208
+ ln=SiSU_i18n::Languages.new.language.list
209
+ Px[:lng_lst].each do |lc|
210
+ if @env.output_dir_structure.by_language_code?
211
+ mp="#{@f.output_path.base.dir}/#{lc}/manifest"
212
+ mn="#{@md.fnb}.html"
213
+ mt="#{mp}/#{mn}"
214
+ mu="#{url}/#{lc}/manifest/#{mn}"
215
+ elsif @env.output_dir_structure.by_filetype?
216
+ mp="#{@f.output_path.base.dir}/manifest"
217
+ mn="#{@md.fnb}.#{lc}.html"
218
+ mt="#{mp}/#{mn}"
219
+ mu="#{url}/manifest/#{mn}"
220
+ else
221
+ mp="#{@f.output_path.base.dir}/#{@md.fnb}"
222
+ mn="sisu_manifest.#{lc}.html"
223
+ mt="#{mp}/#{mn}"
224
+ mu="#{url}/#{mn}"
225
+ end
226
+ if FileTest.directory?(mp) \
227
+ && FileTest.file?(mt)
228
+ lng=ln[lc][:t]
229
+ manifests[lc]={ ln: lng, fn: mn }
230
+ @m << { mu: mu, l: lng }
231
+ end
232
+ end
233
+ #manifests
234
+ @m=@m.uniq
235
+ @m
236
+ end
237
+ def languages(id,file)
238
+ flv=published_manifests?
239
+ flv.each do |l|
240
+ SiSU_Translate::Source.new(@md,@language,l[:n]).language_list
241
+ @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
242
+ end
243
+ end
244
+ def published_languages(id,file)
245
+ flv=published_manifests?
246
+ flv.each do |l|
247
+ @manifest[:txt] << "#{l[:l]} #{the_text.url_open}#{l[:mu]}#{the_text.url_close}\n"
248
+ end
249
+ end
250
+ def metadata(id,info)
251
+ info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")
252
+ @manifest[:txt] << %{#{id}: #{info}\n}
253
+ end
254
+ def md_title_info(id,info)
255
+ info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")
256
+ @manifest[:txt_title] << %{#{info}\n}
257
+ end
258
+ def links(url,lnk,target)
259
+ static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
260
+ elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root)
261
+ else url
262
+ end
263
+ @manifest[:txt] << %{#{url} #{lnk} #{the_text.url_open}#{static}#{the_text.url_close}\n}
264
+ end
265
+ def output_tests
266
+ if FileTest.file?(@f.place_file.html_segtoc.dir)==true
267
+ pth=@f.output_path.html_seg.dir
268
+ rel=@f.output_path.html_seg.rel_sm
269
+ url=@f.output_path.html_seg.url
270
+ id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc
271
+ summarize_html_seg(id,file,pth,rel,url)
272
+ end
273
+ if FileTest.file?(@f.place_file.html_scroll.dir)==true
274
+ pth=@f.output_path.html_scroll.dir
275
+ rel=@f.output_path.html_scroll.rel_sm
276
+ url=@f.output_path.html_scroll.url
277
+ id,file='HTML, full length document',@f.base_filename.html_scroll
278
+ summarize(id,file,pth,rel,url)
279
+ end
280
+ if FileTest.file?(@f.place_file.html_book_index.dir)==true
281
+ pth=@f.output_path.html_seg.dir
282
+ rel=@f.output_path.html_seg.rel_sm
283
+ url=@f.output_path.html_seg.url
284
+ id,file='HTML, (book type) index',@f.base_filename.html_book_index
285
+ summarize(id,file,pth,rel,url)
286
+ end
287
+ if FileTest.file?(@f.place_file.html_concordance.dir)==true
288
+ pth=@f.output_path.html_seg.dir
289
+ rel=@f.output_path.html_seg.rel_sm
290
+ url=@f.output_path.html_seg.url
291
+ id,file='HTML, concordance file',@f.base_filename.html_concordance
292
+ summarize(id,file,pth,rel,url)
293
+ end
294
+ if FileTest.file?(@f.place_file.epub.dir)==true
295
+ id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub
296
+ pth=@f.output_path.epub.dir
297
+ rel=@f.output_path.epub.rel_sm
298
+ url=@f.output_path.epub.url
299
+ summarize(id,file,pth,rel,url)
300
+ end
301
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
302
+ pth=@f.output_path.pdf.dir
303
+ rel=@f.output_path.pdf.rel_sm
304
+ url=@f.output_path.pdf.url
305
+ id,file="PDF, U.S. letter size, portrait/vertical","#{@f.base_filename.pdf_p_letter}"
306
+ summarize(id,file,pth,rel,url)
307
+ end
308
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
309
+ pth=@f.output_path.pdf.dir
310
+ rel=@f.output_path.pdf.rel_sm
311
+ url=@f.output_path.pdf.url
312
+ id,file="PDF, U.S. letter size, landscape/horizontal","#{@f.base_filename.pdf_l_letter}"
313
+ summarize(id,file,pth,rel,url)
314
+ end
315
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
316
+ pth=@f.output_path.pdf.dir
317
+ rel=@f.output_path.pdf.rel_sm
318
+ url=@f.output_path.pdf.url
319
+ id,file="PDF, A4 size, portrait/vertical","#{@f.base_filename.pdf_p_a4}"
320
+ summarize(id,file,pth,rel,url)
321
+ end
322
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
323
+ pth=@f.output_path.pdf.dir
324
+ rel=@f.output_path.pdf.rel_sm
325
+ url=@f.output_path.pdf.url
326
+ id,file="PDF, A4 size, landscape/horizontal","#{@f.base_filename.pdf_l_a4}"
327
+ summarize(id,file,pth,rel,url)
328
+ end
329
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
330
+ pth=@f.output_path.pdf.dir
331
+ rel=@f.output_path.pdf.rel_sm
332
+ url=@f.output_path.pdf.url
333
+ id,file="PDF, A5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_a5}"
334
+ summarize(id,file,pth,rel,url)
335
+ end
336
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
337
+ pth=@f.output_path.pdf.dir
338
+ rel=@f.output_path.pdf.rel_sm
339
+ url=@f.output_path.pdf.url
340
+ id,file="PDF, A5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_a5}"
341
+ summarize(id,file,pth,rel,url)
342
+ end
343
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
344
+ pth=@f.output_path.pdf.dir
345
+ rel=@f.output_path.pdf.rel_sm
346
+ url=@f.output_path.pdf.url
347
+ id,file="PDF, B5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_b5}"
348
+ summarize(id,file,pth,rel,url)
349
+ end
350
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
351
+ pth=@f.output_path.pdf.dir
352
+ rel=@f.output_path.pdf.rel_sm
353
+ url=@f.output_path.pdf.url
354
+ id,file="PDF, B5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_b5}"
355
+ summarize(id,file,pth,rel,url)
356
+ end
357
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
358
+ pth=@f.output_path.pdf.dir
359
+ rel=@f.output_path.pdf.rel_sm
360
+ url=@f.output_path.pdf.url
361
+ id,file="PDF, U.S. legal size, portrait/vertical","#{@f.base_filename.pdf_p_legal}"
362
+ summarize(id,file,pth,rel,url)
363
+ end
364
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
365
+ pth=@f.output_path.pdf.dir
366
+ rel=@f.output_path.pdf.rel_sm
367
+ url=@f.output_path.pdf.url
368
+ id,file="PDF, U.S. legal size, landscape/horizontal","#{@f.base_filename.pdf_l_legal}"
369
+ summarize(id,file,pth,rel,url)
370
+ end
371
+ if FileTest.file?(@f.place_file.odt.dir)==true
372
+ pth=@f.output_path.odt.dir
373
+ rel=@f.output_path.odt.rel_sm
374
+ url=@f.output_path.odf.url
375
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
376
+ summarize(id,file,pth,rel,url)
377
+ end
378
+ if FileTest.file?(@f.place_file.xhtml.dir)==true
379
+ pth=@f.output_path.xhtml.dir
380
+ rel=@f.output_path.xhtml.rel_sm
381
+ url=@f.output_path.xhtml.url
382
+ id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt
383
+ id,file='XHTML',@f.base_filename.xhtml
384
+ summarize(id,file,pth,rel,url)
385
+ end
386
+ if FileTest.file?(@f.place_file.xml_sax.dir)==true
387
+ pth=@f.output_path.xml_sax.dir
388
+ rel=@f.output_path.xml_sax.rel_sm
389
+ url=@f.output_path.xml_sax.url
390
+ id,file='XML SAX',@f.base_filename.xml_sax
391
+ summarize(id,file,pth,rel,url)
392
+ end
393
+ if FileTest.file?(@f.place_file.xml_dom.dir)==true
394
+ pth=@f.output_path.xml_dom.dir
395
+ rel=@f.output_path.xml_dom.rel_sm
396
+ url=@f.output_path.xml_dom.url
397
+ id,file='XML DOM',@f.base_filename.xml_dom
398
+ summarize(id,file,pth,rel,url)
399
+ end
400
+ if FileTest.file?(@f.place_file.txt.dir)==true
401
+ id='Plaintext (UTF-8)'
402
+ #id=if @md.opt.selections.str =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
403
+ #elsif @md.opt.selections.str =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
404
+ #elsif @md.opt.selections.str =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
405
+ #elsif @md.opt.selections.str =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
406
+ #else 'Plaintext (UTF-8)'
407
+ #end
408
+ pth=@f.output_path.txt.dir
409
+ rel=@f.output_path.txt.rel_sm
410
+ url=@f.output_path.txt.url
411
+ file=@f.base_filename.txt
412
+ summarize(id,file,pth,rel,url)
413
+ end
414
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
415
+ id,file='LaTeX (portrait)',"#{@md.fns}.tex"
416
+ pth,rel,url='','',''
417
+ summarize(id,file,pth,rel,url)
418
+ end
419
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
420
+ id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex"
421
+ pth,rel,url='','',''
422
+ summarize(id,file,pth,rel,url)
423
+ end
424
+ if FileTest.file?(@f.place_file.manpage.dir)==true
425
+ pth=@f.output_path.manpage.dir
426
+ rel=@f.output_path.manpage.rel_sm
427
+ url=@f.output_path.manpage.url
428
+ id,file='Manpage',@f.base_filename.manpage
429
+ summarize(id,file,pth,rel,url)
430
+ end
431
+ if FileTest.file?(@f.place_file.texinfo.dir)==true
432
+ pth=@f.output_path.texinfo.dir
433
+ rel=@f.output_path.texinfo.rel_sm
434
+ url=@f.output_path.texinfo.url
435
+ id,file='Texinfo',@f.base_filename.texinfo
436
+ summarize(id,file,pth,rel,url)
437
+ end
438
+ if FileTest.file?(@f.place_file.hash_digest.dir)==true
439
+ pth=@f.output_path.hash_digest.dir
440
+ rel=@f.output_path.hash_digest.rel_sm
441
+ url=@f.output_path.hash_digest.url
442
+ id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest
443
+ summarize(id,file,pth,rel,url)
444
+ end
445
+ end
446
+ def published_versions
447
+ id,file='Markup (SiSU source)',@md.fns
448
+ #languages(id,file)
449
+ published_languages(id,file)
450
+ end
451
+ def language_versions
452
+ if FileTest.file?(@f.place_file.manifest.dir)==true
453
+ id,file='Markup (SiSU source)',@md.fns
454
+ published_languages(id,file)
455
+ end
456
+ end
457
+ def source_tests
458
+ if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents
459
+ if FileTest.file?(@f.place_file.src.dir)==true
460
+ pth=@f.output_path.src.dir
461
+ rel=@f.output_path.src.rel
462
+ url=@f.output_path.src.url
463
+ id,file='Markup Composite File (SiSU source)',@f.base_filename.src
464
+ summarize_sources(id,file,pth,rel,url)
465
+ end
466
+ else
467
+ if FileTest.file?(@f.place_file.src.dir)==true
468
+ pth=@f.output_path.src.dir
469
+ rel=@f.output_path.src.rel
470
+ url=@f.output_path.src.url
471
+ id,file='Markup (SiSU source)',@f.base_filename.src
472
+ summarize_sources(id,file,pth,rel,url)
473
+ end
474
+ end
475
+ if FileTest.file?(@f.place_file.sisupod.dir)==true
476
+ pth=@f.output_path.sisupod.dir
477
+ rel=@f.output_path.sisupod.rel
478
+ url=@f.output_path.sisupod.url
479
+ id,file='SiSU doc (zip)',@f.base_filename.sisupod
480
+ summarize_sources(id,file,pth,rel,url)
481
+ end
482
+ if FileTest.file?(@f.place_file.pot.dir)==true
483
+ pth=@f.output_path.pot.dir
484
+ rel=@f.output_path.pot.rel_sm
485
+ url=@f.output_path.pot.url
486
+ id,file='SiSU pot',@f.base_filename.pot
487
+ summarize_sources(id,file,pth,rel,url)
488
+ end
489
+ end
490
+ def metadata_tests
491
+ if defined? @md.title.full \
492
+ and @md.title.full=~/\S+/
493
+ id,info=@translate.full_title,@md.title.full
494
+ #id,info=@translate.full_title,%{"#{@md.title.full}"}
495
+ metadata(id,info)
496
+ md_title_info(id,info)
497
+ end
498
+ if defined? @md.creator.author \
499
+ and @md.creator.author=~/\S+/
500
+ id,info=@translate.author,@md.creator.author
501
+ metadata(id,info)
502
+ md_title_info(id,info)
503
+ end
504
+ if defined? @md.creator.editor \
505
+ and @md.creator.editor=~/\S+/
506
+ id,info=@translate.editor,@md.creator.editor
507
+ metadata(id,info)
508
+ end
509
+ if defined? @md.creator.contributor \
510
+ and @md.creator.contributor=~/\S+/
511
+ id,info=@translate.contributor,@md.creator.contributor
512
+ metadata(id,info)
513
+ end
514
+ if defined? @md.creator.translator \
515
+ and @md.creator.translator=~/\S+/
516
+ id,info=@translate.translator,%{(#{@md.creator.translator})}
517
+ metadata(id,info)
518
+ md_title_info(id,info)
519
+ end
520
+ if defined? @md.creator.illustrator \
521
+ and @md.creator.illustrator=~/\S+/
522
+ id,info=@translate.illustrator,@md.creator.illustrator
523
+ metadata(id,info)
524
+ end
525
+ if defined? @md.publisher \
526
+ and @md.publisher=~/\S+/ #dc
527
+ id,info=@translate.publisher,@md.publisher
528
+ metadata(id,info)
529
+ end
530
+ if defined? @md.creator.prepared_by \
531
+ and @md.creator.prepared_by=~/\S+/
532
+ id,info=@translate.prepared_by,@md.creator.prepared_by
533
+ metadata(id,info)
534
+ end
535
+ if defined? @md.creator.digitized_by \
536
+ and @md.creator.digitized_by=~/\S+/
537
+ id,info=@translate.digitized_by,@md.creator.digitized_by
538
+ metadata(id,info)
539
+ end
540
+ if defined? @md.rights.all \
541
+ and @md.rights.all=~/\S+/ #dc
542
+ id,info=@translate.rights,@md.rights.all
543
+ metadata(id,info)
544
+ end
545
+ if defined? @md.date.published
546
+ if defined? @md.date.published \
547
+ and @md.date.published=~/\S+/ #dc
548
+ id,info=@translate.date,@md.date.published
549
+ metadata(id,info)
550
+ md_title_info(id,info)
551
+ end
552
+ if defined? @md.date.created \
553
+ and @md.date.created=~/\S+/ #dc
554
+ id,info=@translate.date_created,@md.date.created
555
+ metadata(id,info)
556
+ end
557
+ if defined? @md.date.issued \
558
+ and @md.date.issued=~/\S+/ #dc
559
+ id,info=@translate.date_issued,@md.date.issued
560
+ metadata(id,info)
561
+ end
562
+ if defined? @md.date.available \
563
+ and @md.date.available=~/\S+/ #dc
564
+ id,info=@translate.date_available,@md.date.available
565
+ metadata(id,info)
566
+ end
567
+ if defined? @md.date.modified \
568
+ and @md.date.modified=~/\S+/ #dc
569
+ id,info=@translate.date_modified,@md.date.modified
570
+ metadata(id,info)
571
+ end
572
+ if defined? @md.date.valid \
573
+ and @md.date.valid=~/\S+/ #dc
574
+ id,info=@translate.date_valid,@md.date.valid
575
+ metadata(id,info)
576
+ end
577
+ end
578
+ if defined? @md.title.language \
579
+ and @md.title.language=~/\S+/
580
+ id,info=@translate.language,@md.title.language
581
+ metadata(id,info)
582
+ end
583
+ if defined? @md.original.language \
584
+ and @md.original.language=~/\S+/
585
+ id,info=@translate.language_original,@md.original.language
586
+ metadata(id,info)
587
+ end
588
+ if defined? @md.classify.subject \
589
+ and @md.classify.subject=~/\S+/
590
+ id,info=@translate.subject,@md.classify.subject
591
+ metadata(id,info)
592
+ end
593
+ if defined? @md.classify.keywords \
594
+ and @md.classify.keywords=~/\S+/
595
+ id,info=@translate.keywords,@md.classify.keywords
596
+ metadata(id,info)
597
+ end
598
+ if defined? @md.classify.loc \
599
+ and @md.classify.loc=~/\S+/
600
+ id,info=@translate.cls_loc,@md.classify.loc
601
+ metadata(id,info)
602
+ end
603
+ if defined? @md.classify.dewey \
604
+ and @md.classify.dewey=~/\S+/
605
+ id,info=@translate.cls_dewey,@md.classify.dewey
606
+ metadata(id,info)
607
+ end
608
+ if defined? @md.notes.description \
609
+ and @md.notes.description=~/\S+/
610
+ id,info=@translate.description,@md.notes.description
611
+ metadata(id,info)
612
+ end
613
+ if defined? @md.notes.abstract \
614
+ and @md.notes.abstract=~/\S+/
615
+ id,info=@translate.abstract,@md.notes.abstract
616
+ metadata(id,info)
617
+ end
618
+ if defined? @md.notes.comment \
619
+ and @md.notes.comment=~/\S+/
620
+ id,info=@translate.comments,@md.notes.comment
621
+ metadata(id,info)
622
+ end
623
+ if defined? @md.notes.coverage \
624
+ and @md.notes.coverage=~/\S+/
625
+ id,info=@translate.coverage,@md.notes.coverage
626
+ metadata(id,info)
627
+ end
628
+ if defined? @md.notes.relation \
629
+ and @md.notes.relation=~/\S+/
630
+ id,info=@translate.relation,@md.notes.relation
631
+ metadata(id,info)
632
+ end
633
+ #if defined? @md.notes.source \
634
+ #and @md.notes.source=~/\S+/
635
+ # id,info=@translate.source,@md.notes.source
636
+ # metadata(id,info)
637
+ #end
638
+ #if defined? @md.notes.history \
639
+ #and @md.notes.history=~/\S+/
640
+ # id,info=@translate.history,@md.notes.history
641
+ # metadata(id,info)
642
+ #end
643
+ if defined? @md.notes.type \
644
+ and @md.notes.type=~/\S+/ #dc
645
+ id,info=@translate.type,@md.type
646
+ metadata(id,info)
647
+ end
648
+ if defined? @md.notes.format \
649
+ and @md.notes.format=~/\S+/
650
+ id,info=@transate.format,@md.notes.format
651
+ metadata(id,info)
652
+ end
653
+ if defined? @md.notes.prefix_a \
654
+ and @md.notes.prefix_a=~/\S+/
655
+ id,info=@translate.prefix_a,@md.notes.prefix_a
656
+ metadata(id,info)
657
+ end
658
+ if defined? @md.notes.prefix_b \
659
+ and @md.notes.prefix_b=~/\S+/
660
+ id,info=@translate.prefix_b,@md.notes.prefix_b
661
+ metadata(id,info)
662
+ end
663
+ if defined? @md.original.source \
664
+ and @md.original.source=~/\S+/
665
+ id,info=@translate.source,@md.original.source
666
+ metadata(id,info)
667
+ end
668
+ if defined? @md.identifier.oclc \
669
+ and @md.identifier.oclc=~/\S+/
670
+ id,info=@translate.cls_oclc,@md.identifier.oclc
671
+ @manifest[:txt] << %{#{id}:\n}
672
+ @manifest[:txt] << %{#{info}\n}
673
+ end
674
+ if defined? @md.identifier.isbn \
675
+ and @md.identifier.isbn=~/\S+/
676
+ id,info=@translate.cls_isbn,@md.identifier.isbn
677
+ metadata(id,info)
678
+ end
679
+ if defined? @md.topic_register_array \
680
+ and @md.topic_register_array.length > 0
681
+ @manifest[:txt] << %{#{@translate.topic_register}:\n}
682
+ @md.topic_register_array.each do |t|
683
+ t.each_with_index do |st,i|
684
+ if st.is_a?(Array)
685
+ st.each do |v|
686
+ @manifest[:txt] << %{#{spaces*i}#{v}\n}
687
+ end
688
+ else @manifest[:txt] << %{#{spaces*i}#{st}\n}
689
+ end
690
+ end
691
+ end
692
+ end
693
+ if @md.fns
694
+ id,info=@translate.sourcefile,@md.fns
695
+ metadata(id,info)
696
+ end
697
+ if @md.en[:mismatch] > 0
698
+ id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
699
+ metadata(id,info)
700
+ end
701
+ if @md.wc_words
702
+ id,info=@translate.word_count,@md.wc_words
703
+ metadata(id,info)
704
+ end
705
+ if @md.dgst
706
+ id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1]
707
+ metadata(id,info)
708
+ end
709
+ if @md.sc_number
710
+ id,info=@translate.sc_number,@md.sc_number
711
+ metadata(id,info)
712
+ end
713
+ if @md.sc_date
714
+ id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}"
715
+ metadata(id,info)
716
+ end
717
+ end
718
+ def check_output(data)
719
+ begin
720
+ @f=SiSU_Env::FileOp.new(@md) #.base_filename
721
+ url=@f.output_path.base.url
722
+ @en_manifest=if @env.output_dir_structure.by_language_code?
723
+ "#{url}/en/manifest/#{@md.fnb}.html"
724
+ elsif @env.output_dir_structure.by_filetype?
725
+ "#{url}/manifest/#{@md.fnb}.#{@md.opt.lng}.html"
726
+ else
727
+ "#{url}/sisu_manifest.#{@md.opt.lng}.html"
728
+ end
729
+ @manifest[:txt] <<<<WOK
730
+ #{@translate.manifest_description_metadata}
731
+ #{the_text.url_open}#{@en_manifest}#{the_text.url_close}
732
+ WOK
733
+ metadata_tests
734
+ @manifest[:txt_title] <<<<WOK
735
+ #{the_text.url_open}#{@en_manifest}#{the_text.url_close}
736
+ WOK
737
+ source_tests
738
+ @manifest[:txt] <<<<WOK
739
+ #{@translate.language_version_list}
740
+ WOK
741
+ language_versions
742
+ output_metadata
743
+ output_metadata_short
744
+ rescue
745
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
746
+ __LINE__.to_s + ':' + __FILE__
747
+ end
748
+ ensure
749
+ end
750
+ end
751
+ end
752
+ end
753
+ end
754
+ __END__