texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Sun, 26 Nov 2023 13:16:28 -0500 (EST)

branch: master
commit 39e7427740f3fca323cd6e71ef43da3b1da40e1f
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Nov 26 18:15:53 2023 +0000

    new_formatter tweaks
    
    * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
    Save value of a configuration variable to reuse it.
    Reorder conditional to check for 'paragraph' formatter first
    as this is the most frequently used.
---
 ChangeLog                       |  9 +++++++++
 tp/Texinfo/Convert/Plaintext.pm | 15 +++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e1b4c21c92..77fb387e4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-11-26  Gavin Smith <gavinsmith0123@gmail.com>
+
+       new_formatter tweaks
+
+       * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
+       Save value of a configuration variable to reuse it.
+       Reorder conditional to check for 'paragraph' formatter first
+       as this is the most frequently used.
+
 2023-11-26  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 30d6fcd46c..7ba414953c 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -674,7 +674,6 @@ sub new_formatter($$;$)
     delete $conf->{'first_indent_length'};
   }
 
-  my $container;
   my $container_conf = {
          'max'           => $self->{'text_element_context'}->[-1]->{'max'},
          'indent_level'  => $self->{'format_context'}->[-1]->{'indent_level'},
@@ -684,8 +683,9 @@ sub new_formatter($$;$)
     = $self->{'format_context'}->[-1]->{'indent_length'}
       if (defined($self->{'format_context'}->[-1]->{'indent_length'}));
 
+  my $frenchspacing_conf = $self->{'conf'}->{'frenchspacing'};
   $container_conf->{'frenchspacing'} = 1
-    if ($self->{'conf'}->{'frenchspacing'} eq 'on');
+    if ($frenchspacing_conf eq 'on');
     #if ($self->get_conf('frenchspacing') eq 'on');
     # access 'conf' hash directly for efficiency
 
@@ -711,14 +711,15 @@ sub new_formatter($$;$)
     $container_conf->{'indent_length'} = $indent;
   }
 
-  if ($type eq 'line') {
+  my $container;
+  if ($type eq 'paragraph') {
+    $container = Texinfo::Convert::Paragraph->new($container_conf);
+  } elsif ($type eq 'line') {
     $container_conf->{'max'} = 10000001;
     $container_conf->{'keep_end_lines'} = 1;
     $container_conf->{'no_final_newline'} = 1;
     $container_conf->{'add_final_space'} = 1;
 
-    $container = Texinfo::Convert::Paragraph->new($container_conf);
-  } elsif ($type eq 'paragraph') {
     $container = Texinfo::Convert::Paragraph->new($container_conf);
   } elsif ($type eq 'unfilled') {
     $container_conf->{'max'} = 10000000;
@@ -741,9 +742,7 @@ sub new_formatter($$;$)
                    'upper_case_stack' => [{}],
                    'font_type_stack' => [{}],
                    'w' => 0,
-              'frenchspacing_stack' => [$self->{'conf'}->{'frenchspacing'}],
-              #'frenchspacing_stack' => [$self->get_conf('frenchspacing')],
-              # access 'conf' hash directly for efficiency
+              'frenchspacing_stack' => [ $frenchspacing_conf ],
               'suppress_styles' => undef,
               'no_added_eol' => undef};
   if ($conf) {



reply via email to

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