[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Convert/XML.pm t/08misc...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Convert/XML.pm t/08misc... |
Date: |
Sat, 10 Sep 2011 11:17:28 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/09/10 11:17:27
Modified files:
tp : TODO
tp/Texinfo/Convert: XML.pm
tp/t : 08misc_commands.t
tp/t/results/coverage: cartouche.pl table_command_comment.pl
tp/t/results/misc_commands: comment_space_command_on_line.pl
setfilename.pl
tp/t/results/xtable: table_nested.pl
Log message:
Handle correctly comments on misc command lines.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.165&r2=1.166
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/cartouche.pl?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/table_command_comment.pl?cvsroot=texinfo&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/comment_space_command_on_line.pl?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/setfilename.pl?cvsroot=texinfo&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xtable/table_nested.pl?cvsroot=texinfo&r1=1.12&r2=1.13
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -b -r1.165 -r1.166
--- TODO 7 Sep 2011 23:17:44 -0000 1.165
+++ TODO 10 Sep 2011 11:17:26 -0000 1.166
@@ -7,6 +7,11 @@
formatting command that inserts nothing before and a colon after the
argument to address@hidden'.
+In xml output, as can be seen in xtable/table_nested macro output do
+not begin with an end of line
+ <macro>@vtable @asis
+Is it right or not?
+
Mail Karl about Xref Command Expansion
Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- Texinfo/Convert/XML.pm 8 Sep 2011 22:53:10 -0000 1.23
+++ Texinfo/Convert/XML.pm 10 Sep 2011 11:17:26 -0000 1.24
@@ -361,7 +361,8 @@
if ($index_entry->{'in_code'});
$result .= $self->_convert({'contents' => $index_entry->{'content'}});
pop @{$self->{'document_context'}};
- return $result ."</indexterm>"
+ $result .= "</indexterm>";
+ return $result;
}
return '';
}
@@ -378,8 +379,16 @@
and ($contents_possible_comment->[-1]->{'cmdname'} eq 'c'
or $contents_possible_comment->[-1]->{'cmdname'} eq 'comment')) {
$end_line = $self->_convert($contents_possible_comment->[-1]);
- } else {
+ } elsif ($contents_possible_comment
+ and $contents_possible_comment->[-1]->{'text'}) {
+ my $text = $contents_possible_comment->[-1]->{'text'};
+ if (chomp($text)) {
$end_line = "\n";
+ } else {
+ $end_line = '';
+ }
+ } else {
+ $end_line = '';
}
return $end_line;
}
@@ -418,8 +427,11 @@
if ($comment) {
$end_line = $self->_convert($comment);
} else {
- chomp($converted);
+ if (chomp($converted)) {
$end_line = "\n";
+ } else {
+ $end_line = "";
+ }
}
return ($converted, $end_line);
}
@@ -568,7 +580,14 @@
$attribute = " command=\"$root->{'cmdname'}\"";
}
$attribute .= "
index=\"$root->{'extra'}->{'index_entry'}->{'index_name'}\"";
- return
"<$element${attribute}>".$self->_index_entry($root)."</$element>\n";
+ my $end_line;
+ if ($root->{'args'}->[0]) {
+ $end_line =
$self->_end_line_or_comment($root->{'args'}->[0]->{'contents'});
+ } else {
+ # May that happen?
+ $end_line = '';
+ }
+ return
"<$element${attribute}>".$self->_index_entry($root)."</$element>${end_line}";
} elsif (exists($xml_misc_commands{$root->{'cmdname'}})) {
my $command = $root->{'cmdname'};
my $type = $xml_misc_commands{$root->{'cmdname'}};
@@ -581,13 +600,8 @@
. $self->xml_protect_text($root->{'extra'}->{'text_arg'})
."\"";
}
}
- my $arg = $self->_convert($root->{'args'}->[0]);
- my $end_line;
- if (chomp ($arg)) {
- $end_line = "\n";
- } else {
- $end_line = "";
- }
+ my ($arg, $end_line)
+ = $self->_convert_argument_and_end_line($root->{'args'}->[0]);
return "<$command${attribute}>$arg</$command>$end_line";
} elsif ($type eq 'line') {
if ($root->{'cmdname'} eq 'node') {
@@ -633,13 +647,8 @@
}
$result .= "<$command${attribute}>\n";
if ($root->{'args'} and $root->{'args'}->[0]) {
- my $arg = $self->_convert($root->{'args'}->[0]);
- my $end_line;
- if (chomp ($arg)) {
- $end_line = "\n";
- } else {
- $end_line = "";
- }
+ my ($arg, $end_line)
+ = $self->_convert_argument_and_end_line($root->{'args'}->[0]);
$result .= "<sectiontitle>$arg</sectiontitle>$end_line"
}
} else {
@@ -649,13 +658,8 @@
and defined($root->{'extra'}->{'type'}->{'normalized'})) {
$attribute = "
type=\"$root->{'extra'}->{'type'}->{'normalized'}\"";
}
- my $arg = $self->_convert($root->{'args'}->[0]);
- my $end_line;
- if (chomp ($arg)) {
- $end_line = "\n";
- } else {
- $end_line = "";
- }
+ my ($arg, $end_line)
+ = $self->_convert_argument_and_end_line($root->{'args'}->[0]);
return "<$command${attribute}>$arg</$command>$end_line";
}
} elsif ($type eq 'skipline' or $type eq 'noarg') {
@@ -717,7 +721,13 @@
$arg_index++;
}
}
- return "<$command${attribute}></$command>\n";
+ my $end_line;
+ if ($root->{'args'}->[0] and $root->{'args'}->[0]->{'contents'}) {
+ $end_line =
$self->_end_line_or_comment($root->{'args'}->[0]->{'contents'})
+ } else {
+ $end_line = "\n";
+ }
+ return "<$command${attribute}></$command>$end_line";
}
} elsif ($root->{'type'}
and $root->{'type'} eq 'definfoenclose_command') {
@@ -819,6 +829,7 @@
$self->{'document_context'}->[-1]->{'code'}++ if ($in_code);
my $arg;
if ($arg_index+1 eq scalar(@{$root->{'args'}})) {
+ # last argument
($arg, $end_line)
=
$self->_convert_argument_and_end_line($root->{'args'}->[$arg_index]);
} else {
@@ -975,7 +986,17 @@
if ($root->{'cmdname'}
and exists($Texinfo::Common::block_commands{$root->{'cmdname'}})) {
#$result .= "</$root->{'cmdname'}>\n";
- $result .= "\n";
+ my $end_command = $root->{'extra'}->{'end_command'};
+ my $end_line;
+ if ($end_command) {
+ $end_line
+ = $self->_end_line_or_comment($end_command->{'args'}->[0]->{'contents'})
+ if ($end_command->{'args'}->[0]
+ and $end_command->{'args'}->[0]->{'contents'});
+ } else {
+ $end_line = "\n";
+ }
+ $result .= $end_line;
if ($context_block_commands{$root->{'cmdname'}}) {
pop @{$self->{'document_context'}};
}
Index: t/08misc_commands.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/08misc_commands.t,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- t/08misc_commands.t 13 Aug 2011 15:33:04 -0000 1.22
+++ t/08misc_commands.t 10 Sep 2011 11:17:27 -0000 1.23
@@ -97,7 +97,7 @@
@setfilename file_space_comment @c comment
@setfilename @ @verb{: name :}@
-'],
+', {'test_formats' => ['xml']}],
['bye',
'@bye
'],
@@ -441,7 +441,10 @@
foreach my $test (@converted_test_cases) {
push @{$test->[2]->{'test_formats'}}, 'plaintext';
push @{$test->[2]->{'test_formats'}}, 'html_text';
- push @{$test->[2]->{'test_formats'}}, 'info' if ($info_tests{$test->[0]});
+ if ($info_tests{$test->[0]}) {
+ push @{$test->[2]->{'test_formats'}}, 'info';
+ push @{$test->[2]->{'test_formats'}}, 'xml';
+ }
}
our ($arg_test_case, $arg_generate, $arg_debug);
Index: t/results/coverage/cartouche.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/cartouche.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/results/coverage/cartouche.pl 6 Sep 2011 20:20:45 -0000 1.12
+++ t/results/coverage/cartouche.pl 10 Sep 2011 11:17:27 -0000 1.13
@@ -115,7 +115,6 @@
$result_converted{'xml'}->{'cartouche'} = '<cartouche>
<para>in cartouche.
-</para></cartouche>
-';
+</para></cartouche>';
1;
Index: t/results/coverage/table_command_comment.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/coverage/table_command_comment.pl,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- t/results/coverage/table_command_comment.pl 7 Sep 2011 23:17:45 -0000
1.32
+++ t/results/coverage/table_command_comment.pl 10 Sep 2011 11:17:27 -0000
1.33
@@ -199,7 +199,6 @@
$result_converted{'xml'}->{'table_command_comment'} = '<table
commandarg="@code"><!-- in comment -->
<tableentry><tableterm><item><itemformat
command="@code">item</itemformat></item>
-</tableterm></tableentry></table>
-';
+</tableterm></tableentry></table>';
1;
Index: t/results/misc_commands/comment_space_command_on_line.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/misc_commands/comment_space_command_on_line.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/results/misc_commands/comment_space_command_on_line.pl 4 Sep 2011
12:14:06 -0000 1.12
+++ t/results/misc_commands/comment_space_command_on_line.pl 10 Sep 2011
11:17:27 -0000 1.13
@@ -965,4 +965,32 @@
End Tag Table
';
+
+$result_converted{'xml'}->{'comment_space_command_on_line'} =
'<settitle>Settitle <spacecmd type="spc"/></settitle><!-- settittle -->
+
+<node name="Top">
+<nodename>Top</nodename>
+<nodeup automatic="on">(dir)</nodeup>
+</node>
+<top>
+<sectiontitle>top element<spacecmd type="spc"/> </sectiontitle><!-- @top -->
+
+<frenchspacing value="on"></frenchspacing><!-- comment frenchspacing -->
+
+<cindex index="cp"><indexterm index="cp">index entry <spacecmd
type="spc"/></indexterm></cindex><!-- index entry -->
+
+<heading>Heading <spacecmd type="spc"/> </heading><!-- heading -->
+
+<printindex value="cp"></printindex><!-- printindex -->
+
+<float name="label"
type="Text"><floattype>Text</floattype><floatname>label</floatname>
+<para>float
+</para></float>
+
+<listoffloats type="Text--">Text <spacecmd type="spc"/></listoffloats><!--
listoffloats -->
+
+</top>
+<bye></bye>
+';
+
1;
Index: t/results/misc_commands/setfilename.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/misc_commands/setfilename.pl,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- t/results/misc_commands/setfilename.pl 3 Jul 2011 14:51:00 -0000
1.17
+++ t/results/misc_commands/setfilename.pl 10 Sep 2011 11:17:27 -0000
1.18
@@ -285,4 +285,12 @@
];
+
+$result_converted{'xml'}->{'setfilename'} = '<setfilename
file="file_comment">file_comment</setfilename><!-- comment -->
+<setfilename file="file_and_spaces">file_and_spaces </setfilename>
+<setfilename file="file_space_comment">file_space_comment </setfilename><!--
comment -->
+<setfilename file=" name "><spacecmd type="spc"/><verb delimiter=":"> name
</verb><spacecmd type="spc"/></setfilename>
+
+';
+
1;
Index: t/results/xtable/table_nested.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/xtable/table_nested.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/results/xtable/table_nested.pl 8 Sep 2011 22:53:11 -0000 1.12
+++ t/results/xtable/table_nested.pl 10 Sep 2011 11:17:27 -0000 1.13
@@ -3285,8 +3285,7 @@
';
-$result_converted{'xml'}->{'table_nested'} = '<macro>
address@hidden @asis
+$result_converted{'xml'}->{'table_nested'} = '<macro>@vtable @asis
@item first item
@itemx second itemx
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp TODO Texinfo/Convert/XML.pm t/08misc...,
Patrice Dumas <=