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 (_process_text)


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_process_text): Inline into the only call site for efficiency, as this is a very frequently called function.
Date: Sat, 25 Nov 2023 16:45:12 -0500

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 a528a4a82a * tp/Texinfo/Convert/Plaintext.pm (_process_text): Inline 
into the only call site for efficiency, as this is a very frequently called 
function.
a528a4a82a is described below

commit a528a4a82aa44d67d04d1f5c8be11c2b8fd0ac97
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Nov 25 21:42:06 2023 +0000

    * tp/Texinfo/Convert/Plaintext.pm (_process_text):
    Inline into the only call site for efficiency, as this is
    a very frequently called function.
---
 ChangeLog                       |  6 ++++++
 tp/Texinfo/Convert/Plaintext.pm | 18 +++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0ea3e8f4d1..48f4610b93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-25  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_process_text):
+       Inline into the only call site for efficiency, as this is
+       a very frequently called function.
+
 2023-11-25  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/parsetexi/api.c (find_locales_dir):
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index aba12b8607..d79ba75068 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -664,8 +664,6 @@ sub _process_text_internal {
   return $text;
 }
 
-# Convert ``, '', `, ', ---, -- in $COMMAND->{'text'} to their output,
-# possibly coverting to upper case as well.
 sub _process_text($$$)
 {
   my ($self, $command, $context) = @_;
@@ -1815,7 +1813,21 @@ sub _convert($$)
           $result = _count_added($self, $formatter->{'container'},
                       add_next($formatter->{'container'}, $element->{'text'}));
         } else {
-          my $text = _process_text($self, $element, $formatter);
+          # Convert ``, '', `, ', ---, -- in $COMMAND->{'text'} to their
+          # output, possibly coverting to upper case as well.
+          my $text = $element->{'text'};
+
+          if ($formatter->{'upper_case_stack'}->[-1]->{'upper_case'}) {
+            $text = _protect_sentence_ends($text);
+            $text = uc($text);
+          }
+          if (!$self->{'ascii_dashes_and_quotes'} and $self->{'to_utf8'}) {
+            $text = Texinfo::Convert::Unicode::unicode_text($text,
+                        $formatter->{'font_type_stack'}->[-1]->{'monospace'});
+          } elsif (!$formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
+            $text = _process_text_internal($text);
+          }
+
           # inlined below for efficiency
           #$result = _count_added($self, $formatter->{'container'},
           #                       add_text ($formatter->{'container'}, $text));



reply via email to

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