texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert): Che


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert): Check for accent command after checking for style command as accents commands are slightly less used.
Date: Fri, 07 Apr 2023 18:15:12 -0400

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 3d2058241a * tp/Texinfo/Convert/Plaintext.pm (_convert): Check for 
accent command after checking for style command as accents commands are 
slightly less used.
3d2058241a is described below

commit 3d2058241a5aa25809b00a78423cfac1beb69456
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Fri Apr 7 23:15:04 2023 +0100

    * tp/Texinfo/Convert/Plaintext.pm (_convert):
    Check for accent command after checking for style command
    as accents commands are slightly less used.
---
 ChangeLog                       |  6 ++++
 tp/Texinfo/Convert/Plaintext.pm | 66 ++++++++++++++++++++---------------------
 2 files changed, 39 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c2397237be..0737822f68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-07  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert):
+       Check for accent command after checking for style command
+       as accents commands are slightly less used.
+
 2023-04-07  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/Plaintext.pm (_convert):
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 444b524fd0..c6daec5cee 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1946,39 +1946,6 @@ sub _convert($$)
       }
       return $result;
     # commands with braces
-    } elsif ($accent_commands{$command}) {
-      my $encoding;
-      if ($self->{'enable_encoding'}) {
-        $encoding = $self->{'output_encoding_name'};
-      }
-      my $sc;
-      if ($formatter->{'upper_case_stack'}->[-1]->{'upper_case'}) {
-        $sc = 1;
-      }
-      my $accented_text
-         = Texinfo::Convert::Text::text_accents($element, $encoding, $sc);
-      $result .= _count_added($self, $formatter->{'container'},
-         add_text($formatter->{'container'}, $accented_text));
-
-      my $accented_text_original;
-      if ($formatter->{'upper_case_stack'}->[-1]->{'upper_case'}) {
-        $accented_text_original
-         = Texinfo::Convert::Text::text_accents($element, $encoding);
-      }
-
-      if (($accented_text_original
-           and $accented_text_original !~ /\p{Upper}/)
-          or $formatter->{'upper_case_stack'}->[-1]->{'var'}
-          or $formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
-        allow_end_sentence($formatter->{'container'});
-      }
-
-      # in case the text added ends with punctuation.
-      # If the text is empty (likely because of an error) previous
-      # punctuation will be cancelled, we don't want that.
-      remove_end_sentence($formatter->{'container'})
-        if ($accented_text ne '');
-      return $result;
     } elsif ($self->{'style_map'}->{$command}
          or ($element->{'type'}
              and $element->{'type'} eq 'definfoenclose_command')) {
@@ -2090,6 +2057,39 @@ sub _convert($$)
         }
       }
       return $result;
+    } elsif ($accent_commands{$command}) {
+      my $encoding;
+      if ($self->{'enable_encoding'}) {
+        $encoding = $self->{'output_encoding_name'};
+      }
+      my $sc;
+      if ($formatter->{'upper_case_stack'}->[-1]->{'upper_case'}) {
+        $sc = 1;
+      }
+      my $accented_text
+         = Texinfo::Convert::Text::text_accents($element, $encoding, $sc);
+      $result .= _count_added($self, $formatter->{'container'},
+         add_text($formatter->{'container'}, $accented_text));
+
+      my $accented_text_original;
+      if ($formatter->{'upper_case_stack'}->[-1]->{'upper_case'}) {
+        $accented_text_original
+         = Texinfo::Convert::Text::text_accents($element, $encoding);
+      }
+
+      if (($accented_text_original
+           and $accented_text_original !~ /\p{Upper}/)
+          or $formatter->{'upper_case_stack'}->[-1]->{'var'}
+          or $formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
+        allow_end_sentence($formatter->{'container'});
+      }
+
+      # in case the text added ends with punctuation.
+      # If the text is empty (likely because of an error) previous
+      # punctuation will be cancelled, we don't want that.
+      remove_end_sentence($formatter->{'container'})
+        if ($accented_text ne '');
+      return $result;
     } elsif ($command eq 'image') {
       $result = _count_added($self, $formatter->{'container'},
                    add_pending_word($formatter->{'container'}, 1));



reply via email to

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