-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autodoc: Handle apidoc continuation lines #22373
Conversation
For consistency with all your other "Combine API entries" pull requests, I believe that the changes to autodoc.pl itself (de6c30e) should go into a separate pull request. |
The Subject line for this p.r. is slightly misleading. Last month, in this commit:
... you grouped these API functions together:
Can you briefly note why they should not go into the section discussed in this pull request? (I concede that that would make this section very large.) |
autodoc.pl
Outdated
# Count lines easier | ||
my $get_next_line = sub { $line_num++; return <$fh> }; | ||
# Count lines easier and handle apidoc continuation lines | ||
my $get_next_line = sub { my $contents = <$fh>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we wrap this after the {
and indent the sub body the normal amount instead of half a screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to preserve pre-existing style, but sure. Now done
autodoc.pl
Outdated
/$1/x) | ||
{ | ||
my $next = <$fh>; | ||
last unless defined $next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a no warnings 'exiting';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comment doesn't make sense to me. The last
is exiting a loop. The code works as-is without warnings being generated
They do different things. The functions described here are like The pvf functions concatenate a formatted string, so like |
With this commit, it is now possible to have continuation lines on apidoc lines in the source
I included both so as to prove that the change worked, as it was never exercised before. But I'm changing this PR to be the prerequisite for the |
return unless defined $contents; | ||
|
||
$line_num++; | ||
while ($contents =~ s/ ^ ( =for \ apidoc .*) \s* \\ \n /$1/x) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows only a single space between =for
and apidoc
, but the match in the loop below allows 1 or multiple.
This line should remove the \n
but you also chomp below.
It might be good to allow extra whitespace between the \\
and the newline to avoid trailing whitespace looking like it should continue to a person reading the code, while autodoc.pl
doesn't treat it as one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These points have made me close this request, and integrate the relevant portions into some commits in #22377
With this commit, it is now possible to have continuation lines on apidoc lines in the source