Skip to content

Commit

Permalink
autodoc: Handle apidoc continuation lines
Browse files Browse the repository at this point in the history
With this commit, it is now possible to have continuation lines on
apidoc lines in the source
  • Loading branch information
khwilliamson committed Jul 17, 2024
1 parent 66788e8 commit 73dd2c5
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions autodoc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,26 @@ ($$)

my $file_is_C = $file =~ / \. [ch] $ /x;

# 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>;
return unless defined $contents;

$line_num++;
while ($contents =~ s/ ^ ( =for \ apidoc .*) \s* \\ \n /$1/x) {
my $next = <$fh>;
last unless defined $next;
chomp $contents;

$line_num++;
$contents .= $next;
}

# Read the file
while ($in = $get_next_line->()) {
last unless defined $in;
return $contents;
};

# Read the file
while (defined ($in = $get_next_line->())) {
next unless ( $in =~ / ^ =for [ ]+ apidoc /x
# =head1 lines only have effect in C files
|| ($file_is_C && $in =~ /^=head1/));
Expand Down

0 comments on commit 73dd2c5

Please sign in to comment.