# coding: utf-8 =begin * Name: SiSU * Description: a framework for document structuring, publishing and search * Author: Ralph Amissah * Copyright: (C) 1997 - 2009 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 . If you have Internet connection, the latest version of the GPL should be available at these locations: * SiSU uses: * Standard SiSU markup syntax, * Standard SiSU meta-markup syntax, and the * Standard SiSU object citation numbering and system * Hompages: * Download: * Ralph Amissah ** Description: xml template ** Notes: tidy -xml index.xml >> index.tidy =end module SiSU_XML_format require "#{SiSU_lib}/param" include SiSU_Param include SiSU_Viz class Paragraph_number def initialize(md,paranum) @md=md @paranum=/(\d+)/m.match(paranum)[1] end def display p_num_display=@paranum.gsub(/(\d+)/, '' + '  \1') p_num_display end def name p_num_name=@paranum.gsub(/(\d+)/,'') p_num_name end def goto p_num_goto=@paranum.gsub(/(\d+)/,'') p_num_goto end end class Head_information def initialize #dc rdf @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=@@md # DublinCore 1 - title @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n} if @md.full_title @full_title=%{\n} #if @md.subtitle # #@rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n} # @full_title=%{\n} #else # #@rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n} # @full_title=%{\n} #end end if @md.author # DublinCore 2 - author/creator (author) @rdf_author=%{ dc.author="#{@md.author}"\n} @author=%{\n} end if @md.subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) @rdf_subject=%{ dc.subject="#{@md.subject}"\n} @subject=%{\n} end if @md.description # DublinCore 4 - description @rdf_description=%{ dc.description="#{@md.description}"\n} @description=%{\n} end if @md.publisher # DublinCore 5 - publisher (current copy published by) @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n} @publisher=%{\n} end if @md.contributor # DublinCore 6 - contributor @rdf_contributor=%{ dc.contributor="#{@md.contributor}"\n} @contributor=%{\n} end if @md.date # DublinCore 7 - date year-mm-dd @rdf_date=%{ dc.date="#{@md.date}"\n} @date=%{\n} end if @md.date_created # DublinCore 7 - date.created year-mm-dd @rdf_date_created=%{ dc.date.created="#{@md.date_created}"\n} @date_created=%{\n} end if @md.date_issued # DublinCore 7 - date.issued year-mm-dd @rdf_date_issued=%{ dc.date.issued="#{@md.date_issued}"\n} @date_issued=%{\n} end if @md.date_available # DublinCore 7 - date.available year-mm-dd @rdf_date_available=%{ dc.date.available="#{@md.date_available}"\n} @date_available=%{\n} end if @md.date_valid # DublinCore 7 - date.valid year-mm-dd @rdf_date_valid=%{ dc.date.valid="#{@md.date_valid}"\n} @date_valid=%{\n} end if @md.date_modified # DublinCore 7 - date.modified year-mm-dd @rdf_date_modified=%{ dc.date.modified="#{@md.date_modified}"\n} @date_modified=%{\n} end if @md.type # DublinCore 8 - type (genre eg. report, convention etc) @rdf_type=%{ dc.type="#{@md.type}"\n} @type=%{\n} end if @md.format # DublinCore 9 - format (use your mime type) @rdf_format=%{ dc.format="#{@md.format}"\n} @format=%{\n} end if @md.identifier # DublinCore 10 - identifier (your identifier, could use urn which is free) @rdf_identifier=%{ dc.identifier="#{@md.identifier}"\n} @identifier=%{\n} end if @md.source # DublinCore 11 - source (document source) @rdf_source=%{ dc.source="#{@md.source}"\n} @source=%{\n} end if @md.language[:name] # DublinCore 12 - language (English) @rdf_language=%{ dc.language="#{@md.language[:name]}"\n} @language=%{\n} end if @md.language_original[:name] # DublinCore 12 - language (English) @rdf_language_original=%{ dc.language="#{@md.language_original[:name]}"\n} @language_original=%{\n} end if @md.relation # DublinCore 13 - relation @rdf_relation=%{ dc.relation="#{@md.relation}"\n} @relation=%{\n} end if @md.coverage # DublinCore 14 - coverage @rdf_coverage=%{ dc.coverage="#{@md.coverage}"\n} @coverage=%{\n} end if @md.rights # DublinCore 15 - rights @rdf_rights=%{ dc.rights="#{@md.rights}"\n} @rights=%{\n} end @copyright=%{\n} if @md.rights # possibly redundant see dc.rights @owner=%{\n} if @md.owner @keywords=%{\n} if @md.keywords @vz=SiSU_Env::Get_init.instance.skin #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index=case @md.file_type when /php/; 'index' # @index="index.php" else 'index' end end def toc_head_escript #embedded script in this case PHP # %{

PHP or other embedded script for object persistence may go HERE

} end #def seg_head_escript #embedded script in this case PHP # # %{

PHP or other embedded script for object persistence may go HERE

} #end def table_close ' ' end def buttons_home %{\n#{@banner.home_and_index_buttons}\n} end def copyat %{copy @
#{@txt.home}} end def toc_head # # # #Dublin Core < #{@md.html_title} #@full_title #@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 #{@png.ico} #{@txt.generator} #{@js.head} \n #{@color.body} #{@font.css_table_file} #{@js.top} WOK end end class Format_text_object @@dp=nil attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font def initialize(md,t_o) @md,@t_o=md,t_o if t_o.class == Hash @txt =t_o[:txt] || nil @format =t_o[:format] || nil @lnk_url =t_o[:lnk_url] || nil @lnk_txt =t_o[:lnk_txt] || nil @ocn =t_o[:ocn] || nil #@h_name =t_o[:h_name] || nil #elsif t_o.class == Array # @txt =txt[0] #elsif t_o.class == String # @txt =txt else p t_o.class p caller end if @t_o[:ocn]=~/\d+/ @paranum=/(\d+)/m.match(@t_o[:ocn])[1] @headname='' #if txt[2]=~/\d+/ m=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/m.match(@format) headname=m[1] if m @headname=%{} unless headname.nil? @p_num=SiSU_XML_format::Paragraph_number.new(@md,@paranum) end rgx=/^[1-6-]~{1,2}/ #watch @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/~\{\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}\}~/ @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx @vz=SiSU_Env::Get_init.instance.skin end def scr_endnote_body "#{@txt} " end end class Format_scroll < Format_text_object def initialize(md,t_o) super(md,t_o) end def heading_body %{

#{@p_num.name}#{@headname}#{@txt}

} + %{

#{@p_num.display}

\n} end def heading_body1 %{

#{@p_num.name}#{@headname}#{@txt}

} + %{

#{@p_num.display}

\n} end def heading_body2 %{

#{@p_num.name}#{@headname}#{@txt}

} + %{

#{@p_num.display}

\n} end def heading_body3 %{

#{@p_num.name}#{@headname}#{@txt}

} + %{

#{@p_num.display}

\n} end def heading_body4 %{

#{@p_num.name}#{@headname}#{@txt}

} + %{

#{@p_num.display}

\n} end def heading_body5 %{
#{@p_num.name}#{@headname}#{@txt}
} + %{

#{@p_num.display}

\n} end def heading_body6 %{
#{@p_num.name}#{@headname}#{@txt}
} + %{

#{@p_num.display}

\n} end end class XML end end __END__