aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2/shared_metadata.rb
blob: f27cf5babc289dee10129d6fa0125233c48aa305 (plain)
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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
# coding: utf-8
=begin

 * Name: SiSU

 * Description: a framework for document structuring, publishing and search

 * Author: Ralph Amissah

 * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved.

 * License: GPL 3 or later:

   SiSU, a framework for document structuring, publishing and search

   Copyright (C) Ralph Amissah

   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 3 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, see <http://www.gnu.org/licenses/>.

   If you have Internet connection, the latest version of the GPL should be
   available at these locations:
   <http://www.fsf.org/licensing/licenses/gpl.html>
   <http://www.gnu.org/copyleft/gpl.html>

   <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
   <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
   <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>

 * SiSU uses:
   * Standard SiSU markup syntax,
   * Standard SiSU meta-markup syntax, and the
   * Standard SiSU object citation numbering and system

 * Hompages:
   <http://www.jus.uio.no/sisu>
   <http://www.sisudoc.org>

 * Download:
   <http://www.jus.uio.no/sisu/SiSU/download.html>

 * Ralph Amissah
   <ralph@amissah.com>
   <ralph.amissah@gmail.com>

 ** Description: system environment, resource control and configuration details

=end
module Metadata
  class Summary
    attr_accessor :tag,:inf,:class,:attrib
    def initialize(md,display_heading=false)
      @md,@display_heading=md,display_heading
      @tag,@inf,@class,@attrib=nil
    end
    def metadata_base
      meta,tag=[],[]
      dir=SiSU_Env::Info_env.new(@md.fns)
      base_html="#{dir.url.root}/#{@md.fnb}"
      l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
      language=l[:l]
      tr=SiSU_Translate::Source.new(@md,language)
      @attrib='md'
      if @display_heading
        @tag,@inf=%{<b><u>Document Metadata</u></b>},''
        meta << self.meta_para
      end
      if defined? @md.title.full \
      and @md.title.full=~/\S+/
        @tag,@inf,@class=tr.full_title,@md.title.full,'dc' #1
        meta << self.meta_para
      end
      if defined? @md.creator.author \
      and @md.creator.author=~/\S+/
        @tag,@inf,@class=tr.author,@md.creator.author,'dc' #2
        meta << self.meta_para
      end
      if defined? @md.creator.translator \
      and @md.creator.translator=~/\S+/
        @tag,@inf,@class=tr.translator,@md.creator.translator,'ext'
        meta << self.meta_para
      end
      if defined? @md.creator.illustrator \
      and @md.creator.illustrator=~/\S+/
        @tag,@inf,@class=tr.illustrator,@md.creator.illustrator,'ext'
        meta << self.meta_para
      end
      if defined? @md.creator.prepared_by \
      and @md.creator.prepared_by=~/\S+/
        @tag,@inf,@class=tr.prepared_by,@md.creator.prepared_by,'ext'
        meta << self.meta_para
      end
      if defined? @md.creator.digitized_by \
      and @md.creator.digitized_by=~/\S+/
        @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext'
        meta << self.meta_para
      end
      if defined? @md.rights.all \
      and @md.rights.all=~/\S+/
        @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15
        meta << self.meta_para
      end
      if defined? @md.classify.subject \
      and @md.classify.subject=~/\S+/
        @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3
        meta << self.meta_para
      end
      if defined? @md.notes.description \
      and @md.notes.description=~/\S+/
        @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4
        meta << self.meta_para
      end
      if defined? @md.publisher \
      and @md.publisher=~/\S+/
        @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5
        meta << self.meta_para
      end
      if defined? @md.creator.contributor \
      and @md.creator.contributor=~/\S+/
        @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6
        meta << self.meta_para
      end
      if defined? @md.notes.abstract \
      and @md.notes.abstract=~/\S+/
        @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext'
        meta << self.meta_para
      end
      if defined? @md.date.created \
      and @md.date.created=~/\S+/
        @tag,@inf,@class=tr.date_created,@md.date.created,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.date.issued \
      and @md.date.issued=~/\S+/
        @tag,@inf,@class=tr.date_issued,@md.date.issued,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.date.available \
      and @md.date.available=~/\S+/
        @tag,@inf,@class=tr.date_available,@md.date.available,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.date.modified \
      and @md.date.modified=~/\S+/
        @tag,@inf,@class=tr.date_modified,@md.date.modified,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.date.valid \
      and @md.date.valid=~/\S+/
        @tag,@inf,@class=tr.date_valid,@md.date.valid,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.date.published \
      and @md.date.published=~/\S+/
        @tag,@inf,@class=tr.date,@md.date.published,'dc' #7
        meta << self.meta_para
      end
      if defined? @md.type \
      and @md.date=~/\S+/
        @tag,@inf,@class=tr.type,@md.type,'dc' #8
        meta << self.meta_para
      end
      if defined? @md.classify.loc \
      and @md.classify.loc=~/\S+/
        @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id'
        meta << self.meta_para
      end
      if defined? @md.classify.dewey \
      and @md.classify.dewey=~/\S+/
        @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id'
        meta << self.meta_para
      end
      if defined? @md.classify.pg \
      and @md.classify.pg=~/\S+/
        @tag,@inf,@class=tr.cls_gutenberg,@md.classify.pg,'id'
        meta << self.meta_para
      end
      if defined? @md.classify.isbn \
      and @md.classify.isbn=~/\S+/
        @tag,@inf,@class=tr.cls_isbn,@md.classify.isbn,'id'
        meta << self.meta_para
      end
      if defined? @md.notes.comment \
      and @md.notes.comment=~/\S+/
        @tag,@inf,@class=tr.comments,@md.notes.comment,'ext'
        meta << self.meta_para
      end
      if defined? @md.notes.prefix_a \
      and @md.notes.prefix_a=~/\S+/
        @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf'
        meta << self.meta_para
      end
      if defined? @md.notes.prefix_b \
      and @md.notes.prefix_b=~/\S+/
        @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf'
        meta << self.meta_para
      end
      if defined? @md.classify.identifier \
      and @md.classify.identifier=~/\S+/
        @tag,@inf,@class=tr.identifier,@md.classify.identifier,'dc' #10
        meta << self.meta_para
      end
      if defined? @md.original.source \
      and @md.original.source=~/\S+/
        @tag,@inf,@class=tr.source,@md.original.source,'dc' #11
        meta << self.meta_para
      end
      if defined? @md.title.language \
      and @md.title.language=~/\S+/
        @tag,@inf,@class=tr.language,@md.title.language,'dc' #12
        meta << self.meta_para
      end
      if defined? @md.original.language \
      and @md.original.language=~/\S+/
        @tag,@inf,@class=tr.language_original,@md.original.language,'ext'
        meta << self.meta_para
      end
      if defined? @md.classify.format \
      and @md.classify.format=~/\S+/
        @tag,@inf,@class=tr.format,@md.classify.format,'dc' #9
        meta << self.meta_para
      end
      if defined? @md.classify.relation \
      and @md.classify.relation=~/\S+/
        @tag,@inf,@class=tr.relation,@md.classify.relation,'dc' #13
        meta << self.meta_para
      end
      if defined? @md.classify.coverage \
      and @md.classify.coverage=~/\S+/
        @tag,@inf,@class=tr.coverage,@md.classify.coverage,'dc' #14
        meta << self.meta_para
      end
      if defined? @md.classify.keywords \
      and @md.classify.keywords=~/\S+/
        @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext'
        meta << self.meta_para
      end
      if @display_heading
        @tag,@inf=%{<b><u>Version Information</u></b>},''
        meta << self.meta_para
      end
      if defined? @md.fns \
      and @md.fns=~/\S+/
        @tag,@inf,@class=tr.sourcefile,@md.fns,'src'
        meta << self.meta_para
      end
      if defined? @md.file_encoding \
      and @md.file_encoding=~/\S+/
        @tag,@inf,@class='Filetype',@md.file_encoding,'src'
        meta << self.meta_para
      end
      if defined? @md.dgst \
      and @md.dgst.class==Array
        @tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
        meta << self.meta_para
      end
      if defined? @md.dgst_skin \
      and @md.dgst_skin.class==Array
        @tag,@inf,@class='Skin Digest',"#{@md.dgst_skin[0]} #{@md.dgst_skin[1]}",'src'
        meta << self.meta_para
      end
      if @display_heading
        @tag,@inf=%{<b><u>Generated</u></b>},''
        meta << self.meta_para
      end
      if defined? @md.sisu_version \
      and @md.sisu_version[:version]=~/\S+/
        v="#{tr.sisu_version}: " +
          "#{@md.sisu_version[:project]} " +
          "#{@md.sisu_version[:version]} " +
          "of #{@md.sisu_version[:date_stamp]} " +
          "(#{@md.sisu_version[:date]})"
        @tag,@inf,@class='Generated by',v,'ver'
        meta << self.meta_para
      end
      if defined? @md.ruby_version \
      and @md.ruby_version=~/\S+/
        @tag,@inf,@class=tr.ruby_version,@md.ruby_version,'ver'
        meta << self.meta_para
      end
      if defined? @md.generated \
      and @md.generated.class==Time
        @tag,@inf,@class=tr.last_generated,@md.generated,'date'
        meta << self.meta_para
      end
      meta
    end
    def char_enc(str)
      @s=str
      def utf8
        if @s \
        and @s.class==String
          @s.gsub!(/<br(?: \/)?>/u,Mx[:br_paragraph])
          @s.gsub!(/</um,'&#60;') # '&lt;'   # &#060;
          @s.gsub!(/</um,'&#60;') # '&lt;'   # &#060;
          @s.gsub!(/>/um,'&#62;') # '&gt;'   # &#062;
          @s.gsub!(/¢/um,'&#162;') # '&cent;'   # &#162;
          @s.gsub!(/£/um,'&#163;') # '&pound;'  # &#163;
          @s.gsub!(/¥/um,'&#165;') # '&yen;'    # &#165;
          @s.gsub!(/§/um,'&#167;') # '&sect;'   # &#167;
          @s.gsub!(/©/um,'&#169;') # '&copy;'   # &#169;
          @s.gsub!(/ª/um,'&#170;') # '&ordf;'   # &#170;
          @s.gsub!(/«/um,'&#171;') # '&laquo;'  # &#171;
          @s.gsub!(/®/um,'&#174;') # '&reg;'    # &#174;
          @s.gsub!(/°/um,'&#176;') # '&deg;'    # &#176;
          @s.gsub!(/±/um,'&#177;') # '&plusmn;' # &#177;
          @s.gsub!(/²/um,'&#178;') # '&sup2;'   # &#178;
          @s.gsub!(/³/um,'&#179;') # '&sup3;'   # &#179;
          @s.gsub!(/µ/um,'&#181;') # '&micro;'  # &#181;
          @s.gsub!(/¶/um,'&#182;') # '&para;'   # &#182;
          @s.gsub!(/¹/um,'&#185;') # '&sup1;'   # &#185;
          @s.gsub!(/º/um,'&#186;') # '&ordm;'   # &#186;
          @s.gsub!(/»/um,'&#187;') # '&raquo;'  # &#187;
          @s.gsub!(/¼/um,'&#188;') # '&frac14;' # &#188;
          @s.gsub!(/½/um,'&#189;') # '&frac12;' # &#189;
          @s.gsub!(/¾/um,'&#190;') # '&frac34;' # &#190;
          @s.gsub!(/×/um,'&#215;') # '&times;'  # &#215;
          @s.gsub!(/÷/um,'&#247;') # '&divide;' # &#247;
          @s.gsub!(/¿/um,'&#191;') # '&iquest;' # &#191;
          @s.gsub!(/À/um,'&#192;') # '&Agrave;' # &#192;
          @s.gsub!(/Á/um,'&#193;') # '&Aacute;' # &#193;
          @s.gsub!(/Â/um,'&#194;') # '&Acirc;'  # &#194;
          @s.gsub!(/Ã/um,'&#195;') # '&Atilde;' # &#195;
          @s.gsub!(/Ä/um,'&#196;') # '&Auml;'   # &#196;
          @s.gsub!(/Å/um,'&#197;') # '&Aring;'  # &#197;
          @s.gsub!(/Æ/um,'&#198;') # '&AElig;'  # &#198;
          @s.gsub!(/Ç/um,'&#199;') # '&Ccedil;' # &#199;
          @s.gsub!(/È/um,'&#200;') # '&Egrave;' # &#200;
          @s.gsub!(/É/um,'&#201;') # '&Eacute;' # &#201;
          @s.gsub!(/Ê/um,'&#202;') # '&Ecirc;'  # &#202;
          @s.gsub!(/Ë/um,'&#203;') # '&Euml;'   # &#203;
          @s.gsub!(/Ì/um,'&#204;') # '&Igrave;' # &#204;
          @s.gsub!(/Í/um,'&#205;') # '&Iacute;' # &#205;
          @s.gsub!(/Î/um,'&#206;') # '&Icirc;'  # &#206;
          @s.gsub!(/Ï/um,'&#207;') # '&Iuml;'   # &#207;
          @s.gsub!(/Ð/um,'&#208;') # '&ETH;'    # &#208;
          @s.gsub!(/Ñ/um,'&#209;') # '&Ntilde;' # &#209;
          @s.gsub!(/Ò/um,'&#210;') # '&Ograve;' # &#210;
          @s.gsub!(/Ó/um,'&#211;') # '&Oacute;' # &#211;
          @s.gsub!(/Ô/um,'&#212;') # '&Ocirc;'  # &#212;
          @s.gsub!(/Õ/um,'&#213;') # '&Otilde;' # &#213;
          @s.gsub!(/Ö/um,'&#214;') # '&Ouml;'   # &#214;
          @s.gsub!(/Ø/um,'&#216;') # '&Oslash;' # &#216;
          @s.gsub!(/Ù/um,'&#217;') # '&Ugrave;' # &#217;
          @s.gsub!(/Ú/um,'&#218;') # '&Uacute;' # &#218;
          @s.gsub!(/Û/um,'&#219;') # '&Ucirc;'  # &#219;
          @s.gsub!(/Ü/um,'&#220;') # '&Uuml;'   # &#220;
          @s.gsub!(/Ý/um,'&#221;') # '&Yacute;' # &#221;
          @s.gsub!(/Þ/um,'&#222;') # '&THORN;'  # &#222;
          @s.gsub!(/ß/um,'&#223;') # '&szlig;'  # &#223;
          @s.gsub!(/à/um,'&#224;') # '&agrave;' # &#224;
          @s.gsub!(/á/um,'&#225;') # '&aacute;' # &#225;
          @s.gsub!(/â/um,'&#226;') # '&acirc;'  # &#226;
          @s.gsub!(/ã/um,'&#227;') # '&atilde;' # &#227;
          @s.gsub!(/ä/um,'&#228;') # '&auml;'   # &#228;
          @s.gsub!(/å/um,'&#229;') # '&aring;'  # &#229;
          @s.gsub!(/æ/um,'&#230;') # '&aelig;'  # &#230;
          @s.gsub!(/ç/um,'&#231;') # '&ccedil;' # &#231;
          @s.gsub!(/è/um,'&#232;') # '&egrave;' # &#232;
          @s.gsub!(/é/um,'&#233;') # '&acute;'  # &#233;
          @s.gsub!(/ê/um,'&#234;') # '&circ;'   # &#234;
          @s.gsub!(/ë/um,'&#235;') # '&euml;'   # &#235;
          @s.gsub!(/ì/um,'&#236;') # '&igrave;' # &#236;
          @s.gsub!(/í/um,'&#237;') # '&acute;'  # &#237;
          @s.gsub!(/î/um,'&#238;') # '&icirc;'  # &#238;
          @s.gsub!(/ï/um,'&#239;') # '&iuml;'   # &#239;
          @s.gsub!(/ð/um,'&#240;') # '&eth;'    # &#240;
          @s.gsub!(/ñ/um,'&#241;') # '&ntilde;' # &#241;
          @s.gsub!(/ò/um,'&#242;') # '&ograve;' # &#242;
          @s.gsub!(/ó/um,'&#243;') # '&oacute;' # &#243;
          @s.gsub!(/ô/um,'&#244;') # '&ocirc;'  # &#244;
          @s.gsub!(/õ/um,'&#245;') # '&otilde;' # &#245;
          @s.gsub!(/ö/um,'&#246;') # '&ouml;'   # &#246;
          @s.gsub!(/ø/um,'&#248;') # '&oslash;' # &#248;
          @s.gsub!(/ù/um,'&#250;') # '&ugrave;' # &#250;
          @s.gsub!(/ú/um,'&#251;') # '&uacute;' # &#251;
          @s.gsub!(/û/um,'&#252;') # '&ucirc;'  # &#252;
          @s.gsub!(/ü/um,'&#253;') # '&uuml;'   # &#253;
          @s.gsub!(/þ/um,'&#254;') # '&thorn;'  # &#254;
          @s.gsub!(/ÿ/um,'&#255;') # '&yuml;'   # &#255;
          @s.gsub!(/‘/um,'&#8216;') # '&lsquo;' # &#8216;
          @s.gsub!(/’/um,'&#8217;') # '&rsquo;' # &#8217;
          @s.gsub!(/“/um,'&#8220;') # &ldquo;   # &#8220;
          @s.gsub!(/”/um,'&#8221;') # &rdquo;   # &#8221;
          @s.gsub!(/–/um,'&#8211;') # &ndash;   # &#8211;
          @s.gsub!(/—/um,'&#8212;') # &mdash;   # &#8212;
          @s.gsub!(/∝/um,'&#8733;') # &prop;    # &#8733;
          @s.gsub!(/∞/um,'&#8734;') # &infin;   # &#8734;
          @s.gsub!(/™/um,'&#8482;') # &trade;   # &#8482;
          @s.gsub!(/✠/um,'&#10016;') # &cross;  # &#10016;
          @s.gsub!(/ /um,' ')       # space identify
          @s.gsub!(/ /um,' ')       # space identify
          @s.gsub!(/#{Mx[:br_paragraph]}/u,'<br />')
        end
        @s
      end
      self
    end
    def xml_sax
      def meta_para
        inf_xml=char_enc(@inf).utf8
        <<WOK
<metadata>
#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
#{Ax[:tab]}<data class="#{@attrib}">
#{Ax[:tab]*2}#{inf_xml}
#{Ax[:tab]}</data>
</metadata>
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
    def xml_dom
      def meta_para
        inf_xml=char_enc(@inf).utf8
        <<WOK
#{Ax[:tab]}<header>
#{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
#{Ax[:tab]*2}<#{@attrib}>
#{Ax[:tab]*3}#{inf_xml}
#{Ax[:tab]*2}</#{@attrib}>
#{Ax[:tab]}</header>
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
    def xhtml_scroll
      def meta_para
        inf_xml=char_enc(@inf).utf8
        <<WOK
#{Ax[:tab]}<metadata>
#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
#{Ax[:tab]}<#{@attrib} class="#{@class}">
#{Ax[:tab]*2}#{inf_xml}
#{Ax[:tab]}</#{@attrib}>
#{Ax[:tab]}</metadata>
	<br />
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
    def xhtml_display
      def meta_para
        inf_xml=char_enc(@inf).utf8
        %{<p class="norm">
  <b>#{@tag}</b>: #{inf_xml}
</p>}
      end
      def metadata
        Metadata::Summary.new(@md,true).metadata_base
      end
      self
    end
    def odf
      def meta_para
        url_brace=SiSU_Viz::Skin.new.url_decoration
        if @inf.class==String
          @inf.gsub!(/</,'&lt;'); @inf.gsub!(/>/,'&gt;')
          @inf.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
          if @inf =~/&/
            inf_array=[]
            word=@inf.scan(/\S+|\n/)
            word.each do |w| # _ - / # | : ! ^ ~
              w.gsub!(/&nbsp;/,'&#160;')
              if w !~/&\S{2,7}?;/
                w.gsub!(/&/,'&amp;')
              end
              inf_array << w
            end
            @inf=inf_array.join(' ')
          end
          @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
          @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
            '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url
          if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/
            @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
              %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
          else
            @inf.gsub!(/(https?:\/\/[^<>()'"\s]+)/,
              %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
          end
          @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
            %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol
        end
        <<WOK
<text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p>
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
    def plaintext
      def meta_para
        <<WOK

#{@tag.capitalize}: #{@inf}
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
    def manpage
      def meta_para
        <<WOK

.TP
#{@tag.capitalize}:
.I #{@inf}
WOK
      end
      def metadata
        Metadata::Summary.new(@md).metadata_base
      end
      self
    end
  end
  class TeX_metadata
    def initialize(md)
      @md=md
      @br="\\\\\n"
    end
    def meta_para(tag,inf,sc=true)
      inf=((inf.class==String && sc) ? spec_char(inf) : inf)
      %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
}
    end
    def spec_char(inf)
      SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_characters
    end
    def word_break_points(inf)
      SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_word_break_points
    end
    def number_break_points(inf)
      SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_number_break_points
    end
    def metadata_tex
      meta=[]
      dir=SiSU_Env::Info_env.new(@md.fns)
      base_html="#{dir.url.root}/#{@md.fnb}"
      l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
      language=l[:l]
      tr=SiSU_Translate::Source.new(@md,language)
      tag="Document Manifest @"
      inf="#{@br}#{base_html}/#{@md.fn[:manifest]}"
      meta << meta_para(tag,inf)
      if defined? @md.title.full \
      and @md.title.full=~/\S+/
        tag,inf=tr.full_title,@md.title.full
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.author \
      and @md.creator.author=~/\S+/
        tag,inf=tr.author,@md.creator.author
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.translator \
      and @md.creator.translator=~/\S+/
        tag,inf=tr.translator,@md.creator.translator
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.illustrator \
      and @md.creator.illustrator=~/\S+/
        tag,inf=tr.illustrator,@md.creator.illustrator
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.prepared_by \
      and @md.creator.prepared_by=~/\S+/
        tag,inf=tr.prepared_by,@md.creator.prepared_by
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.digitized_by \
      and @md.creator.digitized_by=~/\S+/
        tag,inf=tr.digitized_by,@md.creator.digitized_by
        meta << meta_para(tag,inf)
      end
      if defined? @md.rights.all \
      and @md.rights.all=~/\S+/
        tag,inf=tr.rights,@md.rights.all
        meta << meta_para(tag,inf)
      end
      if defined? @md.notes.description \
      and @md.notes.description=~/\S+/
        tag,inf=tr.description,@md.notes.description
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.subject \
      and @md.classify.subject=~/\S+/
        tag,inf=tr.subject,@md.classify.subject
        meta << meta_para(tag,inf)
      end
      if defined? @md.publisher \
      and @md.publisher=~/\S+/
        tag,inf=tr.publisher,@md.publisher
        meta << meta_para(tag,inf)
      end
      if defined? @md.creator.contributor \
      and @md.creator.contributor=~/\S+/
        tag,inf=tr.contributor,@md.creator.contributor
        meta << meta_para(tag,inf)
      end
      if defined? @md.notes.abstract \
      and @md.notes.abstract=~/\S+/
        tag,inf=tr.abstract,@md.notes.abstract
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.created \
      and @md.date.created=~/\S+/
        tag,inf=tr.date_created,@md.date.created
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.issued \
      and @md.date.issued=~/\S+/
        tag,inf=tr.date_issued,@md.date.issued
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.available \
      and @md.date.available=~/\S+/
        tag,inf=tr.date_available,@md.date.available
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.modified \
      and @md.date.modified=~/\S+/
        tag,inf=tr.date_modified,@md.date.modified
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.valid \
      and @md.date.valid=~/\S+/
        tag,inf=tr.date_valid,@md.date.valid
        meta << meta_para(tag,inf)
      end
      if defined? @md.date.published \
      and @md.date.published=~/\S+/
        tag,inf=tr.date,@md.date.published
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.topic_register \
      and @md.classify.topic_register=~/\S+/
        tag,inf=tr.topic_register,@md.classify.topic_register
        inf=word_break_points(inf)
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.loc \
      and @md.classify.loc=~/\S+/
        tag,inf=tr.cls_loc,@md.classify.loc
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.dewey \
      and @md.classify.dewey=~/\S+/
        tag,inf=tr.cls_dewey,@md.classify.dewey
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.oclc \
      and @md.classify.oclc=~/\S+/
        tag,inf=tr.cls_oclc,@md.classify.oclc
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.pg \
      and @md.classify.pg=~/\S+/
        tag,inf=tr.cls_gutenberg,@md.classify.pg
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.isbn \
      and @md.classify.isbn=~/\S+/
        tag,inf=tr.cls_isbn,@md.classify.isbn
        meta << meta_para(tag,inf)
      end
      if defined? @md.notes.comment \
      and @md.notes.comment=~/\S+/
        tag,inf=tr.comments,@md.notes.comment
        meta << meta_para(tag,inf)
      end
      if defined? @md.notes.prefix_a \
      and @md.notes.prefix_a=~/\S+/
        tag,inf=tr.prefix_a,@md.notes.prefix_a
        meta << meta_para(tag,inf)
      end
      if defined? @md.notes.prefix_b \
      and @md.notes.prefix_b=~/\S+/
        tag,inf=tr.prefix_b,@md.notes.prefix_b
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.identifier \
      and @md.classify.identifier=~/\S+/
        tag,inf=tr.identifier,@md.classify.identifier
        meta << meta_para(tag,inf)
      end
      if defined? @md.original.source \
      and @md.original.source=~/\S+/
        tag,inf=tr.source,@md.original.source
        meta << meta_para(tag,inf)
      end
      if defined? @md.title.language \
      and @md.title.language=~/\S+/
        tag,inf=tr.language,@md.title.language
        meta << meta_para(tag,inf)
      end
      if defined? @md.original.language \
      and @md.original.language=~/\S+/
        tag,inf=tr.language_original,@md.original.language
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.format \
      and @md.classify.format=~/\S+/
        tag,inf=tr.format,@md.classify.format
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.relation \
      and @md.classify.relation=~/\S+/
        tag,inf=tr.relation,@md.classify.relation
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.coverage \
      and @md.classify.coverage=~/\S+/
        tag,inf=tr.coverage,@md.classify.coverage
        meta << meta_para(tag,inf)
      end
      if defined? @md.classify.keywords \
      and @md.classify.keywords=~/\S+/
        tag,inf=tr.keywords,@md.classify.keywords
        meta << meta_para(tag,inf)
      end
      meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
      if defined? @md.fns \
      and @md.fns=~/\S+/
        fn=spec_char(@md.fns)
        fn=word_break_points(fn)
        fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
        tag,inf=tr.sourcefile,fn
        meta << meta_para(tag,inf,false)
      end
      if defined? @md.file_encoding \
      and @md.file_encoding=~/\S+/
        tag,inf='Filetype',@md.file_encoding
        meta << meta_para(tag,inf)
      end
      if defined? @md.dgst \
      and @md.dgst.class==Array
        hash_of=spec_char(@md.dgst[0])
        hash_of=word_break_points(hash_of)
        dgst=number_break_points(@md.dgst[1])
        tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
        meta << meta_para(tag,inf,false)
      end
      if defined? @md.dgst_skin \
      and @md.dgst_skin.class==Array
        hash_of=spec_char(@md.dgst_skin[0])
        hash_of=word_break_points(hash_of)
        dgst=number_break_points(@md.dgst_skin[1])
        tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
        meta << meta_para(tag,inf,false)
      end
      meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
      if defined? @md.generated \
      and @md.generated.class==Time
        tag,inf=tr.last_generated,@md.generated
        meta << meta_para(tag,inf)
      end
      if defined? @md.sisu_version \
      and @md.sisu_version[:version]=~/\S+/
        tag=tr.sisu_version
        inf="#{@md.sisu_version[:project]} " +
          "#{@md.sisu_version[:version]} " +
          "of #{@md.sisu_version[:date_stamp]} " +
          "(#{@md.sisu_version[:date]})"
        meta << meta_para(tag,inf)
      end
      if defined? @md.ruby_version \
      and @md.ruby_version=~/\S+/
        tag,inf=tr.ruby_version,@md.ruby_version
        meta << meta_para(tag,inf)
      end
      meta
    end
  end
end
__END__