mirror of
https://github.com/python/cpython.git
synced 2025-09-23 00:43:12 +00:00
&get_indexsubitem: This now has a chance of working, thanks to:
&do_cmd_setindexsubitem: New function. Set the indexsubitem value from \setindexsubitem{(...)}. &do_env_opcodedesc: By default, don't index byte codes. $INDEX_OPCODES: New flag. If true, index the byte codes. Default is off. Normalize indentation to 4 spaces everywhere. Minor nits.
This commit is contained in:
parent
8842e867af
commit
00dcfb2bc3
1 changed files with 254 additions and 231 deletions
|
@ -22,7 +22,7 @@ sub do_cmd_POSIX{ join('', 'POSIX', @_[0]); }
|
||||||
sub do_cmd_C{ join('', 'C', @_[0]); }
|
sub do_cmd_C{ join('', 'C', @_[0]); }
|
||||||
sub do_cmd_Cpp{ join('', 'C++', @_[0]); }
|
sub do_cmd_Cpp{ join('', 'C++', @_[0]); }
|
||||||
sub do_cmd_EOF{ join('', 'EOF', @_[0]); }
|
sub do_cmd_EOF{ join('', 'EOF', @_[0]); }
|
||||||
sub do_cmd_NULL{ join('', 'NULL', @_[0]); }
|
sub do_cmd_NULL{ join('', '<tt>NULL</tt>', @_[0]); }
|
||||||
|
|
||||||
sub do_cmd_e{ local($_) = @_; '\' . $_; }
|
sub do_cmd_e{ local($_) = @_; '\' . $_; }
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ sub do_cmd_varvars{
|
||||||
|
|
||||||
sub do_cmd_code{
|
sub do_cmd_code{
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
s/$any_next_pair_pr_rx/<code>\2<\/code>/;
|
s/$any_next_pair_pr_rx/<tt>\2<\/tt>/;
|
||||||
$_;
|
$_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +56,12 @@ sub do_cmd_cfunction{ &do_cmd_code(@_); }
|
||||||
sub do_cmd_constant{ &do_cmd_code(@_); }
|
sub do_cmd_constant{ &do_cmd_code(@_); }
|
||||||
sub do_cmd_method{ &do_cmd_code(@_); }
|
sub do_cmd_method{ &do_cmd_code(@_); }
|
||||||
sub do_cmd_email{ &do_cmd_code(@_); }
|
sub do_cmd_email{ &do_cmd_code(@_); }
|
||||||
|
sub do_cmd_program{ &do_cmd_code(@_); }
|
||||||
|
|
||||||
sub do_cmd_url{
|
sub do_cmd_url{
|
||||||
# use the URL as both text and hyperlink
|
# use the URL as both text and hyperlink
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
s/$any_next_pair_pr_rx/<code><a href="\2">\2<\/a><\/code>/;
|
s/$any_next_pair_pr_rx/<tt><a href="\2">\2<\/a><\/tt>/;
|
||||||
$_;
|
$_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,9 +174,7 @@ sub do_cmd_indexiv{
|
||||||
$_);
|
$_);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub do_cmd_ttindex{
|
sub do_cmd_ttindex{ &do_cmd_index(@_); }
|
||||||
&do_cmd_index(@_);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub my_typed_index_helper{
|
sub my_typed_index_helper{
|
||||||
local($word, $_) = @_;
|
local($word, $_) = @_;
|
||||||
|
@ -254,13 +253,12 @@ sub init_myformat{
|
||||||
$any_next_pair_pr_rx_5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
|
$any_next_pair_pr_rx_5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
|
||||||
$any_next_pair_pr_rx_7 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP";
|
$any_next_pair_pr_rx_7 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP";
|
||||||
$any_next_pair_pr_rx_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP";
|
$any_next_pair_pr_rx_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP";
|
||||||
$new_command{"indexsubitem"} = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&init_myformat;
|
&init_myformat;
|
||||||
|
|
||||||
sub get_indexsubitem{
|
sub get_indexsubitem{
|
||||||
local($result) = $new_command{"indexsubitem"};
|
local($result) = $INDEX_SUBITEM;
|
||||||
#print "\nget_indexsubitem ==> $result\n";
|
#print "\nget_indexsubitem ==> $result\n";
|
||||||
$result ? " $result" : '';
|
$result ? " $result" : '';
|
||||||
}
|
}
|
||||||
|
@ -292,21 +290,22 @@ sub do_env_cfuncdesc{
|
||||||
$function_name = "$4";
|
$function_name = "$4";
|
||||||
$arg_list = "$6";
|
$arg_list = "$6";
|
||||||
$idx = &make_str_index_entry($3,
|
$idx = &make_str_index_entry($3,
|
||||||
"<tt>$function_name()</tt>" . &get_indexsubitem);
|
"<tt>$function_name</tt>" . &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
}
|
}
|
||||||
"<dl><dt>$return_type <b>$idx</b>" .
|
"<dl><dt>$return_type <b>$idx</b>"
|
||||||
"(<var>$arg_list</var>)\n<dd>$'\n</dl>"
|
. "(<var>$arg_list</var>)\n<dd>$'\n</dl>"
|
||||||
}
|
}
|
||||||
|
|
||||||
sub do_env_ctypedesc{
|
sub do_env_ctypedesc{
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
local($type_name) = ('');
|
local($type_name) = ('');
|
||||||
local($cfuncdesc_rx) =
|
local($cfuncdesc_rx) = "$next_pair_rx";
|
||||||
"$next_pair_rx";
|
|
||||||
if (/$cfuncdesc_rx/o) {
|
if (/$cfuncdesc_rx/o) {
|
||||||
$type_name = "$2";
|
$type_name = "$2";
|
||||||
$idx = &make_str_index_entry($1,
|
$idx = &make_str_index_entry($1,
|
||||||
"<tt>$type_name</tt>" . &get_indexsubitem);
|
"<tt>$type_name</tt>" . &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
}
|
}
|
||||||
"<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
|
"<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
|
||||||
}
|
}
|
||||||
|
@ -318,10 +317,12 @@ sub do_env_cvardesc{
|
||||||
if (/$cfuncdesc_rx/o) {
|
if (/$cfuncdesc_rx/o) {
|
||||||
$var_type = "$2";
|
$var_type = "$2";
|
||||||
$var_name = "$4";
|
$var_name = "$4";
|
||||||
$idx = &make_str_index_entry($3,"<tt>$var_name</tt>" . &get_indexsubitem);
|
$idx = &make_str_index_entry($3,
|
||||||
|
"<tt>$var_name</tt>" . &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
}
|
}
|
||||||
"<dl><dt>$var_type <b>$idx</b>\n" .
|
"<dl><dt>$var_type <b>$idx</b>\n"
|
||||||
"<dd>$'\n</dl>";
|
. "<dd>$'\n</dl>";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub do_env_funcdesc{
|
sub do_env_funcdesc{
|
||||||
|
@ -332,7 +333,8 @@ sub do_env_funcdesc{
|
||||||
$function_name = "$2";
|
$function_name = "$2";
|
||||||
$arg_list = "$4";
|
$arg_list = "$4";
|
||||||
$idx = &make_str_index_entry($3,
|
$idx = &make_str_index_entry($3,
|
||||||
"<tt>$function_name()</tt>" . &get_indexsubitem);
|
"<tt>$function_name</tt>" . &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
}
|
}
|
||||||
"<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
|
"<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
|
||||||
}
|
}
|
||||||
|
@ -343,11 +345,17 @@ sub do_cmd_funcline{
|
||||||
|
|
||||||
s/$funcdesc_rx//o;
|
s/$funcdesc_rx//o;
|
||||||
local($br_id, $function_name, $arg_list) = ($3, $2, $4);
|
local($br_id, $function_name, $arg_list) = ($3, $2, $4);
|
||||||
local($idx) = &make_str_index_entry($br_id, "<tt>$function_name()</tt>");
|
local($idx) = &make_str_index_entry($br_id, "<tt>$function_name</tt>");
|
||||||
|
|
||||||
"<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
|
"<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Change this flag to index the opcode entries. I don't think it's very
|
||||||
|
# useful to index them, since they're only presented to describe the dis
|
||||||
|
# module.
|
||||||
|
#
|
||||||
|
$INDEX_OPCODES = 0;
|
||||||
|
|
||||||
sub do_env_opcodedesc{
|
sub do_env_opcodedesc{
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
local($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
|
local($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
|
||||||
|
@ -355,9 +363,14 @@ sub do_env_opcodedesc{
|
||||||
if (/$opcodedesc_rx/o) {
|
if (/$opcodedesc_rx/o) {
|
||||||
$opcode_name = "$2";
|
$opcode_name = "$2";
|
||||||
$arg_list = "$4";
|
$arg_list = "$4";
|
||||||
# $idx = &make_str_index_entry($3,
|
if ($INDEX_OPCODES) {
|
||||||
# "<tt>$opcode_name</tt> (byte code instruction)");
|
$idx = &make_str_index_entry($3,
|
||||||
# $idx =~ s/ \(byte code instruction\)//;
|
"<tt>$opcode_name</tt> (byte code instruction)");
|
||||||
|
$idx =~ s/ \(byte code instruction\)//;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$idx = "<tt>$opcode_name</tt>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$stuff = "<dl><dt><b>$idx</b>";
|
$stuff = "<dl><dt><b>$idx</b>";
|
||||||
if ($arg_list) {
|
if ($arg_list) {
|
||||||
|
@ -371,6 +384,7 @@ sub do_env_datadesc{
|
||||||
local($idx) = '';
|
local($idx) = '';
|
||||||
if (/$next_pair_rx/o) {
|
if (/$next_pair_rx/o) {
|
||||||
$idx = &make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
|
$idx = &make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
}
|
}
|
||||||
"<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
|
"<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
|
||||||
}
|
}
|
||||||
|
@ -380,12 +394,16 @@ sub do_cmd_dataline{
|
||||||
|
|
||||||
s/$next_pair_pr_rx//o;
|
s/$next_pair_pr_rx//o;
|
||||||
local($br_id, $data_name) = ($1, $2);
|
local($br_id, $data_name) = ($1, $2);
|
||||||
local($idx) = &make_str_index_entry($br_id, "<tt>$data_name</tt>");
|
local($idx) = &make_str_index_entry($br_id, "<tt>$data_name</tt>"
|
||||||
|
. &get_indexsubitem);
|
||||||
|
$idx =~ s/ \(.*\)//;
|
||||||
|
|
||||||
"<dt><b>$idx</b>\n<dd>" . $_;
|
"<dt><b>$idx</b>\n<dd>" . $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub do_env_excdesc{ &do_env_datadesc(@_); }
|
sub do_env_excdesc{ &do_env_datadesc(@_); }
|
||||||
|
sub do_env_codesample{ &do_env_verbatim(@_); }
|
||||||
|
|
||||||
|
|
||||||
@col_aligns = ("<td>", "<td>", "<td>");
|
@col_aligns = ("<td>", "<td>", "<td>");
|
||||||
|
|
||||||
|
@ -476,7 +494,7 @@ sub do_env_seealso{
|
||||||
sub do_cmd_seemodule{
|
sub do_cmd_seemodule{
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
|
local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
|
||||||
s/$next_pair_pr_rx$any_next_pair_pr_rx3/<p><code><b>\2<\/b><\/code> (\4)<\/p>/;
|
s/$next_pair_pr_rx$any_next_pair_pr_rx3/<p><tt><b>\2<\/b><\/tt> (\4)<\/p>/;
|
||||||
$_;
|
$_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +505,13 @@ sub do_cmd_seetext{
|
||||||
# These are located down here since they screw up fontlock.
|
# These are located down here since they screw up fontlock.
|
||||||
|
|
||||||
sub do_cmd_file{
|
sub do_cmd_file{
|
||||||
|
# This uses a weird HTML construct to adjust the font to be
|
||||||
|
# reasonable match that used in the printed form as much as
|
||||||
|
# possible. The expected behavior is that a browser that doesn't
|
||||||
|
# understand "<font face=...>" markup will use courier (or whatever
|
||||||
|
# the font is for <tt>).
|
||||||
local($_) = @_;
|
local($_) = @_;
|
||||||
s/$any_next_pair_pr_rx/`<code>\2<\/code>'/;
|
s/$any_next_pair_pr_rx/`<tt><font face=sans-serif>\2<\/font><\/tt>'/;
|
||||||
$_;
|
$_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue