summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-03-02 16:05:35 (GMT)
committerFred Drake <fdrake@acm.org>1999-03-02 16:05:35 (GMT)
commit557460cb7a7b266c7b7a27abff26f483e495ffb4 (patch)
treee8bde39742760db914b5074ec2f31abb3aa698b7
parent2383f6dbbc22585279ab54638015a46d29e6d7fd (diff)
downloadcpython-557460cb7a7b266c7b7a27abff26f483e495ffb4.zip
cpython-557460cb7a7b266c7b7a27abff26f483e495ffb4.tar.gz
cpython-557460cb7a7b266c7b7a27abff26f483e495ffb4.tar.bz2
swallow_newline(): Removed function; not really needed. Modified all call
sites. do_cmd_ignorePlatformAnnotation(), do_cmd_platform(), do_cmd_platformof(): New functions to support platform dependency information. process_all_platformofs(): New function to post-process \platformof macros using information collected during the initial pass. process_python_state(): New function. Call all post-processing functions defined in this file to avoid having to have too much knowledge of the internals for this stuff in l2hinit.perl.
-rw-r--r--Doc/perl/python.perl63
1 files changed, 47 insertions, 16 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 73a04ca..26fc3ce 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -23,10 +23,6 @@ sub next_optional_argument{
return $param;
}
-sub swallow_newline{
- s/[\n]?//o;
-}
-
# 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.
@@ -251,6 +247,44 @@ sub do_cmd_versionchanged{
return "\nChanged in version $release.\n" . $_;
}
+#
+# These function handle platform dependency tracking. The first two implement
+# the \platform and \platformof macros, and the third is called at the end of
+# processing to fill in references to the platform of a module.
+#
+sub do_cmd_platform{
+ local($_) = @_;
+ my $platform = next_argument();
+ $ModulePlatforms{$THIS_MODULE} = $platform;
+ $platform = "Macintosh"
+ if $platform eq "Mac";
+ return "\n<p class=availability>Availability: <span"
+ . "\n class=platform>$platform</span>.</p>\n" . $_;
+}
+
+sub do_cmd_platformof{
+ local($_) = @_;
+ next_optional_argument();
+ my $module = next_argument();
+ return "<tex2html-platformof><$module>" . $_;
+}
+
+$IGNORE_PLATFORM_ANNOTATION = '';
+sub do_cmd_ignorePlatformAnnotation{
+ local($_) = @_;
+ $IGNORE_PLATFORM_ANNOTATION = next_argument();
+ return $_;
+}
+
+sub process_all_platformofs{
+ while (/<tex2html-platformof><([^>]+)>/) {
+ my $match = $&;
+ my $module = $1;
+ s/$match/<span\n class=platform>$ModulePlatforms{$module}<\/span>/;
+ }
+}
+
+
# file and samp are at the end of this file since they screw up fontlock.
# index commands
@@ -338,7 +372,6 @@ sub new_link_info{
sub do_cmd_index{
local($_) = @_;
my $str = next_argument();
-# swallow_newline();
#
my($name,$aname,$ahref) = new_link_info();
add_index_entry("$str", $ahref);
@@ -398,14 +431,12 @@ sub do_cmd_ttindex{
local($_) = @_;
my $str = next_argument();
my $entry = $str . get_indexsubitem();
-# swallow_newline();
return make_index_entry($entry) . $_;
}
sub my_typed_index_helper{
local($word,$_) = @_;
my $str = next_argument();
-# swallow_newline();
#
my($name,$aname,$ahref) = new_link_info();
add_index_entry("$str $word", $ahref);
@@ -421,7 +452,6 @@ sub do_cmd_obindex{ return my_typed_index_helper('object', @_); }
sub my_parword_index_helper{
local($word,$_) = @_;
my $str = next_argument();
-# swallow_newline();
return make_index_entry("$str ($word)") . $_;
}
@@ -444,6 +474,7 @@ sub make_mod_index_entry{
return "$aname$anchor_invisible_mark</a>";
}
+
$THIS_MODULE = '';
$THIS_CLASS = '';
@@ -460,14 +491,12 @@ sub define_module{
sub my_module_index_helper{
local($word, $_) = @_;
my $name = next_argument();
-# swallow_newline();
return define_module($word, $name) . $_;
}
sub ref_module_index_helper{
local($word, $_) = @_;
my $str = next_argument();
-# swallow_newline();
$word = "$word " if $word;
return make_mod_index_entry("<tt>$str</tt> (${word}module)", 'REF') . $_;
}
@@ -476,7 +505,6 @@ sub do_cmd_bifuncindex{
local($_) = @_;
my $str = next_argument();
my $fname = "<tt>$str()</tt>";
-# swallow_newline();
return make_index_entry("$fname (built-in function)") . $_;
}
@@ -989,18 +1017,17 @@ sub do_cmd_modulesynopsis{
local($_) = @_;
my $st = get_synopsis_table(get_chapter_id());
$st->set_synopsis($THIS_MODULE, next_argument());
-# swallow_newline();
return $_;
}
sub do_cmd_localmoduletable{
local($_) = @_;
my $chap = get_chapter_id();
- return "<tex2htmllocalmoduletable><$chap>\\tableofchildlinks[off]" . $_;
+ return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
}
sub process_all_localmoduletables{
- while (/<tex2htmllocalmoduletable><(\d+)>/) {
+ while (/<tex2html-localmoduletable><(\d+)>/) {
my $match = $&;
my $chap = $1;
my $st = get_synopsis_table($chap);
@@ -1008,6 +1035,10 @@ sub process_all_localmoduletables{
s/$match/$data/;
}
}
+sub process_python_state{
+ process_all_localmoduletables();
+ process_all_platformofs();
+}
#
@@ -1048,7 +1079,6 @@ sub do_cmd_seetext{
sub do_env_definitions{
local($_) = @_;
-# swallow_newline();
return "<dl class=definitions>$_</dl>\n";
}
@@ -1056,7 +1086,6 @@ sub do_cmd_term{
local($_) = @_;
my $term = next_argument();
my($name,$aname,$ahref) = new_link_info();
-# swallow_newline();
# could easily add an index entry here...
return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
}
@@ -1068,6 +1097,8 @@ declaremodule # [] # {} # {}
memberline # [] # {}
methodline # [] # {} # {}
modulesynopsis # {}
+platform # {}
+platformof # [] # {}
samp # {}
setindexsubitem # {}
withsubitem # {} # {}