texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Wed, 1 May 2024 09:36:42 -0400 (EDT)

branch: master
commit a3adcfdd2fdf30dfe985f87b74110695f72c8cc4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed May 1 15:16:01 2024 +0200

    Change in comments, minor changes in code.
---
 ChangeLog                            | 4 ++++
 tp/Texinfo/XS/parsetexi/close.c      | 9 ++++++---
 tp/Texinfo/XS/parsetexi/end_line.c   | 4 ++--
 tp/Texinfo/XS/parsetexi/multitable.c | 7 +++++++
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d6d4903f5..c82859935d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-05-01  Patrice Dumas  <pertusus@free.fr>
+
+       Change in comments, minor changes in code.
+
 2024-04-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Converter.pm (_id_to_filename), tp/ext/epub3.pm
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 3ef1515b36..8e6dad58d9 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -302,12 +302,15 @@ close_command_cleanup (ELEMENT *current)
                                      pop_element_from_contents (before_item));
             }
 
-          /* Now if the ET_before_item is empty, remove it. */
+          /* Now if the ET_before_item is empty, remove it.  Note that the
+             some before_item content could also have been reparented in
+             gather_previous_item */
           if (is_container_empty (before_item)
               && before_item->source_mark_list.number == 0)
             {
-              destroy_element (remove_from_contents (current,
-                                                have_leading_spaces ? 1 : 0));
+              ELEMENT *removed = remove_from_contents (current,
+                                                have_leading_spaces ? 1 : 0);
+              destroy_element (removed);
             }
           else /* Non-empty ET_before_item */
             {
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 6f5bde8062..eb1bb6f6b2 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1713,8 +1713,8 @@ end_line_misc_line (ELEMENT *current)
 
           if (source_mark)
             {
-              /* this is in order to keep source marks that are within a
-                removed element.  For the XS parser it is also easier to
+              /* keep the elements, also keeping source marks that are within
+                removed elements.  For the XS parser it is also easier to
                 manage the source mark memory which can stay associated
                 to the element. */
               source_mark->element = pop_element_from_contents (current);
diff --git a/tp/Texinfo/XS/parsetexi/multitable.c 
b/tp/Texinfo/XS/parsetexi/multitable.c
index 0e1950c210..f86d64085a 100644
--- a/tp/Texinfo/XS/parsetexi/multitable.c
+++ b/tp/Texinfo/XS/parsetexi/multitable.c
@@ -14,6 +14,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
+#include <stdio.h>
 
 #include "tree_types.h"
 #include "tree.h"
@@ -63,6 +64,7 @@ gather_previous_item (ELEMENT *current, enum command_id 
next_command)
   if (last_contents_child(current)
       && last_contents_child(current)->type == ET_before_item)
     {
+      /* before_item before the first @item, nothing to do for now */
       if (next_command == CM_itemx)
         line_error ("@itemx should not begin @%s", command_name 
(current->cmd));
       return;
@@ -126,6 +128,8 @@ gather_previous_item (ELEMENT *current, enum command_id 
next_command)
            if (e->type == ET_before_item
                || e->type == ET_table_entry)
              {
+          /* register the before_item if we reached it in order to
+             to reparent some before_item content to the first item */
                if (e->type == ET_before_item)
                  before_item = e;
                term_begin = i + 1;
@@ -142,6 +146,9 @@ gather_previous_item (ELEMENT *current, enum command_id 
next_command)
       remove_slice_from_contents (current, term_begin, begin);
       if (before_item)
         {
+          /* TODO debug message?
+          fprintf (stderr, "REPARENT before_item content\n");
+           */
           /* Reparent any trailing index entries in the before_item to the
              beginning of table term. */
           while (before_item->contents.number > 0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]