texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (begin_paragra


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (begin_paragraph_p): select types that could contain paragraphs only. Improve documentation of the code by listing the types that are avoided.
Date: Sat, 28 Sep 2024 19:04:09 -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 b1e058d7e4 * tp/Texinfo/XS/parsetexi/parser.c (begin_paragraph_p): 
select types that could contain paragraphs only.  Improve documentation of the 
code by listing the types that are avoided.
b1e058d7e4 is described below

commit b1e058d7e4bf2a8a857f9abe57bd963d1697716b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jun 3 19:47:46 2024 +0200

    * tp/Texinfo/XS/parsetexi/parser.c (begin_paragraph_p): select types
    that could contain paragraphs only.  Improve documentation of the
    code by listing the types that are avoided.
---
 ChangeLog                        |  6 ++++++
 tp/Texinfo/ParserNonXS.pm        |  8 ++++++--
 tp/Texinfo/XS/parsetexi/parser.c | 15 ++++++++-------
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5371e50b79..5eff01c1cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
 
        Update test results
 
+2024-06-03  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/parser.c (begin_paragraph_p): select types
+       that could contain paragraphs only.  Improve documentation of the
+       code by listing the types that are avoided.
+
 2024-06-03  Patrice Dumas  <pertusus@free.fr>
 
        Rename brace_command_container type as brace_arg
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index b7787a68f7..dd9550215d 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1362,8 +1362,12 @@ sub _begin_paragraph($$;$)
 {
   my ($self, $current, $source_info) = @_;
 
-  # !$current->{'type'} is true for @-commands and for text without
-  # type nor command.
+  # !$current->{'type'} is true for @-commands and other containers
+  # and some text.
+  # we want to avoid
+  # paragraphs, line_arg, brace_container, brace_arg, root_line,
+  # balanced_braces, block_line_arg, preformatted (which is already
+  # avoided by the context check)
   if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
       and !$no_paragraph_contexts{$self->_top_context()}) {
 
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 183fbfd2f4..3cd5d4d483 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -554,13 +554,14 @@ parse_texi_document (void)
 static int
 begin_paragraph_p (ELEMENT *current)
 {
-  return (/* FIXME these checks for @-commands types look wrong */
-          current->type == ET_NONE /* "True for @-commands" */
-           || current->type == ET_lineraw_command
-           || current->type == ET_line_command
-           || current->type == ET_block_command
-           || current->type == ET_container_command
-
+  /* we want to avoid
+     paragraphs, line_arg, brace_container, brace_arg, root_line,
+     balanced_braces, block_line_arg, preformatted (which is already
+     avoided by the context check) */
+  return (current->type == ET_line_command /* for nodes, sectioning content */
+           || current->type == ET_block_command /* block command content */
+           || current->type == ET_container_command /* @item, @tab block
+                                                       command content */
            || current->type == ET_before_item
            || current->type == ET_before_node_section
            || current->type == ET_document_root



reply via email to

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