This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
html.macro
204 lines (170 loc) · 6.6 KB
/
html.macro
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
%CASE[0]
$Id: macro,v 1.2 2000/02/05 23:07:35 root Exp root $
Macros used to maintain http://www.perlpress.com
Copyright (c) Mark Summerfield 1999-2000. All Rights Reserved.
These macros may be used/distributed/modified under the GPL.
The bulk of their work has now been pushed into macroutil.pl, except for the
menus which should be extracted out but haven't got round to doing so yet.
%END_CASE
%REQUIRE[/home/mark/lib/macroutil.pl]
%DEFINE_VARIABLE MENU_OUROBOURUS_UPDATE [2000/07/31]
%DEFINE_VARIABLE MENU_PERLMODULE_UPDATE [2002/05/26]
%DEFINE_VARIABLE MENU_PERLPROGRAM_UPDATE [2001/05/26]
%DEFINE_VARIABLE MENU_PERLARTICLE_UPDATE [2000/10/20]
%DEFINE_VARIABLE MENU_PERLEXPERIMENT_UPDATE [2000/02/11]
%DEFINE_VARIABLE MENU_PERLANTIQUES_UPDATE [2000/00/00]
%DEFINE_VARIABLE MENU_NOBLINK_UPDATE [2000/01/01]
%DEFINE_VARIABLE MENU_NOBLINK_LINUX_UPDATE [2000/01/01]
%DEFINE_VARIABLE MENU_NOBLINK_MAC_UPDATE [2000/01/01]
%DEFINE_VARIABLE MENU_NOBLINK_WIN_UPDATE [2000/01/01]
%DEFINE_VARIABLE MENU_OUROBOURUS_UPDATE [2000/07/31]
%DEFINE NOPATENTS[<a href="http://petition.eurolinux.org"><img src="/images/nopatent.gif" /></a>]
%DEFINE DOCTYPE_HTML[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">]
%DEFINE DOCTYPE[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]
%DEFINE_SCRIPT STYLESHEET
my $root = relpath ;
qq{<link href="${root}style.css" rel="stylesheet" type="text/css" />}
%END_DEFINE
%DEFINE_SCRIPT BANNER
'';
# qq{
# <!--VirtualAvenueBanner-->
# <a id="TOP" name="TOP" /><!--#exec cgi="/cgi-bin/log.cgi" -->
# }
%END_DEFINE
%DEFINE_SCRIPT _ROOT[relpath]
%DEFINE_SCRIPT PAGETOP
qq{<a href="#TOP">} .
image( relpath . "images/top.gif", 'Top' ) .
'</a>'
%END_DEFINE
%DEFINE_SCRIPT HOME_AND_TOP
my $root = relpath ;
qq{<a href="#TOP">} .
image( "${root}images/top.gif", 'Top' ) .
'</a>' .
qq{<a href="${root}index.html">} .
image( "${root}images/home.gif", 'Home' ) .
'</a>' ;
%END_DEFINE
%DEFINE_SCRIPT IMAGE
image( relpath . "images/$Param[0]", $Param[1] )
%END_DEFINE
%DEFINE_SCRIPT NEW
# Only puts `new' images if they haven't expired.
my $date = shift @Param ;
$date = $Var{$date} unless $date =~ /^\d\d\d\d\D\d\d?\D\d\d?$/ ;
imageif( relpath . "images/new.gif", $date, 'New' ) ;
%END_DEFINE
%DEFINE_SCRIPT UPDATED
# Only puts `updated' images if they haven't expired.
my $date = shift @Param ;
$date = $Var{$date} unless $date =~ /^\d\d\d\d\D\d\d?\D\d\d?$/ ;
imageif( relpath . "images/updated.gif", $date, 'Updated' ) ;
%END_DEFINE
%DEFINE_SCRIPT BODY
if ( abspath =~ /python/ ) {
return qq{<body bgcolor="white">};
}
my $image = relpath . "images/perlpress-tile.gif" ;
my $size = lc html_imgsize( $image ) || '' ;
$size =~ s/(\d+)/"$1"/go ;
qq{<body bgcolor="white" background="$image" ${size} alt="Tile Image">} ;
%END_DEFINE
%DEFINE_SCRIPT COPYRIGHT
'<h6>' . copyright('<a href="mailto:summer@perlpress.com">PerlPress</a>') . '</h6>'
%END_DEFINE
%DEFINE_SCRIPT FRONTPAGECOPYRIGHT
'<h6>' . copyright('<a href="mailto:summer@perlpress.com">PerlPress</a>') .
qq{<br />We respect your <a href="privacy.html">privacy</a>.</h6>}
%END_DEFINE
%DEFINE EMAIL
<a href="mailto:summer@perlpress.com">summer@perlpress.com</a>
%END_DEFINE
%DEFINE_SCRIPT MAINMENU
my %item = (
perlmodule => [ 0, "perl/modules.html", "Perl Modules" ],
perlprogram => [ 1, "perl/programs.html", "Perl Programs" ],
perlarticle => [ 2, "perl/articles.html", "Articles" ],
noblink => [ 3, "noblink/index.html", "NoBlink" ],
python => [ 4, "python/index.html", "Python" ],
perlexperiment => [ 5, "perl/experiment.html", "Perl Experiments" ],
perlantiques => [ 6, "perl/antiques.html", "Perl Antiques" ],
) ;
my $thisitem = shift @Param ;
my $root = relpath ;
my $menu = qq{<ul class="navigate">\n} ;
if( $thisitem ne 'main' ) {
$menu .= qq{<li><a href="${root}index.html">} .
image( "${root}images/home.gif", 'Home' ) . "</a></li>\n" ;
}
foreach my $item ( sort { $item{$a}[0] <=> $item{$b}[0] } keys %item ) {
my $date = $Var{"MENU_\U${item}_UPDATE"} ;
if( $item eq $thisitem ) {
$menu .= qq{<li style="text-color:lightgrey">$item{$item}[2]} .
imageif( "${root}images/updated.gif", $date, 'Updated' ) .
"</li>\n" ;
}
else {
my $path = $root;
$path = '' if $item{$item}[1] =~ m,^http://,;
$menu .= qq{<li><a href="${path}$item{$item}[1]">} .
qq{$item{$item}[2]</a>} .
imageif( "${root}images/updated.gif", $date, 'Updated' ) .
"</li>\n" ;
}
}
$menu .= "</ul>\n" ;
%END_DEFINE
%DEFINE_SCRIPT NOBLINKMENU
my %item = (
linux => [ 0, "noblink/linux.html", "Linux NoBlink" ],
mac => [ 1, "noblink/mac.html", "Mac NoBlink" ],
win => [ 2, "noblink/win.html", "Win NoBlink" ],
) ;
my $thisitem = shift @Param ;
my $root = relpath ;
my $menu = qq{<ul class="navigate">\n} ;
if( $thisitem ne 'main' ) {
$menu .= qq{<li><a href="${root}index.html">} .
image( "${root}images/home.gif", 'Home' ) . "</a></li>\n" ;
}
if( $thisitem ne 'noblinkhome' ) {
$menu .= qq{<li><a href="${root}noblink/index.html">NoBlink Home</a>} .
imageif( "${root}images/updated.gif", $Var{'MENU_NOBLINK_UPDATE'}, 'Updated' ) .
"</li>\n" ;
}
foreach my $item ( sort { $item{$a}[0] <=> $item{$b}[0] } keys %item ) {
my $date = $Var{"MENU_NOBLINK_\U${item}_UPDATE"} ;
if( $item eq $thisitem ) {
$menu .= qq{<li style="text-color:lightgrey">$item{$item}[2]} .
imageif( "${root}images/updated.gif", $date, 'Updated' ) .
"</li>\n" ;
}
else {
$menu .= qq{<li><a href="${root}$item{$item}[1]">} .
qq{$item{$item}[2]</a>} .
imageif( "${root}images/updated.gif", $date, 'Updated' ) .
"</li>\n" ;
}
}
$menu .= "</ul>\n" ;
%END_DEFINE
%DEFINE_SCRIPT OCOPYRIGHT
'<h6>' .
copyright('<a href="mailto:mark@perlpress.com">Mark Summerfield</a>', 2000) .
'</h6>'
%END_DEFINE
%DEFINE_SCRIPT OFRONTPAGECOPYRIGHT
'<h6>' .
copyright('<a href="mailto:mark@python.com">Mark Summerfield</a>', 2000) .
qq{<br />I respect your <a href="privacy.html">privacy</a>.</h6>}
%END_DEFINE
%DEFINE_SCRIPT OLOGO
my $image = relpath . "images/ourobourus-logo.gif" ;
my $size = lc html_imgsize( $image ) || '' ;
$size =~ s/(\d+)/"$1"/go ;
qq{<p style="text-align:center;">} .
qq{<a href="/"><img border="0" src="/images/ourobourus-logo.gif"} .
qq{ $size alt="ourobourus"></a></p>}
%END_DEFINE