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,324 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** modules shared by db and flatfile output generators, mostly xml/xhtml/html
8
+ formatting
9
+
10
+ ** Author: Ralph Amissah
11
+ <ralph@amissah.com>
12
+ <ralph.amissah@gmail.com>
13
+
14
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
15
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
16
+ All Rights Reserved.
17
+
18
+ ** License: GPL 3 or later:
19
+
20
+ SiSU, a framework for document structuring, publishing and search
21
+
22
+ Copyright (C) Ralph Amissah
23
+
24
+ This program is free software: you can redistribute it and/or modify it
25
+ under the terms of the GNU General Public License as published by the Free
26
+ Software Foundation, either version 3 of the License, or (at your option)
27
+ any later version.
28
+
29
+ This program is distributed in the hope that it will be useful, but WITHOUT
30
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
32
+ more details.
33
+
34
+ You should have received a copy of the GNU General Public License along with
35
+ this program. If not, see <http://www.gnu.org/licenses/>.
36
+
37
+ If you have Internet connection, the latest version of the GPL should be
38
+ available at these locations:
39
+ <http://www.fsf.org/licensing/licenses/gpl.html>
40
+ <http://www.gnu.org/licenses/gpl.html>
41
+
42
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
43
+
44
+ ** SiSU uses:
45
+ * Standard SiSU markup syntax,
46
+ * Standard SiSU meta-markup syntax, and the
47
+ * Standard SiSU object citation numbering and system
48
+
49
+ ** Hompages:
50
+ <http://www.jus.uio.no/sisu>
51
+ <http://www.sisudoc.org>
52
+
53
+ ** Git
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
55
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/html_lite_shared.rb;hb=HEAD>
56
+
57
+ =end
58
+ module SiSU_FormatShared
59
+ require_relative 'html_parts' # html_parts.rb
60
+ class CSS_Format
61
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
62
+ include SiSU_Parts_HTML
63
+ @@fns=nil
64
+ def initialize(md,t_o)
65
+ @md,@t_o=md,t_o
66
+ @txt=@t_o.obj
67
+ @id=@ocn=@t_o.ocn if defined? @t_o.ocn
68
+ @lv=@t_o.lv.to_s if @t_o.is==:heading
69
+ if @md.fns != @@fns
70
+ @@fns,@@hname=@md.fns,''
71
+ end
72
+ @hname=if defined? @t_o.name \
73
+ and not @t_o.name.to_s.empty?
74
+ @@hname=@t_o.name
75
+ else @@hname
76
+ end
77
+ @tab="\t"
78
+ @@tablehead,@@tablefoot=[],[]
79
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
80
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
81
+ end
82
+ def urls(data)
83
+ @words=[]
84
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
85
+ data.each do |word|
86
+ @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
87
+ if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
88
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/.match(word).captures
89
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
90
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/.match(word).captures
91
+ elsif word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image/
92
+ m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures
93
+ end
94
+ word=case m
95
+ when /\.png|\.jpg|\.gif|c=|\d+x\d+/
96
+ w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/
97
+ w=%{width="#{w}"} if w
98
+ h=%{height="#{h}"} if h
99
+ c=m[/"(.+?)"/m,1]
100
+ caption=%{<br><p class="caption">#{c}</p>} if c
101
+ png=m.scan(/\S+/)[0]
102
+ ins=if u \
103
+ and u.strip !~/^image$/
104
+ %{<a href="#{u}">[#{png}]</a>#{caption}}
105
+ else %{[#{png}] #{caption}}
106
+ end
107
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)
108
+ else
109
+ u=case u
110
+ when /^https?:\/\//
111
+ u
112
+ when /^:/
113
+ u=u.gsub(/^:/,'')
114
+ "#{@env.url.root}/#{u}"
115
+ when /^\.\.\// # can remove
116
+ u=u.gsub(/^\.\.\//,'')
117
+ "#{@env.url.root}/#{u}"
118
+ else
119
+ if not map_nametags[u].nil?
120
+ @env.url.root + '/' \
121
+ + @md.fnb + '/' \
122
+ + map_nametags[u][:segname] \
123
+ + Sfx[:html] \
124
+ + '#' + u
125
+ else ''
126
+ end
127
+ end
128
+ link=m[/(.+)/m]
129
+ png=m.scan(/\S+/)[0].strip
130
+ link=link.strip
131
+ ins=%{<a href="#{u}">#{link}</a>}
132
+ word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins).
133
+ gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)
134
+ word
135
+ end
136
+ word
137
+ else word
138
+ end
139
+ word
140
+ end
141
+ @words=@words.join(' ')
142
+ end
143
+ def markup_generic(s)
144
+ s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
145
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
146
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
147
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
148
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
149
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
150
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
151
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
152
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
153
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
154
+ end
155
+ def markup_object(t_o)
156
+ s=t_o.obj
157
+ s=if t_o.is !=:code
158
+ s=markup_generic(s)
159
+ if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
160
+ wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/)
161
+ words=urls(wm)
162
+ s=s.gsub(/.+/m,words)
163
+ end
164
+ s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
165
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
166
+ gsub(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
167
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url
168
+ gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{the_url_decoration.xml_open}<a href="\\2" target="_top">\\2</a>#{the_url_decoration.xml_close}\\3}) #http ftp matches with decoration
169
+ else
170
+ s.gsub(/</m,'&lt;').
171
+ gsub(/>/m,'&gt;')
172
+ end
173
+ s
174
+ end
175
+ def markup_note(s)
176
+ s=markup_generic(s)
177
+ if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
178
+ wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/)
179
+ words=urls(wm)
180
+ s=s.gsub(/.+/m,words)
181
+ end
182
+ s=s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
183
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
184
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2'). #http ftp matches escaped, no decoration
185
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url
186
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="\\1" target="_top">\\1</a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration
187
+ end
188
+ def paragraph
189
+ %{<p class="h#{@lv}" type="substantive" header="#{@hname}">#{@txt}</p>\n} # << "\n"
190
+ end
191
+ def endnote(nr,en) #used only by db
192
+ txt=markup_note(en)
193
+ <<GSUB
194
+ <p class="endnote" name="note_#{nr}" from="#{@t_o.ocn}">
195
+ <a href="#{@base_url}#-#{nr}" name="_#{nr}">#{nr}.</a> <note>#{txt}</note>
196
+ </p>
197
+ GSUB
198
+ end
199
+ def tag_header(h)
200
+ %{<p class="#{h[:class]}" type="#{h[:type]}" header="#{h[:header]}">#{h[:txt]}</a></p>\n} # << "\n"
201
+ end
202
+ def tag_para(h)
203
+ %{<p class="#{h[:class]}" type="#{h[:type]}">#{h[:txt]}</a></p>\n} << "\n"
204
+ end
205
+ def lev_toc_hname
206
+ %{<p class="toc#{@lv}" header="#{@hname}"><a href="##{@ocn}">#{@txt}</a></p>\n} #<< "\n"
207
+ end
208
+ def lev_toc
209
+ h={ txt: txt, class: "toc#{@lv}", type: 'toc' }
210
+ tag_para(h)
211
+ end
212
+ def lev4_plus
213
+ txt=markup_object(@t_o)
214
+ h={ txt: txt, class: "h#{@lv}", type: 'substantive', id: @ocn, header: @hname }
215
+ tag_header(h)
216
+ end
217
+ def lev4_minus
218
+ txt=markup_object(@t_o)
219
+ h={ txt: txt, class: "h#{@t_o.ln}", type: 'substantive', id: @ocn }
220
+ tag_para(h)
221
+ end
222
+ def norm_comment
223
+ h={ txt: @t_o.obj, class: 'norm', type: 'comment' }
224
+ tag_para(h)
225
+ end
226
+ def norm
227
+ txt=markup_object(@t_o)
228
+ h={ txt: txt, class: 'norm', type: 'substantive', id: @ocn }
229
+ tag_para(h)
230
+ end
231
+ def code
232
+ txt=markup_object(@t_o)
233
+ h={ txt: "<tt>#{txt}</tt>", class: 'code', type: 'substantive', id: @ocn }
234
+ tag_para(h)
235
+ end
236
+ def indent(t)
237
+ txt=markup_object(@t_o)
238
+ h={ txt: txt, class: "indent#{t}", type: 'substantive', id: @ocn }
239
+ tag_para(h)
240
+ end
241
+ def hang_indent(f,t)
242
+ txt=markup_object(@t_o)
243
+ h={ txt: txt, class: "hang#{f}indent#{t}", type: 'substantive', id: @ocn }
244
+ #h={ txt: txt, class: "h#{f}i#{t}", type: 'substantive', id: @ocn }
245
+ tag_para(h)
246
+ end
247
+ def para_table
248
+ %{<p class="norm" align="left"><font #{the_font.set_small} #{the_font.set_color} #{the_font.set_face}>}
249
+ end
250
+ def ocn
251
+ %{<label class="ocn">#{@ocn}</label>} << "\n"
252
+ end
253
+ def html_table # get rid of use html_table
254
+ @new_content=[]
255
+ @txt.split(/\n/).each do |parablock|
256
+ m=parablock[/<!f(.+?)!>/,1]
257
+ @@tablefoot << m if m
258
+ parablock=parablock.gsub(/<!f.+?!>/,'')
259
+ @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u
260
+ parablock=parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/,
261
+ %{<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center">})
262
+ if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
263
+ tablefoot=[]
264
+ @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}}
265
+ @@tablefoot=[]
266
+ parablock=parablock.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,
267
+ %{#{the_table_close}\n}) # +
268
+ end
269
+ if @@tablehead==1
270
+ if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
271
+ parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
272
+ %{\n<tr>} +
273
+ %{\n<td width="\\1%" valign="top">} +
274
+ %{#{para_table}<b>}).
275
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
276
+ %{</b></td><td width="\\1%" valign="top">} +
277
+ %{#{para_table}<b>}).
278
+ gsub(/#{Mx[:tc_c]}/, '</b></td></tr>')
279
+ @@tablehead=0
280
+ end
281
+ parablock
282
+ else
283
+ parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
284
+ %{\n<tr>} +
285
+ %{\n<td width="\\1%" valign="top">} +
286
+ %{#{para_table}}).
287
+ gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
288
+ %{</td><td width="\\1%" valign="top">} +
289
+ %{#{para_table}}).
290
+ gsub(/#{Mx[:tc_c]}/, '</td></tr>')
291
+ parablock
292
+ end
293
+ @new_content << parablock
294
+ end
295
+ @new_content.join
296
+ end
297
+ end
298
+ class CSS_FormatGeneric #does CSS_Format in one definition, needs to be told about attrib, despite brevity of generic, easier to see structure with CSS_Format
299
+ def initialize(attrib='',txt='',id=nil,ocnd=nil,ocns=nil,lv='',hname=nil)
300
+ @tab="\t"
301
+ @attrib=attrib
302
+ @txt=txt
303
+ @lv=lv.to_s
304
+ @hname=hname.to_s
305
+ @id=@ocn=id
306
+ end
307
+ def paragraph
308
+ attrib=%{class="#{@attrib}" }
309
+ if @ocn
310
+ id=%{id="#{Mx[:ocn_id_char]}#{@ocn}" }
311
+ type=%{type="substantive" }
312
+ else
313
+ id=''
314
+ type=%{type="comment" }
315
+ end
316
+ header=%{header="#{@hname}" } if @hname
317
+ %{<p #{attrib}#{type}#{header}>#{@txt}</p>\n} #<< "\n"
318
+ end
319
+ def para
320
+ paragraph
321
+ end
322
+ end
323
+ end
324
+ __END__
@@ -0,0 +1,1032 @@
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/html_manifest.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Manifest
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_parts' # html_parts.rb
64
+ require_relative 'html_minitoc' # html_minitoc.rb
65
+ require_relative 'html' # html.rb
66
+ include SiSU_HTML_Format
67
+ require_relative 'dp' # dp.rb
68
+ include SiSU_Param
69
+ require_relative 'i18n' # i18n.rb
70
+ class Source
71
+ def initialize(opt)
72
+ @opt=opt
73
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
74
+ l=SiSU_Env::StandardiseLanguage.new(opt.lng).language
75
+ @doc_language=l[:n]
76
+ end
77
+ def read
78
+ begin
79
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
80
+ @md=SiSU_Param::Parameters.new(@opt).get
81
+ xbrowser=@env.program.web_browser
82
+ browser=@env.program.console_web_browser
83
+ # webserv_url=@env.path.url.output_tell #fix in sysenv
84
+ unless @opt.act[:quiet][:set]==:on
85
+ url_html='file://' \
86
+ + @md.file.output_path.manifest.dir + '/' \
87
+ + @md.file.base_filename.manifest
88
+ (@opt.act[:verbose][:set]==:on \
89
+ || @opt.act[:verbose_plus][:set]==:on \
90
+ || @opt.act[:maintenance][:set]==:on) \
91
+ ? SiSU_Screen::Ansi.new(
92
+ @opt.act[:color_state][:set],
93
+ 'Manifest',
94
+ "#{xbrowser} #{url_html}"
95
+ ).green_hi_blue
96
+ : SiSU_Screen::Ansi.new(
97
+ @opt.act[:color_state][:set],
98
+ 'Manifest',
99
+ "[#{@opt.f_pth[:lng_is]}]",
100
+ "#{url_html}"
101
+ ).grey_title_grey_blue
102
+ if (@md.opt.act[:verbose][:set]==:on \
103
+ || @md.opt.act[:verbose_plus][:set]==:on)
104
+ SiSU_Screen::Ansi.new(
105
+ @opt.act[:color_state][:set],
106
+ "#{browser} #{url_html}"
107
+ ).grey_tab
108
+ end
109
+ end
110
+ data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
111
+ SiSU_Manifest::Source::Output.new(@md).check_output(data)
112
+ rescue
113
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
114
+ __LINE__.to_s + ':' + __FILE__
115
+ end
116
+ ensure
117
+ SiSU_Env::CreateSite.new(@opt).cp_css
118
+ Dir.chdir(@opt.f_pth[:pth])
119
+ end
120
+ end
121
+ private
122
+ class Output <Source
123
+ include SiSU_Parts_HTML
124
+ def initialize(md)
125
+ @manifest={ txt: [], html: [] }
126
+ @md,@fns=md,md.fns
127
+ @env=SiSU_Env::InfoEnv.new(md.fns)
128
+ @f=SiSU_Env::FileOp.new(md)
129
+ @fnb=md.fnb
130
+ @base_url="#{@env.url.root}/#{@fnb}"
131
+ @o_str=SiSU_Env::FileOp.new(md).output_dir_structure
132
+ @image_path=(@o_str.dump_or_redirect?) \
133
+ ? './image'
134
+ : %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys}
135
+ @base_path=@f.output_path.manifest.dir
136
+ @@dg ||=SiSU_Env::InfoEnv.new(md.fns,md).digest(md.opt).type
137
+ @dg=@@dg
138
+ l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language
139
+ @language=l[:n]
140
+ @translate=SiSU_Translate::Source.new(md,@language)
141
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
142
+ @fn_lng=(@f.output_dir_structure.by_language_code?) \
143
+ ? ''
144
+ : ('.' + md.opt.lng)
145
+ end
146
+ def output
147
+ manifest=@f.write_file.manifest
148
+ @manifest[:html].each do |x|
149
+ x=x.gsub(Xx[:html_relative2],@f.path_rel_links.html_scroll_2).
150
+ gsub(Xx[:html_relative1],@f.path_rel_links.html_scroll_1)
151
+ manifest << x
152
+ end
153
+ end
154
+ def url_make(url,file,src=nil)
155
+ if @o_str.dump_or_redirect?
156
+ ''
157
+ elsif src==:src #check
158
+ %{<br>#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}}
159
+ else
160
+ %{<p class="tiny">#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}</p>}
161
+ end
162
+ end
163
+ def summarize(desc,id,file,pth='',rel='',url='',img='● ')
164
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
165
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
166
+ @manifest[:txt] << "#{file} #{desc} #{kb}\n"
167
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
168
+ end
169
+ def summarize_html_seg(desc,id,file,pth='',rel='',url='',img='● ')
170
+ size=(File.size("#{pth}/#{file}")/1024.00).to_s
171
+ kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
172
+ @manifest[:txt] << "#{file} #{desc} #{kb}\n"
173
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{desc}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
174
+ end
175
+ def summarize_sources(desc,id,file,pth,rel,url)
176
+ sys=SiSU_Env::SystemCall.new
177
+ dgst=case @dg
178
+ when :sha512
179
+ sys.sha512("#{pth}/#{file}")
180
+ when :sha256
181
+ sys.sha256("#{pth}/#{file}")
182
+ when :md5
183
+ sys.md5("#{pth}/#{file}")
184
+ else
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.act[:color_state][:set],
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] << "#{file} #{desc} #{kb}\n"
198
+ @manifest[:html] << %{<tr>} \
199
+ + %{<th class="left"><p class="norm" id="#{id}"><a href="#{rel}/#{file}">#{desc}</a></p></th>} \
200
+ + %{<td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}#{url_make(url,file,:src)}</p></td>} \
201
+ + %{<td class="right"><p class="right">#{kb}</p></td>} \
202
+ + %{</tr>\n} \
203
+ if kb and kb =~/\d+/
204
+ end
205
+ def published_manifests?
206
+ @f=SiSU_Env::FileOp.new(@md) #.base_filename
207
+ @m=[]
208
+ url=@f.output_path.base.url
209
+ manifests={}
210
+ mp,mn,mt,mr=nil,nil,nil,nil
211
+ ln=SiSU_i18n::Languages.new.language.list
212
+ Px[:lng_lst].each do |lc|
213
+ lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert
214
+ fnh={
215
+ fn: @md.fnb,
216
+ lng: lngc,
217
+ }
218
+ mn=@f.base_filename.manifest(fnh)
219
+ if @o_str.dump_or_redirect? #does not work for --redirect or --dump
220
+ mp="#{@f.output_path.base.dir}"
221
+ mt="#{mp}/#{mn}"
222
+ mr="../../#{lc}/manifest/#{mn}"
223
+ mu="#{url}/#{mn}"
224
+ elsif @f.output_dir_structure.by_language_code?
225
+ mp="#{@f.output_path.base.dir}/#{lc}/manifest"
226
+ mt="#{mp}/#{mn}"
227
+ mr="../../#{lc}/manifest/#{mn}"
228
+ mu="#{url}/#{lc}/manifest/#{mn}"
229
+ elsif @f.output_dir_structure.by_filetype?
230
+ mp="#{@f.output_path.base.dir}/manifest"
231
+ mt="#{mp}/#{mn}"
232
+ mr=mn
233
+ mu="#{url}/manifest/#{mn}"
234
+ else
235
+ mp="#{@f.output_path.base.dir}/#{@md.fnb}"
236
+ mt="#{mp}/#{mn}"
237
+ mr=mn
238
+ mu="#{url}/#{mn}"
239
+ end
240
+ if FileTest.directory?(mp) \
241
+ && FileTest.file?(mt)
242
+ lng=ln[lc][:t]
243
+ manifests[lc]={ ln: lng, fn: mn, rel: mr }
244
+ @m << { mu: mu, l: lng, rel: mr }
245
+ end
246
+ end
247
+ @m=@m.uniq
248
+ end
249
+ def languages(desc,file)
250
+ @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n}
251
+ published_manifests?.each do |l|
252
+ SiSU_Translate::Source.new(@md,@language,l[:n]).language_list
253
+ @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
254
+ @manifest[:html] << %{<li class="norm"><a href="#{l[:rel]}">#{l[:l]}</a>&nbsp;&nbsp;&nbsp;</li>}
255
+ end
256
+ @manifest[:html] << %{</ul></div></th></tr>\n}
257
+ end
258
+ def published_languages(desc)
259
+ published_manifests?.each do |l|
260
+ @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n"
261
+ @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{the_url_decoration.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{the_url_decoration.xml_close}</p></td><td class="right"><p class="right">&nbsp;</p></td></tr>\n}
262
+ end
263
+ end
264
+ def metadata(desc,id,info)
265
+ info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br>')
266
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="#{id}">#{desc}:</p></th><td><p class="left">#{info}</p></td></tr>\n}
267
+ end
268
+ def links(url,lnk,target)
269
+ static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
270
+ elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root)
271
+ else url
272
+ end
273
+ @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">&nbsp;&nbsp;#{the_url_decoration.xml_open}<a href="#{static}">#{static}</a>#{the_url_decoration.xml_close}</p></td></tr>\n}
274
+ end
275
+ def output_tests
276
+ if FileTest.file?(@f.place_file.html_segtoc.dir)==true
277
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_toc.png" alt="TOC linked" /> }
278
+ pth=@f.output_path.html_seg.dir
279
+ rel=@f.output_path.html_seg.rel_sm
280
+ url=@f.output_path.html_seg.url
281
+ desc,id,file='HTML, table of contents (for segmented text)','html',@f.base_filename.html_segtoc
282
+ summarize_html_seg(desc,id,file,pth,rel,url,img)
283
+ end
284
+ if FileTest.file?(@f.place_file.html_scroll.dir)==true
285
+ img=%{<img border="0" height="15" width="15" src="#{@image_path}/b_doc.png" alt="Full Text" /> }
286
+ pth=@f.output_path.html_scroll.dir
287
+ rel=@f.output_path.html_scroll.rel_sm
288
+ url=@f.output_path.html_scroll.url
289
+ desc,id,file='HTML, full length document','html_scroll',@f.base_filename.html_scroll
290
+ summarize(desc,id,file,pth,rel,url,img)
291
+ end
292
+ if FileTest.file?(@f.place_file.html_book_index.dir)==true
293
+ pth=@f.output_path.html_seg.dir
294
+ rel=@f.output_path.html_seg.rel_sm
295
+ url=@f.output_path.html_seg.url
296
+ desc,id,file='HTML, (book type) index','html_book',@f.base_filename.html_book_index
297
+ summarize(desc,id,file,pth,rel,url)
298
+ end
299
+ if FileTest.file?(@f.place_file.html_concordance.dir)==true
300
+ pth=@f.output_path.html_seg.dir
301
+ rel=@f.output_path.html_seg.rel_sm
302
+ url=@f.output_path.html_seg.url
303
+ desc,id,file='HTML, concordance file','concordance',@f.base_filename.html_concordance
304
+ summarize(desc,id,file,pth,rel,url)
305
+ end
306
+ if FileTest.file?(@f.place_file.epub.dir)==true
307
+ img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_epub.png" alt="EPUB" /> }
308
+ desc,id,file='EPUB (Electronic Publication, e-book standard)','epub',@f.base_filename.epub
309
+ pth=@f.output_path.epub.dir
310
+ rel=@f.output_path.epub.rel_sm
311
+ url=@f.output_path.epub.url
312
+ summarize(desc,id,file,pth,rel,url,img)
313
+ end
314
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
315
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
316
+ pth=@f.output_path.pdf.dir
317
+ rel=@f.output_path.pdf.rel_sm
318
+ url=@f.output_path.pdf.url
319
+ desc,id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",'pdf_letter',"#{@f.base_filename.pdf_p_letter}"
320
+ summarize(desc,id,file,pth,rel,url,img)
321
+ end
322
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
323
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
324
+ pth=@f.output_path.pdf.dir
325
+ rel=@f.output_path.pdf.rel_sm
326
+ url=@f.output_path.pdf.url
327
+ desc,id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",'pdf_letter_landscape',"#{@f.base_filename.pdf_l_letter}"
328
+ summarize(desc,id,file,pth,rel,url,img)
329
+ end
330
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
331
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
332
+ pth=@f.output_path.pdf.dir
333
+ rel=@f.output_path.pdf.rel_sm
334
+ url=@f.output_path.pdf.url
335
+ desc,id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",'pdf_a4',"#{@f.base_filename.pdf_p_a4}"
336
+ summarize(desc,id,file,pth,rel,url,img)
337
+ end
338
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
339
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
340
+ pth=@f.output_path.pdf.dir
341
+ rel=@f.output_path.pdf.rel_sm
342
+ url=@f.output_path.pdf.url
343
+ desc,id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",'pdf_a4_landscape',"#{@f.base_filename.pdf_l_a4}"
344
+ summarize(desc,id,file,pth,rel,url,img)
345
+ end
346
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
347
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
348
+ pth=@f.output_path.pdf.dir
349
+ rel=@f.output_path.pdf.rel_sm
350
+ url=@f.output_path.pdf.url
351
+ desc,id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",'pdf_a5',"#{@f.base_filename.pdf_p_a5}"
352
+ summarize(desc,id,file,pth,rel,url,img)
353
+ end
354
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
355
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
356
+ pth=@f.output_path.pdf.dir
357
+ rel=@f.output_path.pdf.rel_sm
358
+ url=@f.output_path.pdf.url
359
+ desc,id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_a5}"
360
+ summarize(desc,id,file,pth,rel,url,img)
361
+ end
362
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
363
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
364
+ pth=@f.output_path.pdf.dir
365
+ rel=@f.output_path.pdf.rel_sm
366
+ url=@f.output_path.pdf.url
367
+ desc,id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",'pdf_b5',"#{@f.base_filename.pdf_p_b5}"
368
+ summarize(desc,id,file,pth,rel,url,img)
369
+ end
370
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
371
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
372
+ pth=@f.output_path.pdf.dir
373
+ rel=@f.output_path.pdf.rel_sm
374
+ url=@f.output_path.pdf.url
375
+ desc,id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",'pdf_a5_landscape',"#{@f.base_filename.pdf_l_b5}"
376
+ summarize(desc,id,file,pth,rel,url,img)
377
+ end
378
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
379
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
380
+ pth=@f.output_path.pdf.dir
381
+ rel=@f.output_path.pdf.rel_sm
382
+ url=@f.output_path.pdf.url
383
+ desc,id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",'pdf_legal',"#{@f.base_filename.pdf_p_legal}"
384
+ summarize(desc,id,file,pth,rel,url,img)
385
+ end
386
+ if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
387
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
388
+ pth=@f.output_path.pdf.dir
389
+ rel=@f.output_path.pdf.rel_sm
390
+ url=@f.output_path.pdf.url
391
+ desc,id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",'pdf_legal_landscape',"#{@f.base_filename.pdf_l_legal}"
392
+ summarize(desc,id,file,pth,rel,url,img)
393
+ end
394
+ if FileTest.file?(@f.place_file.odt.dir)==true
395
+ img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_odf.png" alt="ODF/ODT" /> }
396
+ pth=@f.output_path.odt.dir
397
+ rel=@f.output_path.odt.rel_sm
398
+ url=@f.output_path.odt.url
399
+ desc,id,file='ODF:ODT (Open Document Format)','odt',@f.base_filename.odt
400
+ summarize(desc,id,file,pth,rel,url,img)
401
+ end
402
+ if FileTest.file?(@f.place_file.xhtml.dir)==true
403
+ pth=@f.output_path.xhtml.dir
404
+ rel=@f.output_path.xhtml.rel_sm
405
+ url=@f.output_path.xhtml.url
406
+ desc,id,file='XHTML','xhtml',@f.base_filename.xhtml
407
+ summarize(desc,id,file,pth,rel,url)
408
+ end
409
+ if FileTest.file?(@f.place_file.xml_sax.dir)==true
410
+ pth=@f.output_path.xml_sax.dir
411
+ rel=@f.output_path.xml_sax.rel_sm
412
+ url=@f.output_path.xml_sax.url
413
+ desc,id,file='XML SAX','xml_sax',@f.base_filename.xml_sax
414
+ summarize(desc,id,file,pth,rel,url)
415
+ end
416
+ if FileTest.file?(@f.place_file.xml_dom.dir)==true
417
+ pth=@f.output_path.xml_dom.dir
418
+ rel=@f.output_path.xml_dom.rel_sm
419
+ url=@f.output_path.xml_dom.url
420
+ desc,id,file='XML DOM','xml_dom',@f.base_filename.xml_dom
421
+ summarize(desc,id,file,pth,rel,url)
422
+ end
423
+ if FileTest.file?(@f.place_file.xml_docbook_article.dir)==true
424
+ pth=@f.output_path.xml_docbook_article.dir
425
+ rel=@f.output_path.xml_docbook_article.rel_sm
426
+ url=@f.output_path.xml_docbook_article.url
427
+ desc,id,file='XML Docbook Article','docbook_article',@f.base_filename.xml_docbook_article
428
+ summarize(desc,id,file,pth,rel,url)
429
+ end
430
+ if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true
431
+ pth=@f.output_path.xml_docbook_book.dir
432
+ rel=@f.output_path.xml_docbook_book.rel_sm
433
+ url=@f.output_path.xml_docbook_book.url
434
+ desc,id,file='XML Docbook Book','docbook',@f.base_filename.xml_docbook_book
435
+ summarize(desc,id,file,pth,rel,url)
436
+ end
437
+ if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true
438
+ pth=@f.output_path.xml_fictionbook.dir
439
+ rel=@f.output_path.xml_fictionbook.rel_sm
440
+ url=@f.output_path.xml_fictionbook.url
441
+ desc,id,file='XML Fictionbook','fictionbook',@f.base_filename.xml_fictionbook
442
+ summarize(desc,id,file,pth,rel,url)
443
+ end
444
+ if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true
445
+ pth=@f.output_path.xml_scaffold_structure_sisu.dir
446
+ rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm
447
+ url=@f.output_path.xml_scaffold_structure_sisu.url
448
+ desc,id,file='XML Scaffold sisu structure','xml_scaffold',@f.base_filename.xml_scaffold_structure_sisu
449
+ summarize(desc,id,file,pth,rel,url)
450
+ end
451
+ if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true
452
+ pth=@f.output_path.xml_scaffold_structure_collapse.dir
453
+ rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm
454
+ url=@f.output_path.xml_scaffold_structure_collapse.url
455
+ desc,id,file='XML Scaffold collapsed structure','xml_collapsed',@f.base_filename.xml_scaffold_structure_collapse
456
+ summarize(desc,id,file,pth,rel,url)
457
+ end
458
+ if FileTest.file?(@f.place_file.info.dir)==true
459
+ pth=@f.output_path.texinfo.dir
460
+ rel=@f.output_path.texinfo.rel_sm
461
+ url=@f.output_path.texinfo.url
462
+ desc,id,file='Info file','info',@f.base_filename.info
463
+ summarize(desc,id,file,pth,rel,url)
464
+ end
465
+ if FileTest.file?(@f.place_file.manpage.dir)==true
466
+ pth=@f.output_path.manpage.dir
467
+ rel=@f.output_path.manpage.rel_sm
468
+ url=@f.output_path.manpage.url
469
+ desc,id,file='Manpage','manpage',@f.base_filename.manpage
470
+ summarize(desc,id,file,pth,rel,url)
471
+ end
472
+ if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true
473
+ desc,id,file='SQLite3 file','sqlite',@f.base_filename.sqlite_discrete
474
+ pth=@f.output_path.sqlite_discrete.dir
475
+ rel=@f.output_path.sqlite_discrete.rel_sm
476
+ url=@f.output_path.sqlite_discrete.url
477
+ summarize(desc,id,file,pth,rel,url)
478
+ end
479
+ if FileTest.file?(@f.place_file.txt.dir)==true
480
+ desc,id='Plaintext (UTF-8)','text'
481
+ pth=@f.output_path.txt.dir
482
+ rel=@f.output_path.txt.rel_sm
483
+ url=@f.output_path.txt.url
484
+ file=@f.base_filename.txt
485
+ summarize(desc,id,file,pth,rel,url)
486
+ end
487
+ if FileTest.file?(@f.place_file.textile.dir)==true
488
+ desc,id='Textile text (UTF-8)','textile'
489
+ pth=@f.output_path.textile.dir
490
+ rel=@f.output_path.textile.rel_sm
491
+ url=@f.output_path.textile.url
492
+ file=@f.base_filename.textile
493
+ summarize(desc,id,file,pth,rel,url)
494
+ end
495
+ if FileTest.file?(@f.place_file.asciidoc.dir)==true
496
+ desc,id='AsciiDoc text (UTF-8)','asciidoc'
497
+ pth=@f.output_path.asciidoc.dir
498
+ rel=@f.output_path.asciidoc.rel_sm
499
+ url=@f.output_path.asciidoc.url
500
+ file=@f.base_filename.asciidoc
501
+ summarize(desc,id,file,pth,rel,url)
502
+ end
503
+ if FileTest.file?(@f.place_file.markdown.dir)==true
504
+ desc,id='Markdown text (UTF-8)','markdown'
505
+ pth=@f.output_path.markdown.dir
506
+ rel=@f.output_path.markdown.rel_sm
507
+ url=@f.output_path.markdown.url
508
+ file=@f.base_filename.markdown
509
+ summarize(desc,id,file,pth,rel,url)
510
+ end
511
+ if FileTest.file?(@f.place_file.rst.dir)==true
512
+ desc,id='rST text (UTF-8)','rst'
513
+ pth=@f.output_path.rst.dir
514
+ rel=@f.output_path.rst.rel_sm
515
+ url=@f.output_path.rst.url
516
+ file=@f.base_filename.rst
517
+ summarize(desc,id,file,pth,rel,url)
518
+ end
519
+ if FileTest.file?(@f.place_file.orgmode.dir)==true
520
+ desc,id='OrgMode structure text (UTF-8)','org'
521
+ pth=@f.output_path.orgmode.dir
522
+ rel=@f.output_path.orgmode.rel_sm
523
+ url=@f.output_path.orgmode.url
524
+ file=@f.base_filename.orgmode
525
+ summarize(desc,id,file,pth,rel,url)
526
+ end
527
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
528
+ desc,id,file='LaTeX (portrait)','latex',"#{@md.fns}.tex"
529
+ pth,rel,url='','',''
530
+ summarize(desc,id,file,pth,rel,url)
531
+ end
532
+ if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true
533
+ desc,id,file='LaTeX (landscape)','latex_landscape',"#{@md.fns}.landscape.tex"
534
+ pth,rel,url='','',''
535
+ summarize(desc,id,file,pth,rel,url)
536
+ end
537
+ if FileTest.file?(@f.place_file.hash_digest.dir)==true
538
+ pth=@f.output_path.hash_digest.dir
539
+ rel=@f.output_path.hash_digest.rel_sm
540
+ url=@f.output_path.hash_digest.url
541
+ desc,id,file="Digest/DCC - Document Content Certificate (#{@dg})",'digests',@f.base_filename.hash_digest
542
+ summarize(desc,id,file,pth,rel,url)
543
+ end
544
+ end
545
+ def published_versions
546
+ desc,file='Markup (SiSU source)','source',@md.fns
547
+ languages(desc,file)
548
+ end
549
+ def language_versions
550
+ if FileTest.file?(@f.place_file.manifest.dir)==true
551
+ desc='Markup (SiSU source)'
552
+ published_languages(desc)
553
+ end
554
+ end
555
+ def qrc_image
556
+ fn=(@f.output_dir_structure.by_filename?) \
557
+ ? 'sisu_manifest'
558
+ : @md.fnb
559
+ pth=((@o_str.dump_or_redirect?) \
560
+ || (@f.output_dir_structure.by_filename?)) \
561
+ ? '.'
562
+ : 'qrcode'
563
+ img_md="#{pth}/#{fn}#{@fn_lng}.md.png"
564
+ img_title="#{pth}/#{fn}#{@fn_lng}.title.png"
565
+ if FileTest.file?(@f.place_file.qrcode_md.dir)==true
566
+ @manifest[:html] <<<<WOK
567
+ <tr><td class="left">
568
+ <p class="tiny">QR code SiSU document metadata:</p>
569
+ <p class="tiny">
570
+ <img border="0" src="#{img_md}" alt="qrcode metadata" />
571
+ </p>
572
+ </td></tr>
573
+ WOK
574
+ end
575
+ if FileTest.file?(@f.place_file.qrcode_title.dir)==true
576
+ @manifest[:html] <<<<WOK
577
+ <tr><td class="left">
578
+ <p class="tiny">QR code document title info:</p>
579
+ <p class="tiny">
580
+ <img border="0" src="#{img_title}" alt="qrcode title" />
581
+ </p>
582
+ </td></tr>
583
+ WOK
584
+ end
585
+ end
586
+ def source_tests
587
+ if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents
588
+ if FileTest.file?(@f.place_file.src.dir)==true
589
+ pth=@f.output_path.src.dir
590
+ rel=@f.output_path.src.rel_sm
591
+ url=@f.output_path.src.url
592
+ desc,id,file='Markup Composite File (SiSU source)','source',@f.base_filename.src
593
+ summarize_sources(desc,id,file,pth,rel,url)
594
+ end
595
+ else
596
+ if FileTest.file?(@f.place_file.src.dir)==true
597
+ pth=@f.output_path.src.dir
598
+ rel=@f.output_path.src.rel_sm
599
+ url=@f.output_path.src.url
600
+ desc,id,file='Markup (SiSU source)','composite',@f.base_filename.src
601
+ summarize_sources(desc,id,file,pth,rel,url)
602
+ end
603
+ end
604
+ if FileTest.file?(@f.place_file.sisupod.dir)==true
605
+ pth=@f.output_path.sisupod.dir
606
+ rel=@f.output_path.sisupod.rel_sm
607
+ url=@f.output_path.sisupod.url
608
+ desc,id,file='SiSUdoc pod (tar.xz)','sisupod',@f.base_filename.sisupod
609
+ summarize_sources(desc,id,file,pth,rel,url)
610
+ end
611
+ if FileTest.file?(@f.place_file.pot.dir)==true
612
+ pth=@f.output_path.pot.dir
613
+ rel=@f.output_path.pot.rel_sm
614
+ url=@f.output_path.pot.url
615
+ desc,id,file='SiSU pot','pot',@f.base_filename.pot
616
+ summarize_sources(desc,id,file,pth,rel,url)
617
+ end
618
+ end
619
+ def metadata_tests
620
+ if defined? @md.title #%
621
+ if defined? @md.title.full \
622
+ and @md.title.full=~/\S+/
623
+ desc,id,info=@translate.full_title,'title',@md.title.full
624
+ metadata(desc,id,info)
625
+ end
626
+ end
627
+ if defined? @md.creator #%
628
+ if defined? @md.creator.author \
629
+ and @md.creator.author=~/\S+/
630
+ desc,id,info=@translate.author,'author',@md.creator.author
631
+ metadata(desc,id,info)
632
+ end
633
+ if defined? @md.creator.editor \
634
+ and @md.creator.editor=~/\S+/
635
+ desc,id,info=@translate.editor,'editor',@md.creator.editor
636
+ metadata(desc,id,info)
637
+ end
638
+ if defined? @md.creator.contributor \
639
+ and @md.creator.contributor=~/\S+/
640
+ desc,id,info=@translate.contributor,'contributor',@md.creator.contributor
641
+ metadata(desc,id,info)
642
+ end
643
+ if defined? @md.creator.translator \
644
+ and @md.creator.translator=~/\S+/
645
+ desc,id,info=@translate.translator,'creator',@md.creator.translator
646
+ metadata(desc,id,info)
647
+ end
648
+ if defined? @md.creator.illustrator \
649
+ and @md.creator.illustrator=~/\S+/
650
+ desc,id,info=@translate.illustrator,'illustrator',@md.creator.illustrator
651
+ metadata(desc,id,info)
652
+ end
653
+ if defined? @md.creator.prepared_by \
654
+ and @md.creator.prepared_by=~/\S+/
655
+ desc,id,info=@translate.prepared_by,'prepared_by',@md.creator.prepared_by
656
+ metadata(desc,id,info)
657
+ end
658
+ if defined? @md.creator.digitized_by \
659
+ and @md.creator.digitized_by=~/\S+/
660
+ desc,id,info=@translate.digitized_by,'designed_by',@md.creator.digitized_by
661
+ metadata(desc,id,info)
662
+ end
663
+ end
664
+ if defined? @md.rights
665
+ if defined? @md.rights.all \
666
+ and @md.rights.all=~/\S+/ #dc
667
+ desc,id,info=@translate.rights,'rights',@md.rights.all
668
+ metadata(desc,id,info)
669
+ end
670
+ end
671
+ if defined? @md.date #%
672
+ if defined? @md.date.published \
673
+ and @md.date.published=~/\S+/ #dc
674
+ desc,id,info=@translate.date,'date',@md.date.published
675
+ metadata(desc,id,info)
676
+ end
677
+ if defined? @md.date.created \
678
+ and @md.date.created=~/\S+/ #dc
679
+ desc,id,info=@translate.date_created,'date_created',@md.date.created
680
+ metadata(desc,id,info)
681
+ end
682
+ if defined? @md.date.issued \
683
+ and @md.date.issued=~/\S+/ #dc
684
+ desc,id,info=@translate.date_issued,'date_issued',@md.date.issued
685
+ metadata(desc,id,info)
686
+ end
687
+ if defined? @md.date.available \
688
+ and @md.date.available=~/\S+/ #dc
689
+ desc,id,info=@translate.date_available,'date_available',@md.date.available
690
+ metadata(desc,id,info)
691
+ end
692
+ if defined? @md.date.modified \
693
+ and @md.date.modified=~/\S+/ #dc
694
+ desc,id,info=@translate.date_modified,'date_modified',@md.date.modified
695
+ metadata(desc,id,info)
696
+ end
697
+ if defined? @md.date.valid \
698
+ and @md.date.valid=~/\S+/ #dc
699
+ desc,id,info=@translate.date_valid,'date_valid',@md.date.valid
700
+ metadata(desc,id,info)
701
+ end
702
+ end
703
+ if defined? @md.publisher \
704
+ and @md.publisher=~/\S+/ #dc
705
+ desc,id,info=@translate.publisher,'publisher',@md.publisher
706
+ metadata(desc,id,info)
707
+ end
708
+ if defined? @md.notes #%
709
+ if defined? @md.notes.description \
710
+ and @md.notes.description=~/\S+/
711
+ desc,id,info=@translate.description,'description',@md.notes.description
712
+ metadata(desc,id,info)
713
+ end
714
+ if defined? @md.notes.abstract \
715
+ and @md.notes.abstract=~/\S+/
716
+ desc,id,info=@translate.abstract,'abstract',@md.notes.abstract
717
+ metadata(desc,id,info)
718
+ end
719
+ if defined? @md.notes.comment \
720
+ and @md.notes.comment=~/\S+/
721
+ desc,id,info=@translate.comments,'comment',@md.notes.comment
722
+ metadata(desc,id,info)
723
+ end
724
+ if defined? @md.notes.prefix_a \
725
+ and @md.notes.prefix_a=~/\S+/
726
+ desc,id,info=@translate.prefix_a,'prefix',@md.notes.prefix_a
727
+ metadata(desc,id,info)
728
+ end
729
+ if defined? @md.notes.prefix_b \
730
+ and @md.notes.prefix_b=~/\S+/
731
+ desc,id,info=@translate.prefix_b,'prefix_b',@md.notes.prefix_b
732
+ metadata(desc,id,info)
733
+ end
734
+ end
735
+ if defined? @md.title #%
736
+ if defined? @md.title.language \
737
+ and @md.title.language=~/\S+/
738
+ desc,id,info=@translate.language,'language',@md.title.language
739
+ metadata(desc,id,info)
740
+ end
741
+ if defined? @md.original.language \
742
+ and @md.original.language=~/\S+/
743
+ desc,id,info=@translate.language_original,'language_original',@md.original.language
744
+ metadata(desc,id,info)
745
+ end
746
+ end
747
+ if defined? @md.classify #%
748
+ if defined? @md.topic_register_array \
749
+ and @md.topic_register_array.length > 0
750
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left" id="topics">#{@translate.topic_register}:</p></th><td>\n}
751
+ @md.topic_register_array.each do |t|
752
+ t.each_with_index do |st,i|
753
+ if st.is_a?(Array)
754
+ st.each do |v|
755
+ if v.is_a?(Array)
756
+ v.each do |w|
757
+ @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n}
758
+ end
759
+ else
760
+ @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
761
+ end
762
+ end
763
+ else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
764
+ end
765
+ end
766
+ end
767
+ @manifest[:html] << %{</td></tr>\n}
768
+ end
769
+ if defined? @md.classify.subject \
770
+ and @md.classify.subject=~/\S+/
771
+ desc,id,info=@translate.subject,'subject',@md.classify.subject
772
+ metadata(desc,id,info)
773
+ end
774
+ if defined? @md.classify.keywords \
775
+ and @md.classify.keywords=~/\S+/
776
+ desc,id,info=@translate.keywords,'keywords',@md.classify.keywords
777
+ metadata(desc,id,info)
778
+ end
779
+ if defined? @md.classify.loc \
780
+ and @md.classify.loc=~/\S+/
781
+ desc,id,info=@translate.cls_loc,'loc',@md.classify.loc
782
+ metadata(desc,id,info)
783
+ end
784
+ if defined? @md.classify.dewey \
785
+ and @md.classify.dewey=~/\S+/
786
+ desc,id,info=@translate.cls_dewey,'dewey',@md.classify.dewey
787
+ metadata(desc,id,info)
788
+ end
789
+ if defined? @md.notes.coverage \
790
+ and @md.notes.coverage=~/\S+/
791
+ desc,id,info=@translate.coverage,'coverage',@md.notes.coverage
792
+ metadata(desc,id,info)
793
+ end
794
+ if defined? @md.notes.relation \
795
+ and @md.notes.relation=~/\S+/
796
+ desc,id,info=@translate.relation,'relation',@md.notes.relation
797
+ metadata(desc,id,info)
798
+ end
799
+ if defined? @md.notes.type \
800
+ and @md.notes.type=~/\S+/ #dc
801
+ desc,id,info=@translate.type,'type',@md.notes.type
802
+ metadata(desc,id,info)
803
+ end
804
+ if defined? @md.notes.format \
805
+ and @md.notes.format=~/\S+/
806
+ desc,id,info=@transate.format,'format',@md.notes.format
807
+ metadata(desc,id,info)
808
+ end
809
+ end
810
+ if defined? @md.identifier #%
811
+ if defined? @md.identifier.oclc \
812
+ and @md.identifier.oclc=~/\S+/
813
+ desc,id,info=@translate.cls_oclc,'',@md.identifier.oclc
814
+ @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{desc}:</p></th><td>\n}
815
+ @manifest[:html] << %{<p class="left"><a href="http://worldcat.org/oclc/#{info}">#{info}</a></p>\n}
816
+ @manifest[:html] << %{</td></tr>\n}
817
+ end
818
+ if defined? @md.identifier.pg \
819
+ and @md.identifier.pg=~/\S+/
820
+ desc,id,info=@translate.cls_gutenberg,'ocalc',@md.identifier.pg
821
+ metadata(desc,id,info)
822
+ end
823
+ if defined? @md.identifier.isbn \
824
+ and @md.identifier.isbn=~/\S+/
825
+ desc,id,info=@translate.cls_isbn,'isbn',@md.identifier.isbn
826
+ metadata(desc,id,info)
827
+ end
828
+ end
829
+ if defined? @md.original.source \
830
+ and @md.original.source=~/\S+/
831
+ desc,id,info=@translate.source,'source_original',@md.original.source
832
+ metadata(desc,id,info)
833
+ end
834
+ if @md.fns
835
+ desc,id,info=@translate.sourcefile,'source_filename',@md.fns
836
+ metadata(desc,id,info)
837
+ end
838
+ if @md.en[:mismatch] > 0
839
+ desc,id,info='WARNING document error in endnote markup, number mismatch','',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
840
+ metadata(desc,id,info)
841
+ end
842
+ if @md.wc_words
843
+ desc,id,info=@translate.word_count,'wordcount',@md.wc_words
844
+ metadata(desc,id,info)
845
+ end
846
+ if @md.dgst
847
+ desc,id,info="#{@translate.sourcefile_digest} (#{@dg})",'digests',@md.dgst[1]
848
+ metadata(desc,id,info)
849
+ end
850
+ if @md.sc_number
851
+ desc,id,info=@translate.sc_number,'sc_number',@md.sc_number
852
+ metadata(desc,id,info)
853
+ end
854
+ if @md.sc_date
855
+ desc,id,info=@translate.sc_date,'sc_date',"#{@md.sc_date} at #{@md.sc_time}"
856
+ metadata(desc,id,info)
857
+ end
858
+ if @md.generated
859
+ desc,id,info=@translate.last_generated,'generated',@md.generated
860
+ metadata(desc,id,info)
861
+ end
862
+ if @md.project_details
863
+ desc,id,info=@translate.sisu_version,'project',"#{@md.project_details.project} #{@md.project_details.version} #{@md.project_details.date_stamp} (#{@md.project_details.date})#{@md.project_details.install_method}"
864
+ metadata(desc,id,info)
865
+ end
866
+ if @md.ruby_version
867
+ desc,id,info=@translate.ruby_version,'ruby',@md.ruby_version
868
+ metadata(desc,id,info)
869
+ end
870
+ end
871
+ def links_tests
872
+ if defined? @md.lnk \
873
+ and @md.lnk
874
+ @md.lnk.each do |l|
875
+ if defined? l[:say]
876
+ target=(l[:url] !~/^\.(\.)?\//) \
877
+ ? 'external'
878
+ : '_top'
879
+ url,lnk=l[:url],l[:say]
880
+ unless url.nil? \
881
+ or url.empty?
882
+ links(url,lnk,target)
883
+ end
884
+ end
885
+ end
886
+ end
887
+ end
888
+ def check_output(data)
889
+ begin
890
+ make=SiSU_Env::ProcessingSettings.new(@md)
891
+ minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n")
892
+ format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
893
+ @manifest[:html] <<<<WOK
894
+ <!DOCTYPE html>
895
+ <html>
896
+ <head>
897
+ <meta charset="utf-8">
898
+ <title>
899
+ SiSU manifest: #{@md.title.full}
900
+ </title>
901
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
902
+ <meta name="sourcefile" content="#{@md.fns}" />
903
+ <link rel="generator" href="http://www.jus.uio.no/sisu" />
904
+ <link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" />
905
+ #{@stylesheet.css_head}
906
+ </head>
907
+ <body lang="#{@md.opt.lng}">
908
+ #{format_head_toc.seg_head_navigation_band(:manifest)}
909
+ WOK
910
+ if make.build.manifest_minitoc?
911
+ if @o_str.dump_or_redirect?
912
+ elsif @f.output_dir_structure.by_language_code? \
913
+ or @f.output_dir_structure.by_filetype?
914
+ minitoc=minitoc.gsub(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}).
915
+ gsub(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m,
916
+ %{<a href="#{@f.base_filename.manifest}"})
917
+ end
918
+ @manifest[:html] <<<<WOK
919
+ <div class="toc">
920
+ #{minitoc.to_s}
921
+ </div>
922
+ <div class="content">
923
+ WOK
924
+ else
925
+ @manifest[:html] <<<<WOK
926
+ <div>
927
+ WOK
928
+ end
929
+ if @o_str.dump_or_redirect?
930
+ elsif @f.output_dir_structure.by_language_code? \
931
+ or @f.output_dir_structure.by_filetype?
932
+ pth_local=@f.output_path.manifest.dir
933
+ pth_rel='.'
934
+ else
935
+ pth_local=@f.output_path.base.dir
936
+ pth_rel='..'
937
+ end
938
+ pth_rel_home=if @env.output_dir_structure.by? == :language
939
+ '../..'
940
+ elsif @env.output_dir_structure.by? == :filetype
941
+ '..'
942
+ elsif @env.output_dir_structure.by? == :filename
943
+ '..'
944
+ else '..'
945
+ end
946
+ output_organised_by="(output organised by #{@env.output_dir_structure.by?})"
947
+ harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \
948
+ && FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \
949
+ ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>] #{output_organised_by}</p>}
950
+ : %{<p class="small"><a href="#{pth_rel_home}">#{output_organised_by}</a></p>}
951
+ manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}}
952
+ @manifest[:html] <<<<WOK
953
+ <div id="horizontal_links">
954
+ #{manifest_title}
955
+ </div>
956
+ <h1 class="small">#{@md.title.full}</h1>
957
+ <p class="bold">#{@md.author}</p>
958
+ <div id="horizontal_links"><p class="bold">
959
+ <p class="small">
960
+ &nbsp;&nbsp;<a href="#output">Document, Available Filetypes</a>
961
+ </p>
962
+ <p class="small">
963
+ &nbsp;&nbsp;<a href="#metadata">Document Metadata</a>
964
+ </p>
965
+ <p class="tiny">
966
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">metadata suggested links (if any)</a>
967
+ </p>
968
+ </div>
969
+ <table summary="normal text css" width="100%" border="0" cellpadding="2" align="center">
970
+ WOK
971
+ published_versions
972
+ @manifest[:html] << '</table>'
973
+ @manifest[:html] <<<<WOK
974
+ <h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2>
975
+ <table summary="available output/filetypes" width="100%" border="0" cellpadding="2" align="center">
976
+ <tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr>
977
+
978
+ WOK
979
+ output_tests
980
+ @manifest[:html] << '</table>'
981
+ @manifest[:html] <<<<WOK
982
+ <table summary="normal text css" width="100%" border="0" cellpadding="2" align="center">
983
+ WOK
984
+ source_tests
985
+ @manifest[:html] << '</table>'
986
+ @manifest[:html] <<<<WOK
987
+ <h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2>
988
+ <table summary="document metadata" width="100%" border="0" cellpadding="2" align="center">
989
+ <tr> <th class="left"><p class="bold" id="metadata">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr>
990
+ WOK
991
+ metadata_tests
992
+ @manifest[:html] <<<<WOK
993
+ </table>
994
+ WOK
995
+ @manifest[:html] <<<<WOK
996
+ <p class="bold"><a name="links">#{@translate.suggested_links}:</a></p>
997
+ <table summary="suggested links" width="100%" border="0" cellpadding="2" align="center">
998
+ WOK
999
+ links_tests
1000
+ @manifest[:html] <<<<WOK
1001
+ </table>
1002
+ WOK
1003
+ @manifest[:html] <<<<WOK
1004
+ <h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2>
1005
+ <table summary="language versions" width="100%" border="0" cellpadding="2" align="center">
1006
+ <tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right">&nbsp;</p></th></tr>
1007
+
1008
+ WOK
1009
+ language_versions
1010
+ qrc_image
1011
+ @manifest[:html] <<<<WOK
1012
+ </table>
1013
+ </div>
1014
+ <div>
1015
+ <br>
1016
+ #{SiSU_Proj_HTML::Bits.new.credits_sisu_manifest}
1017
+ </div>
1018
+ </body>
1019
+ </html>
1020
+ WOK
1021
+ output
1022
+ rescue
1023
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
1024
+ __LINE__.to_s + ':' + __FILE__
1025
+ end
1026
+ ensure
1027
+ end
1028
+ end
1029
+ end
1030
+ end
1031
+ end
1032
+ __END__