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