mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									0154fea5f4
								
							
						
					
					
						commit
						3be2074758
					
				
					 1 changed files with 97 additions and 15 deletions
				
			
		|  | @ -932,8 +932,6 @@ sub do_cmd_memberlineni{ | ||||||
| 
 | 
 | ||||||
| @col_aligns = ('<td>', '<td>', '<td>', '<td>'); | @col_aligns = ('<td>', '<td>', '<td>', '<td>'); | ||||||
| 
 | 
 | ||||||
| $TABLE_HEADER_BGCOLOR = $NAV_BGCOLOR; |  | ||||||
| 
 |  | ||||||
| sub fix_font{ | sub fix_font{ | ||||||
|     # do a little magic on a font name to get the right behavior in the first |     # do a little magic on a font name to get the right behavior in the first | ||||||
|     # column of the output table |     # column of the output table | ||||||
|  | @ -1010,7 +1008,7 @@ sub do_env_tableii{ | ||||||
|     s/\\lineii</\\lineii[$a1|$a2]</g; |     s/\\lineii</\\lineii[$a1|$a2]</g; | ||||||
|     return '<table border align="center" style="border-collapse: collapse">' |     return '<table border align="center" style="border-collapse: collapse">' | ||||||
|            . "\n  <thead>" |            . "\n  <thead>" | ||||||
|            . "\n    <tr$TABLE_HEADER_BGCOLOR>" |            . "\n    <tr class=\"tableheader\">" | ||||||
| 	   . "\n      $th1<b>$h1</b>\ </th>" | 	   . "\n      $th1<b>$h1</b>\ </th>" | ||||||
| 	   . "\n      $th2<b>$h2</b>\ </th>" | 	   . "\n      $th2<b>$h2</b>\ </th>" | ||||||
| 	   . "\n    </thead>" | 	   . "\n    </thead>" | ||||||
|  | @ -1135,40 +1133,124 @@ sub do_cmd_lineiv{ | ||||||
| 	   . $_; | 	   . $_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| sub do_cmd_maketitle { | 
 | ||||||
|     local($_) = @_; | # These can be used to control the title page appearance; | ||||||
|     my $the_title = "\n<div class='titlepage'><center>"; | # they need a little bit of documentation. | ||||||
|  | # | ||||||
|  | # If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the | ||||||
|  | # $ICONSERVER directory, or include path information (other than "./").  The | ||||||
|  | # default image type will be assumed if an extension is not provided. | ||||||
|  | # | ||||||
|  | # If specified, the "title page" will contain two colums: one containing the | ||||||
|  | # title/author/etc., and the other containing the graphic.  Use the other | ||||||
|  | # four variables listed here to control specific details of the layout; all | ||||||
|  | # are optional. | ||||||
|  | # | ||||||
|  | # $TITLE_PAGE_GRAPHIC = "my-company-logo"; | ||||||
|  | # $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%"; | ||||||
|  | # $TITLE_PAGE_GRAPHIC_WIDTH = 150; | ||||||
|  | # $TITLE_PAGE_GRAPHIC_HEIGHT = 150; | ||||||
|  | # $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0; | ||||||
|  | 
 | ||||||
|  | sub make_my_titlepage() { | ||||||
|  |     my $the_title = ""; | ||||||
|     if ($t_title) { |     if ($t_title) { | ||||||
| 	$the_title .= "\n<h1>$t_title</h1>"; | 	$the_title .= "\n<h1>$t_title</h1>"; | ||||||
|     } else { write_warnings("\nThis document has no title."); } |     } | ||||||
|  |     else { | ||||||
|  |         write_warnings("\nThis document has no title."); | ||||||
|  |     } | ||||||
|     if ($t_author) { |     if ($t_author) { | ||||||
| 	if ($t_authorURL) { | 	if ($t_authorURL) { | ||||||
| 	    my $href = translate_commands($t_authorURL); | 	    my $href = translate_commands($t_authorURL); | ||||||
| 	    $href = make_named_href('author', $href, | 	    $href = make_named_href('author', $href, | ||||||
| 				    "<b><font size='+2'>$t_author</font></b>"); | 				    "<b><font size='+2'>$t_author</font></b>"); | ||||||
| 	    $the_title .= "\n<p>$href</p>"; | 	    $the_title .= "\n<p>$href</p>"; | ||||||
| 	} else { | 	} | ||||||
|  |         else { | ||||||
| 	    $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>"); | 	    $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>"); | ||||||
| 	} | 	} | ||||||
|     } else { write_warnings("\nThere is no author for this document."); } |     } | ||||||
|  |     else { | ||||||
|  |         write_warnings("\nThere is no author for this document."); | ||||||
|  |     } | ||||||
|     if ($t_institute) { |     if ($t_institute) { | ||||||
|         $the_title .= "\n<p>$t_institute</p>";} |         $the_title .= "\n<p>$t_institute</p>"; | ||||||
|  |     } | ||||||
|     if ($DEVELOPER_ADDRESS) { |     if ($DEVELOPER_ADDRESS) { | ||||||
|         $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";} |         $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>"; | ||||||
|  |     } | ||||||
|     if ($t_affil) { |     if ($t_affil) { | ||||||
| 	$the_title .= "\n<p><i>$t_affil</i></p>";} | 	$the_title .= "\n<p><i>$t_affil</i></p>"; | ||||||
|  |     } | ||||||
|     if ($t_date) { |     if ($t_date) { | ||||||
| 	$the_title .= "\n<p><strong>$t_date</strong>"; | 	$the_title .= "\n<p><strong>$t_date</strong>"; | ||||||
| 	if ($PYTHON_VERSION) { | 	if ($PYTHON_VERSION) { | ||||||
| 	    $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";} | 	    $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>"; | ||||||
|  |         } | ||||||
| 	$the_title .= "</p>" | 	$the_title .= "</p>" | ||||||
|     } |     } | ||||||
|     if ($t_address) { |     if ($t_address) { | ||||||
| 	$the_title .= "\n<p>$t_address</p>"; | 	$the_title .= "\n<p>$t_address</p>"; | ||||||
|     } else { $the_title .= "\n<p>"} |     } | ||||||
|  |     else { | ||||||
|  |         $the_title .= "\n<p>"; | ||||||
|  |     } | ||||||
|     if ($t_email) { |     if ($t_email) { | ||||||
| 	$the_title .= "\n<p>$t_email</p>"; | 	$the_title .= "\n<p>$t_email</p>"; | ||||||
|     }# else { $the_title .= "</p>" } |     } | ||||||
|  |     return $the_title; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | use File::Basename; | ||||||
|  | 
 | ||||||
|  | sub make_my_titlegraphic() { | ||||||
|  |     my($myname, $mydir, $myext) = fileparse($TITLE_PAGE_GRAPHIC, '\..*'); | ||||||
|  |     chop $mydir; | ||||||
|  |     if ($mydir eq '.') { | ||||||
|  |         $mydir = $ICONSERVER; | ||||||
|  |     } | ||||||
|  |     $myext = ".$IMAGE_TYPE" | ||||||
|  |       unless $myext; | ||||||
|  |     my $graphic = "<td class=\"titlegraphic\""; | ||||||
|  |     $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\"" | ||||||
|  |       if ($TITLE_PAGE_GRAPHIC_COLWIDTH); | ||||||
|  |     $graphic .= "><img"; | ||||||
|  |     $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\"" | ||||||
|  |       if ($TITLE_PAGE_GRAPHIC_WIDTH); | ||||||
|  |     $graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\"" | ||||||
|  |       if ($TITLE_PAGE_GRAPHIC_HEIGHT); | ||||||
|  |     $graphic .= "\n  src=\"$mydir/$myname$myext\"></td>\n"; | ||||||
|  |     return $graphic; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | sub do_cmd_maketitle { | ||||||
|  |     local($_) = @_; | ||||||
|  |     my $the_title = "\n<div class=\"titlepage\">"; | ||||||
|  |     if ($TITLE_PAGE_GRAPHIC) { | ||||||
|  |         if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) { | ||||||
|  |             $the_title .= ("\n<table border=\"0\" width=\"100%\">" | ||||||
|  |                            . "<tr align=\"right\">\n<td>" | ||||||
|  |                            . make_my_titlepage() | ||||||
|  |                            . "</td>\n" | ||||||
|  |                            . make_my_titlegraphic() | ||||||
|  |                            . "</tr>\n</table>"); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             $the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n" | ||||||
|  |                            . make_my_titlegraphic() | ||||||
|  |                            . "<td>" | ||||||
|  |                            . make_my_titlepage() | ||||||
|  |                            . "</td></tr>\n</table>"); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         $the_title .= ("\n<center>" | ||||||
|  |                        . make_my_titlepage() | ||||||
|  |                        . "\n</center>"); | ||||||
|  |     } | ||||||
|  |     $the_title .= "\n</div>"; | ||||||
|  |     return $the_title . $_; | ||||||
|     $the_title .= "\n</center></div>"; |     $the_title .= "\n</center></div>"; | ||||||
|     return $the_title . $_ ; |     return $the_title . $_ ; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake