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,198 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** extract and print an XML rendition of document structure to screen
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/xml_scaffold.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XML_Scaffold_Structure_Collapse
58
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
59
+ include SiSU_Particulars
60
+ require_relative 'ao' # ao.rb
61
+ require_relative 'se' # se.rb
62
+ include SiSU_Env
63
+ class Source
64
+ def initialize(opt)
65
+ @opt=opt
66
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
67
+ end
68
+ def spaces
69
+ Ax[:spaces]
70
+ end
71
+ def read
72
+ begin
73
+ @md,@ao_array=@particulars.md,@particulars.ao_array
74
+ SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll.new(@ao_array,@md).songsheet
75
+ rescue
76
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
77
+ __LINE__.to_s + ':' + __FILE__
78
+ end
79
+ ensure
80
+ end
81
+ end
82
+ private
83
+ class Scroll <Source
84
+ def initialize(data='',md='')
85
+ @data,@md=data,md
86
+ end
87
+ def songsheet
88
+ @t='sisu'
89
+ data=@data
90
+ if @md.opt.act[:verbose_plus][:set]==:on
91
+ structure_collapsed(data)
92
+ end
93
+ structure_build_collapsed(data)
94
+ end
95
+ def tags
96
+ # collapsed -->
97
+ def collapsed
98
+ [ '0',
99
+ '1',
100
+ '2',
101
+ '3',
102
+ '4',
103
+ '5',
104
+ '6'
105
+ ]
106
+ end
107
+ def docbook
108
+ end
109
+ def fictionbook
110
+ end
111
+ self
112
+ end
113
+ def output(o,lev=nil,comment='')
114
+ puts lev == (0..6) \
115
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
116
+ : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
117
+ end
118
+ def structure_collapsed(data)
119
+ puts "\ncollapsed structure, heading outline --->\n\n"
120
+ data.each_with_index do |o,i|
121
+ if (o.is ==:heading || o.is ==:heading_insert)
122
+ output(o,o.lc)
123
+ end
124
+ end
125
+ end
126
+ def structure_build_collapsed(data)
127
+ @s=tags.collapsed
128
+ puts "\nXML [#{@t} type] structure outline --->\n\n"
129
+ h=[0,false,false,false]
130
+ puts "<#{@s[0]}>"
131
+ data.each_with_index do |o,i|
132
+ if (o.is ==:heading || o.is ==:heading_insert)
133
+ lev=o.lc
134
+ structure_build_tag_close(lev,h)
135
+ puts "#{spaces*lev}<#{@s[lev]}>\n#{spaces*lev} [#{o.ocn}] #{lev} {#{o.node}}"
136
+ h[0]=lev
137
+ end
138
+ end
139
+ structure_build_tag_close(0,h)
140
+ end
141
+ def structure_build_tag_close(lev,h)
142
+ case h[0]
143
+ when 1
144
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
145
+ puts "</#{@s[0]}>" if (lev==0)
146
+ when 2
147
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
148
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
149
+ puts "</#{@s[0]}>" if (lev==0)
150
+ when 3
151
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
152
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
153
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
154
+ puts "</#{@s[0]}>" if (lev==0)
155
+ when 4
156
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
157
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
158
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
159
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
160
+ puts "</#{@s[0]}>" if (lev==0)
161
+ when 5
162
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
163
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
164
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
165
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
166
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
167
+ puts "</#{@s[0]}>" if (lev==0)
168
+ when 6
169
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
170
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
171
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
172
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
173
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
174
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
175
+ puts "</#{@s[0]}>" if (lev==0)
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ __END__
182
+ @s=['0',
183
+ 'A',
184
+ 'B',
185
+ 'C',
186
+ '1',
187
+ '2',
188
+ '3'
189
+ ]
190
+ #@t='docbook' #@t='fictionbook'
191
+ #@s=['book', #@s=['body',
192
+ # 'part', # 'section',
193
+ # 'subpart N/A', # 'section',
194
+ # 'sub-subpart N/A', # 'section',
195
+ # 'chapter', # 'section',
196
+ # 'sect1', # 'section',
197
+ # 'sect2' # 'section'
198
+ #] #]
@@ -0,0 +1,201 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** extract and print an XML rendition of document structure to screen
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/xml_scaffold.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XML_Scaffold_Structure_Sisu
58
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
59
+ include SiSU_Particulars
60
+ require_relative 'ao' # ao.rb
61
+ require_relative 'se' # se.rb
62
+ include SiSU_Env
63
+ class Source
64
+ def initialize(opt)
65
+ @opt=opt
66
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
67
+ end
68
+ def spaces
69
+ Ax[:spaces]
70
+ end
71
+ def read
72
+ begin
73
+ @md,@ao_array=@particulars.md,@particulars.ao_array
74
+ SiSU_XML_Scaffold_Structure_Sisu::Source::Scroll.new(@ao_array,@md).songsheet
75
+ rescue
76
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
77
+ __LINE__.to_s + ':' + __FILE__
78
+ end
79
+ ensure
80
+ end
81
+ end
82
+ private
83
+ class Scroll <Source
84
+ def initialize(data='',md='')
85
+ @data,@md=data,md
86
+ end
87
+ def songsheet
88
+ @t='sisu'
89
+ data=@data
90
+ if @md.opt.act[:verbose_plus][:set]==:on
91
+ structure_sisu_simple(data)
92
+ end
93
+ structure_build_sisu(data)
94
+ end
95
+ def tags
96
+ def sisu
97
+ [ '0',
98
+ 'A',
99
+ 'B',
100
+ 'C',
101
+ '1',
102
+ '2',
103
+ '3'
104
+ ]
105
+ end
106
+ self
107
+ end
108
+ def structure_sisu_simple(data)
109
+ puts "\nsisu structure, heading outline --->\n\n"
110
+ data.each_with_index do |o,i|
111
+ if (o.is ==:heading || o.is ==:heading_insert)
112
+ puts "#{spaces*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
113
+ end
114
+ end
115
+ end
116
+ def output(o,lev=nil,comment='')
117
+ puts lev == (0..6) \
118
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
119
+ : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
120
+ end
121
+ def structure_build_sisu(data)
122
+ @s=tags.sisu
123
+ puts "\nXML [#{@t} type] structure outline --->\n\n"
124
+ h=[0,false,false,false]
125
+ puts "<#{@s[0]}>"
126
+ data.each_with_index do |o,i|
127
+ if (o.is ==:heading || o.is ==:heading_insert)
128
+ structure_build_tag_close(o.ln,h)
129
+ puts "#{spaces*o.ln}<#{@s[o.ln]}>\n#{spaces*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}"
130
+ case o.ln
131
+ when 1
132
+ h=[o.ln,true,false,false]
133
+ when 2
134
+ h=[o.ln,true,true,false]
135
+ when 3
136
+ h=[o.ln,true,true,true]
137
+ when 4..6
138
+ h[0]=o.ln
139
+ end
140
+ end
141
+ end
142
+ structure_build_tag_close(0,h)
143
+ end
144
+ def structure_build_tag_close(lev,h)
145
+ case h[0]
146
+ when 1
147
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
148
+ puts "</#{@s[0]}>" if (lev==0)
149
+ when 2
150
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
151
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
152
+ puts "</#{@s[0]}>" if (lev==0)
153
+ when 3
154
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
155
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
156
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
157
+ puts "</#{@s[0]}>" if (lev==0)
158
+ when 4
159
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
160
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
161
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
162
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
163
+ puts "</#{@s[0]}>" if (lev==0)
164
+ when 5
165
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
166
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
167
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
168
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
169
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
170
+ puts "</#{@s[0]}>" if (lev==0)
171
+ when 6
172
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
173
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
174
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
175
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
176
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
177
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
178
+ puts "</#{@s[0]}>" if (lev==0)
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+ __END__
185
+ @s=['0',
186
+ 'A',
187
+ 'B',
188
+ 'C',
189
+ '1',
190
+ '2',
191
+ '3'
192
+ ]
193
+ #@t='docbook' #@t='fictionbook'
194
+ #@s=['book', #@s=['body',
195
+ # 'part', # 'section',
196
+ # 'subpart N/A', # 'section',
197
+ # 'sub-subpart N/A', # 'section',
198
+ # 'chapter', # 'section',
199
+ # 'sect1', # 'section',
200
+ # 'sect2' # 'section'
201
+ #] #]
@@ -0,0 +1,665 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** common file for xml generation
8
+
9
+ ** Author: Ralph Amissah
10
+
11
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
12
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
13
+ All Rights Reserved.
14
+
15
+ ** License: GPL 3 or later:
16
+
17
+ SiSU, a framework for document structuring, publishing and search
18
+
19
+ Copyright (C) Ralph Amissah
20
+
21
+ This program is free software: you can redistribute it and/or modify it
22
+ under the terms of the GNU General Public License as published by the Free
23
+ Software Foundation, either version 3 of the License, or (at your option)
24
+ any later version.
25
+
26
+ This program is distributed in the hope that it will be useful, but WITHOUT
27
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
29
+ more details.
30
+
31
+ You should have received a copy of the GNU General Public License along with
32
+ this program. If not, see <http://www.gnu.org/licenses/>.
33
+
34
+ If you have Internet connection, the latest version of the GPL should be
35
+ available at these locations:
36
+ <http://www.fsf.org/licensing/licenses/gpl.html>
37
+ <http://www.gnu.org/licenses/gpl.html>
38
+
39
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
40
+
41
+ ** SiSU uses:
42
+ * Standard SiSU markup syntax,
43
+ * Standard SiSU meta-markup syntax, and the
44
+ * Standard SiSU object citation numbering and system
45
+
46
+ ** Hompages:
47
+ <http://www.jus.uio.no/sisu>
48
+ <http://www.sisudoc.org>
49
+
50
+ ** Git
51
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
52
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/xml_shared.rb;hb=HEAD>
53
+
54
+ ** Ralph Amissah
55
+ <ralph@amissah.com>
56
+ <ralph.amissah@gmail.com>
57
+
58
+ =end
59
+ module SiSU_XML_Munge
60
+ require_relative 'xml_parts' # xml_parts.rb
61
+ class Trans
62
+ include SiSU_Parts_XML
63
+ def initialize(md)
64
+ @md=md
65
+ @sys=SiSU_Env::SystemCall.new
66
+ @dir=SiSU_Env::InfoEnv.new(@md.fns)
67
+ if @md.sem_tag
68
+ @ab ||=semantic_tags.default
69
+ end
70
+ end
71
+ def semantic_tags
72
+ def default
73
+ {
74
+ pub: 'publication',
75
+ conv: 'convention',
76
+ vol: 'volume',
77
+ pg: 'page',
78
+ cty: 'city',
79
+ org: 'organization',
80
+ uni: 'university',
81
+ dept: 'department',
82
+ fac: 'faculty',
83
+ inst: 'institute',
84
+ co: 'company',
85
+ com: 'company',
86
+ conv: 'convention',
87
+ dt: 'date',
88
+ y: 'year',
89
+ m: 'month',
90
+ d: 'day',
91
+ ti: 'title',
92
+ au: 'author',
93
+ ed: 'editor', #editor?
94
+ v: 'version', #edition
95
+ n: 'name',
96
+ fn: 'firstname',
97
+ mn: 'middlename',
98
+ ln: 'lastname',
99
+ in: 'initials',
100
+ qt: 'quote',
101
+ ct: 'cite',
102
+ ref: 'reference',
103
+ ab: 'abreviation',
104
+ def: 'define',
105
+ desc: 'description',
106
+ trans: 'translate',
107
+ }
108
+ end
109
+ self
110
+ end
111
+ def char_enc #character encode
112
+ def utf8(dob='')
113
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
114
+ str=if defined? dob.obj then dob.obj
115
+ elsif dob.is_a?(String) then dob
116
+ end
117
+ if str
118
+ #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
119
+ #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
120
+ str=str.gsub(/</um,'&#60;'). # '&lt;' # &#060;
121
+ gsub(/>/um,'&#62;'). # '&gt;' # &#062;
122
+ gsub(/¢/um,'&#162;'). # '&cent;' # &#162;
123
+ gsub(/£/um,'&#163;'). # '&pound;' # &#163;
124
+ gsub(/¥/um,'&#165;'). # '&yen;' # &#165;
125
+ gsub(/§/um,'&#167;'). # '&sect;' # &#167;
126
+ gsub(/©/um,'&#169;'). # '&copy;' # &#169;
127
+ gsub(/ª/um,'&#170;'). # '&ordf;' # &#170;
128
+ gsub(/«/um,'&#171;'). # '&laquo;' # &#171;
129
+ gsub(/®/um,'&#174;'). # '&reg;' # &#174;
130
+ gsub(/°/um,'&#176;'). # '&deg;' # &#176;
131
+ gsub(/±/um,'&#177;'). # '&plusmn;' # &#177;
132
+ gsub(/²/um,'&#178;'). # '&sup2;' # &#178;
133
+ gsub(/³/um,'&#179;'). # '&sup3;' # &#179;
134
+ gsub(/µ/um,'&#181;'). # '&micro;' # &#181;
135
+ gsub(/¶/um,'&#182;'). # '&para;' # &#182;
136
+ gsub(/¹/um,'&#185;'). # '&sup1;' # &#185;
137
+ gsub(/º/um,'&#186;'). # '&ordm;' # &#186;
138
+ gsub(/»/um,'&#187;'). # '&raquo;' # &#187;
139
+ gsub(/¼/um,'&#188;'). # '&frac14;' # &#188;
140
+ gsub(/½/um,'&#189;'). # '&frac12;' # &#189;
141
+ gsub(/¾/um,'&#190;'). # '&frac34;' # &#190;
142
+ gsub(/×/um,'&#215;'). # '&times;' # &#215;
143
+ gsub(/÷/um,'&#247;'). # '&divide;' # &#247;
144
+ gsub(/¿/um,'&#191;'). # '&iquest;' # &#191;
145
+ gsub(/À/um,'&#192;'). # '&Agrave;' # &#192;
146
+ gsub(/Á/um,'&#193;'). # '&Aacute;' # &#193;
147
+ gsub(/Â/um,'&#194;'). # '&Acirc;' # &#194;
148
+ gsub(/Ã/um,'&#195;'). # '&Atilde;' # &#195;
149
+ gsub(/Ä/um,'&#196;'). # '&Auml;' # &#196;
150
+ gsub(/Å/um,'&#197;'). # '&Aring;' # &#197;
151
+ gsub(/Æ/um,'&#198;'). # '&AElig;' # &#198;
152
+ gsub(/Ç/um,'&#199;'). # '&Ccedil;' # &#199;
153
+ gsub(/È/um,'&#200;'). # '&Egrave;' # &#200;
154
+ gsub(/É/um,'&#201;'). # '&Eacute;' # &#201;
155
+ gsub(/Ê/um,'&#202;'). # '&Ecirc;' # &#202;
156
+ gsub(/Ë/um,'&#203;'). # '&Euml;' # &#203;
157
+ gsub(/Ì/um,'&#204;'). # '&Igrave;' # &#204;
158
+ gsub(/Í/um,'&#205;'). # '&Iacute;' # &#205;
159
+ gsub(/Î/um,'&#206;'). # '&Icirc;' # &#206;
160
+ gsub(/Ï/um,'&#207;'). # '&Iuml;' # &#207;
161
+ gsub(/Ð/um,'&#208;'). # '&ETH;' # &#208;
162
+ gsub(/Ñ/um,'&#209;'). # '&Ntilde;' # &#209;
163
+ gsub(/Ò/um,'&#210;'). # '&Ograve;' # &#210;
164
+ gsub(/Ó/um,'&#211;'). # '&Oacute;' # &#211;
165
+ gsub(/Ô/um,'&#212;'). # '&Ocirc;' # &#212;
166
+ gsub(/Õ/um,'&#213;'). # '&Otilde;' # &#213;
167
+ gsub(/Ö/um,'&#214;'). # '&Ouml;' # &#214;
168
+ gsub(/Ø/um,'&#216;'). # '&Oslash;' # &#216;
169
+ gsub(/Ù/um,'&#217;'). # '&Ugrave;' # &#217;
170
+ gsub(/Ú/um,'&#218;'). # '&Uacute;' # &#218;
171
+ gsub(/Û/um,'&#219;'). # '&Ucirc;' # &#219;
172
+ gsub(/Ü/um,'&#220;'). # '&Uuml;' # &#220;
173
+ gsub(/Ý/um,'&#221;'). # '&Yacute;' # &#221;
174
+ gsub(/Þ/um,'&#222;'). # '&THORN;' # &#222;
175
+ gsub(/ß/um,'&#223;'). # '&szlig;' # &#223;
176
+ gsub(/à/um,'&#224;'). # '&agrave;' # &#224;
177
+ gsub(/á/um,'&#225;'). # '&aacute;' # &#225;
178
+ gsub(/â/um,'&#226;'). # '&acirc;' # &#226;
179
+ gsub(/ã/um,'&#227;'). # '&atilde;' # &#227;
180
+ gsub(/ä/um,'&#228;'). # '&auml;' # &#228;
181
+ gsub(/å/um,'&#229;'). # '&aring;' # &#229;
182
+ gsub(/æ/um,'&#230;'). # '&aelig;' # &#230;
183
+ gsub(/ç/um,'&#231;'). # '&ccedil;' # &#231;
184
+ gsub(/è/um,'&#232;'). # '&egrave;' # &#232;
185
+ gsub(/é/um,'&#233;'). # '&acute;' # &#233;
186
+ gsub(/ê/um,'&#234;'). # '&circ;' # &#234;
187
+ gsub(/ë/um,'&#235;'). # '&euml;' # &#235;
188
+ gsub(/ì/um,'&#236;'). # '&igrave;' # &#236;
189
+ gsub(/í/um,'&#237;'). # '&acute;' # &#237;
190
+ gsub(/î/um,'&#238;'). # '&icirc;' # &#238;
191
+ gsub(/ï/um,'&#239;'). # '&iuml;' # &#239;
192
+ gsub(/ð/um,'&#240;'). # '&eth;' # &#240;
193
+ gsub(/ñ/um,'&#241;'). # '&ntilde;' # &#241;
194
+ gsub(/ò/um,'&#242;'). # '&ograve;' # &#242;
195
+ gsub(/ó/um,'&#243;'). # '&oacute;' # &#243;
196
+ gsub(/ô/um,'&#244;'). # '&ocirc;' # &#244;
197
+ gsub(/õ/um,'&#245;'). # '&otilde;' # &#245;
198
+ gsub(/ö/um,'&#246;'). # '&ouml;' # &#246;
199
+ gsub(/ø/um,'&#248;'). # '&oslash;' # &#248;
200
+ gsub(/ù/um,'&#250;'). # '&ugrave;' # &#250;
201
+ gsub(/ú/um,'&#251;'). # '&uacute;' # &#251;
202
+ gsub(/û/um,'&#252;'). # '&ucirc;' # &#252;
203
+ gsub(/ü/um,'&#253;'). # '&uuml;' # &#253;
204
+ gsub(/þ/um,'&#254;'). # '&thorn;' # &#254;
205
+ gsub(/ÿ/um,'&#255;'). # '&yuml;' # &#255;
206
+ gsub(/‘/um,'&#8216;'). # '&lsquo;' # &#8216;
207
+ gsub(/’/um,'&#8217;'). # '&rsquo;' # &#8217;
208
+ gsub(/“/um,'&#8220;'). # &ldquo; # &#8220;
209
+ gsub(/”/um,'&#8221;'). # &rdquo; # &#8221;
210
+ gsub(/–/um,'&#8211;'). # &ndash; # &#8211;
211
+ gsub(/—/um,'&#8212;'). # &mdash; # &#8212;
212
+ gsub(/∝/um,'&#8733;'). # &prop; # &#8733;
213
+ gsub(/∞/um,'&#8734;'). # &infin; # &#8734;
214
+ gsub(/™/um,'&#8482;'). # &trade; # &#8482;
215
+ gsub(/✠/um,'&#10016;'). # &cross; # &#10016;
216
+ gsub(/ /um,' '). # space identify
217
+ gsub(/ /um,' ') # space identify
218
+ end
219
+ dob=if defined? dob.obj
220
+ dob.obj=str
221
+ dob
222
+ elsif dob.is_a?(String)
223
+ str
224
+ end
225
+ dob
226
+ end
227
+ end
228
+ def html(dob='')
229
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
230
+ dob.obj=dob.obj.gsub(/ /u,' '). # space identify
231
+ gsub(/ /u,' ') # space identify
232
+ end
233
+ end
234
+ self
235
+ end
236
+ def tidywords(wordlist)
237
+ wordlist_new=[]
238
+ wordlist.each do |x|
239
+ #imperfect solution will not catch all possible cases
240
+ x=x.gsub(/&/,'&amp;') unless x =~/&\S+;/
241
+ x=x.gsub(/&([A-Z])/,'&amp;\1')
242
+ wordlist_new << x
243
+ end
244
+ wordlist_new
245
+ end
246
+ def markup(dob='')
247
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
248
+ dob.obj=tidywords(wordlist).join(' ').strip
249
+ unless dob.is==:table
250
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br />').
251
+ gsub(/#{Mx[:br_paragraph]}/u,'<br />').
252
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />')
253
+ end
254
+ dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'').
255
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
256
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
257
+ gsub(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1&lt; ').gsub(/\s+>(\s+|$)/,' &gt;\1').
258
+ #gsub(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>'). #reinstate
259
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>').
260
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>').
261
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
262
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
263
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
264
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
265
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
266
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
267
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>').
268
+ gsub(/<:pb>\s*/,''). #Fix
269
+ gsub(/<+[-~]#>+/,'')
270
+ if dob.is !=:code
271
+ #embeds a red-bullet image -->
272
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
273
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
274
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
275
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
276
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
277
+ dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,'').
278
+ gsub(/#{Mx[:br_page_new]}\s*/,'').
279
+ gsub(/#{Mx[:br_page_line]}\s*/,'').
280
+ gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,'').
281
+ gsub(/<[-~]#>/,'').
282
+ gsub(/href="#{Xx[:segment]}/m,'href="').
283
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
284
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>').
285
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
286
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="../\2">\1</link>').
287
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
288
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="#\2">\1</link>').
289
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
290
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
291
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
292
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
293
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
294
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
295
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
296
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
297
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
298
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>'). #watch, compare html_tune
299
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
300
+ %{#{the_url_decoration.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{the_url_decoration.xml_close}}).
301
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
302
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\1">\1</link>') #escaped urls not linked, deal with later
303
+ else
304
+ dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
305
+ end
306
+ if dob.of==:block
307
+ dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
308
+ end
309
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
310
+ %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}).
311
+ gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}").
312
+ gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}").
313
+ gsub(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;').
314
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
315
+ dob
316
+ end
317
+ def markup_light(dob='')
318
+ dob.obj=dob.obj.gsub(/\/\{(.+?)\}\//,'<i>\1</i>').
319
+ gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>').
320
+ gsub(/_\{(.+?)\}_/,'<u>\1</u>').
321
+ gsub(/-\{(.+?)\}-/,'<del>\1</del>').
322
+ gsub(/<br(\s*\/)?>/,'<br />').
323
+ gsub(/<:pb>\s*/,'').
324
+ gsub(/<[-~]#>/,'').
325
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
326
+ gsub(/&([^;]{1,5})/,'&amp;\1'). #sort, rough estimate, revisit #WATCH found in node not sax
327
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
328
+ "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
329
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;').
330
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
331
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
332
+ dob.obj=tidywords(wordlist).join(' ').strip
333
+ dob
334
+ end
335
+ def clean(str)
336
+ str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
337
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
338
+ end
339
+ def markup_fictionbook(str='',is='')
340
+ str=str.gsub(/#{Mx[:en_a_o]}([\d+*]+).+?#{Mx[:en_a_c]}/m,'<a xl:href="#footnote\1" type="note">[\1]</a>').
341
+ gsub(/&/,'&amp;'). #sort
342
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
343
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
344
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
345
+ str=str.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless is==:table
346
+ str=str.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
347
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
348
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
349
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
350
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
351
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
352
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
353
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
354
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
355
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,'<image xl:href="#\1" />').
356
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
357
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
358
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
359
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
360
+ gsub(/<(p|br)>/,'<\1 />')
361
+ clean(str)
362
+ end
363
+ def markup_docbook(dob='') # work on, initially a copy of fictionbook!
364
+ if dob.is !=:code
365
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s*(.+?)#{Mx[:en_a_c]}/m,'<footnote><para><!-- fn\1 -->\2</para></footnote>').
366
+ gsub(/\\\\/,'</para><para>').
367
+ gsub(/&/,'&amp;'). #sort
368
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
369
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
370
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
371
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
372
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
373
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
374
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
375
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
376
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
377
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
378
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
379
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
380
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
381
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,
382
+ %{#{Xx[:split]}:spaces0:<figure id="fig-\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="../../_sisu/image/\\1.\\2" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). # common image location, else use ./images
383
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,
384
+ '<ulink url="\2">\1</ulink>').
385
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,
386
+ '<ulink url="\1">\1</ulink>').
387
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
388
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
389
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
390
+ gsub(/<(p|br)>/,'<\1 />')
391
+ dob.obj=clean(dob.obj)
392
+ elsif dob.is == :code
393
+ dob.obj=dob.obj.gsub(/&/m,'&amp;'). #sort
394
+ gsub(/</,'&lt;').gsub(/>/,'&gt;')
395
+ else # p dob.is ??
396
+ end
397
+ dob
398
+ end
399
+ def markup_group(dob='')
400
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
401
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
402
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
403
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
404
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
405
+ dob
406
+ end
407
+ def markup_block(dob='')
408
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
409
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br />').
410
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
411
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
412
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
413
+ dob
414
+ end
415
+ def xml_sem_block_paired(matched) # colon depth: many, recurs
416
+ matched=matched.gsub(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}).
417
+ gsub(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}).
418
+ gsub(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}).
419
+ gsub(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}).
420
+ gsub(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}).
421
+ gsub(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}).
422
+ gsub(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}).
423
+ gsub(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}).
424
+ gsub(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}).
425
+ gsub(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}).
426
+ gsub(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}).
427
+ gsub(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')
428
+ end
429
+ def xml_semantic_tags(dob)
430
+ if @md.sem_tag
431
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
432
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
433
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
434
+ dob.obj=dob.obj.gsub(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}).
435
+ gsub(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}).
436
+ gsub(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}).
437
+ gsub(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}).
438
+ gsub(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}).
439
+ gsub(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}).
440
+ gsub(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}).
441
+ gsub(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>').
442
+ gsub(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}).
443
+ gsub(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}).
444
+ gsub(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}).
445
+ gsub(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}).
446
+ gsub(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}).
447
+ gsub(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}).
448
+ gsub(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}).
449
+ gsub(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}).
450
+ gsub(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}).
451
+ gsub(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}).
452
+ gsub(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}).
453
+ gsub(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}).
454
+ gsub(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}).
455
+ gsub(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}).
456
+ gsub(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}).
457
+ gsub(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}).
458
+ gsub(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}).
459
+ gsub(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}).
460
+ gsub(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}).
461
+ gsub(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}).
462
+ gsub(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}).
463
+ gsub(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}).
464
+ gsub(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')
465
+ end
466
+ dob
467
+ end
468
+ end
469
+ end
470
+ module SiSU_XML_Tags #Format
471
+ require_relative 'dp' # dp.rb
472
+ include SiSU_Param
473
+ class RDF
474
+ include SiSU_Parts_XML
475
+ def initialize(md='',seg_name=[],tracker=0)
476
+ @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
477
+ @md=md
478
+ @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
479
+ if defined? @md.title.full \
480
+ and @md.title.full # DublinCore 1 - title
481
+ @rdf_title=%{ dc.title="#{seg_name}#{@md.title.full}"\n}
482
+ @full_title=%{ <meta name="dc.title" content="#{@md.title.full}" />\n}
483
+ end
484
+ if defined? @md.creator.author \
485
+ and @md.creator.author=~/\S+/ # DublinCore 2 - creator/author (author)
486
+ @rdf_author=%{ dc.author="#{@md.creator.author}"\n}
487
+ content=meta_content_clean(@md.creator.author)
488
+ @author=%{ <meta name="dc.author" content="#{content}" />\n}
489
+ end
490
+ if defined? @md.publisher \
491
+ and @md.publisher # DublinCore 5 - publisher (current copy published by)
492
+ @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
493
+ content=meta_content_clean(@md.publisher)
494
+ @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
495
+ end
496
+ if defined? @md.creator.contributor \
497
+ and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
498
+ @rdf_contributor=%{ dc.contributor="#{@md.creator.contributor}"\n}
499
+ content=meta_content_clean(@md.creator.contributor)
500
+ @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
501
+ end
502
+ if defined? @md.date.published \
503
+ and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
504
+ @rdf_date=%{ dc.date="#{@md.date.published}"\n}
505
+ @date=%{ <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
506
+ end
507
+ if defined? @md.date.created \
508
+ and @md.date.created=~/\S+/ # DublinCore 7 - date.created year-mm-dd
509
+ @rdf_date_created=%{ dc.date.created="#{@md.date.created}"\n}
510
+ @date_created=%{ <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
511
+ end
512
+ if defined? @md.date.issued \
513
+ and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued year-mm-dd
514
+ @rdf_date_issued=%{ dc.date.issued="#{@md.date.issued}"\n}
515
+ @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
516
+ end
517
+ if defined? @md.date.available \
518
+ and @md.date.available=~/\S+/ # DublinCore 7 - date.available year-mm-dd
519
+ @rdf_date_available=%{ dc.date.available="#{@md.date.available}"\n}
520
+ @date_available=%{ <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
521
+ end
522
+ if defined? @md.date.valid \
523
+ and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid year-mm-dd
524
+ @rdf_date_valid=%{ dc.date.valid="#{@md.date.valid}"\n}
525
+ @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
526
+ end
527
+ if defined? @md.date.modified \
528
+ and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified year-mm-dd
529
+ @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
530
+ @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
531
+ end
532
+ if defined? @md.rights.all \
533
+ and @md.rights.all # DublinCore 15 - rights
534
+ @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n}
535
+ content=meta_content_clean(@md.rights.all)
536
+ @rights=%{ <meta name="dc.rights" content="#{content}" />\n}
537
+ end
538
+ if defined? @md.classify.subject \
539
+ and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
540
+ @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n}
541
+ content=meta_content_clean(@md.classify.subject)
542
+ @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
543
+ end
544
+ if defined? @md.notes.description \
545
+ and @md.notes.description=~/\S+/ # DublinCore 4 - description
546
+ @rdf_description=%{ dc.description="#{@md.notes.description}"\n}
547
+ content=meta_content_clean(@md.notes.description)
548
+ @description=%{ <meta name="dc.description" content="#{content}" />\n}
549
+ end
550
+ if defined? @md.notes.coverage \
551
+ and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage
552
+ @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n}
553
+ content=meta_content_clean(@md.notes.coverage)
554
+ @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
555
+ end
556
+ if defined? @md.notes.relation \
557
+ and @md.notes.relation=~/\S+/ # DublinCore 13 - relation
558
+ @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n}
559
+ content=meta_content_clean(@md.notes.relation)
560
+ @relation=%{ <meta name="dc.relation" content="#{content}" />\n}
561
+ end
562
+ if defined? @md.notes.type \
563
+ and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc)
564
+ @rdf_type=%{ dc.type="#{@md.notes.type}"\n}
565
+ content=meta_content_clean(@md.notes.type)
566
+ @type=%{ <meta name="dc.type" content="#{content}" />\n}
567
+ end
568
+ if defined? @md.notes.format \
569
+ and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type)
570
+ @rdf_format=%{ dc.format="#{@md.notes.format}"\n}
571
+ content=meta_content_clean(@md.notes.format)
572
+ @format=%{ <meta name="dc.format" content="#{content}" />\n}
573
+ end
574
+ #if defined? @md.identifier.sisupod \
575
+ #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
576
+ # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n}
577
+ # content=meta_content_clean(@md.identifier.sisupod)
578
+ # @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
579
+ #end
580
+ if defined? @md.original.source \
581
+ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source)
582
+ @rdf_source=%{ dc.source="#{@md.original.source}"\n}
583
+ content=meta_content_clean(@md.original.source)
584
+ @source=%{ <meta name="dc.source" content="#{content}" />\n}
585
+ end
586
+ if defined? @md.title.language \
587
+ and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
588
+ @rdf_language=%{ dc.language="#{@md.title.language}"\n}
589
+ @language=%{ <meta name="dc.language" content="#{@md.title.language}" />\n}
590
+ end
591
+ if defined? @md.original.language \
592
+ and @md.original.language=~/\S+/
593
+ @rdf_language_original=%{ dc.language="#{@md.original.language}"\n}
594
+ @language_original=%{ <meta name="dc.language" content="#{@md.original.language}" />\n}
595
+ end
596
+ content=meta_content_clean(@md.keywords)
597
+ @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
598
+ end
599
+ def meta_content_clean(content='')
600
+ content=if not content.nil?
601
+ content=content.tr('"',"'").
602
+ gsub(/&/,'&amp;')
603
+ content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
604
+ else content
605
+ end
606
+ end
607
+ def rdfseg #segHead
608
+ rdftoc
609
+ end
610
+ def comment_xml(extra='')
611
+ generator="Generated by: #{@md.project_details.project} #{@md.project_details.version} of #{@md.project_details.date_stamp} (#{@md.project_details.date})" if @md.project_details.version
612
+ lastdone="Last Generated on: #{Time.now}"
613
+ rubyv="Ruby version: #{@md.ruby_version}"
614
+ sc=if @md.sc_info
615
+ "Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
616
+ else ''
617
+ end
618
+ if extra.empty?
619
+ <<WOK
620
+ <!-- Document processing information:
621
+ * #{generator}
622
+ * #{rubyv}
623
+ * #{sc}
624
+ * #{lastdone}
625
+ * SiSU http://www.jus.uio.no/sisu
626
+ -->
627
+ WOK
628
+ else
629
+ <<WOK
630
+ <!-- Document processing information:
631
+ * #{extra}
632
+ * #{generator}
633
+ * #{rubyv}
634
+ * #{sc}
635
+ * #{lastdone}
636
+ * SiSU http://www.jus.uio.no/sisu
637
+ -->
638
+ WOK
639
+ end
640
+ end
641
+ def comment_xml_sax
642
+ desc='SiSU XML, SAX type representation'
643
+ comment_xml(desc)
644
+ end
645
+ def comment_xml_node
646
+ desc='SiSU XML, Node type representation'
647
+ comment_xml(desc)
648
+ end
649
+ def comment_xml_dom
650
+ desc='SiSU XML, DOM type representation'
651
+ comment_xml(desc)
652
+ end
653
+ def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
654
+ <<WOK
655
+ #{@full_title}#{@subtitle}#{@author}#{@subject}#{@description}#{@publisher}#{@contributor}#{@date}#{@date_created}#{@date_issued}#{@date_available}#{@date_valid}#{@date_modified}#{@type}#{@format}#{@identifier}#{@source}#{@language}#{@relation}#{@coverage}#{@rights}#{@copyright}#{@owner}
656
+ #{SiSU_Proj_XML::Bits.new.txt_generator}
657
+ #{the_png.ico}
658
+ WOK
659
+ end
660
+ end
661
+ end
662
+ module SiSU_Tables
663
+ require_relative 'xml_tables' # xml_tables.rb
664
+ end
665
+ __END__