[xen master] docs/parse-support-md: Break out find_current_sectnode

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] docs/parse-support-md: Break out find_current_sectnode

patchbot
commit b27ea926564a91c6517a501e5c19ee95998dbca8
Author:     Ian Jackson <[hidden email]>
AuthorDate: Wed Apr 25 13:47:31 2018 +0100
Commit:     Ian Jackson <[hidden email]>
CommitDate: Wed Apr 25 14:26:11 2018 +0100

    docs/parse-support-md: Break out find_current_sectnode
   
    We are going to want to add a call site for this.
   
    No functional change.
   
    Signed-off-by: Ian Jackson <[hidden email]>
    Release-acked-by: Juergen Gross <[hidden email]>
---
 docs/parse-support-md | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/docs/parse-support-md b/docs/parse-support-md
index 218e12baa4..f0b4c2503f 100755
--- a/docs/parse-support-md
+++ b/docs/parse-support-md
@@ -67,6 +67,32 @@ our $had_feature;
 
 #---------- parsing ----------
 
+sub find_current_sectnode () {
+    die unless @insections;
+
+    my $sectnode;
+    my $realsect;
+    foreach my $s (@insections) {
+        my $sectlist = $sectnode
+            ? $sectnode->{Children} : $toplevel_sectlist;
+        my $key = $s->{Key};
+        $realsect = $s if $s->{Anchor};
+        tie %$sectlist, 'Tie::IxHash' unless tied %$sectlist;
+#print STDERR "FIND_CURRENT_SECTNODE ", Dumper($s);
+        $sectlist->{$key} //=
+            {
+             Children => new_sectlist(),
+             Headline => $s->{Headline},
+             Key => $key,
+             RealSect => $realsect,
+             HasCaveat => [],
+            };
+        $sectnode = $sectlist->{$key};
+    }
+    die unless $sectnode;
+    return $sectnode;
+}
+
 sub ri_Header {
     my ($c) = @_;
     my ($level, $infos, $hl) = @$c;
@@ -100,29 +126,9 @@ sub ri_Para {
 
 sub parse_feature_entry ($) {
     my ($value) = @_;
-    die unless @insections;
 
     $had_feature = 1;
-
-    my $sectnode;
-    my $realsect;
-    foreach my $s (@insections) {
-        my $sectlist = $sectnode
-            ? $sectnode->{Children} : $toplevel_sectlist;
-        my $key = $s->{Key};
-        $realsect = $s if $s->{Anchor};
-        tie %$sectlist, 'Tie::IxHash' unless tied %$sectlist;
-#print STDERR "PARSE_FEATURE_ENTRY ", Dumper($s);
-        $sectlist->{$key} //=
-            {
-             Children => new_sectlist(),
-             Headline => $s->{Headline},
-             Key => $key,
-             RealSect => $realsect,
-            };
-        $sectnode = $sectlist->{$key};
-    }
-    die unless $sectnode;
+    my $sectnode = find_current_sectnode();
     $sectnode->{Status}[$version_index] = $value;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog