diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 8eb46186df5..36f0f151af7 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -159,7 +159,9 @@ sub do_cmd_dfn{ sub do_cmd_emph{ return use_italics(@_); } sub do_cmd_file{ - return use_wrappers(@_[0], '"', '"'); } + return use_wrappers(@_[0], '', ''); } +sub do_cmd_filenq{ + return use_wrappers(@_[0], '', ''); } sub do_cmd_samp{ return use_wrappers(@_[0], '"', '"'); } sub do_cmd_kbd{ @@ -789,6 +791,19 @@ sub get_th{ return $r; } +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'; + } + return $font; +} + sub setup_column_alignments{ local($_) = @_; my($a1,$a2,$a3,$a4) = split(/[|]/,$_); @@ -804,56 +819,60 @@ sub setup_column_alignments{ sub do_env_tableii{ local($_) = @_; my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); - my $font = next_argument(); + my $font = fix_font(next_argument()); my $h1 = next_argument(); my $h2 = next_argument(); - $font = '' - if ($font eq 'textrm'); + s/[\s\n]+//; $globals{'lineifont'} = $font; - return '' - . "\n " - . "\n $th1$h1" - . "\n $th2$h2" - . "\n" - . "\n" + return '
' + . "\n " + . "\n " + . "\n $th1$h1" + . "\n $th2$h2" + . "\n " + . "\n " . $_ - . "\n
"; + . "\n " + . "\n"; } sub do_cmd_lineii{ local($_) = @_; my $c1 = next_argument(); my $c2 = next_argument(); + s/[\s\n]+//; my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); if ($font) { $sfont = "<$font>"; $efont = ""; + $efont =~ s/ .*>/>/; } my($c1align,$c2align) = @col_aligns[0,1]; - return "$c1align$sfont$c1$efont\n" - . " $c2align$c2\ " + return "\n $c1align$sfont$c1$efont\n" + . " $c2align$c2\ " . $_; } sub do_env_tableiii{ local($_) = @_; my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); - my $font = next_argument(); + my $font = fix_font(next_argument()); my $h1 = next_argument(); my $h2 = next_argument(); my $h3 = next_argument(); - $font = '' - if ($font eq 'textrm'); + s/[\s\n]+//; $globals{'lineifont'} = $font; - return '' - . "\n " - . "\n $th1$h1" - . "\n $th2$h2" - . "\n $th3$h3" - . "\n" - . "\n" + return '
' + . "\n " + . "\n " + . "\n $th1$h1" + . "\n $th2$h2" + . "\n $th3$h3" + . "\n " + . "\n " . $_ - . "\n
"; + . "\n " + . "\n"; } sub do_cmd_lineiii{ @@ -861,39 +880,42 @@ sub do_cmd_lineiii{ my $c1 = next_argument(); my $c2 = next_argument(); my $c3 = next_argument(); + s/[\s\n]+//; my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); if ($font) { $sfont = "<$font>"; $efont = ""; + $efont =~ s/ .*>/>/; } my($c1align,$c2align,$c3align) = @col_aligns[0,1,2]; - return "$c1align$sfont$c1$efont\n" - . " $c2align$c2\n" - . " $c3align$c3\ " + return "\n $c1align$sfont$c1$efont\n" + . " $c2align$c2\n" + . " $c3align$c3\ " . $_; } sub do_env_tableiv{ local($_) = @_; my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); - my $font = next_argument(); + my $font = fix_font(next_argument()); my $h1 = next_argument(); my $h2 = next_argument(); my $h3 = next_argument(); my $h4 = next_argument(); - $font = '' - if ($font eq 'textrm'); + s/[\s\n]+//; $globals{'lineifont'} = $font; - return '' - . "\n " - . "\n $th1$h1" - . "\n $th2$h2" - . "\n $th3$h3" - . "\n $th4$h4" - . "\n" - . "\n" + return '
' + . "\n " + . "\n " + . "\n $th1$h1" + . "\n $th2$h2" + . "\n $th3$h3" + . "\n $th4$h4" + . "\n " + . "\n " . $_ - . "\n
"; + . "\n " + . "\n"; } sub do_cmd_lineiv{ @@ -902,16 +924,18 @@ sub do_cmd_lineiv{ my $c2 = next_argument(); my $c3 = next_argument(); my $c4 = next_argument(); + s/[\s\n]+//; my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); if ($font) { $sfont = "<$font>"; $efont = ""; + $efont =~ s/ .*>/>/; } my($c1align,$c2align,$c3align,$c4align) = @col_aligns; - return "$c1align$sfont$c1$efont\n" - . " $c2align$c2\n" - . " $c3align$c3\n" - . " $c4align$c4\ " + return "\n $c1align$sfont$c1$efont\n" + . " $c2align$c2\n" + . " $c3align$c3\n" + . " $c4align$c4\ " . $_; }