aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/html_format_css.rb
blob: db381e6335a7774d4ff4c8caffe2155498f595fa (plain)
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# 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: html formating, css template

=end
module SiSU_HTML_Format_type
  require "#{SiSU_lib}/html_format"
  include SiSU_Viz
  include SiSU_HTML_Format
  class Head_toc < SiSU_HTML_Format::Head_toc
    def initialize(md='')
      super(md)
    end
    def head
      %{#{doc_type}
<head>
  <title>
    #{@md.html_title}
  </title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdftoc}
#{@rdf.metatag_html}
#{@css.html}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
<a name="start" id="start"></a>
#{@vz.js_top}}
    end
    def concordance
      if @md.concord_make
      %{#{@vz.margin_css}
  <h4 class="toc">
    <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
      <i>Concordance</i>
    </a>
  </h4>
#{@vz.table_close}}
      else
      %{#{@vz.margin_css}
#{@vz.table_close}}
      end
    end
    def metadata
      %{#{@vz.margin_css}
  <h4 class="toc">
    <a href="#@metalink" #{@vz.js_metalink}>
      <i>MetaData</i>
    </a>
  </h4>
#{@vz.table_close}}
    end
  end
  class Head_seg < SiSU_HTML_Format::Head_seg
    def initialize(md='')
      super(md)
    end
    def head
      %{#{doc_type}
<head>
  <title>
    #{@seg_name_html[@seg_name_html_tracker]} -
    #{@md.html_title}
  </title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdfseg}
#{@rdf.metatag_html}
#{@css.html}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
<a name="start" id="start"></a>
#{@vz.js_top}}
    end
    def toc_metadata
      @metalink=%{./#{@md.fn[:meatadata]}}
      toc_metadata
    end
    def title_banner(title,subtitle,creator)
      %{<p class="tiny">
    #{title}
  </p>
  <p class="tiny">
    #{subtitle}
  </p>
  <p class="tiny">
    #{creator}
  </p>
  <p class="tiny">
    copy @
    <a href="#{@vz.url_home}">
      #{@vz.txt_home}
    </a>
  </p>}
    end
  end
  class Head_scroll < SiSU_HTML_Format::Head_scroll
    def initialize(md='')
      super(md)
    end
    def toc_endnote
      %{#{@vz.margin_css}
  <h4 class="toc">
    <a href="#endnotes">
      Endnotes
    </a>
  </h4>
#{@vz.table_close}}
    end
  end
  class Format_scroll < SiSU_HTML_Format::Format_text_object
    def initialize(md='',*txt)
      super(md,*txt)
      @vz=SiSU_Env::Get_init.instance.skin
    end
    def indent_one_no_paranum
      %{#{@vz.margin_txt_1}
#{@paragraph.txt}
  #@one
#{@vz.margin_num}
#{@vz.table_close}}
    end
    def indent_two_no_paranum
      %{#{@vz.margin_txt_1}
#{@paragraph.txt}
  #@one
#{@vz.margin_num}
#{@vz.table_close}}
    end
    def endnote_body
      %{#{@vz.margin_css}
  <p class="endnote">
    #@one
  </p>
#{@vz.margin_num_css}
  &nbsp;
#{@vz.table_close}}
    end
    def header_normal
      %{#{@vz.margin_css}
  <#@tag class="#@class" #{@p_num.id}>#{@p_num.name}
    #@headname
    #@parablock
  </#@tag>
#{@vz.margin_num_css}
  #{@p_num.ocn_display}
#{@vz.table_close}}
    end
    def heading_body
      @tag,@class='p','norm'
      header_normal
    end
    def heading_body1
      @tag,@class='h1','norm'
      header_normal
    end
    def heading_body2
      @tag,@class='h2','norm'
      header_normal
    end
    def heading_body3
      @tag,@class='h3','norm'
      header_normal
    end
    def heading_body4
      @tag,@class='h4','norm'
      header_normal
    end
    def heading_body5
      @tag,@class='h5','norm'
      header_normal
    end
    def heading_body6
      @tag,@class='h6','norm'
      header_normal
    end
  end
  class Format_seg < SiSU_HTML_Format::Format_text_object
    def initialize(md='',*txt)
      super(md,*txt)
    end
    def navigation_para
      %{#{@vz.margin_css}
#{@paragraph.txt}
  #@one
</p>
#{@vz.table_close}}
    end
    def navigation_toc_lev1_advert
      %{#{@banner.home_button}\n
<center>
#@one
#@two
</a></center><p />}
    end
    def navigation_toc_lev1
      %{#{@banner.nav_toc}}
    end
    def navigation_toc_lev2                                                      #change bold use css
      %{<p />
<table summary="navigation segment level 2">
<tr><td width ="20">
</td>
<td>
  <font size="3" #{@vz.font_face}>
    <b>#@one</b>
  </font>
  </p>
#{@vz.table_close}}
    end
    def navigation_toc_lev3                                                      #change bold use css
      %{<p />
<table summary="navigation segment level 3">
<tr><td width ="20">
</td>
<td>
  <font size="3" #{@vz.font_face}>
    <b>#@one</b>
  </font>
  </p>
#{@vz.table_close}}
    end
    def navigation_toc_lev4
      %{<table summary="navigation segment level 4">
<tr><td width ="80">
</td>
<td>
<p>
  #@one
</p>
#{@vz.table_close}}
    end
    def navigation_toc_lev5
    end
    def navigation_toc_lev6
    end
    def endnote_body_seg_tail
      %{#{@vz.margin_css}
  <p class="endnote">
    #@one
  </p>
#{@vz.margin_num_css}&nbsp;
#{@vz.table_close}}
    end
    def endnote_body_seg_tail_indent
      %{#{@vz.margin_css}
  <p class="endnote_indent">
    #@one
  </p>
#{@vz.margin_num_css}&nbsp;
#{@vz.table_close}}
    end
    def endnote_seg_body(fn='')                                                  #url construction keep within single line... BUG WATCH 200408
      fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info
      %{#{@vz.margin_css}
  <p class="endnote">
    #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three
  </p>
#{@vz.margin_num_css}&nbsp;
#{@vz.table_close}}
    end
    def title_header
      %{#{@vz.margin_css}
  <#@tag class="#@class">
    #@one
  </#@tag>
#{@vz.margin_num_css}&nbsp;
#@two
#{@vz.table_close}}
    end
    def title_header1
      @tag,@class='h1','banner'
      title_header
    end
    def title_header2
      @tag,@class='h2','banner'
      title_header
    end
    def title_header3
      @tag,@class='h3','banner'
      title_header
    end
    def title_header4
      %{#{@vz.margin_css}
  <h4 class="banner">
    #@one
  </h4>
#{@vz.margin_num_css}&nbsp;
#{@vz.table_close}}
    end
    def subtoc_lev
      one=if @one \
      and @one =~/<\/?i>|<a\s+name="\S+?">/mi
        @one.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
      else @one
      end
      note=''
      if one =~/(~[{\[].+?[}\]]~\s*)/m #this is a clumsy fix, revisit and address upstream
        note=$1
        note.gsub!(/[\n\s]+/m,' ')
        one.gsub!(/~[{\[].+?[}\]]~\s*/m,' ')
        one.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
      end
      %{<#@tag class="#@class">
    <a href="##@two">
      <i>#{one}</i>
    </a> #{note}
  </#@tag>}
    end
    def subtoc_lev5
      @tag,@class='h5','subtoc'
      subtoc_lev if @one
    end
    def subtoc_lev6
      @tag,@class='h6','subtoc'
      subtoc_lev if @one
    end
    #% para sisu
    def header4
      %{#@format #{@vz.margin_css}
  <h1 class="norm" #{@p_num.id}>#{@p_num.name}
    #@format
    #@parablock
  </h1>
#{@vz.margin_num_css}
#{@p_num.ocn_display}
#{@vz.table_close}}
    end
    def header_sub
      @parablock.gsub!(/~[{\[].+?[}\]]~\s*/m,' ')
      %{#{@vz.margin_css}
#{@headname}
  <#@tag class="#@class" #{@p_num.id}>#{@p_num.name}
    #{@parablock}
  </#@tag>
#{@vz.margin_num_css}
#{@p_num.ocn_display}
#{@vz.table_close}}
    end
    def header5
      @tag,@class='p','bold'
      header_sub
    end
    def header6
      @tag,@class='p','bold'
      header_sub
    end
    def navigation_header4
      %{<table summary="navigation segment header 4" width=100% bgcolor="#08163f" border="0">
<tr><td align="center">
<p class="bold">
  #@parablock
</p>
#{@vz.table_close}}
    end
    def navigation_header5
      %{<p class="bold">
  #@parablock
</p>}
    end
    def navigation_header6
      %{<p class="bold">
  #@parablock
</p>}
    end
    def navigation_indent1
      %{#{@vz.margin_txt_00_1}
#{@paragraph.txt_00}
    #@parablock
  </font>
  </p>
#{@vz.margin_num_css}&nbsp;
#{@vz.table_close}}
    end
    def navigation_indent2
    end
    def navigation_center
      "<center>#@parablock</center>"
    end
  end
  class Format_toc < SiSU_HTML_Format::Format_text_object
    def initialize(md='',*txt)
      super(md,*txt)
    end
    def links_guide
      #@three distinguishes between _top and external, can be used e.g. for different colour scheme
      %{  <li class="doc">
    <a href="#@link" target="_top">
      #@linkname
    </a>
  </li>
}
    end
    def lev(tag,attrib)
  %{<#{tag} class="#{attrib}">
    #@one
  </#{tag}>
}
    end
    def lev1
      lev('h1','toc')
    end
    def lev2
      lev('h2','toc')
    end
    def lev3
      lev('h3','toc')
    end
    def lev4
      lev('h4','toc')
    end
    def lev5
      lev('h5','toc')
    end
    def lev6
      lev('h6','toc')
    end
    def lev0 #docinfo
      lev('h0','toc')
    end
  end
end
__END__