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
|
# coding: utf-8
=begin
* Name: SiSU
* Description: a framework for document structuring, publishing and search
* Author: Ralph Amissah
* Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008 Ralph Amissah All Rights Reserved.
* License: GPL 3 or later:
SiSU, a framework for document structuring, publishing and search
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008 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/licenses/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: 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+)/,
'<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=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/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+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}\}~/
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__
|