texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/ParserNonXS.pm (_begin_preformatted,


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_begin_preformatted, _end_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/parser.c (begin_preformatted): begin rawpreformatted at the only place where it can begin, and not in begin_preformatted().
Date: Thu, 30 Dec 2021 08:06:43 -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 8ee2c8f6ed * tp/Texinfo/ParserNonXS.pm (_begin_preformatted, 
_end_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), 
tp/Texinfo/XS/parsetexi/parser.c (begin_preformatted): begin rawpreformatted at 
the only place where it can begin, and not in begin_preformatted().
8ee2c8f6ed is described below

commit 8ee2c8f6edee85aff8996c813b26a7c36383857d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Dec 30 14:06:31 2021 +0100

    * tp/Texinfo/ParserNonXS.pm (_begin_preformatted, _end_line),
    tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block),
    tp/Texinfo/XS/parsetexi/parser.c (begin_preformatted):
    begin rawpreformatted at the only place where it can begin,
    and not in begin_preformatted().
---
 ChangeLog                          |  8 ++++++++
 tp/Texinfo/ParserNonXS.pm          | 23 +++++++++--------------
 tp/Texinfo/XS/parsetexi/end_line.c |  6 ++++++
 tp/Texinfo/XS/parsetexi/parser.c   | 19 +++++--------------
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92b38d6650..f5b9170a0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-12-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_begin_preformatted, _end_line),
+       tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block),
+       tp/Texinfo/XS/parsetexi/parser.c (begin_preformatted):
+       begin rawpreformatted at the only place where it can begin,
+       and not in begin_preformatted().
+
 2021-12-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_end_preformatted, _end_line),
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 5478693f4f..e7ebe03580 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -509,13 +509,6 @@ foreach my $command (keys(%block_commands)) {
   }
 }
 
-my @preformatted_contexts = ('preformatted', 'rawpreformatted');
-#my @preformatted_contexts = ('preformatted');
-my %preformatted_contexts;
-foreach my $preformatted_context (@preformatted_contexts) {
-  $preformatted_contexts{$preformatted_context} = 1;
-}
-
 # contexts on the context_stack stack where empty line doesn't trigger
 # a paragraph
 my %no_paragraph_contexts;
@@ -1250,16 +1243,12 @@ sub _begin_preformatted($$)
 {
   my ($self, $current) = @_;
 
-  my $top_context = $self->_top_context();
-  if ($preformatted_contexts{$top_context}) {
-  #if ($top_context eq 'rawpreformatted') {
-  #  cluck;
-  #}
+  if ($self->_top_context() eq 'preformatted') {
     push @{$current->{'contents'}},
-          { 'type' => $top_context,
+          { 'type' => 'preformatted',
             'parent' => $current };
     $current = $current->{'contents'}->[-1];
-    print STDERR "PREFORMATTED $top_context\n" if ($self->{'DEBUG'});
+    print STDERR "PREFORMATTED\n" if ($self->{'DEBUG'});
   }
   return $current;
 }
@@ -3078,6 +3067,12 @@ sub _end_line($$$)
       $current = $current->{'contents'}->[-1];
       print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
     }
+    if ($current->{'cmdname'} and $format_raw_commands{$current->{'cmdname'}}) 
{
+      push @{$current->{'contents'}},
+          { 'type' => 'rawpreformatted',
+            'parent' => $current };
+      $current = $current->{'contents'}->[-1];
+    }
     $current = _begin_preformatted($self, $current);
 
   # if we are after a @end verbatim, we must restart a preformatted if needed,
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index e086836277..b67c147247 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1278,6 +1278,12 @@ end_line_starting_block (ELEMENT *current)
       current = menu_comment;
       debug ("MENU_COMMENT OPEN");
     }
+  if (command_flags(current) & CF_format_raw)
+    {
+      ELEMENT *rawpreformatted = new_element (ET_rawpreformatted);
+      add_to_element_contents (current, rawpreformatted);
+      current = rawpreformatted;
+    }
   current = begin_preformatted (current);
 
   return current;
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 24bea012bf..cafe87865b 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -467,21 +467,12 @@ begin_paragraph (ELEMENT *current)
 ELEMENT *
 begin_preformatted (ELEMENT *current)
 {
-  if (current_context() == ct_preformatted
-      || current_context() == ct_rawpreformatted)
+  if (current_context() == ct_preformatted)
     {
-      ELEMENT *e;
-      enum element_type et;
-
-      if (current_context() == ct_preformatted)
-        et = ET_preformatted;
-      else
-        et = ET_rawpreformatted;
-      e = new_element (et);
-      add_to_element_contents (current, e);
-      current = e;
-      debug ("PREFORMATTED %s", et == ET_preformatted ? "preformatted"
-                                                      : "rawpreformatted");
+      ELEMENT *preformatted = new_element (ET_preformatted);
+      add_to_element_contents (current, preformatted);
+      current = preformatted;
+      debug ("PREFORMATTED");
     }
   return current;
 }



reply via email to

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