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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
# encoding: utf-8
=begin
* Name: SiSU
** Description: documents, structuring, processing, publishing, search
*** html formating, css template
** Author: Ralph Amissah
<ralph@amissah.com>
<ralph.amissah@gmail.com>
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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 <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.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
** 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>
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_format.rb;hb=HEAD>
=end
module SiSU_HTML_Format
require_relative 'html_parts' # html_parts.rb
class ParagraphNumber
def initialize(md,ocn)
@md,@ocn=md,ocn.to_s
@ocn ||=''
@ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
@make=SiSU_Env::ProcessingSettings.new(@md)
end
def ocn_display
if @make.build.ocn?
if @ocn.to_i==0 \
or @ocn.empty?
''
else
%{<label class="ocn">#{@ocn}</label>}
end
else
''
end
end
def name
if @make.build.html_strict? \
or @ocn==(nil || @ocn.empty?)
''
else
%{<a name="#{@ocn}"></a>}
end
end
def id #w3c? "tidy" complains about numbers as identifiers ! annoying
(@ocn==nil || @ocn.empty?) ? '' : %{id="#{Mx[:ocn_id_char]}#{@ocn}"}
end
def goto
(@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn_html_identifier}#{@ocn}">}
end
end
class HeadInformation
require_relative 'css' # css.rb
include SiSU_Parts_HTML
require_relative 'xml_shared' # xml_shared.rb
attr_reader :md,:rdf
def initialize(md)
@md=md
# DublinCore 1 - title
@bits=SiSU_Proj_HTML::Bits.new
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
@tocband_scroll,@tocband_segtoc=nil,nil
@stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
@index,@metalink='index','#metadata'
@toc=@md.file.base_filename.html_segtoc
end
def url_path_image_sys
(@o_str.dump_or_redirect?) \
? './image'
: "#{Xx[:html_relative2]}_sisu/image_sys"
end
def icon
def up
'arrow_up_red.png'
end
def next
'arrow_next_red.png'
end
def previous
'arrow_prev_red.png'
end
def dot_clear
'dot_clear.png'
end
def dot_white
'dot_white.png'
end
def dot
dot_white
end
self
end
def png_nav
def toc
%{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="toc" />}
end
def pre
%{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.previous}" alt="<< previous" />}
end
def nxt
%{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.next}" alt="next >>" />}
end
def dot_toc
%{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="^" />}
end
def dot_pre
%{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="<" />}
end
def dot_nxt
%{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt=">" />}
end
self
end
def doc_types(page=:seg) #used in toc & seg_nav_band
wgt=SiSU_HTML_Format::Widget.new(@md)
%{
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor=#{the_color.band2}>
#{wgt.manifest(page)}
#{wgt.search}
</tr></table>}
end
def rdf
SiSU_XML_Tags::RDF.new(md)
end
def button_home(page=:seg)
button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\n}
if @md.make.home_button_image.is_a?(Hash)
image_path=if page==:manifest
@md.file.output_path.manifest.rel_image
elsif page==:scroll
@md.file.output_path.html_scroll.rel_image
else
@md.file.output_path.html_seg.rel_image
end
SiSU_Env::FileOp.new(@md)
button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon -->" /></a></p>\n}
elsif @md.home_button_links.is_a?(Array)
@md.home_button_links.each do |links|
button +=%{ <p class="tiny_left"><a href="#{links[:url]}" target="_top">\n #{links[:say]}\n </a></p>\n}
end
end
button +=%{ </td></tr>\n </table>}
button
end
def html_close #moved
%{</body>
</html>}
end
end
class Widget < HeadInformation
include SiSU_Parts_HTML
def initialize(md)
super(md)
@md=md
@cf_defaults=SiSU_Env::InfoProcessingFlag.new
@env=SiSU_Env::InfoEnv.new(md.fns)
@file=SiSU_Env::FileOp.new(md)
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
@make=SiSU_Env::ProcessingSettings.new(md)
end
def home
%{<td align="center" bgcolor=#{the_color.band2}>
<a href="../index.html" target="_top">
#{the_nav.txt_homepage}</a>
</td>
}
end
def scroll(text)
if @md.fns =~ /\.(?:-|ssm\.)?sst$/
%{<td align="center" bgcolor=#{the_color.band2}>
<a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top">
#{text}
</a>
</td>
}
end
end
def seg(text)
%{<td align="center" bgcolor="#99CC66">
<a href="#{@md.file.base_filename.html_segtoc}" target="_top">
#{text}
</a>
</td>
}
end
def search
if @make.build.html_search_form?
env=SiSU_Env::InfoEnv.new(@md.fns,@md)
env.widget.search_form('sisusearch',nil,nil,true)
else ''
end
end
def manifest(page=:seg)
if @make.build.links_to_manifest? \
and not @o_str.dump_or_redirect?
manifest_lnk=if @file.output_dir_structure.by_language_code? \
or @file.output_dir_structure.by_filetype?
"#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}"
else @file.base_filename.manifest
end
if page==:manifest
manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}"
%{<td align="center" bgcolor=#{the_color.band2}>
<font face="#{the_font.set_fonts}" size="2">
#{the_url_decoration.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{the_url_decoration.xml_close}
</font>
</td>}
else
%{<td align="center" bgcolor=#{the_color.band2}>
<a href="#{manifest_lnk}" target="_top">
#{the_nav.txt_manifest}
</a>
</td>}
end
else ''
end
end
end
class XML
end
class HeadToc < HeadInformation
def initialize(md)
super(md)
@md=md
@o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
@make=SiSU_Env::ProcessingSettings.new(@md)
@file=SiSU_Env::FileOp.new(@md)
end
def scroll_head_navigation_band
if @make.build.html_top_band?
<<WOK
<td align="center" width="60%">
#{make_scroll_search_form_and_manifest_link}
</td>
WOK
%{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}>
<tr><td width="20%">
#{button_home(:scroll)}
</td>
<td width="75%" align="center">
#{doc_types}
</td>
<td width="20%">
#{the_table_close}
<p>}
else ''
end
end
def concordance_navigation_band
up_button=if @make.build.html_navigation?
%{</td>
<td width="5%" align="right">
<a href="toc.html" target="_top" alt="->">
#{png_nav.toc}
</a>
}
else ''
end
if @make.build.html_top_band?
%{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}>
<tr><td width="20%">
#{button_home}
</td>
<td width="75%" align="center">
#{doc_types}
#{up_button}
#{the_table_close}
<p>}
else ''
end
end
def seg_head_navigation_band(page=:seg)
if @make.build.html_navigation?
if page==:manifest
nxt=(@file.output_dir_structure.by_language_code? \
|| @file.output_dir_structure.by_filetype?) \
? "../html/#{@md.fnb}/toc#{@md.lang_code_insert}#{Sfx[:html]}"
: "toc#{@md.lang_code_insert}#{Sfx[:html]}"
firstseg=%{<a href="#{nxt}" target="_top" alt="->">
#{png_nav.nxt}</a>}
elsif @md.firstseg =~/\S+/
firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->">
#{png_nav.nxt}</a>}
end
else ''
end
if @make.build.html_top_band?
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}>
<tr><td width="20%">
#{button_home(page)}
</td>
<td width="75%" align="center">
#{doc_types(page)}
</td>
<td width="5%" align="right">
#{firstseg}
#{the_table_close}
<p>}
else ''
end
end
def manifest_link(text)
# @file=SiSU_Env::FileOp.new(@md) if @md
%{<font size=2>
<a href="#{@md.file.base_filename.manifest}" target="_top">#{text}</a>
</font>}
end
def concordance_link(text)
if @md.concord_make
%{<font size=2>
<a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
else ''
end
end
def make_scroll_search_form_and_manifest_link
wgt=SiSU_HTML_Format::Widget.new(@md)
%{<td align="center" bgcolor=#{the_color.band2}>
#{the_nav.txt_doc_link}
</td>
}
%{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0">
<tr>
#{wgt.manifest}
#{wgt.search}
</tr></table>}
end
def make_scroll_seg_pdf
seg=''
wgt=SiSU_HTML_Format::Widget.new(@md)
seg=%{<td align="center" bgcolor=#{the_color.band2}>
#{the_nav.txt_toc_link}
</td>
}
%{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor=#{the_color.band2}>
#{wgt.manifest}
#{wgt.search}
</tr></table>}
end
def make_concordance
wgt=SiSU_HTML_Format::Widget.new(@md)
%{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor=#{the_color.band2}>
#{wgt.manifest}
#{wgt.search}
</tr></table>}
end
def head
rdf=SiSU_XML_Tags::RDF.new(@md)
%{<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
#{@md.html_title}
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{rdf.metatag_html}
#{@stylesheet.css_head}
</head>
<body lang="#{@md.opt.lng}">
<a name="top" id="top"></a>}
end
def concordance
if @md.concord_make
%{#{the_margin.css}
<h4 class="toc">
<a href="./#{@md.file.base_filename.html_concordance}">
<i>Concordance</i>
</a>
</h4>
#{table_close}}
else
%{#{the_margin.css}
#{table_close}}
end
end
def links_guide_vertical_open
# @file=SiSU_Env::FileOp.new(@md) if @md
%{
<div id="vertical_links">
<ul id="vertical">
<li class="refbold">
<a href="#{the_url.home}">
#{the_text.txt_hp}
</a>
</li>
<li class="ref">
Quick Ref.:
</li>
<li class="ref">
<a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top">
Manifest
</a>
</li>
<!- quick ref -!>}
end
def links_guide_horizontal_open
# @file=SiSU_Env::FileOp.new(@md) if @md
%{
<div id="horizontal_links">
<ul id="horizontal">
<li class="refbold">
<a href="#{the_url.home}">
#{the_text.txt_hp}
</a>
</li>
<li class="ref">
Quick Ref.:
</li>
<li class="ref">
<a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top">
Manifest
</a>
</li>
<!- quick ref -!>}
end
def links_guide_open(type='horizontal')
(type=='vertical') \
? links_guide_vertical_open
: links_guide_horizontal_open
end
def links_guide_close
insert=''
insert=if @md.sfx_src =~/s?/
link='http://sisudoc.org' #get from defaults
url='sisudoc.org'
name='SiSU electronic documents' #get from defaults
insert= %{
<li class="ref">
<a href="#{link}" alt="#{name}" target="_top">
#{url}
</a>
</li>
</ul>
</div>
}
end
%{ #{insert}
<!- quick ref -!>}
end
def prefix_a
end
def rights
def all
rights=SiSU_HTML_Tune::CleanHTML.new(@md.rights.all).clean_for_html
rights=rights.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ')
%{<p class="small_left">Rights: #{rights}</p>
<p>}
end
self
end
def prefix_b
%{<p class="small_left">Prefix: #{@md.prefix_b}<p />}
end
def scroll_head_title_banner_open
icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : ''
%{#{icon}
#{the_banner.instrument_cover_band_scr}}
end
def seg_head_title_banner_open
icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : ''
%{#{icon}
#{the_banner.instrument_cover_band_seg}}
end
def make_scroll
concord=concordance_link(the_nav.txt_concordance)
%{<table summary="toc scroll" border="0" cellpadding="3" cellspacing="0">
<tr><td align="center" bgcolor="white" border="0">
#{the_nav.txt_doc_link}
</td>
<td align="center" bgcolor="white">
#{concord}
#{the_table_close}}
end
def make_seg
concord=concordance_link(the_nav.txt_concordance)
%{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0">
<tr><td align="center" bgcolor="white">
#{the_nav.txt_toc_link}
</td>
<td align="center" bgcolor="white">
<font size=2>
#{concord}
#{the_table_close}}
end
def manifest #check structure
if not @o_str.dump_or_redirect?
manifest=manifest_link(the_nav.txt_manifest)
%{#{the_margin.txt_3}
#{the_font.paragraph_font_small}
#{manifest}
</font>
#{the_table_close}}
else ''
end
end
def concordance #check structure
concord=concordance_link(the_nav.txt_concordance)
%{#{the_margin.txt_3}
#{the_font.paragraph_font_small}
#{concord}
</font>
#{the_table_close}}
end
def metadata
%{#{the_margin.css}
<h4 class="toc">
<a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
#{the_table_close}}
end
def seg_tail
%{
<div class="main_column">
<p> <p>
<table summary="toc segment tail" bgcolor=#{the_color.band1}>
<tr><td width="20%">
#{the_banner.banner_band}
</td>
<td width="60%">
<center>
#{@tocband_segtoc}
</center>
</td></tr>
</table>
<p> </p>
#{@bits.credits_sisu}
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</div>
</div>
</div>
}
end
def scroll_tail #debug
nav=scroll_head_navigation_band
%{
<div class="main_column">
#{nav}
#{@bits.credits_sisu}
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</div>
}
end
def seg_navigation_tail #this is a bug area, look up and "tidy"
%{
<div class="main_column">
<p> </p>
#{@bits.credits_sisu}
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</div>
</div>
</div>
}
end
end
class HeadSeg < HeadInformation
def initialize(md)
super(md)
end
def dot_control_pre_next
pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
up=@toc
nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"
if nxt=~/sisu_manifest\.html/
@file=SiSU_Env::FileOp.new(@md) if @md
if @file.output_dir_structure.by_language_code? \
or @file.output_dir_structure.by_filetype?
nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
end
end
%{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center">
<tr><td align="left">
<a href="#{pre}" target="_top">
#{png_nav.dot_pre}
</a>
</td>
<td align="center">
<a href="#{up}" target="_top">
#{png_nav.dot_toc}
</a>
</td>
<td align="right">
<a href="#{nxt}" target="_top">
#{png_nav.dot_nxt}
</a>
#{the_table_close}}
end
def dot_control_pre
pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}"
up=@toc
nxt="#{@md.file.base_filename.html_segtoc}"
%{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center">
<tr><td align="left">
<a href="#{pre}" target="_top">
#{png_nav.dot_pre}
</a>
</td>
<td align="center">
<a href="#{up}" target="_top">
#{png_nav.dot_toc}
</a>
</td>
<td align="right">
<a href="#{nxt}" target="_top">
#{png_nav.dot_nxt}
</a>
#{the_table_close}}
end
def toc_nav(f_pre=false,f_nxt=false,use=1)
pre=nxt=''
toc=%{<td align="center" bgcolor=#{the_color.band1}>
<a href="#{@toc}" target="_top">
#{png_nav.toc}
</a>
</td>}
pre=%{<td align="center" bgcolor=#{the_color.band1}>
<a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
#{png_nav.pre}
</a>
</td>} if f_pre==true
nxt=%{<td align="center" bgcolor=#{the_color.band1}>
<a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
#{png_nav.nxt}
</a>
</td>} if f_nxt==true
if nxt =~/sisu_manifest.html/
@file=SiSU_Env::FileOp.new(@md) if @md
if @file.output_dir_structure.by_language_code? \
or @file.output_dir_structure.by_filetype?
nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
end
end
%{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tr>
#{pre}
#{toc}
#{nxt}
<td>
#{the_table_close}}
end
def toc_next2
toc_nav(false,true).dup
end
def toc_pre_next2
toc_nav(true,true).dup
end
def toc_pre2
toc_nav(true,false,2).dup
end
def manifest_link(text)
%{<font size=2>
<a href="#{@md.file.base_filename.manifest}" target="_top">
#{text}
</a>
</font>}
end
def concordance_link(text)
if @md.concord_make
%{<font size=2>
<a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
else ''
end
end
def navigation_table
%{<table summary="navigation segment table" width=#{the_width.table1} border="0" bgcolor="white" cellpadding="0">
<tr><th width="#{@@indent['leve_1']}" align="right">
</td>
<td valign="top">
<font size=2>}
end
def navigation_table1
%{<table summary="navigation segment table1" width=#{the_width.table1} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table1} align="left">
<tr><td valign="top">
<font size="2">}
end
def navigation_table2
%{<table summary="navigation segment table2" width=#{the_width.table2} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table2} align="left">
<tr><td valign="top">
<font size="2">}
end
def credit
%{
<div class="main_column">
#{@bits.credits_sisu}
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</div></div>
}
end
def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner
%{<table summary="segment navigation band with banner" bgcolor=#{the_color.band1} width="100%"><tr>
<td width="20%" align="left">
#{button_home}
</td>
<td width="75%" align="center">
#{doc_types}
</td>
<td width="5%" align="right">
#{segtocband}
</td></tr>
</table>
#{seg_table_top_control}}
end
def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigation_band_bannerless
%{
<div class="main_column">
<table summary="segment navigation band" bgcolor=#{the_color.band1} width="100%"><tr>
<td width="70%" align="center">
#{doc_types}
</td>
<td width="5%" align="right">
#{segtocband}
</td></tr>
</table>
#{seg_table_top_control}
</div>
}
end
def endnote_mark
%{
<p class="center" id="endnotes">
<hr class="endnote" />
</p>}
end
def endnote_section_open
%{
<div class="endnote">
}
end
def endnote_section_close
%{
</div>
} #revisit
end
def head_seg
rdf=SiSU_XML_Tags::RDF.new(@md)
%{<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
#{@seg_name_html[@seg_name_html_tracker]} -
#{@md.html_title}
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
#{rdf.metatag_html}
#{@stylesheet.css_head_seg}
</head>
<body lang="#{@md.opt.lng}">
<a name="top" id="top"></a>}
end
def title_banner(title,subtitle,creator)
%{
<div class="summary">
<p class="tiny">
#{title}
</p>
<p class="tiny">
#{subtitle}
</p>
<p class="tiny">
#{creator}
</p>
<p class="tiny">
copy @
<a href="#{the_url.home}">
#{the_text.txt_home}
</a>
</p>
</div>
}
end
end
class HeadScroll < HeadToc
def initialize(md)
super(md)
end
def toc_owner_details
%{#{the_margin.txt_3}
#{the_font.paragraph_font_small}
<a href="#owner.details">
Owner Details
<font size="1" color="#777777">
</font>
</a>
</font>
#{the_table_close}}
end
end
class FormatTextObject
include SiSU_Parts_HTML
attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url
def initialize(md,t_o)
@md,@t_o=md,t_o
@make=SiSU_Env::ProcessingSettings.new(@md)
if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@headname =t_o[:headname] || nil
@trailer =t_o[:trailer] || nil
@endnote_part_a =t_o[:endnote_part_a] || nil
@endnote_part_b =t_o[:endnote_part_b] || nil
@lnk_url =t_o[:lnk_url] || nil
@lnk_txt =t_o[:lnk_txt] || nil
@format =t_o[:format] || nil
elsif t_o.class.inspect =~/^(?:#<)?SiSU_AO_DocumentStructure/
@dob=t_o if defined? t_o.is
@named=nametags_seg(@dob)
@txt=((defined? t_o.obj) ? t_o.obj : nil)
@ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil)
@headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil)
else
if @md.opt.act[:maintenance][:set]==:on
p t_o.class
p caller
end
end
@headnamed=(@headname ? %{<a id="h#{@headname}"></a>} : nil)
if @txt and not @txt.empty?
@txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')
end
@p_num=ParagraphNumber.new(@md,@ocn)
end
def nametags_scroll(dob)
tags=''
if defined? dob.tags \
and dob.tags.length > 0 # insert tags "hypertargets"
dob.tags.each do |t|
t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier
tags=tags << %{<named id="#{t}" />}
end
end
tags
end
def nametags_seg(dob) #FIX
tags=''
if defined? dob.tags \
and dob.tags.length > 0 # insert tags "hypertargets"
dob.tags.each do |t|
t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier
tags=(t =~/^[0-9.]+$/) \
? tags #check what can be sorted in ao
: (tags << %{<a name="#{t}" ></a>})
end
end
tags
end
def headname #check whether used
hn=if @t_o.is ==:heading \
and not @t_o.name.empty? #determine use
hn=(@t_o.is ==:heading) \
? (%{<a id="h#{@t_o.name}"></a>})
: (%{<a id="#{@t_o.name}"></a>})
else nil
end
hn
end
def endnote_body
%{
<p class="endnote">
#{@txt}
</p>
}
end
def endnote_body_indent
%{
<p class="endnote_indent">
#{@txt}
</p>
}
end
def no_paranum
%{
<div class="substance">
<label class="ocn"> </label>
<p class="norm">
#{@txt}
</p>
</div>
}
end
def para_form_css(tag,attrib) # regular paragraphs shaped here
ul=ulc=''
if tag =~/li/
ul,ulc="<ul>\n ","\n </ul>"
end
%{
<div class="substance">
#{@p_num.ocn_display}
#{ul}<#{tag} class="#{attrib}" #{@p_num.id}>
#{@named}#{@txt}
</#{tag}>#{ulc}
</div>
}
end
def para
para_form_css('p','norm')
end
def block
para_form_css('p','block')
end
def group
para_form_css('p','group')
end
def alt
para_form_css('p','alt')
end
def verse
para_form_css('p','verse')
end
def code
para_form_css('p','code')
end
def center
para_form_css('p','center')
end
def bold
para_form_css('p','bold')
end
def bullet
para_form_css('li','bullet')
end
def table
@txt=if @t_o.obj !~/^<table\s/
table=SiSU_HTML_Shared::TableHTML.new(@t_o) #move, make happen earlier
@txt=table.table.obj
else @txt
end
para_form_css('p','norm')
end
def format(tag,attrib)
para_form_css(tag,attrib)
end
def heading_normal(tag,attrib)
section_break=(tag=~/h[1-5]/) \
? '<br><hr width=90% /><br>'
: ''
%{#{section_break}
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}
#{@named}#{@txt}
</#{tag}>
</div>
}
end
def heading_body
heading_normal('p','norm')
end
def heading_body0
heading_normal('h1','norm')
end
def heading_body1
heading_normal('h1','norm')
end
def heading_body2
heading_normal('h2','norm')
end
def heading_body3
heading_normal('h3','norm')
end
def heading_body4
heading_normal('h4','norm')
end
def heading_body5
heading_normal('h5','norm')
end
def heading_body6
heading_normal('h6','norm')
end
def heading_body7
heading_normal('h7','norm')
end
def title_heading(tag,attrib)
cl=(@make.build.html_minitoc?) \
? 'content'
: 'content0'
%{
<div class="#{cl}">
<#{tag} class="#{attrib}">
#{@named}#{@txt}
</#{tag}>
</div>
}
end
def title_heading0
title_heading('h1','tiny')
end
def title_heading1
title_heading('h1','tiny')
end
def title_heading2
title_heading('h2','tiny')
end
def title_heading3
title_heading('h3','tiny')
end
def title_heading4
''
end
def seg_heading_sub(tag,attrib)
@txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@headnamed}
#{@named}#{@txt}
</#{tag}>
</div>
}
end
def seg_heading4
%{
<div class="substance">
#{@p_num.ocn_display}
<h1 class="norm" #{@p_num.id}>#{@p_num.name}
#{@txt}
</h1>
</div>
}
end
def seg_heading5
seg_heading_sub('p','bold')
end
def seg_heading6
seg_heading_sub('p','bold')
end
def dl #check :trailer
"<dl><b>#{@txt}</b> #{@trailer}</dl>"
end
def table_css_end
'</table>
</p>
</div>'
end
def gsub_body #fix
@txt=case @txt
when /^\((i+|iv|v|vi+|ix|x|xi+)\)/
@txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')
when /^\(?(\d|[a-z])+\)/
@txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')
when /^\s*\d{1,3}\.\s/
@txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')
when /^\s*[A-Z]\.\s/
@txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>')
else @txt
end
end
def bold_para
%{#{the_margin.txt_0}
<p class="bold">
#{@txt}
</p>
#{the_margin.num_css}
#{the_table_close}}
end
def bold_heading
%{<p class="bold">
#{@txt}
</p>
#{the_margin.num_css}
#{the_table_close}}
end
def toc_head_copy_at
%{<p class="center">#{@txt}</p>\n}
end
def center
%{<p class="center">#{@txt}</p>\n}
end
def bold
%{<p class="bold">#{@txt}</p>\n}
end
def center_bold
%{<p class="centerbold">#{@txt}</p>\n}
end
end
class FormatScroll < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
end
class FormatSeg < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408
fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info
%{
<p class="endnote">
#{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}
</p>
}
end
def clean(txt)
txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
end
def subtoc_lev(tag,attrib)
@txt=clean(@txt)
@ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
txt=if @txt \
and @txt =~/<\/?i>|<a\s+name="\S+?">/mi
@txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
else @txt
end
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
gsub(/<a[\s]+name="-\d+"[\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'')
end
%{<#{tag} class="#{attrib}">
<a href="##{@ocn_html_identifier}#{@ocn}"><i>#{txt}</i></a> #{note}
</#{tag}>}
end
def subtoc_lev5
subtoc_lev('h5','subtoc') if @txt
end
def subtoc_lev6
subtoc_lev('h6','subtoc') if @txt
end
def subtoc_lev7
subtoc_lev('h7','subtoc') if @txt
end
def heading_sub(tag,attrib)
@txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@headnamed}
#{@txt}
</#{tag}>
</div>
}
end
def heading5
heading_sub('p','bold')
end
def heading6
heading_sub('p','bold')
end
def heading4
%{
<div class="substance">
#{@p_num.ocn_display}
<h1 class="norm" #{@p_num.id}>#{@p_num.name}
#{@t_o[:format]}
#{@txt}
</h1>
</div>
}
end
def navigation_heading4
%{<table summary="navigation segment heading 4" width=100% bgcolor="#08163f" border="0">
<tr><td align="center">
<p class="bold">
#{@txt}
</p>
#{the_table_close}}
end
def navigation_heading5
%{<p class="bold">
#{@txt}
</p>}
end
def navigation_heading6
%{<p class="bold">
#{@txt}
</p>}
end
def navigation_center
"<center>#{@txt}</center>"
end
end
class FormatToc < FormatTextObject
def initialize(md,txt)
super(md,txt)
end
def links_guide
%{ <li class="doc">
<a href="#{@lnk_url}" target="_top">
#{@lnk_txt}
</a>
</li>
}
end
def lev(tag,attrib)
if @txt
%{<#{tag} class="#{attrib}">
#{@txt}
</#{tag}>
}
else ''
end
end
def lev0 #docinfo
lev('h1','toc')
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 lev7
lev('h7','toc')
end
def strip_endnotes(txt)
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
txt
end
def mini_lev0
@txt=strip_endnotes(@txt)
lev('h1','minitoc')
end
def mini_lev1
@txt=strip_endnotes(@txt)
lev('h1','minitoc')
end
def mini_lev2
@txt=strip_endnotes(@txt)
lev('h2','minitoc')
end
def mini_lev3
@txt=strip_endnotes(@txt)
lev('h3','minitoc')
end
def mini_lev4
@txt=strip_endnotes(@txt)
lev('h4','minitoc')
end
def mini_lev5
@txt=strip_endnotes(@txt)
lev('h5','minitoc')
end
def mini_lev6
@txt=strip_endnotes(@txt)
lev('h6','minitoc')
end
def mini_lev7
@txt=strip_endnotes(@txt)
lev('h7','minitoc')
end
def mini_lev0 #docinfo
lev('h1','minitoc')
end
def mini_tail
%{
<h4 class="minitoc">
<a href="sisu_manifest.html">Manifest (alternative outputs)</a>
</h4>
}
end
def mini_concord_tail
%{
<h4 class="minitoc">
<a href="concordance.html">Concordance (wordlist)</a>
</h4>
<h4 class="minitoc">
<a href="sisu_manifest.html">Manifest (alternative outputs)</a>
</h4>
}
end
end
class FormatStr
def initialize(md,str)
@str=str
end
def center
%{<p class="center">#{@str}</p>\n}
end
def bold
%{<p class="bold">#{@str}</p>\n}
end
def center_bold
%{<p class="centerbold">#{@str}</p>\n}
end
def endnote_body
%{
<p class="endnote">
#{@str}
</p>
}
end
end
end
__END__
|