[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/Info.pm t/info_tests...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/Info.pm t/info_tests... |
Date: |
Wed, 02 Feb 2011 23:50:21 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/02/02 23:50:21
Modified files:
tp/Texinfo/Convert: Info.pm
tp/t : info_tests.t
Added files:
tp/t/results/info_tests: text_before_node.pl
Log message:
Get line space before and after a @node right.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/info_tests.t?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/info_tests/text_before_node.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- Texinfo/Convert/Info.pm 2 Feb 2011 22:17:36 -0000 1.19
+++ Texinfo/Convert/Info.pm 2 Feb 2011 23:50:20 -0000 1.20
@@ -405,13 +405,21 @@
my $self = shift;
my $node = shift;
+
+ my $result = '';
+ if (!$self->{'empty_lines_count'}) {
+ $result .= "\n";
+ $self->_add_text_count("\n");
+ }
+
#Â May happen when only converting a fragment
my $output_filename = $self->{'output_filename'};
$output_filename = '' if (!defined($self->{'output_filename'}));
$self->_add_location($node);
- my $result = "\x{1F}\nFile: $output_filename, Node: ";
- $self->_add_text_count($result);
+ my $node_begin = "\x{1F}\nFile: $output_filename, Node: ";
+ $result .= $node_begin;
+ $self->_add_text_count($node_begin);
$result .= $self->convert_line({'type' => 'code',
'contents' => $node->{'extra'}->{'node_content'}});
foreach my $direction(@directions) {
@@ -435,6 +443,7 @@
$result .="\n\n";
$self->_add_text_count("\n\n");
$self->{'count_context'}->[-1]->{'lines'} = 3;
+ $self->{'empty_lines_count'} = 1;
return $result;
}
Index: t/info_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/info_tests.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/info_tests.t 29 Jan 2011 23:58:32 -0000 1.1
+++ t/info_tests.t 2 Feb 2011 23:50:21 -0000 1.2
@@ -23,7 +23,17 @@
@bye
-']);
+'],
+['text_before_node',
+'@node Top
+
address@hidden
+* chapter node::
address@hidden menu
+
+text.
address@hidden chapter node
address@hidden chapter']);
foreach my $test (@test_cases) {
$test->[2]->{'test_formats'} = ['info'];
Index: t/results/info_tests/text_before_node.pl
===================================================================
RCS file: t/results/info_tests/text_before_node.pl
diff -N t/results/info_tests/text_before_node.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/info_tests/text_before_node.pl 2 Feb 2011 23:50:21 -0000
1.1
@@ -0,0 +1,394 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors);
+
+$result_trees{'text_before_node'} = {
+ 'contents' => [
+ {
+ 'contents' => [],
+ 'parent' => {},
+ 'type' => 'text_root'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'Top'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'cmdname' => 'menu',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ },
+ {
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => '* ',
+ 'type' => 'menu_entry_leading_text'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'chapter node'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'menu_entry_node'
+ },
+ {
+ 'parent' => {},
+ 'text' => '::',
+ 'type' => 'menu_entry_separator'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'menu_entry_description'
+ }
+ ],
+ 'extra' => {
+ 'menu_entry_node' => {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'chapter-node'
+ }
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ },
+ 'parent' => {},
+ 'type' => 'menu_entry'
+ }
+ ],
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'text.
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [],
+ 'normalized' => 'Top'
+ }
+ ],
+ 'normalized' => 'Top'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'chapter node'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [],
+ 'normalized' => 'chapter-node'
+ }
+ ],
+ 'normalized' => 'chapter-node'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 8,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'chapter'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'contents' => [],
+ 'extra' => {
+ 'misc_content' => [
+ {}
+ ]
+ },
+ 'level' => 1,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 9,
+ 'macro' => ''
+ },
+ 'number' => 1,
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'text_before_node'}{'contents'}[0]{'parent'} =
$result_trees{'text_before_node'};
+$result_trees{'text_before_node'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[1]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[1]{'args'}[0]{'contents'}[2]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[1]{'args'}[0]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[0]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[0]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[1]{'contents'}[0]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[1]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[2]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[3]{'contents'}[0]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[3];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[3]{'parent'}
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'extra'}{'menu_entry_node'}{'node_content'}[0]
=
$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'args'}[1]{'contents'}[0];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[1]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[2]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[3]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[4]{'contents'}[0]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[1]{'contents'}[4];
+$result_trees{'text_before_node'}{'contents'}[1]{'contents'}[4]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'extra'}{'node_content'}[0] =
$result_trees{'text_before_node'}{'contents'}[1]{'args'}[0]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}
= $result_trees{'text_before_node'}{'contents'}[1]{'extra'}{'node_content'};
+$result_trees{'text_before_node'}{'contents'}[1]{'parent'} =
$result_trees{'text_before_node'};
+$result_trees{'text_before_node'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[2]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[2]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[2]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[2]{'args'}[0]{'contents'}[2]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[2]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[2]{'args'}[0]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[2];
+$result_trees{'text_before_node'}{'contents'}[2]{'extra'}{'node_content'}[0] =
$result_trees{'text_before_node'}{'contents'}[2]{'args'}[0]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[2]{'extra'}{'nodes_manuals'}[0]{'node_content'}
= $result_trees{'text_before_node'}{'contents'}[2]{'extra'}{'node_content'};
+$result_trees{'text_before_node'}{'contents'}[2]{'parent'} =
$result_trees{'text_before_node'};
+$result_trees{'text_before_node'}{'contents'}[3]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[3]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[3]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'text_before_node'}{'contents'}[3]{'args'}[0];
+$result_trees{'text_before_node'}{'contents'}[3]{'args'}[0]{'parent'} =
$result_trees{'text_before_node'}{'contents'}[3];
+$result_trees{'text_before_node'}{'contents'}[3]{'extra'}{'misc_content'}[0] =
$result_trees{'text_before_node'}{'contents'}[3]{'args'}[0]{'contents'}[1];
+$result_trees{'text_before_node'}{'contents'}[3]{'parent'} =
$result_trees{'text_before_node'};
+
+$result_texis{'text_before_node'} = '@node Top
+
address@hidden
+* chapter node::
address@hidden menu
+
+text.
address@hidden chapter node
address@hidden chapter';
+
+
+$result_texts{'text_before_node'} = '
+* chapter node::
+
+text.
+1 chapter
+*********
+';
+
+$result_sectioning{'text_before_node'} = {
+ 'level' => 0,
+ 'section_childs' => [
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chapter-node'
+ }
+ }
+ },
+ 'level' => 1,
+ 'number' => 1,
+ 'section_up' => {}
+ }
+ ]
+};
+$result_sectioning{'text_before_node'}{'section_childs'}[0]{'section_up'} =
$result_sectioning{'text_before_node'};
+
+$result_nodes{'text_before_node'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top'
+ },
+ 'menu_child' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {},
+ 'level' => 1,
+ 'number' => 1
+ },
+ 'normalized' => 'chapter-node'
+ },
+ 'node_prev' => {},
+ 'node_up' => {}
+ },
+ 'menus' => [
+ {
+ 'cmdname' => 'menu'
+ }
+ ],
+ 'node_next' => {},
+ 'node_up' => {
+ 'extra' => {
+ 'manual_content' => [
+ {
+ 'text' => 'dir'
+ }
+ ]
+ }
+ }
+};
+$result_nodes{'text_before_node'}{'menu_child'}{'node_prev'} =
$result_nodes{'text_before_node'};
+$result_nodes{'text_before_node'}{'menu_child'}{'node_up'} =
$result_nodes{'text_before_node'};
+$result_nodes{'text_before_node'}{'node_next'} =
$result_nodes{'text_before_node'}{'menu_child'};
+
+$result_menus{'text_before_node'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top'
+ },
+ 'menu_child' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chapter-node'
+ },
+ 'menu_up' => {},
+ 'menu_up_hash' => {
+ 'Top' => 1
+ }
+ }
+};
+$result_menus{'text_before_node'}{'menu_child'}{'menu_up'} =
$result_menus{'text_before_node'};
+
+$result_errors{'text_before_node'} = [];
+
+
+
+$result_converted{'info'}->{'text_before_node'} = 'This is , produced by
makeinfo version 4.13 from .
+
+
+File: , Node: Top, Next: chapter node, Up: (dir)
+
+* Menu:
+
+* chapter node::
+
+text.
+
+
+File: , Node: chapter node, Prev: Top, Up: Top
+
+1 chapter
+*********
+
+
+
+Tag Table:
+Node: Top52
+Node: chapter node141
+
+End Tag Table
+';
+
+1;
- texinfo/tp Texinfo/Convert/Info.pm t/info_tests...,
Patrice Dumas <=