Kaydet (Commit) 557460cb authored tarafından Fred Drake's avatar Fred Drake

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.
üst 2383f6db
...@@ -23,10 +23,6 @@ sub next_optional_argument{ ...@@ -23,10 +23,6 @@ sub next_optional_argument{
return $param; return $param;
} }
sub swallow_newline{
s/[\n]?//o;
}
# This is a fairly simple hack; it supports \let when it is used to create # 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. # (or redefine) a macro to exactly be some other macro: \let\newname=\oldname.
...@@ -251,6 +247,44 @@ sub do_cmd_versionchanged{ ...@@ -251,6 +247,44 @@ sub do_cmd_versionchanged{
return "\nChanged in version $release.\n" . $_; 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. # file and samp are at the end of this file since they screw up fontlock.
# index commands # index commands
...@@ -338,7 +372,6 @@ sub new_link_info{ ...@@ -338,7 +372,6 @@ sub new_link_info{
sub do_cmd_index{ sub do_cmd_index{
local($_) = @_; local($_) = @_;
my $str = next_argument(); my $str = next_argument();
# swallow_newline();
# #
my($name,$aname,$ahref) = new_link_info(); my($name,$aname,$ahref) = new_link_info();
add_index_entry("$str", $ahref); add_index_entry("$str", $ahref);
...@@ -398,14 +431,12 @@ sub do_cmd_ttindex{ ...@@ -398,14 +431,12 @@ sub do_cmd_ttindex{
local($_) = @_; local($_) = @_;
my $str = next_argument(); my $str = next_argument();
my $entry = $str . get_indexsubitem(); my $entry = $str . get_indexsubitem();
# swallow_newline();
return make_index_entry($entry) . $_; return make_index_entry($entry) . $_;
} }
sub my_typed_index_helper{ sub my_typed_index_helper{
local($word,$_) = @_; local($word,$_) = @_;
my $str = next_argument(); my $str = next_argument();
# swallow_newline();
# #
my($name,$aname,$ahref) = new_link_info(); my($name,$aname,$ahref) = new_link_info();
add_index_entry("$str $word", $ahref); add_index_entry("$str $word", $ahref);
...@@ -421,7 +452,6 @@ sub do_cmd_obindex{ return my_typed_index_helper('object', @_); } ...@@ -421,7 +452,6 @@ sub do_cmd_obindex{ return my_typed_index_helper('object', @_); }
sub my_parword_index_helper{ sub my_parword_index_helper{
local($word,$_) = @_; local($word,$_) = @_;
my $str = next_argument(); my $str = next_argument();
# swallow_newline();
return make_index_entry("$str ($word)") . $_; return make_index_entry("$str ($word)") . $_;
} }
...@@ -444,6 +474,7 @@ sub make_mod_index_entry{ ...@@ -444,6 +474,7 @@ sub make_mod_index_entry{
return "$aname$anchor_invisible_mark</a>"; return "$aname$anchor_invisible_mark</a>";
} }
$THIS_MODULE = ''; $THIS_MODULE = '';
$THIS_CLASS = ''; $THIS_CLASS = '';
...@@ -460,14 +491,12 @@ sub define_module{ ...@@ -460,14 +491,12 @@ sub define_module{
sub my_module_index_helper{ sub my_module_index_helper{
local($word, $_) = @_; local($word, $_) = @_;
my $name = next_argument(); my $name = next_argument();
# swallow_newline();
return define_module($word, $name) . $_; return define_module($word, $name) . $_;
} }
sub ref_module_index_helper{ sub ref_module_index_helper{
local($word, $_) = @_; local($word, $_) = @_;
my $str = next_argument(); my $str = next_argument();
# swallow_newline();
$word = "$word " if $word; $word = "$word " if $word;
return make_mod_index_entry("<tt>$str</tt> (${word}module)", 'REF') . $_; return make_mod_index_entry("<tt>$str</tt> (${word}module)", 'REF') . $_;
} }
...@@ -476,7 +505,6 @@ sub do_cmd_bifuncindex{ ...@@ -476,7 +505,6 @@ sub do_cmd_bifuncindex{
local($_) = @_; local($_) = @_;
my $str = next_argument(); my $str = next_argument();
my $fname = "<tt>$str()</tt>"; my $fname = "<tt>$str()</tt>";
# swallow_newline();
return make_index_entry("$fname (built-in function)") . $_; return make_index_entry("$fname (built-in function)") . $_;
} }
...@@ -989,18 +1017,17 @@ sub do_cmd_modulesynopsis{ ...@@ -989,18 +1017,17 @@ sub do_cmd_modulesynopsis{
local($_) = @_; local($_) = @_;
my $st = get_synopsis_table(get_chapter_id()); my $st = get_synopsis_table(get_chapter_id());
$st->set_synopsis($THIS_MODULE, next_argument()); $st->set_synopsis($THIS_MODULE, next_argument());
# swallow_newline();
return $_; return $_;
} }
sub do_cmd_localmoduletable{ sub do_cmd_localmoduletable{
local($_) = @_; local($_) = @_;
my $chap = get_chapter_id(); my $chap = get_chapter_id();
return "<tex2htmllocalmoduletable><$chap>\\tableofchildlinks[off]" . $_; return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
} }
sub process_all_localmoduletables{ sub process_all_localmoduletables{
while (/<tex2htmllocalmoduletable><(\d+)>/) { while (/<tex2html-localmoduletable><(\d+)>/) {
my $match = $&; my $match = $&;
my $chap = $1; my $chap = $1;
my $st = get_synopsis_table($chap); my $st = get_synopsis_table($chap);
...@@ -1008,6 +1035,10 @@ sub process_all_localmoduletables{ ...@@ -1008,6 +1035,10 @@ sub process_all_localmoduletables{
s/$match/$data/; s/$match/$data/;
} }
} }
sub process_python_state{
process_all_localmoduletables();
process_all_platformofs();
}
# #
...@@ -1048,7 +1079,6 @@ sub do_cmd_seetext{ ...@@ -1048,7 +1079,6 @@ sub do_cmd_seetext{
sub do_env_definitions{ sub do_env_definitions{
local($_) = @_; local($_) = @_;
# swallow_newline();
return "<dl class=definitions>$_</dl>\n"; return "<dl class=definitions>$_</dl>\n";
} }
...@@ -1056,7 +1086,6 @@ sub do_cmd_term{ ...@@ -1056,7 +1086,6 @@ sub do_cmd_term{
local($_) = @_; local($_) = @_;
my $term = next_argument(); my $term = next_argument();
my($name,$aname,$ahref) = new_link_info(); my($name,$aname,$ahref) = new_link_info();
# swallow_newline();
# could easily add an index entry here... # could easily add an index entry here...
return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_; return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
} }
...@@ -1068,6 +1097,8 @@ declaremodule # [] # {} # {} ...@@ -1068,6 +1097,8 @@ declaremodule # [] # {} # {}
memberline # [] # {} memberline # [] # {}
methodline # [] # {} # {} methodline # [] # {} # {}
modulesynopsis # {} modulesynopsis # {}
platform # {}
platformof # [] # {}
samp # {} samp # {}
setindexsubitem # {} setindexsubitem # {}
withsubitem # {} # {} withsubitem # {} # {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment