Class: SiSU_XML_Tags::RDF

Inherits:
Object
  • Object
show all
Includes:
SiSU_Parts_XML
Defined in:
lib/sisu/xml_shared.rb

Instance Method Summary collapse

Methods included from SiSU_Parts_XML

#_url_path_image_base, #band1, #band2, #banner_band, #black, #blue_ink, #blue_tinge, #grey, #grey_medium, #grey_pale, #home_button_only, #ico, #png_home, #png_home_button, #set_face, #set_fonts, #table1, #table2, #the_banner, #the_color, #the_font, #the_line_break, #the_png, #the_table_close, #the_url_decoration, #txt_close, #txt_open, #white, #xml_close, #xml_open, #yellow_light

Methods included from SiSU_Parts_Generic

#footer_signature, #home, #home_txt, #i_choice, #i_home_button, #i_ico, #i_new, #rl_root, #root_http, #sisu, #sisu_txt, #sisudoc, #site, #the_icon, #the_text, #the_url, #txt_home, #txt_hp, #txt_hp_alias, #txt_signature, #urify, #url_close, #url_open

Constructor Details

#initialize(md = '', seg_name = [], tracker = 0) ⇒ RDF

Returns a new instance of RDF.



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
# File 'lib/sisu/xml_shared.rb', line 475

def initialize(md='',seg_name=[],tracker=0)
  @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=''
  @md=md
  @rdfurl=%{  rdf:about="http://www.jus.uio.no/lm/toc"\n}
  if defined? @md.title.full \
  and @md.title.full                          # DublinCore 1 - title
    @rdf_title=%{    dc.title="#{seg_name}#{@md.title.full}"\n}
    @full_title=%{  <meta name="dc.title" content="#{@md.title.full}" />\n}
  end
  if defined? @md.creator.author \
  and @md.creator.author=~/\S+/                                            # DublinCore 2 - creator/author (author)
    @rdf_author=%{    dc.author="#{@md.creator.author}"\n}
    content=meta_content_clean(@md.creator.author)
    @author=%{  <meta name="dc.author" content="#{content}" />\n}
  end
  if defined? @md.publisher \
  and @md.publisher                                                        # DublinCore 5 - publisher (current copy published by)
    @rdf_publisher=%{    dc.publisher="#{@md.publisher}"\n}
    content=meta_content_clean(@md.publisher)
    @publisher=%{  <meta name="dc.publisher" content="#{content}" />\n}
  end
  if defined? @md.creator.contributor \
  and @md.creator.contributor=~/\S+/                                      # DublinCore 6 - contributor
    @rdf_contributor=%{    dc.contributor="#{@md.creator.contributor}"\n}
    content=meta_content_clean(@md.creator.contributor)
    @contributor=%{  <meta name="dc.contributor" content="#{content}" />\n}
  end
  if defined? @md.date.published \
  and @md.date.published=~/\S+/                                           # DublinCore 7 - date year-mm-dd
    @rdf_date=%{    dc.date="#{@md.date.published}"\n}
    @date=%{  <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
  end
  if defined? @md.date.created \
  and @md.date.created=~/\S+/                                             # DublinCore 7 - date.created year-mm-dd
    @rdf_date_created=%{    dc.date.created="#{@md.date.created}"\n}
    @date_created=%{  <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
  end
  if defined? @md.date.issued \
  and @md.date.issued=~/\S+/                                              # DublinCore 7 - date.issued year-mm-dd
    @rdf_date_issued=%{    dc.date.issued="#{@md.date.issued}"\n}
    @date_issued=%{  <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
  end
  if defined? @md.date.available \
  and @md.date.available=~/\S+/                                           # DublinCore 7 - date.available year-mm-dd
    @rdf_date_available=%{    dc.date.available="#{@md.date.available}"\n}
    @date_available=%{  <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
  end
  if defined? @md.date.valid \
  and @md.date.valid=~/\S+/                                               # DublinCore 7 - date.valid year-mm-dd
    @rdf_date_valid=%{    dc.date.valid="#{@md.date.valid}"\n}
    @date_valid=%{  <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
  end
  if defined? @md.date.modified \
  and @md.date.modified=~/\S+/                                            # DublinCore 7 - date.modified year-mm-dd
    @rdf_date_modified=%{    dc.date.modified="#{@md.date.modified}"\n}
    @date_modified=%{  <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
  end
  if defined? @md.rights.all \
  and @md.rights.all                                                      # DublinCore 15 - rights
    @rdf_rights=%{    dc.rights="#{@md.rights.all}"\n}
    content=meta_content_clean(@md.rights.all)
    @rights=%{  <meta name="dc.rights" content="#{content}" />\n}
  end
  if defined? @md.classify.subject \
  and @md.classify.subject=~/\S+/                                          # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
    @rdf_subject=%{    dc.subject="#{@md.classify.subject}"\n}
    content=meta_content_clean(@md.classify.subject)
    @subject=%{  <meta name="dc.subject" content="#{content}" />\n}
  end
  if defined? @md.notes.description \
  and @md.notes.description=~/\S+/                                         # DublinCore 4 - description
    @rdf_description=%{    dc.description="#{@md.notes.description}"\n}
    content=meta_content_clean(@md.notes.description)
    @description=%{  <meta name="dc.description" content="#{content}" />\n}
  end
  if defined? @md.notes.coverage \
  and @md.notes.coverage=~/\S+/                                            # DublinCore 14 - coverage
    @rdf_coverage=%{    dc.coverage="#{@md.notes.coverage}"\n}
    content=meta_content_clean(@md.notes.coverage)
    @coverage=%{  <meta name="dc.coverage" content="#{content}" />\n}
  end
  if defined? @md.notes.relation \
  and @md.notes.relation=~/\S+/                                            # DublinCore 13 - relation
    @rdf_relation=%{    dc.relation="#{@md.notes.relation}"\n}
    content=meta_content_clean(@md.notes.relation)
    @relation=%{  <meta name="dc.relation" content="#{content}" />\n}
  end
  if defined? @md.notes.type \
  and @md.notes.type                                                       # DublinCore 8 - type (genre eg. report, convention etc)
    @rdf_type=%{    dc.type="#{@md.notes.type}"\n}
    content=meta_content_clean(@md.notes.type)
    @type=%{  <meta name="dc.type" content="#{content}" />\n}
  end
  if defined? @md.notes.format \
  and @md.notes.format=~/\S+/                                              # DublinCore 9 - format (use your mime type)
    @rdf_format=%{    dc.format="#{@md.notes.format}"\n}
    content=meta_content_clean(@md.notes.format)
    @format=%{  <meta name="dc.format" content="#{content}" />\n}
  end
  #if defined? @md.identifier.sisupod \
  #and @md.identifier.sisupod=~/\S+/                                       # DublinCore 10 - identifier (your identifier, could use urn which is free)
  #  @rdf_identifier=%{    dc.identifier="#{@md.identifier.sisupod}"\n}
  #  content=meta_content_clean(@md.identifier.sisupod)
  #  @identifier=%{  <meta name="dc.identifier" content="#{content}" />\n}
  #end
  if defined? @md.original.source \
  and @md.original.source=~/\S+/                                           # DublinCore 11 - source (document source)
    @rdf_source=%{    dc.source="#{@md.original.source}"\n}
    content=meta_content_clean(@md.original.source)
    @source=%{  <meta name="dc.source" content="#{content}" />\n}
  end
  if defined? @md.title.language \
  and @md.title.language=~/\S+/                                            # DublinCore 12 - language (English)
    @rdf_language=%{    dc.language="#{@md.title.language}"\n}
    @language=%{  <meta name="dc.language" content="#{@md.title.language}" />\n}
  end
  if defined? @md.original.language \
  and @md.original.language=~/\S+/
    @rdf_language_original=%{    dc.language="#{@md.original.language}"\n}
    @language_original=%{  <meta name="dc.language" content="#{@md.original.language}" />\n}
  end
  content=meta_content_clean(@md.keywords)
  @keywords=%{  <meta name="keywords" content="#{content}" />\n} if @md.keywords
end

Instance Method Details

#comment_xml(extra = '') ⇒ Object



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
# File 'lib/sisu/xml_shared.rb', line 610

def comment_xml(extra='')
  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
  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

#comment_xml_domObject



649
650
651
652
# File 'lib/sisu/xml_shared.rb', line 649

def comment_xml_dom
  desc='SiSU XML, DOM type representation'
  comment_xml(desc)
end

#comment_xml_nodeObject



645
646
647
648
# File 'lib/sisu/xml_shared.rb', line 645

def comment_xml_node
  desc='SiSU XML, Node type representation'
  comment_xml(desc)
end

#comment_xml_saxObject



641
642
643
644
# File 'lib/sisu/xml_shared.rb', line 641

def comment_xml_sax
  desc='SiSU XML, SAX type representation'
  comment_xml(desc)
end

#meta_content_clean(content = '') ⇒ Object



599
600
601
602
603
604
605
606
# File 'lib/sisu/xml_shared.rb', line 599

def meta_content_clean(content='')
  content=if not content.nil?
    content=content.tr('"',"'").
       gsub(/&/,'&amp;')
    content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
  else content
  end
end

#metatag_htmlObject

values strung together, because some empty, and resulting output (line breaks) is much better



653
654
655
656
657
658
659
# File 'lib/sisu/xml_shared.rb', line 653

def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
<<WOK
#{@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}
#{SiSU_Proj_XML::Bits.new.txt_generator}
#{the_png.ico}
WOK
end

#rdfsegObject

segHead



607
608
609
# File 'lib/sisu/xml_shared.rb', line 607

def rdfseg #segHead
  rdftoc
end