summaryrefslogtreecommitdiffstats
path: root/Doc/perl/python.perl
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-05-15 04:28:37 (GMT)
committerFred Drake <fdrake@acm.org>1998-05-15 04:28:37 (GMT)
commite16f6798ae8936c9198ee214edf110be77c56c20 (patch)
treef018748206c02557d0b7ef4a6e5673d4e376a0e8 /Doc/perl/python.perl
parent532246ef550f0c305a57240932429ba1e6314d30 (diff)
downloadcpython-e16f6798ae8936c9198ee214edf110be77c56c20.zip
cpython-e16f6798ae8936c9198ee214edf110be77c56c20.tar.gz
cpython-e16f6798ae8936c9198ee214edf110be77c56c20.tar.bz2
do_cmd_let(): Simple implementation to allow \let to be used to establish
synonyms for macros. This supports: \let\newname = \oldname \let\newname\oldname This is useful sometimes, and can at least avoid real errors at other times.
Diffstat (limited to 'Doc/perl/python.perl')
-rw-r--r--Doc/perl/python.perl24
1 files changed, 21 insertions, 3 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 536f324..8882b31 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -55,6 +55,24 @@ sub ArabictoRoman {
$D2[$c[2]] . $D1[$c[1]] . $D0[$c[0]];
}
+
+# This is a fairly simple hack; it supports \let when it is used to create
+# (or redefine) a macro to exactly be some other macro: \let\newname=\oldname.
+# Many uses of \let aren't supported.
+#
+sub do_cmd_let{
+ local($_) = @_;
+ my $matched = 0;
+ s/\s*[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
+ if ($matched) {
+ my($new, $old) = ($1, $3);
+ eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
+ print "\ndefining handler for \\$new using \\$old\n";
+ }
+ $_;
+}
+
+
# words typeset in a special way (not in HTML though)
sub do_cmd_ABC{ 'ABC' . @_[0]; }
@@ -84,9 +102,9 @@ sub do_cmd_authoraddress{
$_;
}
-sub do_cmd_developer{ do_cmd_author(@_[0]); }
-sub do_cmd_developers{ do_cmd_author(@_[0]); }
-sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); }
+#sub do_cmd_developer{ do_cmd_author(@_[0]); }
+#sub do_cmd_developers{ do_cmd_author(@_[0]); }
+#sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); }
sub do_cmd_hackscore{
local($_) = @_;