[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_abort_empty_line, _
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_abort_empty_line, _parse_texi), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line): do not handle especially @indent and @noindent, except that they are are never directly associated with following space. |
Date: |
Mon, 05 Sep 2022 13:03:57 -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 ba2af0e624 * tp/Texinfo/ParserNonXS.pm (_abort_empty_line,
_parse_texi), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line): do not handle especially
@indent and @noindent, except that they are are never directly associated with
following space.
ba2af0e624 is described below
commit ba2af0e624a3e7e2341b7eab2983f6e9747a4671
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 5 19:00:32 2022 +0200
* tp/Texinfo/ParserNonXS.pm (_abort_empty_line, _parse_texi),
tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line): do not handle
especially @indent and @noindent, except that they are
are never directly associated with following space.
---
ChangeLog | 8 +++++
tp/Texinfo/ParserNonXS.pm | 27 +++-----------
tp/Texinfo/XS/parsetexi/handle_commands.c | 42 ----------------------
tp/Texinfo/XS/parsetexi/parser.c | 4 ++-
tp/t/results/misc_commands/noindent_empty_para.pl | 14 ++------
.../xml_tests/comments_on_misc_command_line.pl | 42 +++++++++++-----------
6 files changed, 39 insertions(+), 98 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 540e3058cc..6be40c387d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-09-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_abort_empty_line, _parse_texi),
+ tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
+ tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line): do not handle
+ especially @indent and @noindent, except that they are
+ are never directly associated with following space.
+
2022-09-04 Gavin Smith <gavinsmith0123@gmail.com>
* doc/texinfo.texi (Heading Format):
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 9088df2619..5d06e6fe36 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2350,7 +2350,11 @@ sub _abort_empty_line {
}
} elsif ($spaces_element->{'type'} eq 'empty_line_after_command'
or $spaces_element->{'type'} eq 'empty_spaces_before_argument') {
- if ($owning_element) {
+ if ($owning_element
+ # indent and noindent are never directly associated with the spaces
+ and (not ($owning_element->{'cmdname'}
+ and ($owning_element->{'cmdname'} eq 'indent'
+ or $owning_element->{'cmdname'} eq 'noindent')))) {
# Remove element from main tree. It will still be referenced in
# the 'extra' hash as 'spaces_before_argument'.
pop @{$current->{'contents'}};
@@ -4729,27 +4733,6 @@ sub _parse_texi($$$)
push @{$current->{'contents'}}, $misc;
}
$line = _start_empty_line_after_command($line, $current, $misc);
- if ($command eq 'indent'
- or $command eq 'noindent') {
- if ($line !~ /\n/) {
- my ($new_line, $new_line_source_info) = _new_line($self,
$source_info);
- $line .= $new_line if (defined($new_line));
- }
- $line =~ s/^(\s*)//;
- if ($1) {
- $current = _merge_text($self, $current, $1);
- }
- if ($line ne ''
- and $current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command') {
- $current->{'contents'}->[-1]->{'type'}
- = 'empty_spaces_after_command';
- }
- my $paragraph = _begin_paragraph($self, $current, $source_info);
- $current = $paragraph if $paragraph;
- if ($line eq '') {
- last;
- }
- }
}
# line commands
} elsif (defined($self->{'line_commands'}->{$command})) {
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index e92c0883de..e075b3ae8a 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -254,48 +254,6 @@ handle_other_command (ELEMENT *current, char **line_inout,
add_to_element_contents (current, misc);
}
start_empty_line_after_command (current, &line, misc);
- if (cmd == CM_indent || cmd == CM_noindent)
- {
- /* Start a new paragraph if not in one already. */
- int spaces;
- ELEMENT *paragraph;
-
- /* Check if if we should change an ET_empty_line_after_command
- element to ET_empty_spaces_after_command by looking ahead
- to see what comes next. */
- if (!strchr (line, '\n'))
- {
- char *line2;
- input_push_text (strdup (line), 0);
- line2 = new_line ();
- if (line2)
- line = line2;
- }
- spaces = strspn (line, whitespace_chars);
- if (spaces > 0)
- {
- char saved = line[spaces];
- line[spaces] = '\0';
- current = merge_text (current, line);
- line[spaces] = saved;
- line += spaces;
- }
- if (*line
- && last_contents_child(current)->type
- == ET_empty_line_after_command)
- {
- last_contents_child(current)->type
- = ET_empty_spaces_after_command;
- }
- paragraph = begin_paragraph (current);
- if (paragraph)
- current = paragraph;
- if (!*line)
- {
- *status = GET_A_NEW_LINE;
- goto funexit;
- }
- }
}
funexit:
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 89d60bceb4..edf738b34b 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -647,7 +647,9 @@ abort_empty_line (ELEMENT **current_inout, char
*additional_spaces)
else if (last_child->type == ET_empty_line_after_command
|| last_child->type == ET_empty_spaces_before_argument)
{
- if (owning_element)
+ /* indent and noindent are never directly associated with the spaces */
+ if (owning_element && ! (owning_element->cmd == CM_indent
+ || owning_element->cmd == CM_noindent))
{
/* Remove element from main tree. */
ELEMENT *e = pop_element_from_contents (current);
diff --git a/tp/t/results/misc_commands/noindent_empty_para.pl
b/tp/t/results/misc_commands/noindent_empty_para.pl
index d94bbdf5ed..d7c7d292e4 100644
--- a/tp/t/results/misc_commands/noindent_empty_para.pl
+++ b/tp/t/results/misc_commands/noindent_empty_para.pl
@@ -27,14 +27,6 @@ $result_trees{'noindent_empty_para'} = {
',
'type' => 'empty_line_after_command'
},
- {
- 'contents' => [],
- 'extra' => {
- 'noindent' => 1
- },
- 'parent' => {},
- 'type' => 'paragraph'
- },
{
'parent' => {},
'text' => '
@@ -63,9 +55,8 @@
$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[0]{'parent'} = $
$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[1]{'extra'}{'spaces_associated_command'}
= $result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[0];
$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'noindent_empty_para'}{'contents'}[0];
$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[2]{'parent'} =
$result_trees{'noindent_empty_para'}{'contents'}[0];
+$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[3]{'contents'}[0]{'parent'}
= $result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[3];
$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[3]{'parent'} =
$result_trees{'noindent_empty_para'}{'contents'}[0];
-$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[4]{'contents'}[0]{'parent'}
= $result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[4];
-$result_trees{'noindent_empty_para'}{'contents'}[0]{'contents'}[4]{'parent'} =
$result_trees{'noindent_empty_para'}{'contents'}[0];
$result_trees{'noindent_empty_para'}{'contents'}[0]{'parent'} =
$result_trees{'noindent_empty_para'};
$result_texis{'noindent_empty_para'} = '@noindent
@@ -85,8 +76,7 @@ $result_floats{'noindent_empty_para'} = {};
-$result_converted{'plaintext'}->{'noindent_empty_para'} = '
- aaa
+$result_converted{'plaintext'}->{'noindent_empty_para'} = 'aaa
';
diff --git a/tp/t/results/xml_tests/comments_on_misc_command_line.pl
b/tp/t/results/xml_tests/comments_on_misc_command_line.pl
index 70e7e0419c..f6348fdbeb 100644
--- a/tp/t/results/xml_tests/comments_on_misc_command_line.pl
+++ b/tp/t/results/xml_tests/comments_on_misc_command_line.pl
@@ -308,25 +308,25 @@ $result_trees{'comments_on_misc_command_line'} = {
'type' => 'empty_spaces_after_command'
},
{
- 'contents' => [
+ 'args' => [
{
- 'args' => [
- {
- 'parent' => {},
- 'text' => ' indent (skipspace)
+ 'parent' => {},
+ 'text' => ' indent (skipspace)
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- ' indent (skipspace)
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'extra' => {
+ 'misc_args' => [
+ ' indent (skipspace)
'
- ]
- },
- 'parent' => {}
- },
+ ]
+ },
+ 'parent' => {}
+ },
+ {
+ 'contents' => [
{
'parent' => {},
'text' => 'Para.
@@ -382,10 +382,10 @@
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[7]{'pa
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[8]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[0];
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[9]{'extra'}{'spaces_associated_command'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[8];
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[9]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[0];
-$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'contents'}[0]{'args'}[0]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'contents'}[0];
-$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'contents'}[0]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10];
-$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'contents'}[1]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'args'}[0]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10];
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[10]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[0];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[11]{'contents'}[0]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[11];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'contents'}[11]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[0];
$result_trees{'comments_on_misc_command_line'}{'contents'}[0]{'parent'} =
$result_trees{'comments_on_misc_command_line'};
$result_texis{'comments_on_misc_command_line'} = '@setfilename
comments_on_misc_command_line.info @c setfilename (text)
@@ -430,8 +430,8 @@ $result_converted{'xml'}->{'comments_on_misc_command_line'}
= '<setfilename file
<pagesizes spaces=" ">200mm </pagesizes><!-- c pagesizes (line) -->
<everyheading spaces=" "><thispage></thispage> <divideheading/> aaa
</everyheading><!-- c everyheading (lineraw) -->
-<indent></indent><para><!-- c indent (skipspace) -->
-Para.
+<indent></indent><!-- c indent (skipspace) -->
+<para>Para.
</para>';
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_abort_empty_line, _parse_texi), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (abort_empty_line): do not handle especially @indent and @noindent, except that they are are never directly associated with following space.,
Patrice Dumas <=