diff options
author | Fred Drake <fdrake@acm.org> | 1998-01-12 23:15:29 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-01-12 23:15:29 (GMT) |
commit | 1af9e79708128dd681e5be44da518eba2ade3905 (patch) | |
tree | 698ba5e6777b46f38729e5a826d7aa81aa800c1f /Doc/myformat.perl | |
parent | 023f87fbf80a25cac104b6019a37af388ab7a523 (diff) | |
download | cpython-1af9e79708128dd681e5be44da518eba2ade3905.zip cpython-1af9e79708128dd681e5be44da518eba2ade3905.tar.gz cpython-1af9e79708128dd681e5be44da518eba2ade3905.tar.bz2 |
Added support for \funcline{} and \dataline{}.
For all generated cases of <strong>...</strong> (from this module), change to
<b>...</b>. This, from me? This is entirely to reduce the size of the
generated markup, which is more of an issue than semantics here. Since
<strong> isn't very meaningful anyway, this should be good.
Diffstat (limited to 'Doc/myformat.perl')
-rw-r--r-- | Doc/myformat.perl | 85 |
1 files changed, 61 insertions, 24 deletions
diff --git a/Doc/myformat.perl b/Doc/myformat.perl index 4eaea06..261cd05 100644 --- a/Doc/myformat.perl +++ b/Doc/myformat.perl @@ -79,7 +79,7 @@ sub do_cmd_emph{ sub do_cmd_strong{ local($_) = @_; - s/$any_next_pair_pr_rx/<strong>\2<\/strong>/; + s/$any_next_pair_pr_rx/<b>\2<\/b>/; $_; } @@ -182,16 +182,24 @@ sub do_cmd_refstmodindex{ &my_module_index_helper('standard', @_, 'REF'); } sub do_cmd_nodename{ &do_cmd_label(@_); } -sub do_cmd_mytableofcontents{ local($_) = @_; $_; } +sub do_cmd_mytableofcontents{ @_[0]; } -$any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C"; -$any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C"; -$any_next_pair_rx7 = "$O(\\d+)$C([\\s\\S]*)$O\\7$C"; -$any_next_pair_rx9 = "$O(\\d+)$C([\\s\\S]*)$O\\9$C"; -$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_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP"; -$new_command{"indexsubitem"} = ""; +sub init_myformat{ + # XXX need some way for this to be called after &initialise; + # <<2>>...<<2>> + $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C"; + $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C"; + $any_next_pair_rx7 = "$O(\\d+)$C([\\s\\S]*)$O\\7$C"; + $any_next_pair_rx9 = "$O(\\d+)$C([\\s\\S]*)$O\\9$C"; + # <#2#>...<#2#> + $any_next_pair_pr_rx_3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$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_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP"; + $new_command{"indexsubitem"} = ""; +} + +&init_myformat; sub get_indexsubitem{ local($result) = $new_command{"indexsubitem"}; @@ -227,7 +235,7 @@ sub do_env_cfuncdesc{ "<tt>$function_name</tt>" . &get_indexsubitem); } $* = 0; - "<dl><dt>$return_type <strong>$idx</strong>" . + "<dl><dt>$return_type <b>$idx</b>" . "(<var>$arg_list</var>)\n<dd>$'\n</dl>" } @@ -243,14 +251,13 @@ sub do_env_ctypedesc{ "<tt>$type_name</tt>" . &get_indexsubitem); } $* = 0; - "<dl><dt><strong>$idx</strong>\n<dd>$'\n</dl>" + "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>" } sub do_env_cvardesc{ local($_) = @_; local($var_type,$var_name,$idx) = ('', '', ''); - local($cfuncdesc_rx) = - "$next_pair_rx$any_next_pair_rx3"; + local($cfuncdesc_rx) = "$next_pair_rx$any_next_pair_rx3"; $* = 1; if (/$cfuncdesc_rx/o) { $var_type = "$2"; @@ -258,7 +265,7 @@ sub do_env_cvardesc{ $idx = &make_str_index_entry($3,"<tt>$var_name</tt>" . &get_indexsubitem); } $* = 0; - "<dl><dt>$var_type <strong>$idx</strong>\n" . + "<dl><dt>$var_type <b>$idx</b>\n" . "<dd>$'\n</dl>"; } @@ -274,7 +281,18 @@ sub do_env_funcdesc{ "<tt>$function_name</tt>" . &get_indexsubitem); } $* = 0; - "<dl><dt><strong>$idx</strong> (<var>$arg_list</var>)\n<dd>$'\n</dl>"; + "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>"; +} + +sub do_cmd_funcline{ + local($_) = @_; + local($funcdesc_rx) = "$next_pair_pr_rx$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP"; + + s/$funcdesc_rx//o; + local($br_id, $function_name, $arg_list) = ($3, $2, $4); + local($idx) = &make_str_index_entry($br_id, "<tt>$function_name</tt>"); + + "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_; } sub do_env_opcodedesc{ @@ -289,7 +307,7 @@ sub do_env_opcodedesc{ "<tt>$opcode_name</tt> (byte code instruction)"); } $* = 0; - $stuff = "<dl><dt><strong>$idx</strong>"; + $stuff = "<dl><dt><b>$idx</b>"; if ($arg_list) { $stuff = "$stuff <var>$arg_list</var>"; } @@ -307,8 +325,17 @@ sub do_env_datadesc{ "<tt>$data_name</tt>" . &get_indexsubitem); } $* = 0; - "<dl><dt><strong>$idx</strong>" . - "\n<dd>$'\n</dl>" + "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>" +} + +sub do_cmd_dataline{ + local($_) = @_; + + s/$next_pair_pr_rx//o; + local($br_id, $data_name) = ($1, $2); + local($idx) = &make_str_index_entry($br_id, "<tt>$data_name</tt>"); + + "<dt><b>$idx</b>\n<dd>" . $_; } sub do_env_excdesc{ &do_env_datadesc(@_); } @@ -318,9 +345,18 @@ sub do_env_excdesc{ &do_env_datadesc(@_); } sub setup_column_alignments{ local($_) = @_; local($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_); + local($th1,$th2,$th3) = ('<th>', '<th>', '<th>'); $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>"); $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>"); $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>"); + # return the aligned header start tags; only used for \begin{tableiii?} + $th1 = (($a1 eq "l") ? "<th align=left>" + : ($a1 eq "r" ? "<th align=right>" : "<th>")); + $th2 = (($a2 eq "l") ? "<th align=left>" + : ($a2 eq "r" ? "<th align=right>" : "<th>")); + $th3 = (($a3 eq "l") ? "<th align=left>" + : ($a3 eq "r" ? "<th align=right>" : "<th>")); + ($th1, $th2, $th3); } sub do_env_tableii{ @@ -330,13 +366,13 @@ sub do_env_tableii{ "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"; $* = 1; if (/$tableiii_rx/o) { - &setup_column_alignments($2); $font = $4; $h1 = $6; $h2 = $8; } + local($th1,$th2,$th3) = &setup_column_alignments($2); $globals{"lineifont"} = $font; - "<table border align=center>\n <tr><th>$h1</th>\n <th>$h2</th>$'\n" + "<table border align=center>\n <tr>$th1$h1</th>\n $th2$h2</th>$'\n" . "</table>"; } @@ -355,20 +391,21 @@ sub do_cmd_lineii{ sub do_env_tableiii{ local($_) = @_; local($font,$h1,$h2,$h3) = ('', '', '', ''); + local($tableiii_rx) = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7" . "$any_next_pair_rx9"; $* = 1; if (/$tableiii_rx/o) { - &setup_column_alignments($2); $font = $4; $h1 = $6; $h2 = $8; $h3 = $10; } + local($th1,$th2,$th3) = &setup_column_alignments($2); $globals{"lineifont"} = $font; - "<table border align=center>\n <tr><th>$h1</th>\n <th>$h2</th>" - . "\n <th>$h3</th>$'\n" + "<table border align=center>\n <tr>$th1$h1</th>\n $th2$h2</th>" + . "\n $th3$h3</th>$'\n" . "</table>"; } |