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 (converter_init


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (converter_initialize) (_process_text): cache $self->get_conf('ASCII_PUNCTUATION') for speed.
Date: Wed, 05 Jan 2022 10:09:43 -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 b8f34ad418 * tp/Texinfo/Convert/Plaintext.pm (converter_initialize) 
(_process_text): cache $self->get_conf('ASCII_PUNCTUATION') for speed.
b8f34ad418 is described below

commit b8f34ad418d5eb2fecef833083c7e70fa0179a1e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jan 5 16:09:32 2022 +0100

    * tp/Texinfo/Convert/Plaintext.pm (converter_initialize)
    (_process_text): cache $self->get_conf('ASCII_PUNCTUATION') for
    speed.
---
 ChangeLog                       | 6 ++++++
 tp/Texinfo/Convert/Plaintext.pm | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 57f4a5d57d..4a0dcd3025 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-01-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Plaintext.pm (converter_initialize)
+       (_process_text): cache $self->get_conf('ASCII_PUNCTUATION') for
+       speed.
+
 2022-01-05  Patrice Dumas  <pertusus@free.fr>
 
        * TODO, tp/TODO: update.
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index bf4ac5dda9..4a7aeb0bd0 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -411,6 +411,10 @@ sub converter_initialize($)
 
   if ($self->get_conf('ASCII_PUNCTUATION')) {
     $self->{'convert_text_options'}->{'ascii_punctuation'} = 1;
+    # cache to avoid calling get_conf
+    $self->{'ascii_punctualtion'} = 1;
+  } else {
+    $self->{'ascii_punctualtion'} = 0;
   }
 
   if ($self->get_conf('ENABLE_ENCODING')
@@ -585,7 +589,7 @@ sub _process_text($$$)
   }
 
   if ($self->{'to_utf8'}
-      and !$self->get_conf('ASCII_PUNCTUATION')) {
+      and !$self->{'ascii_punctuation'}) {
     return Texinfo::Convert::Unicode::unicode_text($text, 
             $context->{'font_type_stack'}->[-1]->{'monospace'});
   } elsif (!$context->{'font_type_stack'}->[-1]->{'monospace'}) {



reply via email to

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