texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: tp/DebugTexinfo/DebugTree.pm: show spaces in extr


From: Patrice Dumas
Subject: branch master updated: tp/DebugTexinfo/DebugTree.pm: show spaces in extra
Date: Wed, 31 Aug 2022 02:58:17 -0400

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 8d6337d205 tp/DebugTexinfo/DebugTree.pm: show spaces in extra
8d6337d205 is described below

commit 8d6337d205a2d888d19777bef001e3965331d046
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 31 08:57:15 2022 +0200

    tp/DebugTexinfo/DebugTree.pm: show spaces in extra
---
 tp/DebugTexinfo/DebugTree.pm | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/tp/DebugTexinfo/DebugTree.pm b/tp/DebugTexinfo/DebugTree.pm
index 6a1ced956a..d923b3be6a 100644
--- a/tp/DebugTexinfo/DebugTree.pm
+++ b/tp/DebugTexinfo/DebugTree.pm
@@ -30,6 +30,8 @@
 # --debug=10 (or more), the tree is printed at the end of the run,
 # --debug=100 (or more), the tree is printed at each newline.
 
+use strict;
+
 package DebugTexinfo::DebugTree;
 
 # also for __(
@@ -37,6 +39,7 @@ use Texinfo::Common;
 use Texinfo::Structuring;
 use Texinfo::Convert::Converter;
 
+use vars qw($VERSION @ISA);
 @ISA = qw(Texinfo::Convert::Converter);
 
 my %defaults = (
@@ -139,6 +142,15 @@ sub convert_tree($$)
 
 sub _print_tree($$;$$);
 
+sub _protect_text($)
+{
+  my $text = shift;
+  $text =~ s/\n/\\n/g;
+  $text =~ s/\f/\\f/g;
+  $text =~ s/\r/\\r/g;
+  return $text;
+}
+
 sub _print_tree($$;$$)
 {
   my $self = shift;
@@ -159,12 +171,19 @@ sub _print_tree($$;$$)
     $result .= "$element->{'type'} ";
   }
   if (defined($element->{'text'})) {
-    my $text = $element->{'text'};
-    $text =~ s/\n/\\n/g;
-    $text =~ s/\f/\\f/g;
-    $text =~ s/\r/\\r/g;
+    my $text = _protect_text($element->{'text'});
     $result .= "|$text|";
   }
+  if ($element->{'extra'}
+      and defined($element->{'extra'}->{'spaces_before_argument'})) {
+    $result .= ' '
+    .'b/'._protect_text($element->{'extra'}->{'spaces_before_argument'}).'/';
+  }
+  if ($element->{'extra'}
+      and defined($element->{'extra'}->{'spaces_after_argument'})) {
+    $result .= ' '
+    .'a/'._protect_text($element->{'extra'}->{'spaces_after_argument'}).'/';
+  }
   $result .= "\n";
   if ($element->{'args'}) {
     foreach my $arg (@{$element->{'args'}}) {



reply via email to

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