texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Inline some method calls


From: Gavin D. Smith
Subject: branch master updated: Inline some method calls
Date: Sat, 04 Jun 2022 07:25:09 -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 9dd5f90492 Inline some method calls
9dd5f90492 is described below

commit 9dd5f90492f9e854476963ff8f51b0ec0efa323d
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Jun 4 12:25:00 2022 +0100

    Inline some method calls
    
    * tp/Texinfo/Convert/HTML.pm (_convert_text):
    Inline calls to in_verbatim, in_raw, in_math, in_upper_case and
    in_non_breakable_space.
---
 ChangeLog                  |  8 ++++++++
 tp/Texinfo/Convert/HTML.pm | 22 +++++++++++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a24937dbad..9699f162b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-06-04  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Inline some method calls
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_text):
+       Inline calls to in_verbatim, in_raw, in_math, in_upper_case and
+       in_non_breakable_space.
+
 2022-06-04  Gavin Smith  <gavinsmith0123@gmail.com>
 
        Override _default_format_protect_text instead
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 028be492d6..7327cd6ed8 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5436,12 +5436,19 @@ sub _convert_text($$$)
   my $element = shift;
   my $text = shift;
 
-  if ($self->in_verbatim()) {
+  my $context = $self->{'document_context'}->[-1];
+
+  #if ($self->in_verbatim()) { # inline these calls for speed
+  if ($context->{'verbatim'}) {
     return $self->_default_format_protect_text($text);
     #return &{$self->formatting_function('format_protect_text')}($self, $text);
   }
-  return $text if ($self->in_raw());
-  $text = uc($text) if ($self->in_upper_case());
+  return $text if $context->{'raw'};
+  #return $text if ($self->in_raw());
+
+  my $formatting_context = $context->{'formatting_context'}->[-1];
+  $text = uc($text) if $formatting_context->{'upper_case'};
+  #$text = uc($text) if ($self->in_upper_case());
 
   $text = $self->_default_format_protect_text($text);
   #$text = &{$self->formatting_function('format_protect_text')}($self, $text);
@@ -5450,8 +5457,8 @@ sub _convert_text($$$)
       and $self->{'conf'}->{'OUTPUT_ENCODING_NAME'}
       and $self->{'conf'}->{'OUTPUT_ENCODING_NAME'} eq 'utf-8') {
     $text = Texinfo::Convert::Unicode::unicode_text($text,
-                                        ($self->in_code() or 
$self->in_math()));
-  } elsif (!$self->in_code() and !$self->in_math()) {
+                                        (in_code($self) or in_math($self)));
+  } elsif (!$context->{'monospace'}->[-1] and !$context->{'math'}) {
     if ($self->{'conf'}->{'USE_NUMERIC_ENTITY'}) {
       $text = $self->xml_format_text_with_numeric_entities($text);
     } elsif ($self->{'conf'}->{'USE_ISO'}) {
@@ -5470,9 +5477,10 @@ sub _convert_text($$$)
     }
   }
 
-  return $text if ($self->in_preformatted());
+  return $text if (in_preformatted($self));
 
-  if ($self->in_non_breakable_space()) {
+  #if ($self->in_non_breakable_space()) {
+  if ($formatting_context->{'space_protected'}) {
     if ($text =~ /(\S*[_-]\S*)/) {
       my $open = $self->html_attribute_class('span', ['w-nolinebreak-text']);
       if ($open ne '') {



reply via email to

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