[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/HTML.pm t/181quotati...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/HTML.pm t/181quotati... |
Date: |
Wed, 01 Aug 2012 23:56:28 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 12/08/01 23:56:28
Modified files:
tp/Texinfo/Convert: HTML.pm
tp/t : 181quotation.t
Added files:
tp/t/results/quotation: quotation_author_in_example.pl
Log message:
Format a command in the parent context, not in the command context.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.240&r2=1.241
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/181quotation.t?cvsroot=texinfo&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/quotation/quotation_author_in_example.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -b -r1.240 -r1.241
--- Texinfo/Convert/HTML.pm 31 Jul 2012 21:54:35 -0000 1.240
+++ Texinfo/Convert/HTML.pm 1 Aug 2012 23:56:28 -0000 1.241
@@ -2474,7 +2474,7 @@
my $command = shift;
my $args = shift;
- if ($self->in_preformatted() or $self->in_string()) {
+ if ($self->in_string()) {
return $self->_convert_preformatted_type($cmdname, $command,
$args->[0]->{'normal'}."\n");
} else {
@@ -2656,13 +2656,17 @@
my $prepended_text;
if ($self->in_string()) {
if ($prepended) {
+ $self->_new_document_context('float prepended');
$prepended_text = $self->convert_tree ($prepended);
+ pop @{$self->{'document_context'}};
} else {
$prepended_text = '';
}
if ($caption) {
+ $self->_new_document_context('float caption');
$caption_text = $self->convert_tree ({'contents'
=> $caption->{'args'}->[0]->{'contents'}});
+ pop @{$self->{'document_context'}};
}
return $prepended.$content.$caption_text;
}
@@ -2696,12 +2700,16 @@
}
push @caption_contents, @caption_original_contents;
if ($new_paragraph) {
+ $self->_new_document_context('float caption');
$caption_text = $self->convert_tree ({'contents' => address@hidden);
+ pop @{$self->{'document_context'}};
$prepended_text = '';
}
}
if (!$caption_text) {
+ $self->_new_document_context('float prepended');
$prepended_text = $self->convert_tree ($prepended);
+ pop @{$self->{'document_context'}};
if ($prepended_text ne '') {
$prepended_text = '<p><strong>'.$prepended_text.'</strong></p>';
}
@@ -2713,7 +2721,9 @@
# Texinfo::Parser::_print_current ($caption)."\n";
if ($caption and !$caption_text) {
+ $self->_new_document_context('float caption');
$caption_text = $self->convert_tree ($caption->{'args'}->[0]);
+ pop @{$self->{'document_context'}};
}
return $self->_attribute_class('div','float'). '>' .$label."\n".$content.
'</div>' . $prepended_text.$caption_text;
@@ -4434,6 +4444,7 @@
{
my $self = shift;
my $cmdname = shift;
+
push @{$self->{'document_context'}},
{'cmdname' => $cmdname,
'formatting_context' => [{'cmdname' => $cmdname}],
@@ -7263,8 +7274,6 @@
$self->{'current_root_command'} = $root;
}
if (exists($self->{'commands_conversion'}->{$command_name})) {
- my $result;
- my $content_formatted;
if (exists($context_brace_commands{$command_name})) {
$self->_new_document_context($command_name);
}
@@ -7299,6 +7308,7 @@
} elsif ($command_name eq 'w') {
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'space_protected'}++;
}
+ my $content_formatted;
if ($root->{'contents'}) {
$content_formatted = $self->_convert_contents($root, $command_type);
}
@@ -7356,16 +7366,6 @@
$arg_idx++;
}
}
- if (!defined($self->{'commands_conversion'}->{$command_name})) {
- print STDERR "No command_conversion for $command_name\n";
- $result = '';
- } else {
- $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
- $command_name, $root, $args_formatted, $content_formatted);
- }
- } else {
- $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
- $command_name, $root, $content_formatted);
}
if (exists ($composition_context_commands{$command_name})) {
pop @{$self->{'document_context'}->[-1]->{'composition_context'}};
@@ -7398,18 +7398,21 @@
if (exists($context_brace_commands{$command_name})) {
pop @{$self->{'document_context'}};
}
- #if ($args_formatted) {
- # if (!defined($self->{'commands_conversion'}->{$command_name})) {
- # print STDERR "No command_conversion for $command_name\n";
- # $result = '';
- # } else {
- # $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
- # $command_name, $root, $args_formatted, $content_formatted);
- # }
- #} else {
- # $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
- # $command_name, $root, $content_formatted);
- #}
+
+ # args are formatted, now format the command itself
+ my $result;
+ if ($args_formatted) {
+ if (!defined($self->{'commands_conversion'}->{$command_name})) {
+ print STDERR "No command_conversion for $command_name\n";
+ $result = '';
+ } else {
+ $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
+ $command_name, $root, $args_formatted, $content_formatted);
+ }
+ } else {
+ $result = &{$self->{'commands_conversion'}->{$command_name}}($self,
+ $command_name, $root, $content_formatted);
+ }
return $result;
} else {
print STDERR "Unknown command `$command_name'\n"
Index: t/181quotation.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/181quotation.t,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- t/181quotation.t 12 Apr 2012 23:05:26 -0000 1.6
+++ t/181quotation.t 1 Aug 2012 23:56:28 -0000 1.7
@@ -14,6 +14,14 @@
A Note
@end quotation
'],
+['quotation_author_in_example',
+'@example
address@hidden
address@hidden Some One
+A quot---ation
address@hidden quotation
address@hidden example
+'],
['space_at_commands_end_quotation_line',
'
@quotation @@ at the end of line @
Index: t/results/quotation/quotation_author_in_example.pl
===================================================================
RCS file: t/results/quotation/quotation_author_in_example.pl
diff -N t/results/quotation/quotation_author_in_example.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/quotation/quotation_author_in_example.pl 1 Aug 2012 23:56:28
-0000 1.1
@@ -0,0 +1,271 @@
+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_elements %result_directions_text);
+
+use utf8;
+
+$result_trees{'quotation_author_in_example'} = {
+ 'contents' => [
+ {
+ 'cmdname' => 'example',
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ },
+ {
+ 'cmdname' => 'quotation',
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'Some One'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'author',
+ 'extra' => {
+ 'misc_content' => [
+ {}
+ ],
+ 'quotation' => {}
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => 'A quot---ation
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'preformatted'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'quotation'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'command' => {},
+ 'command_argument' => 'quotation',
+ 'text_arg' => 'quotation'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 5,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'extra' => {
+ 'authors' => [
+ {}
+ ],
+ 'end_command' => {}
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => ' ',
+ 'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'example'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'spaces_at_end'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'command' => {},
+ 'command_argument' => 'example',
+ 'text_arg' => 'example'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 6,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'extra' => {
+ 'end_command' => {}
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'text_root'
+};
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[0]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[0]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[2]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'extra'}{'misc_content'}[0]
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'extra'}{'quotation'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0]{'contents'}[1]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0]{'contents'}[2]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'args'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'extra'}{'command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'extra'}{'authors'}[0]
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'extra'}{'end_command'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[1]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[1]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[2]{'parent'}
=
$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'extra'}{'command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2]{'parent'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'extra'}{'end_command'}
= $result_trees{'quotation_author_in_example'}{'contents'}[0]{'contents'}[2];
+$result_trees{'quotation_author_in_example'}{'contents'}[0]{'parent'} =
$result_trees{'quotation_author_in_example'};
+
+$result_texis{'quotation_author_in_example'} = '@example
address@hidden
address@hidden Some One
+A quot---ation
address@hidden quotation
address@hidden example
+';
+
+
+$result_texts{'quotation_author_in_example'} = 'A quot---ation
+';
+
+$result_errors{'quotation_author_in_example'} = [];
+
+
+
+$result_converted{'plaintext'}->{'quotation_author_in_example'} = ' A
quot---ation
+ -- _Some One_
+';
+
+
+$result_converted{'html_text'}->{'quotation_author_in_example'} = '<div
class="example">
+<blockquote>
+<pre class="example">A quot---ation
+</pre></blockquote>
+<div align="center">--- <em>Some One</em>
+</div></div>
+';
+
+
+$result_converted{'xml'}->{'quotation_author_in_example'} = '<example>
+<quotation>
+<pre xml:space="preserve"><author>Some One</author>
+A quot---ation
+</pre></quotation>
+</example>
+';
+
+
+$result_converted{'docbook'}->{'quotation_author_in_example'} =
'<blockquote><attribution>Some One</attribution>
+<screen>A quot---ation
+</screen></blockquote>';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp Texinfo/Convert/HTML.pm t/181quotati...,
Patrice Dumas <=