texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Tue, 2 Aug 2022 08:11:29 -0400 (EDT)

branch: master
commit 2f8ce518df4022341f69760c3813de28deaa7450
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 2 14:11:15 2022 +0200

    Handle txidefnamenospace/omit_def_name_space in info/plaintext
    
    * tp/Texinfo/Convert/Plaintext.pm (_convert): add @def* line
    formatting cases without space between name and argument for
    the case of omit_def_name_space set.
---
 ChangeLog                          |  8 ++++
 tp/Texinfo/Convert/Plaintext.pm    | 89 +++++++++++++++++++++++++++++---------
 tp/t/results/def/omit_def_space.pl |  4 +-
 3 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8a768c42ea..62abf0c1be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-08-01  Patrice Dumas  <pertusus@free.fr>
+
+       Handle txidefnamenospace/omit_def_name_space in info/plaintext
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert): add @def* line
+       formatting cases without space between name and argument for
+       the case of omit_def_name_space set.
+
 2022-08-01  Patrice Dumas  <pertusus@free.fr>
 
        No omit_def_name_space in main def element
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 8b6cad9b3d..b5373dd1e0 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2796,6 +2796,8 @@ sub _convert($$)
         } else {
           $name = '';
         }
+
+        my $omit_def_space = $element->{'extra'}->{'omit_def_name_space'};
         
         if ($command eq 'deffn'
             or $command eq 'defvr'
@@ -2804,10 +2806,15 @@ sub _convert($$)
                  or $command eq 'deftypevr')
                 and !$element->{'extra'}->{'def_parsed_hash'}->{'type'})) {
           if ($arguments) {
-            $tree = $self->gdt('@tie{}-- {category}: {name} {arguments}', {
+            my $strings = {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
                     'name' => $name,
-                    'arguments' => $arguments});
+                    'arguments' => $arguments};
+            if ($omit_def_space) {
+              $tree = $self->gdt('@tie{}-- {category}: {name}{arguments}', 
$strings);
+            } else {
+              $tree = $self->gdt('@tie{}-- {category}: {name} {arguments}', 
$strings);
+            }
           } else {
             $tree = $self->gdt('@tie{}-- {category}: {name}', {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
@@ -2823,11 +2830,21 @@ sub _convert($$)
                     'arguments' => $arguments};
             if ($self->get_conf('deftypefnnewline') eq 'on'
                 and $command eq 'deftypefn') {
-              $tree = $self->gdt('@tie{}-- {category}:@*{type}@*{name} 
{arguments}',
-                                 $strings);
+              if ($omit_def_space) {
+                $tree = $self->gdt('@tie{}-- 
{category}:@*{type}@*{name}{arguments}',
+                                   $strings);
+              } else {
+                $tree = $self->gdt('@tie{}-- {category}:@*{type}@*{name} 
{arguments}',
+                                   $strings);
+              }
             } else {
-              $tree = $self->gdt('@tie{}-- {category}: {type} {name} 
{arguments}',
-                                 $strings);
+              if ($omit_def_space) {
+                $tree = $self->gdt('@tie{}-- {category}: {type} 
{name}{arguments}',
+                                   $strings);
+              } else {
+                $tree = $self->gdt('@tie{}-- {category}: {type} {name} 
{arguments}',
+                                   $strings);
+              }
             }
           } else {
             my $strings = {
@@ -2847,11 +2864,18 @@ sub _convert($$)
                  or ($command eq 'deftypecv'
                      and !$element->{'extra'}->{'def_parsed_hash'}->{'type'})) 
{
           if ($arguments) {
-            $tree = $self->gdt('@tie{}-- {category} of {class}: {name} 
{arguments}', {
+            my $strings = {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
                     'name' => $name,
                     'class' => 
$element->{'extra'}->{'def_parsed_hash'}->{'class'},
-                    'arguments' => $arguments});
+                    'arguments' => $arguments};
+            if ($omit_def_space) {
+              $tree = $self->gdt('@tie{}-- {category} of {class}: 
{name}{arguments}',
+                                 $strings);
+            } else {
+              $tree = $self->gdt('@tie{}-- {category} of {class}: {name} 
{arguments}',
+                                 $strings);
+            }
           } else {
             $tree = $self->gdt('@tie{}-- {category} of {class}: {name}', {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
@@ -2862,11 +2886,18 @@ sub _convert($$)
                  or ($command eq 'deftypeop'
                      and !$element->{'extra'}->{'def_parsed_hash'}->{'type'})) 
{
           if ($arguments) {
-            $tree = $self->gdt('@tie{}-- {category} on {class}: {name} 
{arguments}', {
-                    'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
+            my $strings = {
+                   'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
                     'name' => $name,
                     'class' => 
$element->{'extra'}->{'def_parsed_hash'}->{'class'},
-                    'arguments' => $arguments});
+                    'arguments' => $arguments};
+            if ($omit_def_space) {
+              $tree = $self->gdt('@tie{}-- {category} on {class}: 
{name}{arguments}',
+                                 $strings);
+            } else {
+              $tree = $self->gdt('@tie{}-- {category} on {class}: {name} 
{arguments}',
+                                 $strings);
+            }
           } else {
             $tree = $self->gdt('@tie{}-- {category} on {class}: {name}', {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
@@ -2882,13 +2913,25 @@ sub _convert($$)
                     'type' => 
$element->{'extra'}->{'def_parsed_hash'}->{'type'},
                     'arguments' => $arguments};
             if ($self->get_conf('deftypefnnewline') eq 'on') {
-              $tree
-                = $self->gdt('@tie{}-- {category} on {class}:@*{type}@*{name} 
{arguments}',
-                             $strings);
+              if ($omit_def_space) {
+                $tree
+                  = $self->gdt('@tie{}-- {category} on 
{class}:@*{type}@*{name}{arguments}',
+                               $strings);
+              } else {
+                $tree
+                  = $self->gdt('@tie{}-- {category} on 
{class}:@*{type}@*{name} {arguments}',
+                               $strings);
+              }
             } else {
-              $tree
-                = $self->gdt('@tie{}-- {category} on {class}: {type} {name} 
{arguments}',
-                             $strings);
+              if ($omit_def_space) {
+                $tree
+                  = $self->gdt('@tie{}-- {category} on {class}: {type} 
{name}{arguments}',
+                               $strings);
+              } else {
+                $tree
+                  = $self->gdt('@tie{}-- {category} on {class}: {type} {name} 
{arguments}',
+                               $strings);
+              }
             }
           } else {
             my $strings = {
@@ -2914,9 +2957,15 @@ sub _convert($$)
                     'class' => 
$element->{'extra'}->{'def_parsed_hash'}->{'class'},
                     'type' => 
$element->{'extra'}->{'def_parsed_hash'}->{'type'},
                     'arguments' => $arguments};
-            $tree
-              = $self->gdt('@tie{}-- {category} of {class}: {type} {name} 
{arguments}',
-                           $strings);
+            if ($omit_def_space) {
+              $tree
+                = $self->gdt('@tie{}-- {category} of {class}: {type} 
{name}{arguments}',
+                             $strings);
+            } else {
+              $tree
+                = $self->gdt('@tie{}-- {category} of {class}: {type} {name} 
{arguments}',
+                             $strings);
+            }
           } else {
             my $strings = {
                     'category' => 
$element->{'extra'}->{'def_parsed_hash'}->{'category'},
diff --git a/tp/t/results/def/omit_def_space.pl 
b/tp/t/results/def/omit_def_space.pl
index f4c9b54b44..85ef148d19 100644
--- a/tp/t/results/def/omit_def_space.pl
+++ b/tp/t/results/def/omit_def_space.pl
@@ -574,8 +574,8 @@ $result_indices_sort_strings{'omit_def_space'} = {
 
 
 
-$result_converted{'plaintext'}->{'omit_def_space'} = ' -- Function: function 
(arg1, arg2)
- -- Function: another (aarg)
+$result_converted{'plaintext'}->{'omit_def_space'} = ' -- Function: 
function(arg1, arg2)
+ -- Function: another(aarg)
      explain
 ';
 



reply via email to

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