diff options
author | Karl Williamson <khw@cpan.org> | 2020-11-04 04:51:39 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-11-05 21:18:31 -0700 |
commit | c7a2af9823712e6314f4951a85e02d8933912d61 (patch) | |
tree | 0d31e0465bab7263c5e75caf0976858d444f3e27 /autodoc.pl | |
parent | 0213d97dcda976f02ce257031d969e7964ecc545 (diff) | |
download | perl-c7a2af9823712e6314f4951a85e02d8933912d61.tar.gz |
autodoc.pl: Extract code into a fcn
This is in preparation for it to be called from a 2nd place
Diffstat (limited to 'autodoc.pl')
-rw-r--r-- | autodoc.pl | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/autodoc.pl b/autodoc.pl index 27c5b9e606..c25cdb18a3 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -1095,6 +1095,33 @@ sub parse_config_h { } } +sub format_pod_indexes($) { + my $entries_ref = shift; + + # Output the X<> references to the names, packed since they don't get + # displayed, but not too many per line so that when someone is editing the + # file, it doesn't run on + + my $text =""; + my $line_length = 0; + for my $name (sort dictionary_order $entries_ref->@*) { + my $entry = "X<$name>"; + my $entry_length = length $entry; + + # Don't loop forever if we have a verrry long name, and don't go too + # far to the right. + if ($line_length > 0 && $line_length + $entry_length > $max_width) { + $text .= "\n"; + $line_length = 0; + } + + $text .= $entry; + $line_length += $entry_length; + } + + return $text; +} + sub docout ($$$) { # output the docs for one function my($fh, $element_name, $docref) = @_; @@ -1382,29 +1409,13 @@ sub construct_missings_section { EOT } - $text .= "\n"; + $text .= "\n" . format_pod_indexes($missings_ref); # Sort the elements. my @missings = sort dictionary_order $missings_ref->@*; - # Output the X<> references to the names, packed since they don't get - # displayed, but not too many per line so that when someone is editing the - # file, it doesn't run on - my $line_length = 0; - for my $missing (sort dictionary_order @missings) { - my $entry = "X<$missing>"; - my $entry_length = length $entry; - # Don't loop forever if we have a verrry long name, and don't go too - # far to the right. - if ($line_length > 0 && $line_length + $entry_length > $max_width) { - $text .= "\n"; - $line_length = 0; - } - - $text .= $entry; - $line_length += $entry_length; - } + $text .= "\n"; use integer; |