docs/parse-support-md: Correctly handle footnotes for non-leaf sections

Non-leaf sections with footnotes must have a row of their own, for
just that section, because footnotes only appear if there is status
information.

In that case, the footnote applies to only the rows for that section
in the markdown document, ie that RealSect.

And of course for a leaf section that is true too.

So for footnoes we always want to use a rowspan of the number of
Status elements in the section.  So (i) calculate this in
count_rows_sectlist and (ii) use it, instead of the total number of
rows including all the subsections', when writing out the footnote
ref.

This bug has been present in this script since the beginning.

Also, while we're here, suppress the rowspan if it would be 1.

Reported-by: Lars Kurth <lars.kurth@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Ian Jackson authored and Ian Jackson committed 2018-04-23 13:58:42 +01:00
1 parent 5e77896ddc
commit fa9cb90071
1 file changed
+10 -3
+10 -3
View File
@@ -296,7 +296,11 @@ sub count_rows_sectlist ($);
sub count_rows_sectnode ($) {
my ($sectnode) = @_;
my $rows = 0;
$rows++ if $sectnode->{Status};
$sectnode->{RealSect}{OwnRows} //= 0;
if ($sectnode->{Status}) {
$rows++;
$sectnode->{RealSect}{OwnRows}++;
}
$rows += count_rows_sectlist $sectnode->{Children};
$sectnode->{Rows} = $rows;
$sectnode->{RealSect}{Rows} = $rows;
@@ -306,6 +310,7 @@ sub count_rows_sectnode ($) {
# Now we have
# $sectnode->{Rows}
# $sectnode->{RealSect}{Rows}
# $sectnode->{RealSect}{OwnRows}
sub count_rows_sectlist ($) {
my ($sectlist) = @_;
@@ -388,8 +393,10 @@ sub write_output_row ($) {
$colspan= ' colspan="2"';
if ($sectnode->{RealSect}{HasCaveat}[$i] && $st
&& $sectnode->{RealSect}{Anchor}) {
my $rows = $sectnode->{RealSect}{Rows};
$nextcell = sprintf '<td rowspan=%d>', $rows;
my $rows = $sectnode->{RealSect}{OwnRows};
$nextcell = '<td';
$nextcell .= sprintf ' rowspan=%d', $rows if $rows>1;
$nextcell .= '>';
$nextcell .= docref_a $i, $sectnode->{RealSect};
$nextcell .= '[*]</a>';
$nextcell .= '</td>';
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.