docs/parse-support-md: Do caveats properly (!)
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 25 Apr 2018 12:48:27 +0000 (13:48 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 25 Apr 2018 13:26:18 +0000 (14:26 +0100)
Each document has its own objects in @insections.  Only the first
RealSect encountered ends up in the main $toplevel_sectlist tree.

This means that trying to unify the Caveats information for all
version in the RealSect (the $insection) does not work.  The caveats
for all versions that aren't the first one where this section was seen
end up in the @insections array during parsing of that version, but
not recorded in the main tree.

The result was that footnotes would only appear in the output for
versions which were the most recent version where that feature row or
category appeared.  The other footnotes would be lost.

Instead, store HasCaveat in the sectnode.  That means ri_Para needs to
find the sectnode.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
docs/parse-support-md

index f0b4c2503fd9d2e42b29f46b4dcb675fa7afeda3..1c82f563c9d655d47bae7742d403ba16ab40a0ed 100755 (executable)
@@ -33,8 +33,8 @@ our $toplevel_sectlist = new_sectlist();
 # $sectlist->{KEY}{Status}[VI] = absent or markdown content
 # $sectlist->{KEY}{Children} = a further $sectlist
 # $sectlist->{KEY}{Key} = KEY
+# $sectlist->{KEY}{HasCaveat}[VI] = trueish iff other in a Para
 # $sectlist->{KEY}{RealSect} = containing real section in @insections, so
-# $sectlist->{KEY}{RealSect}{HasCaveat}[VI] = trueish iff other in a Para
 # $sectlist->{KEY}{RealSect}{HasDescription} = VI for some Emph in Para
 # $sectlist->{KEY}{RealSect}{Anchor} = value for < id="" > in the pandoc html
 # A $sectnode represents a single section from the original markdown
@@ -58,7 +58,6 @@ our @insections;
 # $insections[]{Headline} = markdown content
 # these next are only defined for real sections, not Status elements
 # $insections[]{Anchor} = string
-# $insections[]{HasCaveat} = array, $sectlist->{HasCaveat} will refer to this
 # $insections[]{HasDescription} VI, likewise
 
 our $had_unknown;
@@ -106,7 +105,6 @@ sub ri_Header {
          Key => $id,
          Anchor => $id,
          Headline => $hl,
-         HasCaveat => [],
          HasDescription => undef,
         };
 #print STDERR Dumper(\@insections);
@@ -116,9 +114,12 @@ sub ri_Header {
 sub ri_Para {
     return unless @insections;
     my $insection = $insections[$#insections];
+#    print STDERR "ri_Para $version_index $had_feature ".
+#        $insection->{HasCaveat}." $insection->{Key}\n";
 
     if ($had_feature) {
-        $insection->{HasCaveat}[$version_index] = 1;
+        my $sectnode = find_current_sectnode();
+        $sectnode->{HasCaveat}[$version_index] = 1;
     } else {
         $insection->{HasDescription} //= $version_index;
     }
@@ -397,7 +398,7 @@ sub write_output_row ($) {
         my $nextcell = '';
         if (!defined $colspan) { # first row of this RealSect
             $colspan= ' colspan="2"';
-            if ($sectnode->{RealSect}{HasCaveat}[$i] && $st
+            if ($sectnode->{HasCaveat}[$i] && $st
                 && $sectnode->{RealSect}{Anchor}) {
                 my $rows = $sectnode->{RealSect}{OwnRows};
                 $nextcell = '<td';