texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * util/txixml2texi.pl: output spaces explicitly.


From: Patrice Dumas
Subject: branch master updated: * util/txixml2texi.pl: output spaces explicitly. Output user-defined index entry command name.
Date: Sat, 01 Oct 2022 06:17:48 -0400

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 9c65d36a8b * util/txixml2texi.pl: output spaces explicitly.  Output 
user-defined index entry command name.
9c65d36a8b is described below

commit 9c65d36a8b88540366f87d58b3eaeb66cc95fe49
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 1 12:17:37 2022 +0200

    * util/txixml2texi.pl: output spaces explicitly.  Output user-defined
    index entry command name.
---
 ChangeLog           |  5 +++++
 util/txixml2texi.pl | 26 ++++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 949949d2ed..beee1a61ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-01  Patrice Dumas  <pertusus@free.fr>
+
+       * util/txixml2texi.pl: output spaces explicitly.  Output user-defined
+       index entry command name.
+
 2022-10-01  Patrice Dumas  <pertusus@free.fr>
 
        * util/txixml2texi.pl: separate accent formatting.  Always output the
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index 1b6ddea7c1..338ddc576a 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -255,16 +255,25 @@ while ($reader->read) {
   }
   my $name = $reader->name;
   if ($reader->nodeType() eq XML_READER_TYPE_ELEMENT) {
+    my $user_defined_index_command;
     if (($name eq 'entry' or $name eq 'indexcommand')
         and $reader->hasAttributes()
         and defined($reader->getAttribute('command'))) {
       $name = $reader->getAttribute('command');
+      $user_defined_index_command = 1;
     } elsif ($name eq 'listitem') {
       $name = 'item';
     }
     if ($Texinfo::Convert::TexinfoMarkup::commands_args_elements{$name}) {
       push @commands_with_args_stack, 0;
     }
+    my $spaces = $reader->getAttribute('spaces');
+    if (defined($spaces)) {
+      $spaces =~ s/\\n/\n/g;
+      $spaces =~ s/\\f/\f/g;
+    } else {
+      $spaces = '';
+    }
     if ($name eq 'accent') {
       if ($reader->hasAttributes()) {
         if (defined($reader->getAttribute('type'))) {
@@ -272,8 +281,6 @@ while ($reader->read) {
           print "\@$command"
             if (defined($command));
         }
-        my $spaces = $reader->getAttribute('spaces');
-        $spaces = '' if (!defined($spaces));
         print "$spaces";
         if (!(defined($reader->getAttribute('bracketed'))
               and $reader->getAttribute('bracketed') eq 'off')) {
@@ -299,6 +306,7 @@ while ($reader->read) {
           and defined($reader->getAttribute('delimiter'))) {
         print $reader->getAttribute('delimiter');
       }
+      print "$spaces";
     } elsif (exists($Texinfo::Common::block_commands{$name})) {
       print "\@$name";
       if ($name eq 'macro') {
@@ -306,9 +314,12 @@ while ($reader->read) {
           print $reader->getAttribute('line');
         }
         print "\n";
+      } else {
+        print "$spaces";
       }
     } elsif (defined($Texinfo::Common::line_commands{$name})
-             or defined($Texinfo::Common::nobrace_commands{$name})) {
+             or defined($Texinfo::Common::nobrace_commands{$name})
+             or $user_defined_index_command) {
       if ($reader->hasAttributes()
           and defined($reader->getAttribute('originalcommand'))) {
         $name = $reader->getAttribute('originalcommand');
@@ -326,6 +337,7 @@ while ($reader->read) {
         }
       }
       print "\@$name";
+      print "$spaces";
       if ($reader->hasAttributes() and defined($reader->getAttribute('line'))) 
{
         my $line = $reader->getAttribute('line');
         $line =~ s/\\\\/\x{1F}/g;
@@ -348,6 +360,7 @@ while ($reader->read) {
         $commands_with_args_stack[-1]++;
         print ',';
       }
+      print "$spaces";
     } elsif ($ignored_elements{$name}) {
       my $keep_indexterm = 0;
       if ($name eq 'indexterm') {
@@ -385,13 +398,6 @@ while ($reader->read) {
           and $reader->getAttribute('bracketed') eq 'on') {
         print '{';
       }
-      if ($name ne 'accent'
-          and defined($reader->getAttribute('spaces'))) {
-        my $spaces = $reader->getAttribute('spaces');
-        $spaces =~ s/\\n/\n/g;
-        $spaces =~ s/\\f/\f/g;
-        print $spaces;
-      }
       if (defined($reader->getAttribute('leadingtext'))) {
         print $reader->getAttribute('leadingtext');
       }



reply via email to

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