diff options
Diffstat (limited to 'lib/sisu/0.52/shared_xml.rb')
-rw-r--r-- | lib/sisu/0.52/shared_xml.rb | 580 |
1 files changed, 0 insertions, 580 deletions
diff --git a/lib/sisu/0.52/shared_xml.rb b/lib/sisu/0.52/shared_xml.rb deleted file mode 100644 index a3b4b07f..00000000 --- a/lib/sisu/0.52/shared_xml.rb +++ /dev/null @@ -1,580 +0,0 @@ -=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__ - |