[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_o
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/menus.c (handle_menu): use close_container to close preformatted and menu_comment when starting a menu entry. |
Date: |
Sun, 05 Feb 2023 05:09:05 -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 ec93fa7351 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/menus.c (handle_menu): use close_container to close
preformatted and menu_comment when starting a menu entry.
ec93fa7351 is described below
commit ec93fa73513f86c66c309ae134544c74f39b505c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 5 11:08:54 2023 +0100
* tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/menus.c (handle_menu): use close_container
to close preformatted and menu_comment when starting a menu entry.
---
ChangeLog | 6 ++++++
tp/TODO | 5 -----
tp/Texinfo/ParserNonXS.pm | 27 ++++++-----------------
tp/Texinfo/XS/parsetexi/menus.c | 16 +++-----------
tp/t/60macro.t | 11 ++++++++++
tp/t/results/macro/macro_in_menu.pl | 43 ++++++++++++++-----------------------
6 files changed, 42 insertions(+), 66 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 43ac556023..bb16e7504d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-02-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/menus.c (handle_menu): use close_container
+ to close preformatted and menu_comment when starting a menu entry.
+
2023-02-05 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/ParserNonXS.pm (_end_line_starting_block):
diff --git a/tp/TODO b/tp/TODO
index d2e4b87c52..993cae10b0 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -17,8 +17,6 @@ or value expansion. aliases.
done: source_marks structures, with beginning and end of included file, @
protecting end of line in @def*, @setfilename in included files.
-# TODO add test with type different from before_item and preformatted
-
check that there is a test of something like
@macro cpfn
cp fn
@@ -30,9 +28,6 @@ Source marks of element popped can lead to empty element
readded for the source
mark leading to an infinite loop. Such a situation should maybe be handled in
_pop_element_from_contents
-Check position in t/*macro.t macro_in_menu starspaces macro expansion
- # FIXME check if correctly placed
-
Test for the case of
# FIXME check with source mark as it could be problematic
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index b408563db7..0c3809cc62 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1680,10 +1680,8 @@ sub _close_container($$)
# Keep the element to keep the source mark, but remove some types.
# Keep before_item in order not to add empty table definition in
# gather_previous_item.
- # TODO add test with type different from before_item and preformatted
delete $current->{'type'} if ($current->{'type'} ne 'before_item');
} else {
- #print STDERR "TTTTTTTTTTT $current->{'type'}\n";
$element_to_remove = $current;
}
}
@@ -4994,27 +4992,14 @@ sub _process_remaining_on_line($$$$)
my $menu_star_element = _pop_element_from_contents($self, $current);
$line =~ s/^(\s+)//;
my $leading_text = '*' . $1;
- # FIXME remove empty description too? In that case there won't be
- # a need to delete preformatted 'contents'
+ # FIXME remove empty description too?
if ($current->{'type'} eq 'preformatted'
and $current->{'parent'}->{'type'}
- and ($current->{'parent'}->{'type'} eq 'menu_comment'
- # or $current->{'parent'}->{'type'} eq 'menu_entry_description'
- )) {
- my $menu = $current->{'parent'}->{'parent'};
- if (!$current->{'contents'}) {
- # FIXME check if correctly placed
- # source marks here are tested in t/*macro.t macro_in_menu
- # with starspaces macro expansion
- _pop_element_from_contents($self, $current->{'parent'}, 1);
- if (not $current->{'parent'}
- or not $current->{'parent'}->{'contents'}
- or not scalar(@{$current->{'parent'}->{'contents'}})) {
- # also tested in the same test as the previous one
- _pop_element_from_contents($self, $menu, 1);
- }
- }
- $current = $menu;
+ and $current->{'parent'}->{'type'} eq 'menu_comment') {
+ # close preformatted
+ $current = _close_container($self, $current);
+ # close menu_comment
+ $current = _close_container($self, $current);
} else {
# first parent preformatted, third is menu_entry
if ($current->{'type'} ne 'preformatted'
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index 9e66a6d0b4..7457c74cc9 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -133,19 +133,9 @@ handle_menu (ELEMENT **current_inout, char **line_inout)
{
ELEMENT *menu = current->parent->parent;
- /* Remove an empty ET_preformatted, and an empty ET_menu_comment. */
- if (current->contents.number == 0)
- {
- pop_element_from_contents (current->parent, 1);
- if (current->parent->contents.number == 0)
- {
- pop_element_from_contents (menu, 1);
- destroy_element (current->parent);
- }
- destroy_element (current);
- }
-
- current = menu;
+ /* Close ET_preformatted, and ET_menu_comment. */
+ current = close_container (current);
+ current = close_container (current);
}
else
{
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index 99f8031055..fbbb3ef2f8 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -374,6 +374,17 @@ menu comment
@emptystring{}
@end menu
'],
+# this is actually already tested in macro_in_menu with
+# @starspaces{}, but this test is more focused
+['macro_in_empty_menu_comment',
+'@macro emptystring
+
+@end macro
+
+@menu
+@emptystring{}* Copying Conditions:: Your rights.
+@end menu
+'],
['macro_in_accent',
'@macro aletter
a
diff --git a/tp/t/results/macro/macro_in_menu.pl
b/tp/t/results/macro/macro_in_menu.pl
index ed4d304b1a..8d15077650 100644
--- a/tp/t/results/macro/macro_in_menu.pl
+++ b/tp/t/results/macro/macro_in_menu.pl
@@ -401,35 +401,24 @@ $result_trees{'macro_in_menu'} = {
'cmdname' => 'menu',
'contents' => [
{
- 'contents' => [
+ 'source_marks' => [
{
- 'contents' => [
- {
- 'source_marks' => [
- {
- 'counter' => 1,
- 'element' => {
- 'args' => [
- {
- 'text' => ''
- }
- ],
- 'extra' => {
- 'name' => 'starspaces'
- },
- 'type' => 'macro_call'
- },
- 'sourcemark_type' => 'macro_expansion',
- 'status' => 'start'
- }
- ],
- 'text' => ''
- }
- ],
- 'type' => 'preformatted'
+ 'counter' => 1,
+ 'element' => {
+ 'args' => [
+ {
+ 'text' => ''
+ }
+ ],
+ 'extra' => {
+ 'name' => 'starspaces'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
}
- ],
- 'type' => 'menu_comment'
+ ]
},
{
'contents' => [
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/menus.c (handle_menu): use close_container to close preformatted and menu_comment when starting a menu entry.,
Patrice Dumas <=