sisu 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sisu +367 -0
  3. data/bin/sisugem +367 -0
  4. data/data/sisu/image/arrow_next_red.png +0 -0
  5. data/data/sisu/image/arrow_prev_red.png +0 -0
  6. data/data/sisu/image/arrow_up_red.png +0 -0
  7. data/data/sisu/image/b_bluebell.png +0 -0
  8. data/data/sisu/image/b_doc.png +0 -0
  9. data/data/sisu/image/b_epub.png +0 -0
  10. data/data/sisu/image/b_home.png +0 -0
  11. data/data/sisu/image/b_info.png +0 -0
  12. data/data/sisu/image/b_odf.png +0 -0
  13. data/data/sisu/image/b_pdf.png +0 -0
  14. data/data/sisu/image/b_search.png +0 -0
  15. data/data/sisu/image/b_toc.png +0 -0
  16. data/data/sisu/image/bullet_08.png +0 -0
  17. data/data/sisu/image/bullet_09.png +0 -0
  18. data/data/sisu/image/bullet_10.png +0 -0
  19. data/data/sisu/image/bullet_11.png +0 -0
  20. data/data/sisu/image/bullet_12.png +0 -0
  21. data/data/sisu/image/bullet_doc.png +0 -0
  22. data/data/sisu/image/bullet_red.png +0 -0
  23. data/data/sisu/image/dot_clear.png +0 -0
  24. data/data/sisu/image/dot_white.png +0 -0
  25. data/data/sisu/image/gplv3.png +0 -0
  26. data/data/sisu/image/gplv3_free_software.png +0 -0
  27. data/data/sisu/image/next.png +0 -0
  28. data/data/sisu/image/previous.png +0 -0
  29. data/data/sisu/image/rb7.ico +0 -0
  30. data/data/sisu/image/sisu.png +0 -0
  31. data/data/sisu/image/toctoc.png +0 -0
  32. data/data/sisu/version.yml +5 -0
  33. data/lib/sisu.rb +94 -0
  34. data/lib/sisu/air.rb +80 -0
  35. data/lib/sisu/ao.rb +590 -0
  36. data/lib/sisu/ao_character_check.rb +102 -0
  37. data/lib/sisu/ao_composite.rb +286 -0
  38. data/lib/sisu/ao_doc_objects.rb +565 -0
  39. data/lib/sisu/ao_doc_str.rb +2269 -0
  40. data/lib/sisu/ao_endnotes.rb +136 -0
  41. data/lib/sisu/ao_expand_insertions.rb +514 -0
  42. data/lib/sisu/ao_hash_digest.rb +174 -0
  43. data/lib/sisu/ao_idx.rb +422 -0
  44. data/lib/sisu/ao_images.rb +187 -0
  45. data/lib/sisu/ao_metadata.rb +86 -0
  46. data/lib/sisu/ao_misc_arrange.rb +207 -0
  47. data/lib/sisu/ao_numbering.rb +720 -0
  48. data/lib/sisu/ao_persist.rb +194 -0
  49. data/lib/sisu/ao_references.rb +502 -0
  50. data/lib/sisu/ao_syntax.rb +640 -0
  51. data/lib/sisu/cgi.rb +84 -0
  52. data/lib/sisu/cgi_pgsql.rb +270 -0
  53. data/lib/sisu/cgi_sql_common.rb +986 -0
  54. data/lib/sisu/cgi_sqlite.rb +244 -0
  55. data/lib/sisu/conf.rb +287 -0
  56. data/lib/sisu/constants.rb +388 -0
  57. data/lib/sisu/css.rb +3484 -0
  58. data/lib/sisu/db_columns.rb +1997 -0
  59. data/lib/sisu/db_create.rb +689 -0
  60. data/lib/sisu/db_dbi.rb +90 -0
  61. data/lib/sisu/db_drop.rb +207 -0
  62. data/lib/sisu/db_import.rb +877 -0
  63. data/lib/sisu/db_indexes.rb +146 -0
  64. data/lib/sisu/db_load_tuple.rb +323 -0
  65. data/lib/sisu/db_remove.rb +182 -0
  66. data/lib/sisu/db_select.rb +230 -0
  67. data/lib/sisu/db_sqltxt.rb +173 -0
  68. data/lib/sisu/db_tests.rb +114 -0
  69. data/lib/sisu/dbi.rb +166 -0
  70. data/lib/sisu/dbi_discrete.rb +206 -0
  71. data/lib/sisu/digests.rb +306 -0
  72. data/lib/sisu/dp.rb +1606 -0
  73. data/lib/sisu/dp_identify_markup.rb +161 -0
  74. data/lib/sisu/dp_make.rb +668 -0
  75. data/lib/sisu/embedded.rb +149 -0
  76. data/lib/sisu/errors.rb +84 -0
  77. data/lib/sisu/generic_parts.rb +131 -0
  78. data/lib/sisu/git.rb +277 -0
  79. data/lib/sisu/html.rb +775 -0
  80. data/lib/sisu/html_concordance.rb +391 -0
  81. data/lib/sisu/html_format.rb +1348 -0
  82. data/lib/sisu/html_harvest.rb +109 -0
  83. data/lib/sisu/html_harvest_author_format.rb +111 -0
  84. data/lib/sisu/html_harvest_authors.rb +466 -0
  85. data/lib/sisu/html_harvest_topics.rb +893 -0
  86. data/lib/sisu/html_lite_shared.rb +324 -0
  87. data/lib/sisu/html_manifest.rb +1032 -0
  88. data/lib/sisu/html_minitoc.rb +230 -0
  89. data/lib/sisu/html_parts.rb +437 -0
  90. data/lib/sisu/html_persist.rb +237 -0
  91. data/lib/sisu/html_promo.rb +440 -0
  92. data/lib/sisu/html_scroll.rb +235 -0
  93. data/lib/sisu/html_segments.rb +716 -0
  94. data/lib/sisu/html_shared.rb +62 -0
  95. data/lib/sisu/html_table.rb +64 -0
  96. data/lib/sisu/html_tune.rb +301 -0
  97. data/lib/sisu/hub.rb +277 -0
  98. data/lib/sisu/hub_actions.rb +1122 -0
  99. data/lib/sisu/hub_loop_markup_files.rb +170 -0
  100. data/lib/sisu/hub_options.rb +1695 -0
  101. data/lib/sisu/i18n.rb +702 -0
  102. data/lib/sisu/manpage.rb +377 -0
  103. data/lib/sisu/manpage_format.rb +85 -0
  104. data/lib/sisu/object_munge.rb +307 -0
  105. data/lib/sisu/prog_text_translation.rb +1702 -0
  106. data/lib/sisu/qrcode.rb +754 -0
  107. data/lib/sisu/relaxng.rb +1153 -0
  108. data/lib/sisu/remote.rb +246 -0
  109. data/lib/sisu/rexml.rb +148 -0
  110. data/lib/sisu/se.rb +158 -0
  111. data/lib/sisu/se_cleanoutput.rb +145 -0
  112. data/lib/sisu/se_clear.rb +105 -0
  113. data/lib/sisu/se_createsite.rb +273 -0
  114. data/lib/sisu/se_css.rb +221 -0
  115. data/lib/sisu/se_date.rb +92 -0
  116. data/lib/sisu/se_db.rb +214 -0
  117. data/lib/sisu/se_envcall.rb +326 -0
  118. data/lib/sisu/se_file_op.rb +2758 -0
  119. data/lib/sisu/se_filemap.rb +247 -0
  120. data/lib/sisu/se_get_init.rb +238 -0
  121. data/lib/sisu/se_hub_particulars.rb +234 -0
  122. data/lib/sisu/se_info_env.rb +2179 -0
  123. data/lib/sisu/se_info_port.rb +70 -0
  124. data/lib/sisu/se_info_system.rb +202 -0
  125. data/lib/sisu/se_load.rb +108 -0
  126. data/lib/sisu/se_processing.rb +659 -0
  127. data/lib/sisu/se_programs.rb +394 -0
  128. data/lib/sisu/se_remotes.rb +553 -0
  129. data/lib/sisu/se_standardise_lang.rb +176 -0
  130. data/lib/sisu/se_version.rb +174 -0
  131. data/lib/sisu/shared_images.rb +137 -0
  132. data/lib/sisu/shared_markup_alt.rb +336 -0
  133. data/lib/sisu/shared_metadata.rb +1361 -0
  134. data/lib/sisu/shared_sem.rb +156 -0
  135. data/lib/sisu/sisu_thor_lib.rb +407 -0
  136. data/lib/sisu/sitemaps.rb +224 -0
  137. data/lib/sisu/src_kdissert_share.rb +102 -0
  138. data/lib/sisu/src_po4a_share.rb +309 -0
  139. data/lib/sisu/src_po4a_shelf.rb +1217 -0
  140. data/lib/sisu/src_po4a_shelf_set.rb +297 -0
  141. data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
  142. data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
  143. data/lib/sisu/src_po4a_sstm.rb +135 -0
  144. data/lib/sisu/src_shared.rb +347 -0
  145. data/lib/sisu/src_sisupod_make.rb +171 -0
  146. data/lib/sisu/src_sisupod_sstm.rb +109 -0
  147. data/lib/sisu/sst_convert_markup.rb +323 -0
  148. data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
  149. data/lib/sisu/sst_from_xml.rb +178 -0
  150. data/lib/sisu/sst_identify_markup.rb +482 -0
  151. data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
  152. data/lib/sisu/termsheet.rb +163 -0
  153. data/lib/sisu/texinfo.rb +430 -0
  154. data/lib/sisu/texinfo_format.rb +541 -0
  155. data/lib/sisu/texpdf.rb +1162 -0
  156. data/lib/sisu/texpdf_format.rb +1689 -0
  157. data/lib/sisu/texpdf_parts.rb +235 -0
  158. data/lib/sisu/txt_asciidoc.rb +354 -0
  159. data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
  160. data/lib/sisu/txt_markdown.rb +389 -0
  161. data/lib/sisu/txt_markdown_decorate.rb +207 -0
  162. data/lib/sisu/txt_orgmode.rb +376 -0
  163. data/lib/sisu/txt_orgmode_decorate.rb +186 -0
  164. data/lib/sisu/txt_output.rb +86 -0
  165. data/lib/sisu/txt_plain.rb +410 -0
  166. data/lib/sisu/txt_plain_decorate.rb +189 -0
  167. data/lib/sisu/txt_read.rb +109 -0
  168. data/lib/sisu/txt_rst.rb +371 -0
  169. data/lib/sisu/txt_rst_decorate.rb +186 -0
  170. data/lib/sisu/txt_shared.rb +241 -0
  171. data/lib/sisu/txt_textile.rb +367 -0
  172. data/lib/sisu/txt_textile_decorate.rb +186 -0
  173. data/lib/sisu/update.rb +141 -0
  174. data/lib/sisu/urls.rb +696 -0
  175. data/lib/sisu/utils.rb +232 -0
  176. data/lib/sisu/utils_composite.rb +115 -0
  177. data/lib/sisu/utils_response.rb +114 -0
  178. data/lib/sisu/utils_screen_text_color.rb +472 -0
  179. data/lib/sisu/utils_spell.rb +99 -0
  180. data/lib/sisu/webrick.rb +191 -0
  181. data/lib/sisu/wikispeak.rb +375 -0
  182. data/lib/sisu/xhtml.rb +472 -0
  183. data/lib/sisu/xhtml_epub2.rb +890 -0
  184. data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
  185. data/lib/sisu/xhtml_epub2_format.rb +2272 -0
  186. data/lib/sisu/xhtml_epub2_persist.rb +278 -0
  187. data/lib/sisu/xhtml_epub2_segments.rb +599 -0
  188. data/lib/sisu/xhtml_epub2_tune.rb +330 -0
  189. data/lib/sisu/xhtml_parts.rb +183 -0
  190. data/lib/sisu/xhtml_shared.rb +62 -0
  191. data/lib/sisu/xhtml_table.rb +97 -0
  192. data/lib/sisu/xml_docbook5.rb +376 -0
  193. data/lib/sisu/xml_dom.rb +624 -0
  194. data/lib/sisu/xml_fictionbook2.rb +389 -0
  195. data/lib/sisu/xml_format.rb +865 -0
  196. data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
  197. data/lib/sisu/xml_odf_odt.rb +887 -0
  198. data/lib/sisu/xml_odf_odt_format.rb +674 -0
  199. data/lib/sisu/xml_parts.rb +191 -0
  200. data/lib/sisu/xml_persist.rb +126 -0
  201. data/lib/sisu/xml_sax.rb +521 -0
  202. data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
  203. data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
  204. data/lib/sisu/xml_shared.rb +665 -0
  205. data/lib/sisu/xml_tables.rb +261 -0
  206. data/lib/sisu/zap.rb +90 -0
  207. metadata +251 -0
@@ -0,0 +1,336 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/shared_markup_alt.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_TextRepresentation
58
+ class Alter
59
+ def initialize(x)
60
+ if x.is_a?(String)
61
+ @t_o,@s=nil,x
62
+ else
63
+ @t_o,@s=x,x.obj.dup
64
+ end
65
+ end
66
+ def strip_clean_of_extra_spaces # dal output tuned
67
+ @s=@s.dup
68
+ @s=@s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless @s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
69
+ @s=@s.gsub(/ [ ]+/,' ').
70
+ gsub(/^ [ ]+/,'').
71
+ gsub(/ [ ]+$/,'').
72
+ gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2').
73
+ gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
74
+ end
75
+ def strip_clean_of_markup # text form used in sql db search, used for digest, define rules, make same as in db clean
76
+ @s=@s.dup #% same as db clean -->
77
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1').
78
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1').
79
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1').
80
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1').
81
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1').
82
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1').
83
+ gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]').
84
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1').
85
+ gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1').
86
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
87
+ gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,''). # endnote removed
88
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,''). # endnote removed
89
+ gsub(/(?:#{Mx[:nbsp]})+/,' ').
90
+ gsub(/(?:#{Mx[:br_nl]})+/,"\n").
91
+ gsub(/(?:#{Mx[:br_paragraph]})+/,"\n").
92
+ gsub(/(?:#{Mx[:br_line]})+/,"\n").
93
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
94
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
95
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
96
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
97
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
98
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
99
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
100
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
101
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
102
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
103
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
104
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
105
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
106
+ gsub(/\s\s+/,' ').
107
+ gsub(/\s\s+/,' ').
108
+ strip
109
+ end
110
+ def semi_revert_markup # used for digest, define rules, make same as in db clean
111
+ if @t_o
112
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*').
113
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/').
114
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_').
115
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"').
116
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
117
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
118
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^').
119
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},').
120
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
121
+ gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~'). # endnote marker marked up
122
+ gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up
123
+ if @t_o.is==:heading \
124
+ || @t_o.is==:para
125
+ @s=@s.gsub(/ [ ]+/,' ')
126
+ @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
127
+ if @t_o.is==:heading
128
+ @s=@t_o.lv + '~ ' + @s
129
+ end
130
+ if @t_o.is==:para
131
+ if @t_o.bullet_
132
+ @s='_* ' + @s
133
+ end
134
+ if @t_o.indent.to_i > 0
135
+ @s="_#{@t_o.indent} " + @s
136
+ @s=@s.gsub(/^(_[1-9])\s_\*\s/,'\1* ')
137
+ end
138
+ end
139
+ end
140
+ if @t_o.is==:block \
141
+ || @t_o.is==:group \
142
+ || @t_o.is==:code
143
+ @s=@s.gsub(/#{Mx[:nbsp]}/,' ')
144
+ @s="#{@t_o.is.to_s}{\n\n#{@s}\n\n}#{@t_o.is.to_s}"
145
+ @s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n")
146
+ end
147
+ #dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such
148
+ @s=@s.strip
149
+ end
150
+ @s
151
+ end
152
+ def html_lite #test whether eventually can be used in db_import replacing shared_html_lite (search for SiSU_FormatShared)
153
+ if @t_o
154
+ @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
155
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
156
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
157
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
158
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+').
159
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-').
160
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
161
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
162
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
163
+ if @t_o.is !=:code
164
+ if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
165
+ wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)
166
+ words=urls(wm)
167
+ @s=@s.gsub(/.+/m,words)
168
+ end
169
+ @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
170
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
171
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration
172
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3'). #special case \{ e.g. \}http://url
173
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration
174
+ else
175
+ @s=@s.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
176
+ end
177
+ if @t_o.is==:paragraph
178
+ if @t_o.bullet_
179
+ @s=@s
180
+ end
181
+ if @t_o.indent > 0
182
+ @s=@s
183
+ end
184
+ end
185
+ if @t_o.is==:heading
186
+ @s=@s
187
+ end
188
+ else
189
+ p __FILE__ << ':' << __LINE__.to_s
190
+ end
191
+ @s
192
+ end
193
+ end
194
+ class ModifiedTextPlusHashDigest
195
+ def initialize(md,x)
196
+ @md=md
197
+ if x.is_a?(String)
198
+ @t_o,@s=nil,x
199
+ else
200
+ @t_o,@s=x,x.obj.dup
201
+ end
202
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
203
+ @sha_ = @env.digest(@md.opt).type
204
+ begin
205
+ case @sha_
206
+ when :sha512
207
+ require 'digest/sha2'
208
+ when :sha256
209
+ require 'digest/sha2'
210
+ when :md5
211
+ require 'digest/md5'
212
+ end
213
+ rescue LoadError
214
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error((@sha_ ? 'digest/sha2' : 'digest/md5') + ' NOT FOUND')
215
+ end
216
+ end
217
+ def digest(txt)
218
+ d=nil
219
+ case @sha_
220
+ when :sha512
221
+ for hash_class in [ Digest::SHA512 ]
222
+ d=hash_class.hexdigest(txt)
223
+ end
224
+ when :sha256
225
+ for hash_class in [ Digest::SHA256 ]
226
+ d=hash_class.hexdigest(txt)
227
+ end
228
+ when :md5
229
+ for hash_class in [ Digest::MD5 ]
230
+ d=hash_class.hexdigest(txt)
231
+ end
232
+ end
233
+ d
234
+ end
235
+ def strip_clean_of_markup
236
+ def txt
237
+ SiSU_TextRepresentation::Alter.new(@s).strip_clean_of_markup
238
+ end
239
+ def dgst
240
+ txt_dgst=digest(txt)
241
+ { txt: txt, dgst_txt: txt_dgst }
242
+ end
243
+ self
244
+ end
245
+ def semi_revert_markup
246
+ def txt
247
+ SiSU_TextRepresentation::Alter.new(@s).semi_revert_markup
248
+ end
249
+ def dgst
250
+ txt_dgst=digest(txt)
251
+ { txt: txt, dgst_txt: txt_dgst }
252
+ end
253
+ self
254
+ end
255
+ def composite
256
+ def stripped_clean(txt)
257
+ SiSU_TextRepresentation::Alter.new(txt).strip_clean_of_markup
258
+ end
259
+ def markup_reverted(txt)
260
+ SiSU_TextRepresentation::Alter.new(txt).semi_revert_markup
261
+ end
262
+ def images(imgs)
263
+ sys=SiSU_Env::SystemCall.new
264
+ line_image=[]
265
+ if imgs and imgs.length > 0
266
+ @image_name,@image_dgst,@img=[],[],[]
267
+ imgs.each do |i|
268
+ image_source=if FileTest.file?("#{@env.path.image_source_include_local}/#{i}")
269
+ @env.path.image_source_include_local
270
+ elsif FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")
271
+ @env.path.image_source_include_remote
272
+ elsif FileTest.file?("#{@env.path.image_source_include}/#{i}")
273
+ @env.path.image_source_include
274
+ else
275
+ SiSU_Screen::Ansi.new(
276
+ @md.opt.act[:color_state][:set],
277
+ "ERROR - image:",
278
+ %{"#{i}" missing},
279
+ "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}"
280
+ ).error2 unless @md.opt.act[:quiet][:set]==:on
281
+ nil
282
+ end
283
+ img_type = /\S+\.(png|jpg|gif)/.match(i)[1]
284
+ if image_source
285
+ para_image = image_source + '/' + i
286
+ image_name = i
287
+ image_dgst =(@sha_ ? sys.sha256(para_image) : sys.md5(para_image))
288
+ else
289
+ image_name = i + ' [image missing]'
290
+ image_dgst = ''
291
+ end
292
+ line_image << { img_dgst: image_dgst[1], img_name: image_name, img_type: img_type }
293
+ end
294
+ end
295
+ line_image
296
+ end
297
+ def endnotes(en)
298
+ en_dgst=[]
299
+ if en and en.length > 0
300
+ en.flatten.each do |e|
301
+ note_no=e.gsub(/^([\d*+]+)\s+.+/,'\1')
302
+ e=digest(stripped_clean(e))
303
+ note_dgst=digest(e)
304
+ en_dgst << { note_number: note_no, note_dgst: note_dgst }
305
+ end
306
+ end
307
+ en_dgst
308
+ end
309
+ def dgst
310
+ if @t_o.of !=:comment \
311
+ && @t_o.of !=:structure \
312
+ && @t_o.of !=:layout
313
+ txt_stripped_dgst=digest(stripped_clean(@t_o))
314
+ txt_markup_reverted_dgst=digest(markup_reverted(@t_o))
315
+ endnotes_dgst=[]
316
+ rgx_notes=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
317
+ notes=@t_o.obj.scan(rgx_notes)
318
+ endnotes_dgst=endnotes(notes)
319
+ rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
320
+ imgs=if (@t_o.is==:para \
321
+ || @t_o.is==:image) \
322
+ and @t_o.obj =~rgx_image
323
+ imgs=@t_o.obj.scan(rgx_image).flatten
324
+ line_image=images(imgs)
325
+ end
326
+ dgst={ is: @t_o.is, ocn: @t_o.ocn, dgst_stripped_txt: txt_stripped_dgst, dgst_markedup_txt: txt_markup_reverted_dgst }
327
+ dgst[:endnotes]=endnotes_dgst if endnotes_dgst and endnotes_dgst.length > 0
328
+ dgst[:images]=line_image if line_image and line_image.length > 0
329
+ end
330
+ dgst
331
+ end
332
+ self
333
+ end
334
+ end
335
+ end
336
+ __END__
@@ -0,0 +1,1361 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/shared_metadata.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Metadata
58
+ require_relative 'xml_parts' # xml_parts.rb
59
+ require_relative 'xml_shared' # xml_shared.rb
60
+ class Summary
61
+ include SiSU_Parts_XML
62
+ attr_accessor :tag,:inf,:class,:attrib
63
+ def initialize(md,display_heading=false)
64
+ @md,@display_heading=md,display_heading
65
+ @tag,@inf,@class,@attrib=nil
66
+ end
67
+ def metadata_base
68
+ meta=[]
69
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
70
+ language=l[:n]
71
+ tr=SiSU_Translate::Source.new(@md,language)
72
+ @attrib='md'
73
+ def meta_content_clean(content='')
74
+ content=if not content.nil?
75
+ content=content.tr('"',"'").
76
+ gsub(/&/,'&amp;')
77
+ content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
78
+ else content
79
+ end
80
+ end
81
+ if @display_heading
82
+ @tag,@inf=%{<b><u>Document Metadata</u></b>},''
83
+ meta << self.meta_para
84
+ end
85
+ if defined? @md.title.full \
86
+ and @md.title.full=~/\S+/
87
+ @tag,@inf,@class=tr.full_title,@md.title.full,'dc' #1
88
+ meta << self.meta_para
89
+ end
90
+ if defined? @md.creator.author \
91
+ and @md.creator.author=~/\S+/
92
+ @tag,@inf,@class=tr.author,@md.creator.author,'dc' #2
93
+ meta << self.meta_para
94
+ end
95
+ if defined? @md.creator.translator \
96
+ and @md.creator.translator=~/\S+/
97
+ @tag,@inf,@class=tr.translator,@md.creator.translator,'ext'
98
+ meta << self.meta_para
99
+ end
100
+ if defined? @md.creator.illustrator \
101
+ and @md.creator.illustrator=~/\S+/
102
+ @tag,@inf,@class=tr.illustrator,@md.creator.illustrator,'ext'
103
+ meta << self.meta_para
104
+ end
105
+ if defined? @md.creator.prepared_by \
106
+ and @md.creator.prepared_by=~/\S+/
107
+ @tag,@inf,@class=tr.prepared_by,@md.creator.prepared_by,'ext'
108
+ meta << self.meta_para
109
+ end
110
+ if defined? @md.creator.digitized_by \
111
+ and @md.creator.digitized_by=~/\S+/
112
+ @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext'
113
+ meta << self.meta_para
114
+ end
115
+ if defined? @md.creator.contributor \
116
+ and @md.creator.contributor=~/\S+/
117
+ @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6
118
+ meta << self.meta_para
119
+ end
120
+ if defined? @md.rights.all \
121
+ and @md.rights.all=~/\S+/
122
+ @tag,@inf,@class=tr.rights,meta_content_clean(@md.rights.all),'dc' #15
123
+ meta << self.meta_para
124
+ end
125
+ if defined? @md.classify.subject \
126
+ and @md.classify.subject=~/\S+/
127
+ @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3
128
+ meta << self.meta_para
129
+ end
130
+ if defined? @md.classify.keywords \
131
+ and @md.classify.keywords=~/\S+/
132
+ @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext'
133
+ meta << self.meta_para
134
+ end
135
+ if defined? @md.classify.loc \
136
+ and @md.classify.loc=~/\S+/
137
+ @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id'
138
+ meta << self.meta_para
139
+ end
140
+ if defined? @md.classify.dewey \
141
+ and @md.classify.dewey=~/\S+/
142
+ @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id'
143
+ meta << self.meta_para
144
+ end
145
+ if defined? @md.publisher \
146
+ and @md.publisher=~/\S+/
147
+ @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5
148
+ meta << self.meta_para
149
+ end
150
+ if defined? @md.date.created \
151
+ and @md.date.created=~/\S+/
152
+ @tag,@inf,@class=tr.date_created,@md.date.created,'dc' #7
153
+ meta << self.meta_para
154
+ end
155
+ if defined? @md.date.issued \
156
+ and @md.date.issued=~/\S+/
157
+ @tag,@inf,@class=tr.date_issued,@md.date.issued,'dc' #7
158
+ meta << self.meta_para
159
+ end
160
+ if defined? @md.date.available \
161
+ and @md.date.available=~/\S+/
162
+ @tag,@inf,@class=tr.date_available,@md.date.available,'dc' #7
163
+ meta << self.meta_para
164
+ end
165
+ if defined? @md.date.modified \
166
+ and @md.date.modified=~/\S+/
167
+ @tag,@inf,@class=tr.date_modified,@md.date.modified,'dc' #7
168
+ meta << self.meta_para
169
+ end
170
+ if defined? @md.date.valid \
171
+ and @md.date.valid=~/\S+/
172
+ @tag,@inf,@class=tr.date_valid,@md.date.valid,'dc' #7
173
+ meta << self.meta_para
174
+ end
175
+ if defined? @md.date.published \
176
+ and @md.date.published=~/\S+/
177
+ @tag,@inf,@class=tr.date,@md.date.published,'dc' #7
178
+ meta << self.meta_para
179
+ end
180
+ if defined? @md.identifier.isbn \
181
+ and @md.identifier.isbn=~/\S+/
182
+ @tag,@inf,@class=tr.cls_isbn,@md.identifier.isbn,'id'
183
+ meta << self.meta_para
184
+ end
185
+ if defined? @md.identifier.oclc \
186
+ and @md.identifier.oclc=~/\S+/
187
+ @tag,@inf,@class=tr.cls_oclc,@md.identifier.oclc,'id'
188
+ meta << self.meta_para
189
+ end
190
+ if defined? @md.notes.description \
191
+ and @md.notes.description=~/\S+/
192
+ @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4
193
+ meta << self.meta_para
194
+ end
195
+ if defined? @md.notes.abstract \
196
+ and @md.notes.abstract=~/\S+/
197
+ @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext'
198
+ meta << self.meta_para
199
+ end
200
+ if defined? @md.notes.comment \
201
+ and @md.notes.comment=~/\S+/
202
+ @tag,@inf,@class=tr.comments,@md.notes.comment,'ext'
203
+ meta << self.meta_para
204
+ end
205
+ if defined? @md.notes.coverage \
206
+ and @md.notes.coverage=~/\S+/
207
+ @tag,@inf,@class=tr.coverage,@md.notes.coverage,'dc' #14
208
+ meta << self.meta_para
209
+ end
210
+ if defined? @md.notes.relation \
211
+ and @md.notes.relation=~/\S+/
212
+ @tag,@inf,@class=tr.relation,@md.notes.relation,'dc' #13
213
+ meta << self.meta_para
214
+ end
215
+ #if defined? @md.notes.source \
216
+ #and @md.notes.source=~/\S+/
217
+ # @tag,@inf,@class=tr.source,@md.notes.source,'dc' #11
218
+ # meta << self.meta_para
219
+ #end
220
+ if defined? @md.notes.history \
221
+ and @md.notes.history=~/\S+/
222
+ @tag,@inf,@class=tr.type,@md.notes.history,'dc' #8
223
+ meta << self.meta_para
224
+ end
225
+ if defined? @md.notes.type \
226
+ and @md.notes.type=~/\S+/
227
+ @tag,@inf,@class=tr.type,@md.notes.type,'dc' #8
228
+ meta << self.meta_para
229
+ end
230
+ if defined? @md.notes.format \
231
+ and @md.notes.format=~/\S+/
232
+ @tag,@inf,@class=tr.format,@md.notes.format,'dc' #9
233
+ meta << self.meta_para
234
+ end
235
+ if defined? @md.notes.prefix_a \
236
+ and @md.notes.prefix_a=~/\S+/
237
+ @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf'
238
+ meta << self.meta_para
239
+ end
240
+ if defined? @md.notes.prefix_b \
241
+ and @md.notes.prefix_b=~/\S+/
242
+ @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf'
243
+ meta << self.meta_para
244
+ end
245
+ if defined? @md.original.source \
246
+ and @md.original.source=~/\S+/
247
+ @tag,@inf,@class=tr.source,@md.original.source,'dc' #11
248
+ meta << self.meta_para
249
+ end
250
+ if defined? @md.title.language \
251
+ and @md.title.language=~/\S+/
252
+ @tag,@inf,@class=tr.language,@md.title.language,'dc' #12
253
+ meta << self.meta_para
254
+ end
255
+ if defined? @md.original.language \
256
+ and @md.original.language=~/\S+/
257
+ @tag,@inf,@class=tr.language_original,@md.original.language,'ext'
258
+ meta << self.meta_para
259
+ end
260
+ if @display_heading
261
+ @tag,@inf=%{<b><u>Version Information</u></b>},''
262
+ meta << self.meta_para
263
+ end
264
+ if defined? @md.fns \
265
+ and @md.fns=~/\S+/
266
+ @tag,@inf,@class=tr.sourcefile,@md.fns,'src'
267
+ meta << self.meta_para
268
+ end
269
+ if defined? @md.file_encoding \
270
+ and @md.file_encoding=~/\S+/
271
+ @tag,@inf,@class='Filetype',@md.file_encoding,'src'
272
+ meta << self.meta_para
273
+ end
274
+ if defined? @md.dgst \
275
+ and @md.dgst.is_a?(Array)
276
+ @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
277
+ meta << self.meta_para
278
+ end
279
+ if @display_heading
280
+ @tag,@inf=%{<b><u>Generated</u></b>},''
281
+ meta << self.meta_para
282
+ end
283
+ if defined? @md.project_details \
284
+ and @md.project_details.version=~/\S+/
285
+ v="#{tr.sisu_version}: " +
286
+ "#{@md.project_details.project} " +
287
+ "#{@md.project_details.version} " +
288
+ "of #{@md.project_details.date_stamp} " +
289
+ "(#{@md.project_details.date})"
290
+ @tag,@inf,@class='Generated by',v,'ver'
291
+ meta << self.meta_para
292
+ end
293
+ if defined? @md.ruby_version \
294
+ and @md.ruby_version=~/\S+/
295
+ @tag,@inf,@class=tr.ruby_version,@md.ruby_version,'ver'
296
+ meta << self.meta_para
297
+ end
298
+ if defined? @md.generated \
299
+ and @md.generated.is_a?(Time)
300
+ @tag,@inf,@class=tr.last_generated,@md.generated,'date'
301
+ meta << self.meta_para
302
+ end
303
+ meta
304
+ end
305
+ def metadata_alt
306
+ meta=[]
307
+ if @display_heading
308
+ @tag,@inf=%{<b><u>Document Metadata</u></b>},''
309
+ meta << self.meta_para
310
+ end
311
+ if defined? @md.title.main \
312
+ and @md.title.main=~/\S+/
313
+ @tag='title'
314
+ @inf=@md.title.main
315
+ meta << self.meta_para
316
+ end
317
+ if defined? @md.title.sub \
318
+ and @md.title.sub=~/\S+/
319
+ @tag='subtitle'
320
+ @inf=@md.title.sub
321
+ meta << self.meta_para
322
+ end
323
+ if defined? @md.creator.author \
324
+ and @md.creator.author=~/\S+/
325
+ @tag='author'
326
+ @inf=@md.creator.author
327
+ meta << self.meta_para
328
+ end
329
+ if defined? @md.creator.translator \
330
+ and @md.creator.translator=~/\S+/
331
+ @tag='translator'
332
+ @inf=@md.creator.translator
333
+ meta << self.meta_para
334
+ end
335
+ if defined? @md.creator.illustrator \
336
+ and @md.creator.illustrator=~/\S+/
337
+ @tag='illustrator'
338
+ @inf=@md.creator.illustrator
339
+ meta << self.meta_para
340
+ end
341
+ if defined? @md.rights.copyright.text \
342
+ and @md.rights.copyright.text=~/\S+/
343
+ @tag='copyright'
344
+ @inf=@md.rights.copyright.text # year & holder
345
+ @inf=@inf.gsub(/(?:Copyright|\(C\))+\s*/,'')
346
+ meta << self.meta_para
347
+ end
348
+ if defined? @md.rights.license \
349
+ and @md.rights.license=~/\S+/
350
+ @tag='license'
351
+ @inf=@md.rights.license
352
+ meta << self.meta_para
353
+ end
354
+ meta
355
+ end
356
+ def processing_tags
357
+ def make
358
+ def language
359
+ if defined? @md.make.language \
360
+ and @md.make.language
361
+ ' :language: ' + @md.make.language.join(', ')
362
+ else nil
363
+ end
364
+ end
365
+ def headings
366
+ if defined? @md.make.headings \
367
+ and @md.make.headings
368
+ ' :headings: ' + @md.make.headings[0].join('; ')
369
+ else nil
370
+ end
371
+ end
372
+ def num_top
373
+ if defined? @md.make.num_top \
374
+ and @md.make.num_top
375
+ ' :num_top: ' + @md.make.num_top
376
+ else nil
377
+ end
378
+ end
379
+ def breaks
380
+ x=if defined? @md.make.breaks \
381
+ and @md.make.breaks
382
+ x=' :breaks:'
383
+ if @md.make.breaks[:page_break]
384
+ x +=' break=' + @md.make.breaks[:page_break] + ';'
385
+ end
386
+ if @md.make.breaks[:page_new]
387
+ x +=' new=' + @md.make.breaks[:page_new] + ';'
388
+ end
389
+ else nil
390
+ end
391
+ end
392
+ def emphasis
393
+ if defined? @md.make.emphasis \
394
+ and @md.make.emphasis
395
+ ' :emphasis: ' + @md.make.emphasis[:regx].inspect
396
+ else nil
397
+ end
398
+ end
399
+ def bold
400
+ if defined? @md.make.bold \
401
+ and @md.make.bold
402
+ ' :bold: ' + @md.make.bold[:regx].inspect
403
+ else nil
404
+ end
405
+ end
406
+ def italics
407
+ if defined? @md.make.italics \
408
+ and @md.make.italics
409
+ ' :italics: ' + @md.make.italics[:regx].inspect
410
+ else nil
411
+ end
412
+ end
413
+ def texpdf_font
414
+ if defined? @md.make.texpdf_font \
415
+ and @md.make.texpdf_font
416
+ ' :texpdf_font: ' + @md.make.texpdf_font.main
417
+ else nil
418
+ end
419
+ end
420
+ self
421
+ end
422
+ self
423
+ end
424
+ def metadata_tags
425
+ def title
426
+ def main
427
+ if defined? @md.title.main \
428
+ and @md.title.main
429
+ '@title: ' + @md.title.main
430
+ else '@title:'
431
+ end
432
+ end
433
+ def sub
434
+ if defined? @md.title.sub \
435
+ and @md.title.sub
436
+ ' :subtitle: ' + @md.title.sub
437
+ else nil
438
+ end
439
+ end
440
+ def edition
441
+ if defined? @md.title.edition \
442
+ and @md.title.edition
443
+ ' :edition: ' + @md.title.edition
444
+ else nil
445
+ end
446
+ end
447
+ def note
448
+ if defined? @md.title.note \
449
+ and @md.title.note
450
+ ' :note: ' + @md.title.note
451
+ else nil
452
+ end
453
+ end
454
+ def short
455
+ if defined? @md.title.short \
456
+ and @md.title.short
457
+ ' :short: ' + @md.title.short
458
+ else nil
459
+ end
460
+ end
461
+ def language
462
+ if defined? @md.title.language \
463
+ and @md.title.language
464
+ ' :language: ' + @md.title.language
465
+ else nil
466
+ end
467
+ end
468
+ def language_char
469
+ if defined? @md.title.language_char \
470
+ and @md.title.language_char
471
+ ' :language_char: ' + @md.title.language_char
472
+ else nil
473
+ end
474
+ end
475
+ self
476
+ end
477
+ def creator
478
+ def head
479
+ '@creator:'
480
+ end
481
+ def author
482
+ x=if defined? @md.creator.author_detail \
483
+ and @md.creator.author_detail
484
+ x=''
485
+ @md.creator.author_detail.each do |n|
486
+ x += "#{n[:the]}, #{n[:others]}; "
487
+ end
488
+ x=x.gsub(/;\s*$/,'')
489
+ ' :author: ' + x
490
+ else nil
491
+ end
492
+ end
493
+ def contributor
494
+ x=if defined? @md.creator.contributor_detail \
495
+ and @md.creator.contributor_detail
496
+ x=''
497
+ @md.creator.contributor_detail.each do |n|
498
+ x += "#{n[:the]}, #{n[:others]}; "
499
+ end
500
+ x=x.gsub(/;\s*$/,'')
501
+ ' :contributor: ' + x
502
+ else nil
503
+ end
504
+ end
505
+ def illustrator
506
+ x=if defined? @md.creator.illustrator_detail \
507
+ and @md.creator.illustrator_detail
508
+ x=''
509
+ @md.creator.illustrator_detail.each do |n|
510
+ x += "#{n[:the]}, #{n[:others]}; "
511
+ end
512
+ x=x.gsub(/;\s*$/,'')
513
+ ' :illustrator: ' + x
514
+ else nil
515
+ end
516
+ end
517
+ def photographer
518
+ x=if defined? @md.creator.photographer_detail \
519
+ and @md.creator.photographer_detail
520
+ x=''
521
+ @md.creator.photographer_detail.each do |n|
522
+ x += "#{n[:the]}, #{n[:others]}; "
523
+ end
524
+ x=x.gsub(/;\s*$/,'')
525
+ ' :photographer: ' + x
526
+ else nil
527
+ end
528
+ end
529
+ def translator
530
+ x=if defined? @md.creator.translator_detail \
531
+ and @md.creator.translator_detail
532
+ x=''
533
+ @md.creator.translator_detail.each do |n|
534
+ x += "#{n[:the]}, #{n[:others]}; "
535
+ end
536
+ x=x.gsub(/;\s*$/,'')
537
+ ' :translator: ' + x
538
+ else nil
539
+ end
540
+ end
541
+ def audio
542
+ x=if defined? @md.creator.audio_detail \
543
+ and @md.creator.audio_detail
544
+ x=''
545
+ @md.creator.audio_detail.each do |n|
546
+ x += "#{n[:the]}, #{n[:others]}; "
547
+ end
548
+ x=x.gsub(/;\s*$/,'')
549
+ ' :audio: ' + x
550
+ else nil
551
+ end
552
+ end
553
+ def digitized_by
554
+ x=if defined? @md.creator.digitized_by_detail \
555
+ and @md.creator.digitized_by_detail
556
+ x=''
557
+ @md.creator.digitized_by_detail.each do |n|
558
+ x += "#{n[:the]}, #{n[:others]}; "
559
+ end
560
+ x=x.gsub(/;\s*$/,'')
561
+ ' :digitized_by: ' + x
562
+ else nil
563
+ end
564
+ end
565
+ def prepared_by
566
+ x=if defined? @md.creator.prepared_by_detail \
567
+ and @md.creator.prepared_by_detail
568
+ x=''
569
+ @md.creator.prepared_by_detail.each do |n|
570
+ x += "#{n[:the]}, #{n[:others]}; "
571
+ end
572
+ x=x.gsub(/;\s*$/,'')
573
+ ' :prepared_by: ' + x
574
+ else nil
575
+ end
576
+ end
577
+ self
578
+ end
579
+ def rights
580
+ def head
581
+ '@rights:'
582
+ end
583
+ def copyright
584
+ def text
585
+ if defined? @md.rights.copyright.text \
586
+ and @md.rights.copyright.text
587
+ ' :copyright: ' + @md.rights.copyright.text
588
+ else nil
589
+ end
590
+ end
591
+ def translation
592
+ if defined? @md.rights.copyright.translation \
593
+ and @md.rights.copyright.translation
594
+ ' :translation: ' + @md.rights.copyright.translation
595
+ else nil
596
+ end
597
+ end
598
+ def illustrations
599
+ if defined? @md.rights.copyright.illustrations \
600
+ and @md.rights.copyright.illustrations
601
+ ' :illustrations: ' + @md.rights.copyright.illustrations
602
+ else nil
603
+ end
604
+ end
605
+ def photographs
606
+ if defined? @md.rights.copyright.photographs \
607
+ and @md.rights.copyright.photographs
608
+ ' :photographs: ' + @md.rights.copyright.photographs
609
+ else nil
610
+ end
611
+ end
612
+ def digitization
613
+ if defined? @md.rights.copyright.digitization \
614
+ and @md.rights.copyright.digitization
615
+ ' :digitization: ' + @md.rights.copyright.digitization
616
+ else nil
617
+ end
618
+ end
619
+ def audio
620
+ if defined? @md.rights.copyright.audio \
621
+ and @md.rights.copyright.audio
622
+ ' :audio: ' + @md.rights.copyright.audio
623
+ else nil
624
+ end
625
+ end
626
+ self
627
+ end
628
+ def license
629
+ if defined? @md.rights.license \
630
+ and @md.rights.license
631
+ ' :license: ' + @md.rights.license
632
+ else nil
633
+ end
634
+ end
635
+ self
636
+ end
637
+ def classify
638
+ def head
639
+ '@classify:'
640
+ end
641
+ def coverage
642
+ if defined? @md.classify.coverage \
643
+ and @md.classify.coverage
644
+ ' :coverage: ' + @md.classify.coverage
645
+ else nil
646
+ end
647
+ end
648
+ def relation
649
+ if defined? @md.classify.relation \
650
+ and @md.classify.relation
651
+ ' :relation: ' + @md.classify.relation
652
+ else nil
653
+ end
654
+ end
655
+ def subject
656
+ if defined? @md.classify.subject \
657
+ and @md.classify.subject
658
+ ' :subject: ' + @md.classify.subject
659
+ else nil
660
+ end
661
+ end
662
+ def topic_register
663
+ if defined? @md.classify.topic_register \
664
+ and @md.classify.topic_register
665
+ ' :topic_register: ' + @md.classify.topic_register
666
+ else nil
667
+ end
668
+ end
669
+ def type
670
+ # if defined? @md.classify.type \
671
+ # and @md.classify.type
672
+ # ' :type: ' + @md.classify.type
673
+ # else nil
674
+ # end
675
+ nil
676
+ end
677
+ #def identifier
678
+ # if defined? @md.classify.identifier \
679
+ # and @md.classify.identifier
680
+ # ' :identifier: ' + @md.classify.identifier
681
+ # else nil
682
+ # end
683
+ #end
684
+ def loc
685
+ if defined? @md.classify.loc \
686
+ and @md.classify.loc
687
+ ' :loc: ' + @md.classify.loc
688
+ else nil
689
+ end
690
+ end
691
+ def dewey
692
+ if defined? @md.classify.dewey \
693
+ and @md.classify.dewey
694
+ ' :dewey: ' + @md.classify.dewey
695
+ else nil
696
+ end
697
+ end
698
+ def oclc
699
+ if defined? @md.classify.oclc \
700
+ and @md.classify.oclc
701
+ ' :oclc: ' + @md.classify.oclc
702
+ else nil
703
+ end
704
+ end
705
+ def pg
706
+ if defined? @md.classify.pg \
707
+ and @md.classify.pg
708
+ ' :pg: ' + @md.classify.pg
709
+ else nil
710
+ end
711
+ end
712
+ def isbn
713
+ if defined? @md.classify.isbn \
714
+ and @md.classify.isbn
715
+ ' :isbn: ' + @md.classify.isbn
716
+ else nil
717
+ end
718
+ end
719
+ self
720
+ end
721
+ def date
722
+ def head
723
+ '@date:'
724
+ end
725
+ def added_to_site
726
+ if defined? @md.date.added_to_site \
727
+ and @md.date.added_to_site
728
+ ' :added_to_site: ' + @md.date.added_to_site
729
+ else nil
730
+ end
731
+ end
732
+ def available
733
+ if defined? @md.date.available \
734
+ and @md.date.available
735
+ ' :available: ' + @md.date.available
736
+ else nil
737
+ end
738
+ end
739
+ def created
740
+ if defined? @md.date.created \
741
+ and @md.date.created
742
+ ' :created: ' + @md.date.created
743
+ else nil
744
+ end
745
+ end
746
+ def issued
747
+ if defined? @md.date.issued \
748
+ and @md.date.issued
749
+ ' :issued: ' + @md.date.issued
750
+ else nil
751
+ end
752
+ end
753
+ def modified
754
+ if defined? @md.date.modified \
755
+ and @md.date.modified
756
+ ' :modified: ' + @md.date.modified
757
+ else nil
758
+ end
759
+ end
760
+ def published
761
+ if defined? @md.date.published \
762
+ and @md.date.published
763
+ ' :published: ' + @md.date.published
764
+ else nil
765
+ end
766
+ end
767
+ def valid
768
+ if defined? @md.date.valid \
769
+ and @md.date.valid
770
+ ' :valid: ' + @md.date.valid
771
+ else nil
772
+ end
773
+ end
774
+ self
775
+ end
776
+ #def make
777
+ # def headings
778
+ # @md.make.headings \
779
+ # ? (' :headings: ' + @md.make.headings) \
780
+ # : nil
781
+ # end
782
+ #end
783
+ self
784
+ end
785
+ def char_enc(str)
786
+ @s=str
787
+ def amp
788
+ if @s \
789
+ and @s.is_a?(String)
790
+ @s=@s.gsub(/&/u,'&amp;')
791
+ end
792
+ @s
793
+ end
794
+ def br
795
+ if @s \
796
+ and @s.is_a?(String)
797
+ @s=@s.gsub(/(?:#{Mx[:br_line]}|\\\\)+/,'<br />')
798
+ end
799
+ @s
800
+ end
801
+ def utf8
802
+ if @s \
803
+ and @s.is_a?(String)
804
+ @s=@s.gsub(/<br(?: \/)?>/u,Mx[:br_paragraph]).
805
+ gsub(/</um,'&lt;').gsub(/>/um,'&gt;').
806
+ #gsub(/</um,'&#60;').gsub(/>/um,'&#62;').
807
+ gsub(/ /um,' '). # space identify
808
+ gsub(/ /um,' '). # space identify
809
+ gsub(/#{Mx[:br_paragraph]}/u,'<br />')
810
+ end
811
+ @s
812
+ end
813
+ self
814
+ end
815
+ def xml_docbook
816
+ def meta_para
817
+ inf_xml=char_enc(@inf).amp
818
+ inf_xml=char_enc(inf_xml).utf8
819
+ inf_xml=char_enc(inf_xml).br
820
+ <<WOK
821
+ #{Ax[:tab]}<#{@tag}>
822
+ #{Ax[:tab]*2}#{inf_xml}
823
+ #{Ax[:tab]}</#{@tag}>
824
+ WOK
825
+ end
826
+ def metadata
827
+ SiSU_Metadata::Summary.new(@md).metadata_alt
828
+ end
829
+ self
830
+ end
831
+ def html_display
832
+ def meta_para
833
+ inf_xml=char_enc(@inf).amp
834
+ inf_xml=char_enc(inf_xml).utf8
835
+ inf_xml=char_enc(inf_xml).br
836
+ %{<p class="norm">
837
+ <b>#{@tag}</b>: #{inf_xml}
838
+ </p>}
839
+ end
840
+ def metadata
841
+ SiSU_Metadata::Summary.new(@md,true).metadata_base
842
+ end
843
+ self
844
+ end
845
+ def xml_sax
846
+ def meta_para
847
+ inf_xml=char_enc(@inf).utf8
848
+ inf_xml=char_enc(inf_xml).br
849
+ <<WOK
850
+ <metadata>
851
+ #{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
852
+ #{Ax[:tab]}<data class="#{@attrib}">
853
+ #{Ax[:tab]*2}#{inf_xml}
854
+ #{Ax[:tab]}</data>
855
+ </metadata>
856
+ WOK
857
+ end
858
+ def metadata
859
+ SiSU_Metadata::Summary.new(@md).metadata_base
860
+ end
861
+ self
862
+ end
863
+ def xml_dom
864
+ def meta_para
865
+ inf_xml=char_enc(inf_xml).amp
866
+ inf_xml=char_enc(@inf).utf8
867
+ inf_xml=char_enc(inf_xml).br
868
+ <<WOK
869
+ #{Ax[:tab]}<header>
870
+ #{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
871
+ #{Ax[:tab]*2}<#{@attrib}>
872
+ #{Ax[:tab]*3}#{inf_xml}
873
+ #{Ax[:tab]*2}</#{@attrib}>
874
+ #{Ax[:tab]}</header>
875
+ WOK
876
+ end
877
+ def metadata
878
+ SiSU_Metadata::Summary.new(@md).metadata_base
879
+ end
880
+ self
881
+ end
882
+ def xhtml_scroll
883
+ def meta_para
884
+ inf_xml=char_enc(inf_xml).amp
885
+ inf_xml=char_enc(@inf).utf8
886
+ inf_xml=char_enc(inf_xml).br
887
+ <<WOK
888
+ #{Ax[:tab]}<metadata>
889
+ #{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
890
+ #{Ax[:tab]}<#{@attrib} class="#{@class}">
891
+ #{Ax[:tab]*2}#{inf_xml}
892
+ #{Ax[:tab]}</#{@attrib}>
893
+ #{Ax[:tab]}</metadata>
894
+ <br />
895
+ WOK
896
+ end
897
+ def metadata
898
+ SiSU_Metadata::Summary.new(@md).metadata_base
899
+ end
900
+ self
901
+ end
902
+ def xhtml_display
903
+ def meta_para
904
+ inf_xml=char_enc(@inf).amp
905
+ inf_xml=char_enc(inf_xml).utf8
906
+ inf_xml=char_enc(inf_xml).br
907
+ %{<p class="norm">
908
+ <b>#{@tag}</b>: #{inf_xml}
909
+ </p>}
910
+ end
911
+ def metadata
912
+ SiSU_Metadata::Summary.new(@md,true).metadata_base
913
+ end
914
+ self
915
+ end
916
+ def odf
917
+ def meta_para
918
+ if @inf.is_a?(String)
919
+ @inf=@inf.gsub(/</,'&lt;').gsub(/>/,'&gt;').
920
+ gsub(/&lt;br(?: \/)?&gt;/,'<br />')
921
+ if @inf =~/&/
922
+ inf_array=[]
923
+ word=@inf.scan(/\S+|\n/)
924
+ word.each do |w| # _ - / # | : ! ^ ~
925
+ w=w.gsub(/&nbsp;/,'&#160;')
926
+ if w !~/&\S{2,7}?;/
927
+ w=w.gsub(/&/,'&amp;')
928
+ end
929
+ inf_array << w
930
+ end
931
+ @inf=inf_array.join(' ')
932
+ end
933
+ @inf=@inf.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
934
+ '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
935
+ gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
936
+ '\1<text:a xl:type="simple" xl:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
937
+ @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
938
+ @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
939
+ %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration
940
+ else
941
+ @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/,
942
+ %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration
943
+ end
944
+ @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
945
+ %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
946
+ end
947
+ <<WOK
948
+ <text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
949
+ WOK
950
+ end
951
+ def metadata
952
+ SiSU_Metadata::Summary.new(@md).metadata_base
953
+ end
954
+ self
955
+ end
956
+ def plaintext
957
+ def meta_para
958
+ <<WOK
959
+
960
+ #{@tag.capitalize}: #{@inf}
961
+ WOK
962
+ end
963
+ def metadata
964
+ SiSU_Metadata::Summary.new(@md).metadata_base
965
+ end
966
+ self
967
+ end
968
+ def manpage
969
+ def meta_para
970
+ <<WOK
971
+
972
+ .TP
973
+ #{@tag.capitalize}:
974
+ .I #{@inf}
975
+ WOK
976
+ end
977
+ def metadata
978
+ SiSU_Metadata::Summary.new(@md).metadata_base
979
+ end
980
+ self
981
+ end
982
+ end
983
+ class TeX_Metadata
984
+ def initialize(md)
985
+ @md=md
986
+ @br="\\\\\n"
987
+ @make=SiSU_Env::ProcessingSettings.new(md)
988
+ @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
989
+ end
990
+ def meta_para(tag,inf,sc=true)
991
+ inf=((inf.is_a?(String) && sc) ? spec_char(inf) : inf)
992
+ %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
993
+ }
994
+ end
995
+ def spec_char(inf)
996
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_characters
997
+ end
998
+ def word_break_points(inf)
999
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_word_break_points
1000
+ end
1001
+ def number_break_points(inf)
1002
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_number_break_points
1003
+ end
1004
+ def metadata_tex
1005
+ meta=[]
1006
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
1007
+ language=l[:n]
1008
+ tr=SiSU_Translate::Source.new(@md,language)
1009
+ if @make.build.links_to_manifest? \
1010
+ and not @o_str.dump_or_redirect?
1011
+ tag="Document Manifest @"
1012
+ inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
1013
+ meta << meta_para(tag,inf)
1014
+ end
1015
+ if defined? @md.title.full \
1016
+ and @md.title.full=~/\S+/
1017
+ tag,inf=tr.full_title,@md.title.full
1018
+ meta << meta_para(tag,inf)
1019
+ end
1020
+ if defined? @md.creator.author \
1021
+ and @md.creator.author=~/\S+/
1022
+ tag,inf=tr.author,@md.creator.author
1023
+ meta << meta_para(tag,inf)
1024
+ end
1025
+ if defined? @md.creator.translator \
1026
+ and @md.creator.translator=~/\S+/
1027
+ tag,inf=tr.translator,@md.creator.translator
1028
+ meta << meta_para(tag,inf)
1029
+ end
1030
+ if defined? @md.creator.illustrator \
1031
+ and @md.creator.illustrator=~/\S+/
1032
+ tag,inf=tr.illustrator,@md.creator.illustrator
1033
+ meta << meta_para(tag,inf)
1034
+ end
1035
+ if defined? @md.creator.prepared_by \
1036
+ and @md.creator.prepared_by=~/\S+/
1037
+ tag,inf=tr.prepared_by,@md.creator.prepared_by
1038
+ meta << meta_para(tag,inf)
1039
+ end
1040
+ if defined? @md.creator.digitized_by \
1041
+ and @md.creator.digitized_by=~/\S+/
1042
+ tag,inf=tr.digitized_by,@md.creator.digitized_by
1043
+ meta << meta_para(tag,inf)
1044
+ end
1045
+ if defined? @md.rights.all \
1046
+ and @md.rights.all=~/\S+/
1047
+ tag,inf=tr.rights,@md.rights.all
1048
+ meta << meta_para(tag,inf)
1049
+ end
1050
+ if defined? @md.notes.description \
1051
+ and @md.notes.description=~/\S+/
1052
+ tag,inf=tr.description,@md.notes.description
1053
+ meta << meta_para(tag,inf)
1054
+ end
1055
+ if defined? @md.classify.subject \
1056
+ and @md.classify.subject=~/\S+/
1057
+ tag,inf=tr.subject,@md.classify.subject
1058
+ meta << meta_para(tag,inf)
1059
+ end
1060
+ if defined? @md.publisher \
1061
+ and @md.publisher=~/\S+/
1062
+ tag,inf=tr.publisher,@md.publisher
1063
+ meta << meta_para(tag,inf)
1064
+ end
1065
+ if defined? @md.creator.contributor \
1066
+ and @md.creator.contributor=~/\S+/
1067
+ tag,inf=tr.contributor,@md.creator.contributor
1068
+ meta << meta_para(tag,inf)
1069
+ end
1070
+ if defined? @md.notes.abstract \
1071
+ and @md.notes.abstract=~/\S+/
1072
+ tag,inf=tr.abstract,@md.notes.abstract
1073
+ meta << meta_para(tag,inf)
1074
+ end
1075
+ if defined? @md.date.created \
1076
+ and @md.date.created=~/\S+/
1077
+ tag,inf=tr.date_created,@md.date.created
1078
+ meta << meta_para(tag,inf)
1079
+ end
1080
+ if defined? @md.date.issued \
1081
+ and @md.date.issued=~/\S+/
1082
+ tag,inf=tr.date_issued,@md.date.issued
1083
+ meta << meta_para(tag,inf)
1084
+ end
1085
+ if defined? @md.date.available \
1086
+ and @md.date.available=~/\S+/
1087
+ tag,inf=tr.date_available,@md.date.available
1088
+ meta << meta_para(tag,inf)
1089
+ end
1090
+ if defined? @md.date.modified \
1091
+ and @md.date.modified=~/\S+/
1092
+ tag,inf=tr.date_modified,@md.date.modified
1093
+ meta << meta_para(tag,inf)
1094
+ end
1095
+ if defined? @md.date.valid \
1096
+ and @md.date.valid=~/\S+/
1097
+ tag,inf=tr.date_valid,@md.date.valid
1098
+ meta << meta_para(tag,inf)
1099
+ end
1100
+ if defined? @md.date.published \
1101
+ and @md.date.published=~/\S+/
1102
+ tag,inf=tr.date,@md.date.published
1103
+ meta << meta_para(tag,inf)
1104
+ end
1105
+ if defined? @md.classify.topic_register \
1106
+ and @md.classify.topic_register=~/\S+/
1107
+ tag,inf=tr.topic_register,@md.classify.topic_register
1108
+ inf=word_break_points(inf)
1109
+ meta << meta_para(tag,inf)
1110
+ end
1111
+ if defined? @md.classify.loc \
1112
+ and @md.classify.loc=~/\S+/
1113
+ tag,inf=tr.cls_loc,@md.classify.loc
1114
+ meta << meta_para(tag,inf)
1115
+ end
1116
+ if defined? @md.classify.dewey \
1117
+ and @md.classify.dewey=~/\S+/
1118
+ tag,inf=tr.cls_dewey,@md.classify.dewey
1119
+ meta << meta_para(tag,inf)
1120
+ end
1121
+ if defined? @md.classify.oclc \
1122
+ and @md.classify.oclc=~/\S+/
1123
+ tag,inf=tr.cls_oclc,@md.classify.oclc
1124
+ meta << meta_para(tag,inf)
1125
+ end
1126
+ if defined? @md.classify.pg \
1127
+ and @md.classify.pg=~/\S+/
1128
+ tag,inf=tr.cls_gutenberg,@md.classify.pg
1129
+ meta << meta_para(tag,inf)
1130
+ end
1131
+ if defined? @md.classify.isbn \
1132
+ and @md.classify.isbn=~/\S+/
1133
+ tag,inf=tr.cls_isbn,@md.classify.isbn
1134
+ meta << meta_para(tag,inf)
1135
+ end
1136
+ if defined? @md.notes.comment \
1137
+ and @md.notes.comment=~/\S+/
1138
+ tag,inf=tr.comments,@md.notes.comment
1139
+ meta << meta_para(tag,inf)
1140
+ end
1141
+ if defined? @md.notes.prefix_a \
1142
+ and @md.notes.prefix_a=~/\S+/
1143
+ tag,inf=tr.prefix_a,@md.notes.prefix_a
1144
+ meta << meta_para(tag,inf)
1145
+ end
1146
+ if defined? @md.notes.prefix_b \
1147
+ and @md.notes.prefix_b=~/\S+/
1148
+ tag,inf=tr.prefix_b,@md.notes.prefix_b
1149
+ meta << meta_para(tag,inf)
1150
+ end
1151
+ if defined? @md.classify.identifier \
1152
+ and @md.classify.identifier=~/\S+/
1153
+ tag,inf=tr.identifier,@md.classify.identifier
1154
+ meta << meta_para(tag,inf)
1155
+ end
1156
+ if defined? @md.original.source \
1157
+ and @md.original.source=~/\S+/
1158
+ tag,inf=tr.source,@md.original.source
1159
+ meta << meta_para(tag,inf)
1160
+ end
1161
+ if defined? @md.title.language \
1162
+ and @md.title.language=~/\S+/
1163
+ tag,inf=tr.language,@md.title.language
1164
+ meta << meta_para(tag,inf)
1165
+ end
1166
+ if defined? @md.original.language \
1167
+ and @md.original.language=~/\S+/
1168
+ tag,inf=tr.language_original,@md.original.language
1169
+ meta << meta_para(tag,inf)
1170
+ end
1171
+ if defined? @md.classify.format \
1172
+ and @md.classify.format=~/\S+/
1173
+ tag,inf=tr.format,@md.classify.format
1174
+ meta << meta_para(tag,inf)
1175
+ end
1176
+ if defined? @md.classify.relation \
1177
+ and @md.classify.relation=~/\S+/
1178
+ tag,inf=tr.relation,@md.classify.relation
1179
+ meta << meta_para(tag,inf)
1180
+ end
1181
+ if defined? @md.classify.coverage \
1182
+ and @md.classify.coverage=~/\S+/
1183
+ tag,inf=tr.coverage,@md.classify.coverage
1184
+ meta << meta_para(tag,inf)
1185
+ end
1186
+ if defined? @md.classify.keywords \
1187
+ and @md.classify.keywords=~/\S+/
1188
+ tag,inf=tr.keywords,@md.classify.keywords
1189
+ meta << meta_para(tag,inf)
1190
+ end
1191
+ meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
1192
+ if defined? @md.fns \
1193
+ and @md.fns=~/\S+/
1194
+ fn=spec_char(@md.fns)
1195
+ fn=word_break_points(fn)
1196
+ fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
1197
+ tag,inf=tr.sourcefile,fn
1198
+ meta << meta_para(tag,inf,false)
1199
+ end
1200
+ if defined? @md.file_encoding \
1201
+ and @md.file_encoding=~/\S+/
1202
+ tag,inf='Filetype',@md.file_encoding
1203
+ meta << meta_para(tag,inf)
1204
+ end
1205
+ if defined? @md.dgst \
1206
+ and @md.dgst.is_a?(Array)
1207
+ hash_of=spec_char(@md.dgst[0])
1208
+ hash_of=word_break_points(hash_of)
1209
+ dgst=number_break_points(@md.dgst[1])
1210
+ tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
1211
+ meta << meta_para(tag,inf,false)
1212
+ end
1213
+ meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
1214
+ if defined? @md.generated \
1215
+ and @md.generated.is_a?(Time)
1216
+ tag,inf=tr.last_generated,@md.generated
1217
+ meta << meta_para(tag,inf)
1218
+ end
1219
+ if defined? @md.project_details \
1220
+ and @md.project_details.version=~/\S+/
1221
+ tag=tr.sisu_version
1222
+ inf="#{@md.project_details.project} " +
1223
+ "#{@md.project_details.version} " +
1224
+ "of #{@md.project_details.date_stamp} " +
1225
+ "(#{@md.project_details.date})"
1226
+ meta << meta_para(tag,inf)
1227
+ end
1228
+ if defined? @md.ruby_version \
1229
+ and @md.ruby_version=~/\S+/
1230
+ tag,inf=tr.ruby_version,@md.ruby_version
1231
+ meta << meta_para(tag,inf)
1232
+ end
1233
+ meta
1234
+ end
1235
+ end
1236
+ end
1237
+ __END__
1238
+ if @md.title
1239
+ x=[
1240
+ @md.title.main,
1241
+ @md.title.sub,
1242
+ @md.title.edition,
1243
+ @md.title.note,
1244
+ @md.title.short,
1245
+ @md.title.full,
1246
+ @md.title.language,
1247
+ @md.title.language_char
1248
+ ]
1249
+ x.each {|y| p y if y}
1250
+ end
1251
+ if @md.creator
1252
+ x=[
1253
+ @md.creator.author,
1254
+ @md.creator.author_detail,
1255
+ @md.creator.contributor,
1256
+ @md.creator.contributor_detail,
1257
+ @md.creator.illustrator,
1258
+ @md.creator.illustrator_detail,
1259
+ @md.creator.photographer,
1260
+ @md.creator.photographer_detail,
1261
+ @md.creator.translator,
1262
+ @md.creator.translator_detail,
1263
+ @md.creator.audio,
1264
+ @md.creator.audio_detail,
1265
+ @md.creator.digitized_by,
1266
+ @md.creator.digitized_by_detail,
1267
+ @md.creator.prepared_by,
1268
+ @md.creator.prepared_by_detail
1269
+ ]
1270
+ x.each {|y| p y if y}
1271
+ end
1272
+ if @md.rights
1273
+ x=[
1274
+ @md.rights.copyright.text,
1275
+ @md.rights.copyright.translation,
1276
+ @md.rights.copyright.illustrations,
1277
+ @md.rights.copyright.photographs,
1278
+ @md.rights.copyright.digitization,
1279
+ @md.rights.copyright.audio,
1280
+ @md.rights.license,
1281
+ @md.rights.all
1282
+ ]
1283
+ x.each {|y| p y if y}
1284
+ end
1285
+ if @md.classify
1286
+ x=[
1287
+ @md.classify.coverage,
1288
+ @md.classify.relation,
1289
+ @md.classify.subject,
1290
+ @md.classify.topic_register,
1291
+ @md.classify.type,
1292
+ @md.classify.identifier,
1293
+ @md.classify.loc,
1294
+ @md.classify.dewey,
1295
+ @md.classify.oclc,
1296
+ @md.classify.pg,
1297
+ @md.classify.isbn,
1298
+ ]
1299
+ x.each {|y| p y if y}
1300
+ end
1301
+ if @md.date
1302
+ x=[
1303
+ @md.date.added_to_site,
1304
+ @md.date.available,
1305
+ @md.date.created,
1306
+ @md.date.issued,
1307
+ @md.date.modified,
1308
+ @md.date.published,
1309
+ @md.date.valid
1310
+ ]
1311
+ x.each {|y| p y if y}
1312
+ end
1313
+ #if @md.language
1314
+ # p @md.language.document
1315
+ # p @md.language.document_char
1316
+ # p @md.language.original
1317
+ # p @md.language.original_char
1318
+ #end
1319
+ if @md.make
1320
+ x=[
1321
+ @md.make.headings,
1322
+ @md.make.num_top,
1323
+ @md.make.breaks,
1324
+ @md.make.bold,
1325
+ @md.make.italics,
1326
+ @md.make.emphasis,
1327
+ @md.make.plaintext_wrap,
1328
+ @md.make.texpdf_font,
1329
+ @md.make.promo,
1330
+ @md.make.ad,
1331
+ @md.make.manpage
1332
+ ]
1333
+ x.each {|y| p y if y}
1334
+ end
1335
+ if @md.current_publisher # @md.publisher
1336
+ x=[
1337
+ @md.current_publisher
1338
+ ]
1339
+ x.each {|y| p y if y}
1340
+ end
1341
+ if @md.original
1342
+ x=[
1343
+ @md.original.publisher,
1344
+ @md.original.language,
1345
+ @md.original.language_char,
1346
+ @md.original.source,
1347
+ @md.original.institution,
1348
+ @md.original.nationality
1349
+ ]
1350
+ x.each {|y| p y if y}
1351
+ end
1352
+ if @md.notes
1353
+ x=[
1354
+ @md.notes.abstract,
1355
+ @md.notes.comment,
1356
+ @md.notes.description,
1357
+ @md.notes.history,
1358
+ @md.notes.prefix
1359
+ ]
1360
+ x.each {|y| p y if y}
1361
+ end