diff options
author | Fred Drake <fdrake@acm.org> | 1998-04-17 20:04:09 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-04-17 20:04:09 (GMT) |
commit | 5ccf330e4c0912bbca921fd5ac76aa89c0e195b9 (patch) | |
tree | eb79272ad3987df18c0ab2d9a3720867f60eb239 | |
parent | 4f6d6e487c786d1591c0e26e671322e470bdd244 (diff) | |
download | cpython-5ccf330e4c0912bbca921fd5ac76aa89c0e195b9.zip cpython-5ccf330e4c0912bbca921fd5ac76aa89c0e195b9.tar.gz cpython-5ccf330e4c0912bbca921fd5ac76aa89c0e195b9.tar.bz2 |
next_optional_argument(): Don't include the square brackets in the return
value.
ArabictoRoman(): Acquired function from Robert Donohue
<donahue@cfassp48.harvard.edu>; might be useful someday, and I don't
want to figure it out again!
-rw-r--r-- | Doc/perl/python.perl | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index b7c425a..08ed98a 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -24,7 +24,7 @@ sub next_argument{ sub next_optional_argument{ my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?"); - s/$rx/$param=$1;''/eo; + s/$rx/$param=$2;''/eo; $param; } @@ -32,6 +32,29 @@ sub swallow_newline{ s/[\n]?//o; } +sub ArabictoRoman { + # Written by Robert Donohue <donahue@cfassp48.harvard.edu>, + # fixed by Fred Drake <fdrake@acm.org>, + # kept around in case it becomes useful. + my $a = @_; + my($b,@c,$i); + my(@D0,@D1,@D2); + + @D0 = ("", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"); + @D1 = ("", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"); + @D2 = ("", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"); + + $b = $a; + $i = 0; + while($b > 0) { + $c[$i] = ($b % 10); + $b -= ($b % 10); + $b /= 10; + $i++; + } + $D2[$c[2]] . $D1[$c[1]] . $D0[$c[0]]; +} + # words typeset in a special way (not in HTML though) sub do_cmd_ABC{ 'ABC' . @_[0]; } @@ -600,6 +623,21 @@ sub do_env_memberdesc{ } +sub do_cmd_memberline{ + local($_) = @_; + my $class = next_optional_argument(); + my($member,$br_id) = next_argument_id(); + $class = $THIS_CLASS + unless $class; + my $extra = ''; + $extra = " ($class_name attribute)" + if (!($class eq '')); + my $idx = make_str_index_entry($br_id, "<tt>$member</tt>$extra"); + $idx =~ s/ \(.*\)//; + $idx =~ s/\(\)//; + "<dt><b>$idx</b><dd>" . $_; +} + sub do_env_memberdescni{ local($_) = @_; next_optional_argument(); @@ -608,6 +646,13 @@ sub do_env_memberdescni{ } +sub do_cmd_memberlineni{ + local($_) = @_; + next_optional_argument(); + my $member = next_argument(); + "<dt><b>$member</b><dd>" . $_; +} + @col_aligns = ("<td>", "<td>", "<td>"); sub setup_column_alignments{ |