1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
=begin
* Name: SiSU information Structuring Universe - Structured information, Serialized Units
* Author: Ralph Amissah
* http://www.jus.uio.no/sisu
* http://www.jus.uio.no/sisu/SiSU/download.html
* Description: common file for xml generation
* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah
* License: GPL 2 or later
Summary of GPL 2
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
If you have Internet connection, the latest version of the GPL should be
available at these locations:
http://www.fsf.org/licenses/gpl.html
http://www.gnu.org/copyleft/gpl.html
http://www.jus.uio.no/sisu/gpl2.fsf
SiSU was first released to the public on January 4th 2005
SiSU uses:
* Standard SiSU markup syntax,
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
© Ralph Amissah 1997, current 2007.
All Rights Reserved.
* Ralph Amissah: ralph@amissah.com
ralph.amissah@gmail.com
=end
module SiSU_text_parts
class Split_text_object
require SiSU_lib + '/param'
require SiSU_lib + '/xml_format'
include SiSU_Viz
include SiSU_XML_format
@@alt_id_count=0
@@dp=nil
attr_reader :format,:text,:ocn,:lev_para_ocn
def initialize(md,para)
@md,@para=md,para
@format,@ocn='null','null'
#@format,@ocn=nil,nil
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
end
def lev_segname_para_ocn #using shared_txt instead, watch #% watch closely
if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
if /^([1-6])~(\S+)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@format,segname,@text,@ocn=$1,$2,$3,$4
@format="#@format~#{segname}" #
elsif /^([1-6]~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@format,@text,@ocn=$1,$2,$3 #,$4
elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@format,@text,@ocn=$1,$2,$3
elsif /^([1-6])~(\S+)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@@alt_id_count+=1
@format,segname,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}"
@format="#@format~#{segname}" #
elsif /^([1-6]~)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@@alt_id_count+=1
@format,@text,@ocn=$1,$2,"x#{@@alt_id_count}"
end
else
if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
@text,@ocn=$1,$2
end
if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06
@text=/(.+?)/m.match(@para)[1]
end
if /^(\d)~\S*\s+(.+)/m.match(@para)
@format,@text=$1,$2
end
end
@lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
SiSU_XML_format::Format_scroll.new(@md,@format,@text,@ocn)
else
SiSU_XML_format::Format_scroll.new(@md,@format,@text,"<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>")
end
self
end
def lev_segname_para
if @para =~/^(\d~|<:.+?>).+/
if /^([1-6])~(\S+)\s+(\S.+)/m.match(@para)
@format,segname,@text=$1,$2,$3
@format="#@format~#{segname}" #
elsif /^([1-6]~)\s+(\S.+)/m.match(@para)
@format,@text=$1,$2
elsif /<:(.+?)>\s*(\S.+?)/m.match(@para)
@format,@text=$1,$2
elsif /^([1-6])~(\S+)\s+(\S.+?)/m.match(@para)
@@alt_id_count+=1
@format,segname,@text=$1,$2,$3
@format="#@format~#{segname}" #
elsif /^([1-6]~)\s+(\S.+?)/m.match(@para)
@@alt_id_count+=1
@format,@text=$1,$2
end
else
if /(.+?)/m.match(@para)
@text=$1
end
if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06
@text=/(.+?)/m.match(@para)[1]
end
if /^(\d)~\S*\s+(.+)/m.match(@para)
@format,@text=$1,$2
end
end
@lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
SiSU_XML_format::Format_scroll.new(@md,@format,@text,@ocn)
else
SiSU_XML_format::Format_scroll.new(@md,@format,@text,"<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>")
end
self
end
end
end
module SiSU_XML_munge
class Trans
def initialize(md)
@sys=SiSU_Env::System_call.new
@dir=SiSU_Env::Info_env.new(md.fns)
@dp=SiSU_Env::Info_env.new.digest.pattern
end
def char_enc #character encode
def utf8(para='')
if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
#¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
#¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
##para.gsub!(//, '&#;')
##para.gsub!(//, '&;')
para.gsub!(/¢/, '¢') # '¢' # ¢
para.gsub!(/£/, '£') # '£' # £
para.gsub!(/¥/, '¥') # '¥' # ¥
para.gsub!(/§/, '§') # '§' # §
para.gsub!(/©/, '©') # '©' # ©
para.gsub!(/ª/, 'ª') # 'ª' # ª
para.gsub!(/«/, '«') # '«' # «
para.gsub!(/®/, '®') # '®' # ®
para.gsub!(/°/, '°') # '°' # °
para.gsub!(/±/, '±') # '±' # ±
para.gsub!(/²/, '²') # '²' # ²
para.gsub!(/³/, '³') # '³' # ³
para.gsub!(/µ/, 'µ') # 'µ' # µ
para.gsub!(/¶/, '¶') # '¶' # ¶
para.gsub!(/¹/, '¹') # '¹' # ¹
para.gsub!(/º/, 'º') # 'º' # º
para.gsub!(/»/, '»') # '»' # »
para.gsub!(/¼/, '¼') # '¼' # ¼
para.gsub!(/½/, '½') # '½' # ½
para.gsub!(/¾/, '¾') # '¾' # ¾
para.gsub!(/×/, '×') # '×' # ×
para.gsub!(/÷/, '÷') # '÷' # ÷
para.gsub!(/¿/, '¿') # '¿' # ¿
para.gsub!(/À/, 'À') # 'À' # À
para.gsub!(/Á/, 'Á') # 'Á' # Á
para.gsub!(/Â/, 'Â') # 'Â' # Â
para.gsub!(/Ã/, 'Ã') # 'Ã' # Ã
para.gsub!(/Ä/, 'Ä') # 'Ä' # Ä
para.gsub!(/Å/, 'Å') # 'Å' # Å
para.gsub!(/Æ/, 'Æ') # 'Æ' # Æ
para.gsub!(/Ç/, 'Ç') # 'Ç' # Ç
para.gsub!(/È/, 'È') # 'È' # È
para.gsub!(/É/, 'É') # 'É' # É
para.gsub!(/Ê/, 'Ê') # 'Ê' # Ê
para.gsub!(/Ë/, 'Ë') # 'Ë' # Ë
para.gsub!(/Ì/, 'Ì') # 'Ì' # Ì
para.gsub!(/Í/, 'Í') # 'Í' # Í
para.gsub!(/Î/, 'Î') # 'Î' # Î
para.gsub!(/Ï/, 'Ï') # 'Ï' # Ï
para.gsub!(/Ð/, 'Ð') # 'Ð' # Ð
para.gsub!(/Ñ/, 'Ñ') # 'Ñ' # Ñ
para.gsub!(/Ò/, 'Ò') # 'Ò' # Ò
para.gsub!(/Ó/, 'Ó') # 'Ó' # Ó
para.gsub!(/Ô/, 'Ô') # 'Ô' # Ô
para.gsub!(/Õ/, 'Õ') # 'Õ' # Õ
para.gsub!(/Ö/, 'Ö') # 'Ö' # Ö
para.gsub!(/Ø/, 'Ø') # 'Ø' # Ø
para.gsub!(/Ù/, 'Ù') # 'Ù' # Ù
para.gsub!(/Ú/, 'Ú') # 'Ú' # Ú
para.gsub!(/Û/, 'Û') # 'Û' # Û
para.gsub!(/Ü/, 'Ü') # 'Ü' # Ü
para.gsub!(/Ý/, 'Ý') # 'Ý' # Ý
para.gsub!(/Þ/, 'Þ') # 'Þ' # Þ
para.gsub!(/ß/, 'ß') # 'ß' # ß
para.gsub!(/à/, 'à') # 'à' # à
para.gsub!(/á/, 'á') # 'á' # á
para.gsub!(/â/, 'â') # 'â' # â
para.gsub!(/ã/, 'ã') # 'ã' # ã
para.gsub!(/ä/, 'ä') # 'ä' # ä
para.gsub!(/å/, 'å') # 'å' # å
para.gsub!(/æ/, 'æ') # 'æ' # æ
para.gsub!(/ç/, 'ç') # 'ç' # ç
para.gsub!(/è/, 'è') # 'è' # è
para.gsub!(/é/, 'é') # '´' # é
para.gsub!(/ê/, 'ê') # 'ˆ' # ê
para.gsub!(/ë/, 'ë') # 'ë' # ë
para.gsub!(/ì/, 'ì') # 'ì' # ì
para.gsub!(/í/, 'í') # '´' # í
para.gsub!(/î/, 'î') # 'î' # î
para.gsub!(/ï/, 'ï') # 'ï' # ï
para.gsub!(/ð/, 'ð') # 'ð' # ð
para.gsub!(/ñ/, 'ñ') # 'ñ' # ñ
para.gsub!(/ò/, 'ò') # 'ò' # ò
para.gsub!(/ó/, 'ó') # 'ó' # ó
para.gsub!(/ô/, 'ô') # 'ô' # ô
para.gsub!(/õ/, 'õ') # 'õ' # õ
para.gsub!(/ö/, 'ö') # 'ö' # ö
para.gsub!(/ø/, 'ø') # 'ø' # ø
para.gsub!(/ù/, 'ú') # 'ù' # ú
para.gsub!(/ú/, 'û') # 'ú' # û
para.gsub!(/û/, 'ü') # 'û' # ü
para.gsub!(/ü/, 'ý') # 'ü' # ý
para.gsub!(/þ/, 'þ') # 'þ' # þ
para.gsub!(/ÿ/, 'ÿ') # 'ÿ' # ÿ
end
end
def html(para='')
if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
para.gsub!(/¢/, '¢') # ¢
para.gsub!(/£/, '£') # £
para.gsub!(/¥/, '¥') # ¥
para.gsub!(/§/, '§') # §
para.gsub!(/©/, '©') # ©
para.gsub!(/ª/, 'ª') # ª
para.gsub!(/«/, '«') # «
para.gsub!(/®/, '®') # ®
para.gsub!(/°/, '°') # °
para.gsub!(/±/, '±') # ±
para.gsub!(/²/, '²') # ²
para.gsub!(/³/, '³') # ³
para.gsub!(/µ/, 'µ') # µ
para.gsub!(/¶/, '¶') # ¶
para.gsub!(/¹/, '¹') # ¹
para.gsub!(/º/, 'º') # º
para.gsub!(/»/, '»') # »
para.gsub!(/¼/, '¼') # ¼
para.gsub!(/½/, '½') # ½
para.gsub!(/¾/, '¾') # ¾
para.gsub!(/×/, '×') # ×
para.gsub!(/÷/, '÷') # ÷
para.gsub!(/¿/, '¿') # ¿
para.gsub!(/À/, 'À') # À
para.gsub!(/Á/, 'Á') # Á
para.gsub!(/Â/, 'Â') # Â
para.gsub!(/Ã/, 'Ã') # Ã
para.gsub!(/Ä/, 'Ä') # Ä
para.gsub!(/Å/, 'Å') # Å
para.gsub!(/Æ/, 'Æ') # Æ
para.gsub!(/Ç/, 'Ç') # Ç
para.gsub!(/È/, 'È') # È
para.gsub!(/É/, 'É') # É
para.gsub!(/Ê/, 'Ê') # Ê
para.gsub!(/Ë/, 'Ë') # Ë
para.gsub!(/Ì/, 'Ì') # Ì
para.gsub!(/Í/, 'Í') # Í
para.gsub!(/Î/, 'Î') # Î
para.gsub!(/Ï/, 'Ï') # Ï
para.gsub!(/Ð/, 'Ð') # Ð
para.gsub!(/Ñ/, 'Ñ') # Ñ
para.gsub!(/Ò/, 'Ò') # Ò
para.gsub!(/Ó/, 'Ó') # Ó
para.gsub!(/Ô/, 'Ô') # Ô
para.gsub!(/Õ/, 'Õ') # Õ
para.gsub!(/Ö/, 'Ö') # Ö
para.gsub!(/Ø/, 'Ø') # Ø
para.gsub!(/Ù/, 'Ù') # Ù
para.gsub!(/Ú/, 'Ú') # Ú
para.gsub!(/Û/, 'Û') # Û
para.gsub!(/Ü/, 'Ü') # Ü
para.gsub!(/Ý/, 'Ý') # Ý
para.gsub!(/Þ/, 'Þ') # Þ
para.gsub!(/ß/, 'ß') # ß
para.gsub!(/à/, 'à') # à
para.gsub!(/á/, 'á') # á
para.gsub!(/â/, 'â') # â
para.gsub!(/ã/, 'ã') # ã
para.gsub!(/ä/, 'ä') # ä
para.gsub!(/å/, 'å') # å
para.gsub!(/æ/, 'æ') # æ
para.gsub!(/ç/, 'ç') # ç
para.gsub!(/è/, 'è') # è
para.gsub!(/é/, '´') # é
para.gsub!(/ê/, 'ˆ') # ê
para.gsub!(/ë/, 'ë') # ë
para.gsub!(/ì/, 'ì') # ì
para.gsub!(/í/, '´') # í
para.gsub!(/î/, 'î') # î
para.gsub!(/ï/, 'ï') # ï
para.gsub!(/ð/, 'ð') # ð
para.gsub!(/ñ/, 'ñ') # ñ
para.gsub!(/ò/, 'ò') # ò
para.gsub!(/ó/, 'ó') # ó
para.gsub!(/ô/, 'ô') # ô
para.gsub!(/õ/, 'õ') # õ
para.gsub!(/ö/, 'ö') # ö
para.gsub!(/ø/, 'ø') # ø
para.gsub!(/ù/, 'ù') # ú
para.gsub!(/ú/, 'ú') # û
para.gsub!(/û/, 'û') # ü
para.gsub!(/ü/, 'ü') # ý
para.gsub!(/þ/, 'þ') # þ
para.gsub!(/ÿ/, 'ÿ') # ÿ
end
end
self
end
def tidywords(wordlist)
wordlist.each do |x|
x.gsub!(/&/,'&') unless x =~/&\S+;/
end
end
def markup(para='')
wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17
para=tidywords(wordlist).join(' ').strip
para.gsub!(/(^|\s+)<\s+/,'\1< ')
para.gsub!(/\s+>(\s+|$)/,' >\1')
para.gsub!(/<:pb>\s*/,'')
para.gsub!(/<+[-~]#>+/,'')
para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'')
para.gsub!(/^(<:i[12]>\s*)_\*\s+/,'\1 <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_red.png" width="12" height="12" alt="*" /> ')
para.gsub!(/^_\*\s+/,'<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_red.png" width="12" height="12" alt="*" /> ')
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2" width="\\3" height="\\4" />[\\2] \\5})
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2"/>\\2})
para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4')
para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\2</link>\3')
para.gsub!(/ /,' ') #clean
para
end
def markup_light(para='')
para.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>')
para.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>')
para.gsub!(/_\{(.+?)\}_/,'<u>\1</u>')
para.gsub!(/-\{(.+?)\}-/,'<del>\1</del>')
para.gsub!(/<br(\s*\/)?>/,'<br />')
para.gsub!(/<:pb>\s*/,'')
para.gsub!(/<[-~]#>/,'')
para.gsub!(/(^|\s)&\s+/,'\1& ') #sort
para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax
para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|ftp):\/\/\S+|image)/,
"<image.path>#{@dir.url.images_local}\/\\1</image.path>")
para.gsub!(/ /,' ')
wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17
para=tidywords(wordlist).join(' ').strip
para
end
def markup_group(para='')
para.gsub!(/</,'<')
para.gsub!(/>/,'>')
para.gsub!(/<br(?:\s+\/)?>/,'<br />')
para
end
end
end
module SiSU_XML_tags #Format
require SiSU_lib + '/param'
include SiSU_Param
include SiSU_Viz
class RDF
def initialize(md='',seg_name=[],tracker=0)
@dc_title=@dc_subtitle=@dc_creator=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@dc_relation=@dc_coverage=@dc_rights=@copyright=@owner=@keywords=''
#seg_name=%{#{@@seg_name[@@tracker]} - } if @@seg_name[@@tracker]
@md=md
@sfx,@pdf=@md.sfx,@md.pdf
@rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
if @md.dc_title # DublinCore 1 - title
@rdf_title=%{ dc.title="#{seg_name}#{@md.dc_title}"\n}
@dc_title=%{ <meta name="dc.title" content="#{seg_name}#{@md.dc_title}" />\n}
#if @md.subtitle
# @rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n}
# @title=%{<meta name="dc.title" } +
# %{content="#{seg_name}#{@md.title} - #{@md.subtitle}" />\n}
#else
# @rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n}
# @title=%{<meta name="dc.title" } +
# %{content="#{seg_name}#{@md.title}" />\n}
#end
end
if @md.dc_creator # DublinCore 2 - creator/author (author)
@rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n}
content=meta_content_clean(@md.dc_creator)
@dc_creator=%{ <meta name="dc.creator" content="#{content}" />\n}
end
if @md.dc_subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
@rdf_subject=%{ dc.subject="#{@md.dc_subject}"\n}
content=meta_content_clean(@md.dc_subject)
@dc_subject=%{ <meta name="dc.subject" content="#{content}" />\n}
end
if @md.dc_description # DublinCore 4 - description
@rdf_description=%{ dc.description="#{@md.dc_description}"\n}
content=meta_content_clean(@md.dc_description)
@dc_description=%{ <meta name="dc.description" content="#{content}" />\n}
end
if @md.dc_publisher # DublinCore 5 - publisher (current copy published by)
@rdf_publisher=%{ dc.publisher="#{@md.dc_publisher}"\n}
content=meta_content_clean(@md.dc_publisher)
@dc_publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
end
if @md.dc_contributor # DublinCore 6 - contributor
@rdf_contributor=%{ dc.contributor="#{@md.dc_contributor}"\n}
content=meta_content_clean(@md.dc_contributor)
@dc_contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
end
if @md.dc_date # DublinCore 7 - date year-mm-dd
@rdf_date=%{ dc.date="#{@md.dc_date}"\n}
@dc_date=%{ <meta name="dc.date" content="#{@md.dc_date}" #{@md.date_scheme} />\n}
end
if @md.dc_date_created # DublinCore 7 - date.created year-mm-dd
@rdf_date_created=%{ dc.date.created="#{@md.dc_date_created}"\n}
@dc_date_created=%{ <meta name="dc.date.created" content="#{@md.dc_date_created}" #{@md.date_created_scheme} />\n}
end
if @md.dc_date_issued # DublinCore 7 - date.issued year-mm-dd
@rdf_date_issued=%{ dc.date.issued="#{@md.dc_date_issued}"\n}
@dc_date_issued=%{ <meta name="dc.date.issued" content="#{@md.dc_date_issued}" #{@md.date_issued_scheme} />\n}
end
if @md.dc_date_available # DublinCore 7 - date.available year-mm-dd
@rdf_date_available=%{ dc.date.available="#{@md.dc_date_available}"\n}
@dc_date_available=%{ <meta name="dc.date.available" content="#{@md.dc_date_available}" #{@md.date_available_scheme} />\n}
end
if @md.dc_date_valid # DublinCore 7 - date.valid year-mm-dd
@rdf_date_valid=%{ dc.date.valid="#{@md.dc_date_valid}"\n}
@dc_date_valid=%{ <meta name="dc.date.valid" content="#{@md.dc_date_valid}" #{@md.date_valid_scheme} />\n}
end
if @md.dc_date_modified # DublinCore 7 - date.modified year-mm-dd
@rdf_date_modified=%{ dc.date.modified="#{@md.dc_date_modified}"\n}
@dc_date_modified=%{ <meta name="dc.date.modified" content="#{@md.dc_date_modified}" #{@md.date_modified_scheme} />\n}
end
if @md.dc_type # DublinCore 8 - type (genre eg. report, convention etc)
@rdf_type=%{ dc.type="#{@md.dc_type}"\n}
content=meta_content_clean(@md.dc_type)
@dc_type=%{ <meta name="dc.type" content="#{content}" />\n}
end
if @md.dc_format # DublinCore 9 - format (use your mime type)
@rdf_format=%{ dc.format="#{@md.dc_format}"\n}
content=meta_content_clean(@md.dc_format)
@dc_format=%{ <meta name="dc.format" content="#{content}" />\n}
end
if @md.dc_identifier # DublinCore 10 - identifier (your identifier, could use urn which is free)
@rdf_identifier=%{ dc.identifier="#{@md.dc_identifier}"\n}
content=meta_content_clean(@md.dc_identifier)
@dc_identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
end
if @md.dc_source # DublinCore 11 - source (document source)
@rdf_source=%{ dc.source="#{@md.dc_source}"\n}
content=meta_content_clean(@md.dc_source)
@dc_source=%{ <meta name="dc.source" content="#{content}" />\n}
end
if @md.dc_language[:name] # DublinCore 12 - language (English)
@rdf_language=%{ dc.language="#{@md.dc_language[:name]}"\n}
@dc_language=%{ <meta name="dc.language" content="#{@md.dc_language[:name]}" />\n}
end
if @md.language_original[:name]
@rdf_language_original=%{ dc.language="#{@md.language_original[:name]}"\n}
@language_original=%{ <meta name="dc.language" content="#{@md.language_original[:name]}" />\n}
end
if @md.dc_relation # DublinCore 13 - relation
@rdf_relation=%{ dc.relation="#{@md.dc_relation}"\n}
content=meta_content_clean(@md.dc_relation)
@dc_relation=%{ <meta name="dc.relation" content="#{content}" />\n}
end
if @md.dc_coverage # DublinCore 14 - coverage
@rdf_coverage=%{ dc.coverage="#{@md.dc_coverage}"\n}
content=meta_content_clean(@md.dc_coverage)
@dc_coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
end
if @md.dc_rights # DublinCore 15 - rights
@rdf_rights=%{ dc.rights="#{@md.dc_rights}"\n}
content=meta_content_clean(@md.dc_rights)
@dc_rights=%{ <meta name="dc.rights" content="#{content}" />\n}
end
content=meta_content_clean(@md.keywords)
@keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
@vz=SiSU_Env::Get_init.instance.skin
end
def meta_content_clean(content='')
unless content.nil?
content.tr!('"',"'")
end
content
end
def rdftoc #tocHead #values strung together, because some empty, and resulting output (line breaks) is much better
#<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
# xmlns:dc="http://purl.org/dc/elements/1.1/">
# <rdf:Description rdf:about="http://www.jus.uio.no/lm/doc"
# dc:creator="Author"
# dc:title="Title"
# dc:description="Description if any"
# dc:date="Publication Date"
# />
#</rdf:RDF>
#Dublin Core
#### XML only :-( KEEP
#<<WOK
#<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
# xmlns:dc="http://purl.org/dc/elements/1.1/">
# <rdf:Description
# #@rdfurl#@rdf_title#@rdf_subtitle#@rdf_creator#@rdf_subject#@rdf_description#@rdf_publisher#@rdf_contributor#@rdf_date#@rdf_dateCreated#@rdf_dateIssued#@rdf_dateAvailable#@rdf_dateValid#@rdf_dateModified#@rdf_type#@rdf_format#@rdf_identifier#@rdf_source#@rdf_language#@rdf_relation #@rdf_coverage#@rdf_rights
# />\n
#</rdf:RDF>\n
#WOK
end
def rdfseg #segHead
rdftoc
end
def comment_xml(extra='')
generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
lastdone="Last Generated on: #{Time.now}"
rubyv="Ruby version: #{@md.ruby_version}"
sc=if @md.sc_info
"Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
else ''
end
if extra.empty?
<<WOK
<!-- Document processing information:
* #{generator}
* #{rubyv}
* #{sc}
* #{lastdone}
* SiSU http://www.jus.uio.no/sisu
-->
WOK
else
<<WOK
<!-- Document processing information:
* #{extra}
* #{generator}
* #{rubyv}
* #{sc}
* #{lastdone}
* SiSU http://www.jus.uio.no/sisu
-->
WOK
end
end
def comment_xml_sax
desc='SiSU XML, SAX type representation'
comment_xml(desc)
end
def comment_xml_node
desc='SiSU XML, Node type representation'
comment_xml(desc)
end
def comment_xml_dom
desc='SiSU XML, DOM type representation'
comment_xml(desc)
end
def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
#{@vz.js_head}
<<WOK
#@dc_title#@dc_subtitle#@dc_creator#@dc_subject#@dc_description#@dc_publisher#@dc_contributor#@dc_date#@dc_date_created#@dc_date_issued#@dc_date_available#@dc_date_valid#@dc_date_modified#@dc_type#@dc_format#@dc_identifier#@dc_source#@dc_language#@dc_relation#@dc_coverage#@dc_rights#@copyright#@owner
#{@vz.txt_generator}
#{@vz.png_ico}
WOK
end
end
end
module SiSU_Tables
require SiSU_lib + '/xml_tables'
end
__END__
|