Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce0e175

Browse files
committed
&do_cmd_url,
&do_cmd_email: Adjust to use a font similar to that used in the printed representation. &my_module_index_helper: Change to be only used for defining markup. Don't prepend an <A NAME=...> to the result; use the containing page as the module target for the index. &ref_module_index_helper: New function. Used only for references to modules described elsewhere. Generate the right target. &init_myformat: Set the anchor_mark to an empty string; this avoids junky "&#160;"'s in the text, which could really screw up vertical spacing when that's all that's in a paragraph. &do_cmd_seemodule: Insert markup to jump right to the referred-to module.
1 parent 026d962 commit ce0e175

1 file changed

Lines changed: 40 additions & 11 deletions

File tree

Doc/myformat.perl

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,18 @@ sub do_cmd_code{
5858
sub do_cmd_email{ &do_cmd_code(@_); }
5959
sub do_cmd_program{ &do_cmd_code(@_); }
6060

61+
sub do_cmd_email{
62+
local($_) = @_;
63+
s/$any_next_pair_pr_rx/<tt><font face=sans-serif>\2<\/font><\/tt>/;
64+
$_;
65+
}
66+
6167
sub do_cmd_url{
6268
# use the URL as both text and hyperlink
6369
local($_) = @_;
64-
s/$any_next_pair_pr_rx/<tt><a href="\2">\2<\/a><\/tt>/;
65-
$_;
70+
s/$any_next_pair_pr_rx//;
71+
local($url) = $2;
72+
"<tt><font face=sans-serif><a href=\"$url\">$url</a></font></tt>" . $_;
6673
}
6774

6875
sub do_cmd_manpage{
@@ -225,24 +232,36 @@ sub make_mod_index_entry{
225232
}
226233

227234
sub my_module_index_helper{
228-
local($word, $_, $define) = @_;
235+
local($word, $_) = @_;
236+
s/$next_pair_pr_rx[\n]*//o;
237+
local($br_id, $str) = ($1, $2);
238+
local($section_tag) = join('', @curr_sec_id);
239+
&make_mod_index_entry("SECTION$section_tag",
240+
"<tt>$str</tt> ($word module)", 'DEF');
241+
$_;
242+
}
243+
244+
sub ref_module_index_helper{
245+
local($word, $_) = @_;
229246
s/$next_pair_pr_rx//o;
230247
local($br_id, $str) = ($1, $2);
231-
&make_mod_index_entry($br_id, "<tt>$str</tt> ($word module)",
232-
$define) . $_;
248+
&make_mod_index_entry($br_id, "<tt>$str</tt> ($word module)", 'REF') . $_;
233249
}
234250

235251
sub do_cmd_bifuncindex{ &my_parword_index_helper('built-in function', @_); }
236-
sub do_cmd_bimodindex{ &my_module_index_helper('built-in', @_, 'DEF'); }
237-
sub do_cmd_stmodindex{ &my_module_index_helper('standard', @_, 'DEF'); }
252+
sub do_cmd_bimodindex{ &my_module_index_helper('built-in', @_); }
253+
sub do_cmd_stmodindex{ &my_module_index_helper('standard', @_); }
238254

239-
sub do_cmd_refbimodindex{ &my_module_index_helper('built-in', @_, 'REF'); }
240-
sub do_cmd_refstmodindex{ &my_module_index_helper('standard', @_, 'REF'); }
255+
# these should be adjusted a bit....
256+
sub do_cmd_refbimodindex{ &ref_module_index_helper('built-in', @_); }
257+
sub do_cmd_refstmodindex{ &ref_module_index_helper('standard', @_); }
241258

242259
sub do_cmd_nodename{ &do_cmd_label(@_); }
243260

244261
sub init_myformat{
245262
# XXX need some way for this to be called after &initialise;
263+
$anchor_mark = '';
264+
$icons{'anchor_mark'} = '';
246265
# <<2>>...<<2>>
247266
$any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
248267
$any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
@@ -526,10 +545,20 @@ sub do_env_seealso{
526545
}
527546

528547
sub do_cmd_seemodule{
548+
# Insert the right magic to jump to the module definition. This should
549+
# work most of the time, at least for repeat builds....
529550
local($_) = @_;
530551
local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
531-
s/$next_pair_pr_rx$any_next_pair_pr_rx3/<p><tt><b>\2<\/b><\/tt> (\4)<\/p>/;
532-
$_;
552+
s/$next_pair_pr_rx$any_next_pair_pr_rx3//;
553+
local($module,$text,$node,$key) = ($2, $4, '', "module$2");
554+
$key =~ s/_//g;
555+
# $node = $external_labels{$key} unless
556+
# ($node = $ref_files{$key});
557+
$node = $key;
558+
print "seemodule $module: $node#$key\n";
559+
"<p>Module <tt><b><a href=\"$node#$key\">$module</a></b></tt>"
560+
. "&nbsp;&nbsp;&nbsp;($text)</p>"
561+
. $_;
533562
}
534563

535564
sub do_cmd_seetext{

0 commit comments

Comments
 (0)