summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-08-16 21:56:24 (GMT)
committerFred Drake <fdrake@acm.org>2001-08-16 21:56:24 (GMT)
commitcb19976f1abb27dd9b28db2d8dea8802326c94de (patch)
tree2dffcd5091c0e1d54ce41d03185eee1adec81b50 /Doc
parent457c4190f94f4857dbdd081344cd2b48456eac99 (diff)
downloadcpython-cb19976f1abb27dd9b28db2d8dea8802326c94de.zip
cpython-cb19976f1abb27dd9b28db2d8dea8802326c94de.tar.gz
cpython-cb19976f1abb27dd9b28db2d8dea8802326c94de.tar.bz2
fix_font(): Instead of using a long if/elsif cluster, use a bloody
dictionary. Added some entries to the dictionary to fix part of SF bug #451556.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/perl/python.perl39
1 files changed, 16 insertions, 23 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index dabab66..f5363c6 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -1182,33 +1182,26 @@ sub do_cmd_memberlineni{
@col_aligns = ('<td>', '<td>', '<td>', '<td>', '<td>');
+%FontConversions = ('cdata' => 'tt class="cdata"',
+ 'character' => 'tt class="character"',
+ 'class' => 'tt class="class"',
+ 'command' => 'code',
+ 'constant' => 'tt class="constant"',
+ 'exception' => 'tt class="exception"',
+ 'file' => 'tt class="file"',
+ 'filenq' => 'tt class="file"',
+ 'kbd' => 'kbd',
+ 'member' => 'tt class="member"',
+ 'programopt' => 'b',
+ 'textrm' => '',
+ );
+
sub fix_font{
# do a little magic on a font name to get the right behavior in the first
# column of the output table
my $font = @_[0];
- if ($font eq 'textrm') {
- $font = '';
- }
- elsif ($font eq 'file' || $font eq 'filenq') {
- $font = 'tt class="file"';
- }
- elsif ($font eq 'member') {
- $font = 'tt class="member"';
- }
- elsif ($font eq 'class') {
- $font = 'tt class="class"';
- }
- elsif ($font eq 'constant') {
- $font = 'tt class="constant"';
- }
- elsif ($font eq 'kbd') {
- $font = 'kbd';
- }
- elsif ($font eq 'programopt') {
- $font = 'b';
- }
- elsif ($font eq 'exception') {
- $font = 'tt class="exception"';
+ if (defined $FontConversions{$font}) {
+ $font = $FontConversions{$font};
}
return $font;
}