[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] docs/parse-support-md: Correctly handle footnotes for non-leaf sections



commit fa9cb90071dbc9a20b01cc6a88d96ba140545af9
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Tue Apr 17 14:34:36 2018 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon Apr 23 13:58:42 2018 +0100

    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@xxxxxxxxxx>
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 docs/parse-support-md | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

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 '<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>';
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.