Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3be2074

Browse files
committed
Push some table header formatting to the style sheet; this also helps
separate some of the ties between l2hinit.perl and python.perl. Revamp the "title page" construction to allow more flexibility.
1 parent 0154fea commit 3be2074

1 file changed

Lines changed: 97 additions & 15 deletions

File tree

Doc/perl/python.perl

Lines changed: 97 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,6 @@ sub do_cmd_memberlineni{
932932

933933
@col_aligns = ('<td>', '<td>', '<td>', '<td>');
934934

935-
$TABLE_HEADER_BGCOLOR = $NAV_BGCOLOR;
936-
937935
sub fix_font{
938936
# do a little magic on a font name to get the right behavior in the first
939937
# column of the output table
@@ -1010,7 +1008,7 @@ sub do_env_tableii{
10101008
s/\\lineii</\\lineii[$a1|$a2]</g;
10111009
return '<table border align="center" style="border-collapse: collapse">'
10121010
. "\n <thead>"
1013-
. "\n <tr$TABLE_HEADER_BGCOLOR>"
1011+
. "\n <tr class=\"tableheader\">"
10141012
. "\n $th1<b>$h1</b>\&nbsp;</th>"
10151013
. "\n $th2<b>$h2</b>\&nbsp;</th>"
10161014
. "\n </thead>"
@@ -1135,40 +1133,124 @@ sub do_cmd_lineiv{
11351133
. $_;
11361134
}
11371135

1138-
sub do_cmd_maketitle {
1139-
local($_) = @_;
1140-
my $the_title = "\n<div class='titlepage'><center>";
1136+
1137+
# These can be used to control the title page appearance;
1138+
# they need a little bit of documentation.
1139+
#
1140+
# If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the
1141+
# $ICONSERVER directory, or include path information (other than "./"). The
1142+
# default image type will be assumed if an extension is not provided.
1143+
#
1144+
# If specified, the "title page" will contain two colums: one containing the
1145+
# title/author/etc., and the other containing the graphic. Use the other
1146+
# four variables listed here to control specific details of the layout; all
1147+
# are optional.
1148+
#
1149+
# $TITLE_PAGE_GRAPHIC = "my-company-logo";
1150+
# $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%";
1151+
# $TITLE_PAGE_GRAPHIC_WIDTH = 150;
1152+
# $TITLE_PAGE_GRAPHIC_HEIGHT = 150;
1153+
# $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0;
1154+
1155+
sub make_my_titlepage() {
1156+
my $the_title = "";
11411157
if ($t_title) {
11421158
$the_title .= "\n<h1>$t_title</h1>";
1143-
} else { write_warnings("\nThis document has no title."); }
1159+
}
1160+
else {
1161+
write_warnings("\nThis document has no title.");
1162+
}
11441163
if ($t_author) {
11451164
if ($t_authorURL) {
11461165
my $href = translate_commands($t_authorURL);
11471166
$href = make_named_href('author', $href,
11481167
"<b><font size='+2'>$t_author</font></b>");
11491168
$the_title .= "\n<p>$href</p>";
1150-
} else {
1169+
}
1170+
else {
11511171
$the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>");
11521172
}
1153-
} else { write_warnings("\nThere is no author for this document."); }
1173+
}
1174+
else {
1175+
write_warnings("\nThere is no author for this document.");
1176+
}
11541177
if ($t_institute) {
1155-
$the_title .= "\n<p>$t_institute</p>";}
1178+
$the_title .= "\n<p>$t_institute</p>";
1179+
}
11561180
if ($DEVELOPER_ADDRESS) {
1157-
$the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";}
1181+
$the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";
1182+
}
11581183
if ($t_affil) {
1159-
$the_title .= "\n<p><i>$t_affil</i></p>";}
1184+
$the_title .= "\n<p><i>$t_affil</i></p>";
1185+
}
11601186
if ($t_date) {
11611187
$the_title .= "\n<p><strong>$t_date</strong>";
11621188
if ($PYTHON_VERSION) {
1163-
$the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
1189+
$the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";
1190+
}
11641191
$the_title .= "</p>"
11651192
}
11661193
if ($t_address) {
11671194
$the_title .= "\n<p>$t_address</p>";
1168-
} else { $the_title .= "\n<p>"}
1195+
}
1196+
else {
1197+
$the_title .= "\n<p>";
1198+
}
11691199
if ($t_email) {
11701200
$the_title .= "\n<p>$t_email</p>";
1171-
}# else { $the_title .= "</p>" }
1201+
}
1202+
return $the_title;
1203+
}
1204+
1205+
use File::Basename;
1206+
1207+
sub make_my_titlegraphic() {
1208+
my($myname, $mydir, $myext) = fileparse($TITLE_PAGE_GRAPHIC, '\..*');
1209+
chop $mydir;
1210+
if ($mydir eq '.') {
1211+
$mydir = $ICONSERVER;
1212+
}
1213+
$myext = ".$IMAGE_TYPE"
1214+
unless $myext;
1215+
my $graphic = "<td class=\"titlegraphic\"";
1216+
$graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\""
1217+
if ($TITLE_PAGE_GRAPHIC_COLWIDTH);
1218+
$graphic .= "><img";
1219+
$graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\""
1220+
if ($TITLE_PAGE_GRAPHIC_WIDTH);
1221+
$graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\""
1222+
if ($TITLE_PAGE_GRAPHIC_HEIGHT);
1223+
$graphic .= "\n src=\"$mydir/$myname$myext\"></td>\n";
1224+
return $graphic;
1225+
}
1226+
1227+
sub do_cmd_maketitle {
1228+
local($_) = @_;
1229+
my $the_title = "\n<div class=\"titlepage\">";
1230+
if ($TITLE_PAGE_GRAPHIC) {
1231+
if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) {
1232+
$the_title .= ("\n<table border=\"0\" width=\"100%\">"
1233+
. "<tr align=\"right\">\n<td>"
1234+
. make_my_titlepage()
1235+
. "</td>\n"
1236+
. make_my_titlegraphic()
1237+
. "</tr>\n</table>");
1238+
}
1239+
else {
1240+
$the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n"
1241+
. make_my_titlegraphic()
1242+
. "<td>"
1243+
. make_my_titlepage()
1244+
. "</td></tr>\n</table>");
1245+
}
1246+
}
1247+
else {
1248+
$the_title .= ("\n<center>"
1249+
. make_my_titlepage()
1250+
. "\n</center>");
1251+
}
1252+
$the_title .= "\n</div>";
1253+
return $the_title . $_;
11721254
$the_title .= "\n</center></div>";
11731255
return $the_title . $_ ;
11741256
}

0 commit comments

Comments
 (0)