texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * util/txixml2texi.pl: separate accent formatting


From: Patrice Dumas
Subject: branch master updated: * util/txixml2texi.pl: separate accent formatting. Always output the braces and the spaces right after command if they are specified for an accent.
Date: Sat, 01 Oct 2022 05:34:49 -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 e2db9499d9 * util/txixml2texi.pl: separate accent formatting.  Always 
output the braces and the spaces right after command if they are specified for 
an accent.
e2db9499d9 is described below

commit e2db9499d9ca94c699670fa88a0668f8a2c61ecb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 1 11:34:34 2022 +0200

    * util/txixml2texi.pl: separate accent formatting.  Always output the
    braces and the spaces right after command if they are specified for
    an accent.
---
 ChangeLog           |  6 ++++++
 util/txixml2texi.pl | 43 +++++++++++++++++++++----------------------
 2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b7fc36a415..949949d2ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-01  Patrice Dumas  <pertusus@free.fr>
+
+       * util/txixml2texi.pl: separate accent formatting.  Always output the
+       braces and the spaces right after command if they are specified for
+       an accent.
+
 2022-10-01  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (%formatted_line_commands)
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index 1908fb63cd..1b6ddea7c1 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -162,9 +162,6 @@ foreach my $command (keys(%no_arg_commands_formatting)) {
   }
 }
 
-# FIXME select based on element name
-$element_at_commands{'accent'} = 0;
-
 my %arg_elements;
 foreach my $command 
(keys(%Texinfo::Convert::TexinfoMarkup::commands_args_elements)) {
   my $arg_index = 0;
@@ -268,23 +265,25 @@ while ($reader->read) {
     if ($Texinfo::Convert::TexinfoMarkup::commands_args_elements{$name}) {
       push @commands_with_args_stack, 0;
     }
-    if (exists $element_at_commands{$name}) {
-      if ($name eq 'accent') {
-        if ($reader->hasAttributes()) {
-          if (defined($reader->getAttribute('type'))) {
-            my $command = $accent_type_command{$reader->getAttribute('type')};
-            print "\@$command"
-              if (defined($command));
-          }
-          if (!defined($reader->getAttribute('spaces'))
-              and !(defined($reader->getAttribute('bracketed'))
-                    and $reader->getAttribute('bracketed') eq 'off')) {
-            print '{';
-          }
-        } else {
+    if ($name eq 'accent') {
+      if ($reader->hasAttributes()) {
+        if (defined($reader->getAttribute('type'))) {
+          my $command = $accent_type_command{$reader->getAttribute('type')};
+          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')) {
           print '{';
         }
-      } elsif (!ref($element_at_commands{$name})) {
+      } else {
+        print '{';
+      }
+    } elsif (exists $element_at_commands{$name}) {
+      if (!ref($element_at_commands{$name})) {
         print $element_at_commands{$name};
       } else {
         my ($attribute) = keys(%{$element_at_commands{$name}});
@@ -386,7 +385,8 @@ while ($reader->read) {
           and $reader->getAttribute('bracketed') eq 'on') {
         print '{';
       }
-      if (defined($reader->getAttribute('spaces'))) {
+      if ($name ne 'accent'
+          and defined($reader->getAttribute('spaces'))) {
         my $spaces = $reader->getAttribute('spaces');
         $spaces =~ s/\\n/\n/g;
         $spaces =~ s/\\f/\f/g;
@@ -434,9 +434,8 @@ while ($reader->read) {
     } elsif ($elements_end_attributes{$name}) {
       if ($name eq 'accent') {
         if ($reader->hasAttributes()) {
-          if (!defined($reader->getAttribute('spaces'))
-              and !(defined($reader->getAttribute('bracketed'))
-                    and $reader->getAttribute('bracketed') eq 'off')) {
+          if (!(defined($reader->getAttribute('bracketed'))
+                and $reader->getAttribute('bracketed') eq 'off')) {
             print '}';
           }
         } else {



reply via email to

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