texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * util/txixml2texi.pl: skip a comment after <colu


From: Patrice Dumas
Subject: branch master updated: * util/txixml2texi.pl: skip a comment after <columnfractions> as the comment is already in the line attribute.
Date: Sun, 27 Nov 2022 17:43:22 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 7fbc789b48 * util/txixml2texi.pl: skip a comment after 
<columnfractions> as the comment is already in the line attribute.
7fbc789b48 is described below

commit 7fbc789b485be034e40e2e6e011821bf3fd42c41
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 27 23:43:12 2022 +0100

    * util/txixml2texi.pl: skip a comment after <columnfractions> as
    the comment is already in the line attribute.
---
 ChangeLog           |  5 +++++
 util/txixml2texi.pl | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 64b04e66ba..deabaab06a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-27  Patrice Dumas  <pertusus@free.fr>
+
+       * util/txixml2texi.pl: skip a comment after <columnfractions> as
+       the comment is already in the line attribute.
+
 2022-11-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not have
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index 8ff5119a59..2f06d993d1 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -222,6 +222,7 @@ sub skip_until_end($$)
 }
 
 my $eat_space = 0;
+my $skip_comment = 0;
 my @commands_with_args_stack;
 
 while ($reader->read) {
@@ -230,7 +231,7 @@ while ($reader->read) {
   if ($debug) {
     my $args_stack_str = join('|', map {'['.$_->[0].','.$_->[1].']'}
                                         @commands_with_args_stack);
-    printf STDERR "(args: $args_stack_str) (eat_space $eat_space) %d %d %s 
%d", (
+    printf STDERR "(args: $args_stack_str) (eat_space $eat_space) 
(skip_comment $skip_comment) %d %d %s %d", (
           $reader->depth, $reader->nodeType, $reader->name, 
$reader->isEmptyElement);
     my $value = '';
     if ($reader->hasValue()) {
@@ -353,8 +354,17 @@ while ($reader->read) {
         $line =~ s/\x{1F}/\\/g;
         print $line;
       }
-      if ($name eq 'set' or $name eq 'clickstyle') {
+      if ($name eq 'set' or $name eq 'clickstyle' or $name eq 
'columnfractions') {
         skip_until_end($reader, $name);
+        if ($name eq 'columnfractions') {
+          # A comment should already appear in the line attribute, so we skip
+          # a redundant XML comment following the columnfractions closing
+          # element.
+          # start at 2 as there is a -1 right after at the end of
+          # the loop, and another -1 for the next element (possibly
+          # an ignored comment).
+          $skip_comment = 2;
+        }
       }
     } elsif ($arg_elements{$name}) {
       if ($reader->hasAttributes()
@@ -514,11 +524,12 @@ while ($reader->read) {
       $comment =~ s/^ (comment|c)//;
       my $command = $1;
       $comment =~ s/ $//;
-      print "\@${command}$comment";
+      print "\@${command}$comment" unless ($skip_comment);
     }
   } elsif ($reader->nodeType() eq XML_READER_TYPE_DOCUMENT_TYPE) {
     $eat_space = 1;
   }
+  $skip_comment-- if ($skip_comment);
 }
 
 1;



reply via email to

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