texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_set_environment_o


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_set_environment_options): if @w is the @itemize argument, use an explicit empty format to have no bullet.
Date: Tue, 04 Jan 2022 09:22:42 -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 21a99295ec * tp/Texinfo/Convert/LaTeX.pm (_set_environment_options): 
if @w is the @itemize argument, use an explicit empty format to have no bullet.
21a99295ec is described below

commit 21a99295ecdac074901ba54f74eb18ccba06de09
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jan 4 15:22:29 2022 +0100

    * tp/Texinfo/Convert/LaTeX.pm (_set_environment_options): if @w
    is the @itemize argument, use an explicit empty format to have
    no bullet.
---
 ChangeLog                          |  6 ++++++
 tp/Texinfo/Convert/LaTeX.pm        | 13 ++++++++++---
 tp/t/18itemize.t                   |  4 ++++
 tp/t/results/itemize/w_argument.pl |  7 +++++++
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 10691e739d..097f3fa63d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-01-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/LaTeX.pm (_set_environment_options): if @w
+       is the @itemize argument, use an explicit empty format to have
+       no bullet.
+
 2022-01-03  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * TODO: Remove already implemented functionality.
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 1430e720e0..0dcd845441 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -949,6 +949,8 @@ sub output($$)
   my $modified_root;
 
   if (defined($inserted_preamble_idx)) {
+    print STDERR "INSERT $latex_document_type: $inserted_preamble_idx\n"
+      if ($self->get_conf('DEBUG'));
     $modified_root = {'contents' => [ @{$root->{'contents'}} ], 'type' => 
$root->{'type'}};
     my $new_before_node_section = {'type' => 
$modified_root->{'contents'}->[0]->{'type'},
                                    'parent' => $modified_root,
@@ -999,7 +1001,7 @@ sub output($$)
   _pop_context($self);
   $result .= $self->write_or_return($self->_latex_footer(), $fh);
 
-  #print $result;
+  #print STDERR "OUTPUT fh:$fh|F:$output_file|$result";
   if ($fh and $output_file ne '-') {
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $output_file);
@@ -1734,11 +1736,16 @@ sub _set_environment_options($$$)
       }
     }
   } elsif ($command eq 'itemize') {
-    if ($element->{'args'} and $element->{'args'}->[0]->{'contents'}) {
+    my $environment = $LaTeX_environment_commands{$command}[0];
+    if ($element->{'extra'} and $element->{'extra'}->{'command_as_argument'}
+        and $element->{'extra'}->{'command_as_argument'}->{'cmdname'} eq 'w') {
+      # the result with \hbox{} would probably have been the same,
+      # but using an empty label is more consistent with the Texinfo manual
+      return {$environment => 'label={}'};
+    } elsif ($element->{'args'} and $element->{'args'}->[0]->{'contents'}) {
       # FIXME start a new top context?
       my $itemize_label = _convert($self, $element->{'args'}->[0]);
       if ($itemize_label ne '') {
-        my $environment = $LaTeX_environment_commands{$command}[0];
         return {$environment => 'label='.$itemize_label};
       }
     }
diff --git a/tp/t/18itemize.t b/tp/t/18itemize.t
index 7fcfb01643..9ec790e933 100644
--- a/tp/t/18itemize.t
+++ b/tp/t/18itemize.t
@@ -600,11 +600,15 @@ my @test_invalid = (
 my @file_latex_tests_cases_tests = ('inter_item_commands_in_itemize',
   'inter_item_commands_in_enumerate');
 
+my @latex_tests_cases_tests = ('w_argument');
+
 foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'plaintext';
   push @{$test->[2]->{'test_formats'}}, 'html_text';
   push @{$test->[2]->{'test_formats'}}, 'file_latex'
     if (grep {$_ eq $test->[0]} @file_latex_tests_cases_tests);
+  push @{$test->[2]->{'test_formats'}}, 'latex'
+    if (grep {$_ eq $test->[0]} @latex_tests_cases_tests);
 }
 
 our ($arg_test_case, $arg_generate, $arg_debug);
diff --git a/tp/t/results/itemize/w_argument.pl 
b/tp/t/results/itemize/w_argument.pl
index 4e249fbdd3..f672db4b0d 100644
--- a/tp/t/results/itemize/w_argument.pl
+++ b/tp/t/results/itemize/w_argument.pl
@@ -240,4 +240,11 @@ $result_converted{'html_text'}->{'w_argument'} = '<ul 
class="no-bullet">
 </li></ul>
 ';
 
+
+$result_converted{'latex'}->{'w_argument'} = '\\begin{itemize}[label={}]
+\\item \\texttt{{-}{-}build=} platform on which the program is compiled,
+\\item \\texttt{{-}{-}target=} target platform on which the program is 
processed.
+\\end{itemize}
+';
+
 1;



reply via email to

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