From: Ian Jackson Date: Tue, 17 Apr 2018 13:34:36 +0000 (+0100) Subject: docs/parse-support-md: Correctly handle footnotes for non-leaf sections X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~162 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fa9cb90071dbc9a20b01cc6a88d96ba140545af9;p=xen.git 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 Signed-off-by: Ian Jackson Release-acked-by: Juergen Gross --- diff --git a/docs/parse-support-md b/docs/parse-support-md index bbbb615b1a..218e12baa4 100755 --- a/docs/parse-support-md +++ b/docs/parse-support-md @@ -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 '', $rows; + my $rows = $sectnode->{RealSect}{OwnRows}; + $nextcell = '1; + $nextcell .= '>'; $nextcell .= docref_a $i, $sectnode->{RealSect}; $nextcell .= '[*]'; $nextcell .= '';