texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: No 'first_indent_length' option for new_formatter


From: Gavin D. Smith
Subject: branch master updated: No 'first_indent_length' option for new_formatter
Date: Sun, 26 Nov 2023 14:32:38 -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 d937d566df No 'first_indent_length' option for new_formatter
d937d566df is described below

commit d937d566df01d57fe88bf750b865af7c00befe36
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Nov 26 19:32:31 2023 +0000

    No 'first_indent_length' option for new_formatter
    
    * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
    Eliminate 'first_indent_length' as a possible configuration
    option.  This is not used by the paragraph formatting module
    itself, and was only used at place new_formatter was called.
    This means the options passed to new_formatter are now the
    same as those used for the paragraph formatter.
    (_convert) <paragraph indent>: Set 'indent_length' and
    'indent_length_next' here, rather than 'first_indent_length'.
---
 ChangeLog                       | 13 +++++++++++++
 tp/Texinfo/Convert/Plaintext.pm | 41 +++++++++++++++--------------------------
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b9ba2ad54..719f14278f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-26  Gavin Smith <gavinsmith0123@gmail.com>
+
+       No 'first_indent_length' option for new_formatter
+
+       * tp/Texinfo/Convert/Plaintext.pm (new_formatter):
+       Eliminate 'first_indent_length' as a possible configuration
+       option.  This is not used by the paragraph formatting module
+       itself, and was only used at place new_formatter was called.
+       This means the options passed to new_formatter are now the
+       same as those used for the paragraph formatter.
+       (_convert) <paragraph indent>: Set 'indent_length' and
+       'indent_length_next' here, rather than 'first_indent_length'.
+
 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 878abfc8ac..9fd958398b 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -668,25 +668,24 @@ sub new_formatter($$;$)
 {
   my ($self, $type, $conf) = @_;
 
-  my $first_indent_length;
-  if ($conf) {
-    $first_indent_length = $conf->{'first_indent_length'};
-    delete $conf->{'first_indent_length'};
-  }
-
   my $container_conf = {
-         'max'           => $self->{'text_element_context'}->[-1]->{'max'},
+    'max' => $self->{'text_element_context'}->[-1]->{'max'},
   };
 
-  $container_conf->{'indent_length'}
-    = $self->{'format_context'}->[-1]->{'indent_length'}
-      if (defined($self->{'format_context'}->[-1]->{'indent_length'}));
+  my $indent = $self->{'format_context'}->[-1]->{'indent_length'};
+  if (defined($indent)) {
+    $container_conf->{'indent_length'} = $indent;
+  } else {
+    $container_conf->{'indent_length'}
+      = $indent_length*($self->{'format_context'}->[-1]->{'indent_level'});
+  }
 
   my $frenchspacing_conf = $self->{'conf'}->{'frenchspacing'};
+  #my $frenchspacing_conf = $self->get_conf('frenchspacing');
+  # access 'conf' hash directly for efficiency
+
   $container_conf->{'frenchspacing'} = 1
     if ($frenchspacing_conf eq 'on');
-    #if ($self->get_conf('frenchspacing') eq 'on');
-    # access 'conf' hash directly for efficiency
 
   $container_conf->{'counter'}
     = $self->{'text_element_context'}->[-1]->{'counter'}
@@ -699,17 +698,6 @@ sub new_formatter($$;$)
     }
   }
 
-  my $indent = $container_conf->{'indent_length'};
-  $indent = $indent_length*($self->{'format_context'}->[-1]->{'indent_level'})
-    if (!defined($indent));
-
-  if ($first_indent_length) {
-    $container_conf->{'indent_length'} = $first_indent_length;
-    $container_conf->{'indent_length_next'} = $indent;
-  } else {
-    $container_conf->{'indent_length'} = $indent;
-  }
-
   my $container;
   if ($type eq 'paragraph') {
     $container = Texinfo::Convert::Paragraph->new($container_conf);
@@ -3124,9 +3112,10 @@ sub _convert($$)
                 and ($self->{'format_context'}->[-1]->{'paragraph_count'}
                   or $self->get_conf('firstparagraphindent') eq 'insert')
                and !$self->{'text_element_context'}->[-1]->{'counter'}))) {
-        $conf->{'first_indent_length'} = $self->get_conf('paragraphindent');
-        $conf->{'first_indent_length'} = 0
-          if ($conf->{'first_indent_length'} eq 'none');
+        my $para_indent = $self->get_conf('paragraphindent');
+        $para_indent = 0 if $para_indent eq 'none';
+        $conf->{'indent_length'} = $para_indent;
+        $conf->{'indent_length_next'} = 0;
       }
       $paragraph = $self->new_formatter('paragraph', $conf);
       push @{$self->{'formatters'}}, $paragraph;



reply via email to

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