diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2007-06-02 11:27:06 +0100 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2007-06-02 11:27:06 +0100 |
commit | 26767cc88c0548ad7978021796d0ccc4c9f7ffed (patch) | |
tree | fe225e99e180b5d2925cbf776826f74db27e1888 /lib/sisu/0.52/xml_format.rb | |
parent | restrict use to ruby1.8 branch, i.e. < 1.9 (diff) |
0.53.0, pre-build, see changelog, library naming changed for scm, placed under v0 (instead of 0.53)upstream/0.53.0sisu_0.53.0
Diffstat (limited to 'lib/sisu/0.52/xml_format.rb')
-rw-r--r-- | lib/sisu/0.52/xml_format.rb | 339 |
1 files changed, 0 insertions, 339 deletions
diff --git a/lib/sisu/0.52/xml_format.rb b/lib/sisu/0.52/xml_format.rb deleted file mode 100644 index 111e2bee..00000000 --- a/lib/sisu/0.52/xml_format.rb +++ /dev/null @@ -1,339 +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: xml template - - * 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 - - * 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+)/, - '<font size="1" color="#777777">' + - ' \1</font>') - p_num_display - end - def name - p_num_name=@paranum.gsub(/(\d+)/,'<a name="\1"></a>') - p_num_name - end - def goto - p_num_goto=@paranum.gsub(/(\d+)/,'<a href="#\1">') - p_num_goto - end - end - class Head_information - def initialize #dc rdf - @dc_title=@dc_subtitle=@dc_creator=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@dc_relation=@dc_coverage=@dc_rights=@copyright=@owner=@keywords='' - @sfx,@pdf,@md=@@md.sfx,@@md.pdf,@@md - # DublinCore 1 - title - @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n} - if @md.dc_title - @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} - # @dc_title=%{<meta name="dc.title" content="#{seg_name}#{@md.title} - #{@md.subtitle}" />\n} - #else - # #@rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n} - # @dc_title=%{<meta name="dc.title" content="#{seg_name}#{@md.dc_title}" />\n} - #end - end - if @md.dc_creator # DublinCore 2 - creator/author (author) - @rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n} - @dc_creator=%{<meta name="dc.creator" content="#{@md.dc_creator}" />\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} - @dc_subject=%{<meta name="dc.subject" content="#{@md.dc_subject}" />\n} - end - if @md.dc_description # DublinCore 4 - description - @rdf_description=%{ dc.description="#{@md.description}"\n} - @dc_description=%{<meta name="dc.dc_description" content="#{@md.description}" />\n} - end - if @md.dc_publisher # DublinCore 5 - publisher (current copy published by) - @rdf_publisher=%{ dc.publisher="#{@md.dc_publisher}"\n} - @dc_publisher=%{<meta name="dc.publisher" content="#{@md.dc_publisher}" />\n} - end - if @md.dc_contributor # DublinCore 6 - contributor - @rdf_contributor=%{ dc.contributor="#{@md.dc_contributor}"\n} - @dc_contributor=%{<meta name="dc.contributor" content="#{@md.dc_contributor}" />\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} - @dc_type=%{<meta name="dc.type" content="#{@md.dc_type}" />\n} - end - if @md.dc_format # DublinCore 9 - format (use your mime type) - @rdf_format=%{ dc.format="#{@md.dc_format}"\n} - @dc_format=%{<meta name="dc.format" content="#{@md.dc_format}" />\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} - @dc_identifier=%{<meta name="dc.identifier" content="#{@md.dc_identifier}" />\n} - end - if @md.dc_source # DublinCore 11 - source (document source) - @rdf_source=%{ dc.source="#{@md.dc_source}"\n} - @dc_source=%{<meta name="dc.source" content="#{@md.dc_source}" />\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] # DublinCore 12 - language (English) - @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} - @dc_relation=%{<meta name="dc.relation" content="#{@md.dc_relation}" />\n} - end - if @md.dc_coverage # DublinCore 14 - coverage - @rdf_coverage=%{ dc.coverage="#{@md.dc_coverage}"\n} - @dc_coverage=%{<meta name="dc.coverage" content="#{@md.dc_coverage}" />\n} - end - if @md.dc_rights # DublinCore 15 - rights - @rdf_rights=%{ dc.rights="#{@md.dc_rights}"\n} - @dc_rights=%{<meta name="dc.rights" content="#{@md.dc_rights}" />\n} - end - @copyright=%{<meta name="copyright" content="#{@md.dc_rights}" />\n} if @md.rights # possibly redundant see dc.rights - @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner - @keywords=%{<meta name="keywords" content="#{@md.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 - # %{<p>PHP or other embedded script for object persistence may go HERE</p>} - end - #def seg_head_escript #embedded script in this case PHP - # # %{<p>PHP or other embedded script for object persistence may go HERE</p>} - #end - def table_close - '</font> </td></tr></table>' - end - def buttons_home - %{\n#{@banner.home_and_index_buttons}\n} - end - def copyat - %{copy @ <a href="#{@url.home}" #{@js.home}>#{@txt.home}</a>} - end - def toc_head - #<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 - <<WOK -<html> -<head> -<title>#{@md.html_title}</title> -<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_date_created -#@rdf_date_issued -#@rdf_date_available -#@rdf_date_valid -#@rdf_date_modified -#@rdf_type -#@rdf_format -#@rdf_identifier -#@rdf_source -#@rdf_language -#@rdf_relation -#@rdf_coverage -#@rdf_rights - /> -</rdf:RDF> -#@dc_title -#@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 -#{@png.ico} -#{@txt.generator} -#{@js.head} -\n</head> -#{@color.body} -#{@font.css_table_file} -<a name="top"></a> -<a name="up"></a> -<a name="start"></a> -#{@js.top} -WOK - end - end - class Format_text_object - @@dp=nil - attr_accessor :md,:one,:two,:three,:parablock,:table,:link,:linkname,:format,:paranum,:p_num,:para_id,:headname,:margin,:paragraph,:table,:banner,:url,:icon,:font,:one_stripped - def initialize(md,*txt) - @md=md - txt[0].gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ - @one,@two,@three=txt[0],txt[1],txt[2] - @format,@parablock=txt[0],txt[1] - if txt[2]=~/\d+/ - @paranum=/(\d+)/m.match(txt[2])[1] - @headname='' - #if txt[2]=~/\d+/ - m=/\d~(\S+)/m.match(format) - headname=m[1] if m - @headname=%{<a name="h#{headname}"></a>} unless headname.nil? - @p_num=SiSU_XML_format::Paragraph_number.new(@md,@paranum) - end - #{ - rgx=/^[1-6-]~{1,2}/ #watch - link=txt[0].gsub(rgx,'') if @one =~rgx - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{\d+\s+(.+?)<#@dp>\}~/ - link=txt[0].gsub(rgx,'\1') if txt[0] =~rgx - @link,@linkname=link,txt[1] - @vz=SiSU_Env::Get_init.instance.skin - end - def scr_endnote_body - "<endnote>#@one</endnote> " - end - end - class Format_scroll < Format_text_object - def initialize(*txt) - super(*txt) - end - def heading_body - %{<p class="norm">#{@p_num.name}#@headname#@parablock </p>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body1 - %{<h1 class="norm">#{@p_num.name}#@headname#@parablock </h1>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body2 - %{<h2 class="norm">#{@p_num.name}#@headname#@parablock </h2>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body3 - %{<h3 class="norm">#{@p_num.name}#@headname#@parablock </h3>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body4 - %{<h4 class="norm">#{@p_num.name}#@headname#@parablock</h4>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body5 - %{<h5 class="norm">#{@p_num.name}#@headname#@parablock </h5>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - def heading_body6 - %{<h6 class="norm">#{@p_num.name}#@headname#@parablock </h6>} + - %{<p class="paranum">#{@p_num.display} </p>\n} - end - end - class XML - end -end -__END__ - |