[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/Plaintext.pm t/19def...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/Plaintext.pm t/19def... |
Date: |
Sat, 27 Nov 2010 14:12:09 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/11/27 14:12:09
Modified files:
tp/Texinfo/Convert: Plaintext.pm
tp/t : 19def.t
tp/t/results/def: all_commands.pl all_commands_delimiters.pl
defx_after_comment.pl empty_def_command.pl
end_of_lines_protected.pl
end_of_lines_protected_in_footnote.pl
protected_brace.pl
Log message:
Simplify definition line formatting code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/19def.t?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/all_commands.pl?cvsroot=texinfo&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/all_commands_delimiters.pl?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/defx_after_comment.pl?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/empty_def_command.pl?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/end_of_lines_protected.pl?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/end_of_lines_protected_in_footnote.pl?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/def/protected_brace.pl?cvsroot=texinfo&r1=1.6&r2=1.7
Patches:
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- Texinfo/Convert/Plaintext.pm 27 Nov 2010 13:31:31 -0000 1.24
+++ Texinfo/Convert/Plaintext.pm 27 Nov 2010 14:12:07 -0000 1.25
@@ -389,8 +389,8 @@
my $current = shift;
my $arg_category = shift;
my $arg_class = shift;
- return $arg_category->[0]
- if (!defined($arg_class->[1]) or $arg_class->[1] !~ /\S/);
+ return $arg_category
+ if (!defined($arg_class));
my $style =
$Texinfo::Common::command_index_prefix{$current->{'extra'}->{'def_command'}};
@@ -400,14 +400,14 @@
# if ($self->{'debug'});
if ($style eq 'f') {
#return Texinfo::Parser::parse_texi_line (undef, "$category on $class");
- return $self->gdt('{category} on {class}', { 'category' =>
$arg_category->[0],
- 'class' => $arg_class->[0] });
+ return $self->gdt('{category} on {class}', { 'category' => $arg_category,
+ 'class' => $arg_class });
} elsif ($style eq 'v') {
#return Texinfo::Parser::parse_texi_line (undef, "$category of $class");
- return $self->gdt('{category} of {class}', { 'category' =>
$arg_category->[0],
- 'class' => $arg_class->[0] });
+ return $self->gdt('{category} of {class}', { 'category' => $arg_category,
+ 'class' => $arg_class });
}
- return $arg_category->[0];
+ return $arg_category;
}
# on top, the converter object which holds some gloal information
@@ -907,40 +907,32 @@
$paragraph = $self->new_formatter('paragraph', $conf);
push @{$self->{'formatters'}}, $paragraph;
$self->{'format_context'}->[-1]->{'paragraph_count'}++;
- } elsif ($root->{'type'} eq 'def_line') {
+ } elsif ($root->{'type'} eq 'def_line' and $root->{'extra'} and
$root->{'extra'}->{'def_args'}
+ and @{$root->{'extra'}->{'def_args'}}) {
#print STDERR "$root->{'extra'}->{'def_command'}\n";
my @args = @{$root->{'extra'}->{'def_args'}};
- my ($category, $name, $class, $type) = ('', '', '', '');
- my ($parsed_category, $parsed_name, $parsed_class, $parsed_type);
+ my ($name, $type) = ('', '');
# FIXME this is all wrong. The def should be formatted as a paragraph,
# see info.init.
- while (@args) {
- my $parsed_arg = shift @args;
- if ($parsed_arg->[0] eq 'category') {
- $parsed_category = $parsed_arg->[1];
- $category = $self->convert_unfilled($parsed_category,
{'indent_length' => 0});
- } elsif ($parsed_arg->[0] eq 'name') {
- $parsed_name = $parsed_arg->[1];
- $name = $self->convert_unfilled($parsed_name, {'indent_length' =>
0});
- } elsif ($parsed_arg->[0] eq 'class') {
- $parsed_class = $parsed_arg->[1];
- $class = $self->convert_unfilled($parsed_class, {'indent_length' =>
0});
- } elsif ($parsed_arg->[0] eq 'type') {
- $parsed_type = $parsed_arg->[1];
- $type = $self->convert_unfilled($parsed_type, {'indent_length' =>
0});
- } elsif ($parsed_arg->[0] eq 'arg' or $parsed_arg->[0] eq 'typearg'
- or $parsed_arg->[0] eq 'delimiter') {
- unshift @args, $parsed_arg;
- last;
+ foreach my $def_item ([\$name, 'name'], [\$type, 'type']) {
+ ${$def_item->[0]} =
$self->convert_unfilled($root->{'extra'}->{'def_parsed_hash'}->{$def_item->[1]},
+ {'indent_length' => 0})
+ if
(defined($root->{'extra'}->{'def_parsed_hash'}->{$def_item->[1]}));
}
+
+ while (@args) {
+ last if ($args[0]->[0] ne 'spaces'
+ and !$root->{'extra'}->{'def_parsed_hash'}->{$args[0]->[0]});
+ shift @args;
}
- print STDERR "DEF LINE(parsed) category `$category' name `$name' class
`$class' type `$type'\n"
+ print STDERR "DEF LINE(parsed) name `$name' type `$type'\n"
if ($self->{'debug'});
my $parsed_definition_category = $self->_definition_category ($root,
- [$parsed_category,
$category],
- [$parsed_class, $class]);
- my $definition_category =
$self->convert_unfilled($parsed_definition_category, {'indent_length' => 0});
+ $root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ $root->{'extra'}->{'def_parsed_hash'}->{'class'});
+ my $definition_category
+ = $self->convert_unfilled($parsed_definition_category,
{'indent_length' => 0});
my $type_name = '';
$type_name .= "$type " if ($type ne '');
$type_name .= $name if ($name ne '');
Index: t/19def.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/19def.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- t/19def.t 27 Nov 2010 11:22:32 -0000 1.8
+++ t/19def.t 27 Nov 2010 14:12:08 -0000 1.9
@@ -402,6 +402,10 @@
']
);
+foreach my $test (@test_cases) {
+ $test->[2]->{'test_formats'} = ['plaintext'];
+}
+
our ($arg_test_case, $arg_generate, $arg_debug);
run_all ('def', address@hidden, @test_invalid], $arg_test_case,
Index: t/results/def/all_commands.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/all_commands.pl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- t/results/def/all_commands.pl 27 Nov 2010 13:31:32 -0000 1.16
+++ t/results/def/all_commands.pl 27 Nov 2010 14:12:08 -0000 1.17
@@ -2479,4 +2479,60 @@
$result_errors{'all_commands'} = [];
+
+$result_converted{'plaintext'}->{'all_commands'} = ' -- c--ategory:
d--efvr_name
+ d-efvr
+
+ -- c--ategory: t--ype d--eftypefn_name a--rguments...
+ d-eftypefn
+
+ -- c--ategory on c--lass: t--ype d--eftypeop_name a--rguments...
+ d-eftypeop
+
+ -- c--ategory: t--ype d--eftypevr_name
+ d-eftypevr
+
+ -- c--ategory of c--lass: d--efcv_name
+ d-efcv
+
+ -- c--ategory on c--lass: d--efop_name a--rguments...
+ d-efop
+
+ -- c--ategory: d--eftp_name a--ttributes...
+ d-eftp
+
+ -- Function: d--efun_name a--rguments...
+ d-efun
+
+ -- Macro: d--efmac_name a--rguments...
+ d-efmac
+
+ -- Special Form: d--efspec_name a--rguments...
+ d-efspec
+
+ -- Variable: d--efvar_name
+ d-efvar
+
+ -- User Option: d--efopt_name
+ d-efopt
+
+ -- Function: t--ype d--eftypefun_name a--rguments...
+ d-eftypefun
+
+ -- Variable: t--ype d--eftypevar_name
+ d-eftypevar
+
+ -- Instance Variable of c--lass: d--efivar_name
+ d-efivar
+
+ -- Instance Variable of c--lass: t--ype d--eftypeivar_name
+ d-eftypeivar
+
+ -- Method on c--lass: d--efmethod_name a--rguments...
+ d-efmethod
+
+ -- Method on c--lass: t--ype d--eftypemethod_name a--rguments...
+ d-eftypemethod
+';
+
1;
Index: t/results/def/all_commands_delimiters.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/all_commands_delimiters.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- t/results/def/all_commands_delimiters.pl 27 Nov 2010 13:31:32 -0000
1.15
+++ t/results/def/all_commands_delimiters.pl 27 Nov 2010 14:12:08 -0000
1.16
@@ -12121,4 +12121,57 @@
$result_errors{'all_commands_delimiters'} = [];
+
+$result_converted{'plaintext'}->{'all_commands_delimiters'} = ' -- Command:
forward--char nchars argument2 argument3 (arg in brace, [something in
v--ar, in, b , comma apref p]) last
+
+ -- Variable: fill-column
+ -- Library Function: int foobar (int foo, float bar)
+ -- Library Function: int foobar (int foo, float bar) (arg in brace,
[something in v--ar, in, b , comma apref p]) ct
+
+ last
+ -- Library Function: int foobug [something
+ -- stacks: private push (s:in out stack; n:in integer) ;
;barg aarg; ; end
+ -- Global Flag: int enable
+ -- Data type: pair car cdr (arg in brace, [something in v--ar, in, b
, comma apref p]) last
+ -- Class Option of Window: border-pattern
+ -- Class Option2 of Window: `int\' border-pattern
+ -- Operation on windows: expose (arg in brace, [something in v--ar, in, b ,
comma apref p]) last
+ -- Operation2 on W,indow: `int\' expose (arg in brace, [something in v--ar,
in, b , comma apref p]) last
+ -- Operation5 on Window: `int\' expose type arg
+ -- Operation3 on W,indow: `int\' e,xpose type arg
+ -- Operation4 on ,Window: `int\' ,expose type arg
+ -- Operation6 on W,indow: `int\' e,xpose type arg
+ -- Operation7 on ,Window: `int\' ,expose type arg
+ -- Operation13 on W)indow: `int\' e)xpose type arg
+ -- Operation14 on )Window: `int\' )expose type arg
+ -- Operation16 on W)indow: `int\' e)xpose type arg
+ -- Operation17 on )Window: `int\' )expose type arg
+ -- Operation18 on W;indow: `int\' e;xpose type arg
+ -- Operation19 on ;Window: `int\' ;expose type arg
+ -- Operation20 on W;indow: `int\' e;xpose type arg
+ -- Operation21 on ;Window: `int\' ;expose type arg
+ -- Command on `com\': Window`int\' expose exp name
+ -- Function: apply function &rest arguments
+ -- A1: A2 A3 A4
+ -- `A1\': `A2\' `A3\' `A4\'
+ -- A1: A2
+ -- `A1\': `A2\'
+ -- A1: A2 A3 A4 A5
+ -- `A1\': `A2\' `A3\' `A4\' `A5\'
+ -- A1: A2 A3
+ -- `A1\': A2 `A3\'
+ -- A1: A2 A3 A4
+ -- `A1\': `A2\' `A3\' `A4\'
+ -- A1 of A2: A3
+ -- `A1\': `A2\' `A3\' `A4\' `A5\'
+ -- A1 of A2: A3 A4
+ -- `A1\' of `A2\': `A3\' `A4\'
+ -- A1 on A2: A3 A4 A5
+ -- `A1\' on `A2\': `A3\' `A4\' `A5\'
+ -- A1 on A2: A3 A4 A5 A6
+ -- `A1\' on `A2\': `A3\' `A4\' `A5\' `A6\'
+ -- code then var: ret_type fun_name `A1\' A2 `A3\' A4
+ -- var then code: ret_type1 fun_name1 A1 `A2\' A3 `A4\'
+';
+
1;
Index: t/results/def/defx_after_comment.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/defx_after_comment.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- t/results/def/defx_after_comment.pl 27 Nov 2010 13:31:32 -0000 1.15
+++ t/results/def/defx_after_comment.pl 27 Nov 2010 14:12:08 -0000 1.16
@@ -271,4 +271,9 @@
$result_errors{'defx_after_comment'} = [];
+
+$result_converted{'plaintext'}->{'defx_after_comment'} = ' -- fset: i a g
+ -- truc: bidulr machin...
+';
+
1;
Index: t/results/def/empty_def_command.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/empty_def_command.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- t/results/def/empty_def_command.pl 27 Nov 2010 13:31:32 -0000 1.15
+++ t/results/def/empty_def_command.pl 27 Nov 2010 14:12:08 -0000 1.16
@@ -300,4 +300,11 @@
$result_errors{'empty_def_command'} = [];
+
+$result_converted{'plaintext'}->{'empty_def_command'} = ' -- empty: deffn
+
+ -- empty: deffn with deffnx
+ -- empty: deffnx
+';
+
1;
Index: t/results/def/end_of_lines_protected.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/end_of_lines_protected.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- t/results/def/end_of_lines_protected.pl 27 Nov 2010 13:31:32 -0000
1.15
+++ t/results/def/end_of_lines_protected.pl 27 Nov 2010 14:12:08 -0000
1.16
@@ -281,4 +281,9 @@
$result_errors{'end_of_lines_protected'} = [];
+
+$result_converted{'plaintext'}->{'end_of_lines_protected'} = ' -- category:
deffn_name arguments more args with end of line within with 3 @ @ one last
arg
+ deffn
+';
+
1;
Index: t/results/def/end_of_lines_protected_in_footnote.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/def/end_of_lines_protected_in_footnote.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- t/results/def/end_of_lines_protected_in_footnote.pl 27 Nov 2010 13:31:32
-0000 1.15
+++ t/results/def/end_of_lines_protected_in_footnote.pl 27 Nov 2010 14:12:09
-0000 1.16
@@ -330,4 +330,7 @@
$result_errors{'end_of_lines_protected_in_footnote'} = [];
+
+$result_converted{'plaintext'}->{'end_of_lines_protected_in_footnote'} = '';
+
1;
Index: t/results/def/protected_brace.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/def/protected_brace.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- t/results/def/protected_brace.pl 27 Nov 2010 13:31:32 -0000 1.6
+++ t/results/def/protected_brace.pl 27 Nov 2010 14:12:09 -0000 1.7
@@ -111,4 +111,8 @@
$result_errors{'protected_brace'} = [];
+
+$result_converted{'plaintext'}->{'protected_brace'} = ' -- c: {
+';
+
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp Texinfo/Convert/Plaintext.pm t/19def...,
Patrice Dumas <=