[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Gather tree information when closing incorrectly
From: |
Patrice Dumas |
Subject: |
branch master updated: Gather tree information when closing incorrectly nested @def* lines |
Date: |
Sat, 03 Dec 2022 17:12:53 -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 1ca2089f02 Gather tree information when closing incorrectly nested
@def* lines
1ca2089f02 is described below
commit 1ca2089f02da11db2c1b665a36cd6e02a894fdc3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 3 23:12:02 2022 +0100
Gather tree information when closing incorrectly nested @def* lines
* tp/Texinfo/ParserNonXS.pm (_close_current, _end_line_def_line)
(_end_line), tp/Texinfo/XS/parsetexi/close.c (close_current),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line, end_line):
when ending a @def*x? command line because it was interrupted or
at the end of the file, use the same code as the code used at the
end of line, put in the end_line_def_line() function to gather
information on the line and separate arguments with roles.
* tp/t/57invalid_nestings.t: move section_on_defx_line to
@formatted_cases.
---
ChangeLog | 15 ++
tp/TODO | 4 -
tp/Texinfo/ParserNonXS.pm | 170 +++++++++---------
tp/Texinfo/XS/parsetexi/close.c | 24 +--
tp/Texinfo/XS/parsetexi/end_line.c | 198 +++++++++++----------
tp/Texinfo/XS/parsetexi/parser.h | 1 +
tp/t/57invalid_nestings.t | 16 +-
tp/t/results/def/end_of_line_end_file.pl | 83 ++++++++-
.../invalid_nestings/section_on_def_line.pl | 74 +++++++-
.../invalid_nestings/section_on_defx_line.pl | 82 ++++++++-
10 files changed, 461 insertions(+), 206 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 54ad4c1a18..19d8ab4110 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,21 @@
that get in the way in \pdflinkpage and appear to be unnecessary.
(\dopageno, \doshortpageno): Remove.
+2022-12-03 Patrice Dumas <pertusus@free.fr>
+
+ Gather tree information when closing incorrectly nested @def* lines
+
+ * tp/Texinfo/ParserNonXS.pm (_close_current, _end_line_def_line)
+ (_end_line), tp/Texinfo/XS/parsetexi/close.c (close_current),
+ tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line, end_line):
+ when ending a @def*x? command line because it was interrupted or
+ at the end of the file, use the same code as the code used at the
+ end of line, put in the end_line_def_line() function to gather
+ information on the line and separate arguments with roles.
+
+ * tp/t/57invalid_nestings.t: move section_on_defx_line to
+ @formatted_cases.
+
2022-12-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): ignore @def*
diff --git a/tp/TODO b/tp/TODO
index e2323765e3..339637d3d5 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,10 +10,6 @@ This is the todo list for texi2any
Before next release
===================
-Test @deffnx interrupted
-
-Process @def* interrupted.
-
Bugs
====
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index f70f9ee156..69775312a2 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1940,19 +1940,17 @@ sub _close_current($$$;$$)
and !@{$current->{'contents'}}) {
pop @{$current->{'parent'}->{'contents'}};
}
+ } elsif ($current->{'parent'}
+ and $current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq 'def_line') {
+ _end_line_def_line($self, $current, $source_info);
} elsif ($current->{'type'} eq 'line_arg') {
- if ($current->{'parent'}
- and $current->{'parent'}->{'type'}
- and $current->{'parent'}->{'type'} eq 'def_line') {
- $self->_pop_context(['ct_def'], $source_info, $current);
- } else {
- #$current = _end_line_misc_line($self, $current, $source_info);
- # We ignore the current returned $current, to be sure that
- # we close the command too.
- _end_line_misc_line($self, $current, $source_info);
- }
+ #$current = _end_line_misc_line($self, $current, $source_info);
+ # We ignore the current returned $current, to be sure that
+ # we close the command too.
+ _end_line_misc_line($self, $current, $source_info);
} elsif ($current->{'type'} eq 'block_line_arg') {
- $self->_pop_context(['ct_line', 'ct_def'], $source_info, $current);
+ $self->_pop_context(['ct_line'], $source_info, $current);
}
# empty types, not closed or associated to a command that is not closed
delete $current->{'contents'}
@@ -3265,6 +3263,85 @@ sub _end_line_misc_line($$$)
return $current;
}
+sub _end_line_def_line($$$)
+{
+ my $self = shift;
+ my $current = shift;
+ my $source_info = shift;
+
+ $self->_pop_context(['ct_def'], $source_info, $current);
+ # in case there are no arguments at all, it needs to be called here.
+ _abort_empty_line($self, $current);
+ my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
+ my $arguments = _parse_def($self, $def_command, $current);
+ if (scalar(@$arguments)) {
+ #$current->{'parent'}->{'extra'}->{'def_args'} = $arguments;
+ my $def_parsed_hash = {};
+ foreach my $arg (@$arguments) {
+ die if (!defined($arg->[0]));
+ last if ($arg->[0] eq 'arg' or $arg->[0] eq 'typearg'
+ or $arg->[0] eq 'delimiter');
+ next if ($arg->[0] eq 'spaces');
+ $def_parsed_hash->{$arg->[0]} = $arg->[1];
+ }
+ $current->{'parent'}->{'extra'}->{'def_parsed_hash'} = $def_parsed_hash;
+ # do a standard index entry tree
+ my $index_entry;
+ if (defined($def_parsed_hash->{'name'})) {
+ $index_entry = $def_parsed_hash->{'name'}
+ # empty bracketed
+ unless ($def_parsed_hash->{'name'}->{'type'}
+ and $def_parsed_hash->{'name'}->{'type'} eq
'bracketed_def_content'
+ and (!$def_parsed_hash->{'name'}->{'contents'}
+ or (!scalar(@{$def_parsed_hash->{'name'}->{'contents'}}))
+ or (scalar(@{$def_parsed_hash->{'name'}->{'contents'}})
== 1
+ and
defined($def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'})
+ and
$def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'} !~ /\S/)));
+ }
+ if (defined($index_entry)) {
+ my $index_contents_normalized;
+ if ($def_parsed_hash->{'class'}) {
+ # Delay getting the text until Texinfo::Structuring::sort_index_keys
+ # in order to avoid using gdt.
+ # We need to store the language as well in case there are multiple
+ # languages in the document.
+ if ($command_index{$def_command} eq 'fn'
+ or $command_index{$def_command} eq 'vr'
+ and $def_command ne 'defcv') {
+ undef $index_entry;
+ if (defined($self->{'documentlanguage'})) {
+ $current->{'parent'}->{'extra'}->{'documentlanguage'}
+ = $self->{'documentlanguage'};
+ }
+ }
+ }
+ my $index_contents;
+ if ($index_entry) {
+ $index_contents_normalized = [$index_entry];
+ $index_contents = [$index_entry];
+ }
+
+ _enter_index_entry($self,
+ $current->{'parent'}->{'extra'}->{'def_command'},
+ $current->{'parent'}->{'extra'}->{'original_def_cmdname'},
+ $current->{'parent'}, $index_contents,
+ $index_contents_normalized, $source_info);
+ } else {
+ $self->_command_warn($current->{'parent'}, $source_info,
+ __('missing name for @%s'),
+ $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
+ }
+ } else {
+ $self->_command_warn($current->{'parent'}, $source_info,
+ __('missing category for @%s'),
+ $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
+ }
+ $current = $current->{'parent'}->{'parent'};
+ $current = _begin_preformatted($self, $current);
+
+ return $current;
+}
+
# close constructs and do stuff at end of line (or end of the document)
sub _end_line($$$);
sub _end_line($$$)
@@ -3424,76 +3501,7 @@ sub _end_line($$$)
} elsif ($current->{'parent'}
and $current->{'parent'}->{'type'}
and $current->{'parent'}->{'type'} eq 'def_line') {
- $self->_pop_context(['ct_def'], $source_info, $current);
- # in case there are no arguments at all, it needs to be called here.
- _abort_empty_line($self, $current);
- my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
- my $arguments = _parse_def($self, $def_command, $current);
- if (scalar(@$arguments)) {
- #$current->{'parent'}->{'extra'}->{'def_args'} = $arguments;
- my $def_parsed_hash = {};
- foreach my $arg (@$arguments) {
- die if (!defined($arg->[0]));
- last if ($arg->[0] eq 'arg' or $arg->[0] eq 'typearg'
- or $arg->[0] eq 'delimiter');
- next if ($arg->[0] eq 'spaces');
- $def_parsed_hash->{$arg->[0]} = $arg->[1];
- }
- $current->{'parent'}->{'extra'}->{'def_parsed_hash'} = $def_parsed_hash;
- # do a standard index entry tree
- my $index_entry;
- if (defined($def_parsed_hash->{'name'})) {
- $index_entry = $def_parsed_hash->{'name'}
- # empty bracketed
- unless ($def_parsed_hash->{'name'}->{'type'}
- and $def_parsed_hash->{'name'}->{'type'} eq
'bracketed_def_content'
- and (!$def_parsed_hash->{'name'}->{'contents'}
- or
(!scalar(@{$def_parsed_hash->{'name'}->{'contents'}}))
- or (scalar(@{$def_parsed_hash->{'name'}->{'contents'}})
== 1
- and
defined($def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'})
- and
$def_parsed_hash->{'name'}->{'contents'}->[0]->{'text'} !~ /\S/)));
- }
- if (defined($index_entry)) {
- my $index_contents_normalized;
- if ($def_parsed_hash->{'class'}) {
- # Delay getting the text until Texinfo::Structuring::sort_index_keys
- # in order to avoid using gdt.
- # We need to store the language as well in case there are multiple
- # languages in the document.
- if ($command_index{$def_command} eq 'fn'
- or $command_index{$def_command} eq 'vr'
- and $def_command ne 'defcv') {
- undef $index_entry;
- if (defined($self->{'documentlanguage'})) {
- $current->{'parent'}->{'extra'}->{'documentlanguage'}
- = $self->{'documentlanguage'};
- }
- }
- }
- my $index_contents;
- if ($index_entry) {
- $index_contents_normalized = [$index_entry];
- $index_contents = [$index_entry];
- }
-
- _enter_index_entry($self,
- $current->{'parent'}->{'extra'}->{'def_command'},
- $current->{'parent'}->{'extra'}->{'original_def_cmdname'},
- $current->{'parent'}, $index_contents,
- $index_contents_normalized, $source_info);
- } else {
- $self->_command_warn($current->{'parent'}, $source_info,
- __('missing name for @%s'),
- $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
- }
- } else {
- $self->_command_warn($current->{'parent'}, $source_info,
- __('missing category for @%s'),
- $current->{'parent'}->{'extra'}->{'original_def_cmdname'});
- }
- $current = $current->{'parent'}->{'parent'};
- $current = _begin_preformatted($self, $current);
-
+ $current = _end_line_def_line($self, $current, $source_info);
# other block command lines
} elsif ($current->{'type'}
and $current->{'type'} eq 'block_line_arg') {
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index eea8b1e9d6..f385db34aa 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -357,14 +357,10 @@ close_current (ELEMENT *current,
break;
case ET_line_arg:
+ /* @-commands like @deffnx */
if (current->parent && current->parent->type == ET_def_line)
{
- c = pop_context ();
- if (c != ct_def)
- {
- /* error */
- fatal ("def context expected");
- }
+ end_line_def_line (current);
}
else
{
@@ -376,11 +372,19 @@ close_current (ELEMENT *current,
break;
case ET_block_line_arg:
- c = pop_context ();
- if (c != ct_line && c != ct_def)
+ /* @-commands like @deffn */
+ if (current->parent && current->parent->type == ET_def_line)
+ {
+ end_line_def_line (current);
+ }
+ else
{
- /* error */
- fatal ("line or def context expected");
+ c = pop_context ();
+ if (c != ct_line)
+ {
+ /* error */
+ fatal ("line context expected");
+ }
}
current = current->parent;
break;
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 5ca59f736c..cfc9a9787d 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1931,6 +1931,108 @@ end_line_misc_line (ELEMENT *current)
return current;
}
+ELEMENT *
+end_line_def_line (ELEMENT *current)
+{
+ enum command_id def_command, original_def_command;
+ DEF_INFO *def_info = 0;
+ static DEF_INFO zero_def_info; /* always stays zeroed */
+ KEY_PAIR *k;
+
+ if (pop_context () != ct_def)
+ fatal ("def context expected");
+
+ k = lookup_extra (current->parent, "original_def_cmdname");
+ if (k)
+ original_def_command = lookup_command ((char *) k->value);
+ else
+ original_def_command = current->parent->parent->cmd;
+
+ def_command = original_def_command;
+ /* Strip an trailing x from the command, e.g. @deffnx -> @deffn */
+ if (command_data(def_command).flags & CF_line)
+ {
+ char *stripped = strdup (command_name(def_command));
+ stripped[strlen (stripped) - 1] = '\0';
+ def_command = lookup_command (stripped);
+ free (stripped);
+ }
+
+ /* in case there are no arguments at all, it needs to be called here. */
+ abort_empty_line (¤t, NULL);
+
+ def_info = parse_def (def_command, current);
+
+ /* Record the index entry if def_info is not empty. */
+ if (!memcmp(def_info, &zero_def_info, sizeof (DEF_INFO)))
+ {
+ free (def_info);
+ command_warn (current->parent, "missing category for @%s",
+ command_name (original_def_command));
+ }
+ else
+ {
+ ELEMENT *index_entry = 0; /* Index entry text. */
+
+ add_extra_def_info (current->parent, "def_parsed_hash", def_info);
+
+ if (def_info->name)
+ {
+ char *t;
+ /* Set index_entry unless an empty ET_bracketed_def_content. */
+ if (def_info->name->type == ET_bracketed_def_content
+ && (def_info->name->contents.number == 0
+ || (def_info->name->contents.number == 1
+ && (t = def_info->name->contents.list[0]->text.text)
+ && t[strspn (t, whitespace_chars)] == '\0')))
+ {
+ }
+ else
+ index_entry = def_info->name;
+ }
+
+ if (index_entry)
+ {
+ ELEMENT *index_contents = 0;
+
+ if (def_info->class &&
+ (def_command == CM_defop
+ || def_command == CM_deftypeop
+ || def_command == CM_defmethod
+ || def_command == CM_deftypemethod
+ || def_command == CM_defivar
+ || def_command == CM_deftypeivar
+ || def_command == CM_deftypecv))
+ {
+ if (global_documentlanguage)
+ add_extra_string_dup (current->parent, "documentlanguage",
+ global_documentlanguage);
+ }
+ else
+ {
+ index_contents = new_element (ET_NONE);
+ if (index_contents->contents.number == 0)
+ add_to_contents_as_array (index_contents, index_entry);
+ }
+
+ enter_index_entry (def_command,
+ original_def_command,
+ current->parent,
+ index_contents);
+ }
+ else
+ {
+ command_warn (current->parent, "missing name for @%s",
+ command_name (original_def_command));
+ }
+ }
+
+ current = current->parent->parent;
+ current = begin_preformatted (current);
+
+ return current;
+}
+
/* Actions to be taken when a whole line of input has been processed */
ELEMENT *
end_line (ELEMENT *current)
@@ -2126,101 +2228,7 @@ end_line (ELEMENT *current)
/* End of a definition line, like @deffn */
else if (current->parent && current->parent->type == ET_def_line)
{
- enum command_id def_command, original_def_command;
- DEF_INFO *def_info = 0;
- static DEF_INFO zero_def_info; /* always stays zeroed */
- KEY_PAIR *k;
-
- if (pop_context () != ct_def)
- fatal ("def context expected");
-
- k = lookup_extra (current->parent, "original_def_cmdname");
- if (k)
- original_def_command = lookup_command ((char *) k->value);
- else
- original_def_command = current->parent->parent->cmd;
-
- def_command = original_def_command;
- /* Strip an trailing x from the command, e.g. @deffnx -> @deffn */
- if (command_data(def_command).flags & CF_line)
- {
- char *stripped = strdup (command_name(def_command));
- stripped[strlen (stripped) - 1] = '\0';
- def_command = lookup_command (stripped);
- free (stripped);
- }
-
- /* in case there are no arguments at all, it needs to be called here. */
- abort_empty_line (¤t, NULL);
-
- def_info = parse_def (def_command, current);
-
- /* Record the index entry if def_info is not empty. */
- if (!memcmp(def_info, &zero_def_info, sizeof (DEF_INFO)))
- {
- free (def_info);
- command_warn (current->parent, "missing category for @%s",
- command_name (original_def_command));
- }
- else
- {
- ELEMENT *index_entry = 0; /* Index entry text. */
-
- add_extra_def_info (current->parent, "def_parsed_hash", def_info);
-
- if (def_info->name)
- {
- char *t;
- /* Set index_entry unless an empty ET_bracketed_def_content. */
- if (def_info->name->type == ET_bracketed_def_content
- && (def_info->name->contents.number == 0
- || (def_info->name->contents.number == 1
- && (t = def_info->name->contents.list[0]->text.text)
- && t[strspn (t, whitespace_chars)] == '\0')))
- {
- }
- else
- index_entry = def_info->name;
- }
-
- if (index_entry)
- {
- ELEMENT *index_contents = 0;
-
- if (def_info->class &&
- (def_command == CM_defop
- || def_command == CM_deftypeop
- || def_command == CM_defmethod
- || def_command == CM_deftypemethod
- || def_command == CM_defivar
- || def_command == CM_deftypeivar
- || def_command == CM_deftypecv))
- {
- if (global_documentlanguage)
- add_extra_string_dup (current->parent, "documentlanguage",
- global_documentlanguage);
- }
- else
- {
- index_contents = new_element (ET_NONE);
- if (index_contents->contents.number == 0)
- add_to_contents_as_array (index_contents, index_entry);
- }
-
- enter_index_entry (def_command,
- original_def_command,
- current->parent,
- index_contents);
- }
- else
- {
- command_warn (current->parent, "missing name for @%s",
- command_name (original_def_command));
- }
- }
-
- current = current->parent->parent;
- current = begin_preformatted (current);
+ current = end_line_def_line (current);
}
/* End of a line starting a block. */
else if (current->type == ET_block_line_arg)
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index ee08412e7a..fd316a693f 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -119,6 +119,7 @@ ELEMENT *close_current (ELEMENT *current,
/* In end_line.c */
NODE_SPEC_EXTRA *parse_node_manual (ELEMENT *node);
ELEMENT *end_line (ELEMENT *current);
+ELEMENT *end_line_def_line (ELEMENT *current);
ELEMENT *end_line_misc_line (ELEMENT *current);
ELEMENT *parse_special_misc_command (char *line, enum command_id cmd,
int *has_commment);
diff --git a/tp/t/57invalid_nestings.t b/tp/t/57invalid_nestings.t
index d247043dfb..ee96ba3c2b 100644
--- a/tp/t/57invalid_nestings.t
+++ b/tp/t/57invalid_nestings.t
@@ -99,14 +99,6 @@ Somethin
Content
'],
-['section_on_defx_line',
-'@deffn h j k l
-@deffnx a b @section s
-
-Something
-
-@end deffn
-'],
['center',
'@center @indent @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote}
@@ -558,6 +550,14 @@ in quotation
Something
+@end deffn
+'],
+['section_on_defx_line',
+'@deffn h j k l
+@deffnx a b @section s
+
+Something
+
@end deffn
'],
);
diff --git a/tp/t/results/def/end_of_line_end_file.pl
b/tp/t/results/def/end_of_line_end_file.pl
index a273aa11ad..a25a102e62 100644
--- a/tp/t/results/def/end_of_line_end_file.pl
+++ b/tp/t/results/def/end_of_line_end_file.pl
@@ -17,7 +17,43 @@ $result_trees{'end_of_line_end_file'} = {
{
'contents' => [
{
- 'text' => 'category deffn_name arguments '
+ 'extra' => {
+ 'def_role' => 'category'
+ },
+ 'text' => 'category'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'name'
+ },
+ 'text' => 'deffn_name'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'arg'
+ },
+ 'text' => 'arguments'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
}
],
'type' => 'block_line_arg'
@@ -25,6 +61,25 @@ $result_trees{'end_of_line_end_file'} = {
],
'extra' => {
'def_command' => 'deffn',
+ 'def_parsed_hash' => {
+ 'category' => {},
+ 'name' => {}
+ },
+ 'index_entry' => {
+ 'content_normalized' => [
+ {}
+ ],
+ 'entry_content' => [
+ {}
+ ],
+ 'entry_element' => {},
+ 'entry_number' => 1,
+ 'in_code' => 1,
+ 'index_at_command' => 'deffn',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'fn',
+ 'index_type_command' => 'deffn'
+ },
'original_def_cmdname' => 'deffn'
},
'source_info' => {
@@ -50,13 +105,28 @@ $result_trees{'end_of_line_end_file'} = {
],
'type' => 'document_root'
};
+$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'def_parsed_hash'}{'category'}
=
$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'def_parsed_hash'}{'name'}
=
$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'content_normalized'}[0]
=
$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_content'}[0]
=
$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_element'}
=
$result_trees{'end_of_line_end_file'}{'contents'}[0]{'contents'}[0]{'contents'}[0];
$result_texis{'end_of_line_end_file'} = '@deffn category deffn_name arguments
';
-$result_texts{'end_of_line_end_file'} = '';
+$result_texts{'end_of_line_end_file'} = 'category: deffn_name arguments
+';
$result_errors{'end_of_line_end_file'} = [
+ {
+ 'error_line' => 'warning: entry for index `fn\' outside of any node
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'entry for index `fn\' outside of any node',
+ 'type' => 'warning'
+ },
{
'error_line' => 'no matching `@end deffn\'
',
@@ -72,8 +142,15 @@ $result_errors{'end_of_line_end_file'} = [
$result_floats{'end_of_line_end_file'} = {};
+$result_indices_sort_strings{'end_of_line_end_file'} = {
+ 'fn' => [
+ 'deffn_name'
+ ]
+};
+
+
-$result_converted{'xml'}->{'end_of_line_end_file'} = '<deffn spaces="
"><definitionterm></definitionterm>
+$result_converted{'xml'}->{'end_of_line_end_file'} = '<deffn spaces="
"><definitionterm><indexterm index="fn"
number="1">deffn_name</indexterm><defcategory>category</defcategory>
<deffunction>deffn_name</deffunction> <defparam>arguments</defparam>
</definitionterm>
</deffn>
';
diff --git a/tp/t/results/invalid_nestings/section_on_def_line.pl
b/tp/t/results/invalid_nestings/section_on_def_line.pl
index bdb3865f47..d601e73765 100644
--- a/tp/t/results/invalid_nestings/section_on_def_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_def_line.pl
@@ -17,7 +17,30 @@ $result_trees{'section_on_def_line'} = {
{
'contents' => [
{
- 'text' => 'a b '
+ 'extra' => {
+ 'def_role' => 'category'
+ },
+ 'text' => 'a'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'name'
+ },
+ 'text' => 'b'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
}
],
'type' => 'block_line_arg'
@@ -25,6 +48,25 @@ $result_trees{'section_on_def_line'} = {
],
'extra' => {
'def_command' => 'deffn',
+ 'def_parsed_hash' => {
+ 'category' => {},
+ 'name' => {}
+ },
+ 'index_entry' => {
+ 'content_normalized' => [
+ {}
+ ],
+ 'entry_content' => [
+ {}
+ ],
+ 'entry_element' => {},
+ 'entry_number' => 1,
+ 'in_code' => 1,
+ 'index_at_command' => 'deffn',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'fn',
+ 'index_type_command' => 'deffn'
+ },
'original_def_cmdname' => 'deffn'
},
'source_info' => {
@@ -96,6 +138,11 @@ $result_trees{'section_on_def_line'} = {
],
'type' => 'document_root'
};
+$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'def_parsed_hash'}{'category'}
=
$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'def_parsed_hash'}{'name'}
=
$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'content_normalized'}[0]
=
$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_content'}[0]
=
$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_element'}
=
$result_trees{'section_on_def_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0];
$result_texis{'section_on_def_line'} = '@deffn a b @section s
@@ -104,7 +151,8 @@ Something
';
-$result_texts{'section_on_def_line'} = '1 s
+$result_texts{'section_on_def_line'} = 'a: b
+1 s
===
Something
@@ -148,6 +196,15 @@ $result_errors{'section_on_def_line'} = [
'text' => '@section should not appear in @deffn',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: entry for index `fn\' outside of any node
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'entry for index `fn\' outside of any node',
+ 'type' => 'warning'
+ },
{
'error_line' => '@section seen before @end deffn
',
@@ -172,8 +229,17 @@ $result_errors{'section_on_def_line'} = [
$result_floats{'section_on_def_line'} = {};
+$result_indices_sort_strings{'section_on_def_line'} = {
+ 'fn' => [
+ 'b'
+ ]
+};
+
+
+
+$result_converted{'plaintext'}->{'section_on_def_line'} = ' -- a: b
-$result_converted{'plaintext'}->{'section_on_def_line'} = '1 s
+1 s
===
Something
@@ -181,7 +247,7 @@ Something
';
-$result_converted{'xml'}->{'section_on_def_line'} = '<deffn spaces="
"><definitionterm></definitionterm>
+$result_converted{'xml'}->{'section_on_def_line'} = '<deffn spaces="
"><definitionterm><indexterm index="fn"
number="1">b</indexterm><defcategory>a</defcategory>
<deffunction>b</deffunction> </definitionterm>
</deffn>
<section spaces=" "><sectiontitle>s</sectiontitle>
diff --git a/tp/t/results/invalid_nestings/section_on_defx_line.pl
b/tp/t/results/invalid_nestings/section_on_defx_line.pl
index 81c6889314..b92c2101f9 100644
--- a/tp/t/results/invalid_nestings/section_on_defx_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_defx_line.pl
@@ -108,7 +108,30 @@ $result_trees{'section_on_defx_line'} = {
{
'contents' => [
{
- 'text' => 'a b '
+ 'extra' => {
+ 'def_role' => 'category'
+ },
+ 'text' => 'a'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'name'
+ },
+ 'text' => 'b'
+ },
+ {
+ 'extra' => {
+ 'def_role' => 'spaces'
+ },
+ 'text' => ' ',
+ 'type' => 'spaces'
}
],
'type' => 'line_arg'
@@ -117,6 +140,25 @@ $result_trees{'section_on_defx_line'} = {
'cmdname' => 'deffnx',
'extra' => {
'def_command' => 'deffn',
+ 'def_parsed_hash' => {
+ 'category' => {},
+ 'name' => {}
+ },
+ 'index_entry' => {
+ 'content_normalized' => [
+ {}
+ ],
+ 'entry_content' => [
+ {}
+ ],
+ 'entry_element' => {},
+ 'entry_number' => 2,
+ 'in_code' => 1,
+ 'index_at_command' => 'deffnx',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'fn',
+ 'index_type_command' => 'deffn'
+ },
'original_def_cmdname' => 'deffnx'
},
'info' => {
@@ -196,6 +238,11 @@
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'content_normalized'}[0]
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_content'}[0]
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2];
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'index_entry'}{'entry_element'}
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[0];
+$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'def_parsed_hash'}{'category'}
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'def_parsed_hash'}{'name'}
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'content_normalized'}[0]
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'entry_content'}[0]
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[2];
+$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'index_entry'}{'entry_element'}
=
$result_trees{'section_on_defx_line'}{'contents'}[0]{'contents'}[0]{'contents'}[1];
$result_texis{'section_on_defx_line'} = '@deffn h j k l
@deffnx a b @section s
@@ -206,6 +253,7 @@ Something
$result_texts{'section_on_defx_line'} = 'h: j k l
+a: b
1 s
===
@@ -259,6 +307,15 @@ $result_errors{'section_on_defx_line'} = [
'text' => '@section should not appear in @deffnx',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: entry for index `fn\' outside of any node
+',
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => '',
+ 'text' => 'entry for index `fn\' outside of any node',
+ 'type' => 'warning'
+ },
{
'error_line' => '@section seen before @end deffn
',
@@ -285,9 +342,32 @@ $result_floats{'section_on_defx_line'} = {};
$result_indices_sort_strings{'section_on_defx_line'} = {
'fn' => [
+ 'b',
'j'
]
};
+
+$result_converted{'plaintext'}->{'section_on_defx_line'} = ' -- h: j k l
+ -- a: b
+
+1 s
+===
+
+Something
+
+';
+
+
+$result_converted{'xml'}->{'section_on_defx_line'} = '<deffn spaces="
"><definitionterm><indexterm index="fn"
number="1">j</indexterm><defcategory>h</defcategory>
<deffunction>j</deffunction> <defparam>k</defparam> <defparam>l</defparam>
</definitionterm>
+<deffnx spaces=" "><definitionterm><indexterm index="fn"
number="2">b</indexterm><defcategory>a</defcategory>
<deffunction>b</deffunction> </definitionterm></deffnx>
+</deffn>
+<section spaces=" "><sectiontitle>s</sectiontitle>
+
+<para>Something
+</para>
+</section>
+';
+
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Gather tree information when closing incorrectly nested @def* lines,
Patrice Dumas <=