[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/HTML.pm t/html_tests...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/HTML.pm t/html_tests... |
Date: |
Wed, 13 Jul 2011 20:58:55 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/07/13 20:58:55
Modified files:
tp/Texinfo/Convert: HTML.pm
tp/t : html_tests.t test_utils.pl
Added files:
tp/t/results/html_tests: raw_html.pl
Log message:
Correctly pass expanded formats in tests.
Don't protect raw text.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.103&r2=1.104
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/html_tests.t?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/html_tests/raw_html.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.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- Texinfo/Convert/HTML.pm 13 Jul 2011 14:49:09 -0000 1.103
+++ Texinfo/Convert/HTML.pm 13 Jul 2011 20:58:54 -0000 1.104
@@ -3189,6 +3189,7 @@
my $command = shift;
my $text = shift;
+ return $text if ($type and $type eq 'raw');
$text = uc($text) if ($self->in_upper_case());
$text = $self->xml_protect_text($text);
if ($self->get_conf('ENABLE_ENCODING') and
Index: t/html_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/html_tests.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/html_tests.t 12 Jul 2011 08:41:22 -0000 1.2
+++ t/html_tests.t 13 Jul 2011 20:58:55 -0000 1.3
@@ -23,7 +23,12 @@
@example
@image{f--ile,,,alt @b{in b}}
@end example
-']
+'],
+['raw_html',
+'@html
+<i>
address@hidden html
+'],
);
foreach my $test (@test_cases) {
Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- t/test_utils.pl 9 Jul 2011 06:35:39 -0000 1.85
+++ t/test_utils.pl 13 Jul 2011 20:58:55 -0000 1.86
@@ -125,9 +125,9 @@
my $name = shift;
my $generate = shift;
my $debug = shift;
- my $formats = shift;
+ my $test_formats = shift;
my $test = {'name' => $name, 'generate' => $generate,
- 'DEBUG' => $debug, 'test_formats' => $formats};
+ 'DEBUG' => $debug, 'test_formats' => $test_formats};
if ($generate) {
mkdir "t/results/$name" if (! -d "t/results/$name");
@@ -199,13 +199,19 @@
sub filter_elements_keys {[grep {!$avoided_keys_elements{$_}}
( sort keys %{$_[0]} )] }
-sub convert_to_plaintext($$$;$)
+sub convert_to_plaintext($$$$$;$)
{
my $self = shift;
+ my $format = shift;
my $tree = shift;
my $parser = shift;
+ my $parser_options = shift;
my $converter_options = shift;
- $converter_options = {} if (!defined($converter_options));
+ if (!defined($converter_options)) {
+ $converter_options = {};
+ $converter_options->{'expanded_formats'} = [$format]
+ if (!defined($parser_options->{'expanded_formats'}));
+ }
my $converter =
Texinfo::Convert::Plaintext->converter({'DEBUG' => $self->{'DEBUG'},
'parser' => $parser,
@@ -216,13 +222,20 @@
return ($errors, $result);
}
-sub convert_to_info($$$;$)
+sub convert_to_info($$$$$;$)
{
my $self = shift;
+ my $format = shift;
my $tree = shift;
my $parser = shift;
+ my $parser_options = shift;
my $converter_options = shift;
- $converter_options = {} if (!defined($converter_options));
+ if (!defined($converter_options)) {
+ $converter_options = {};
+ # FIXME plaintext too?
+ $converter_options->{'expanded_formats'} = [$format]
+ if (!defined($parser_options->{'expanded_formats'}));
+ }
my $converter =
Texinfo::Convert::Info->converter ({'DEBUG' => $self->{'DEBUG'},
'parser' => $parser,
@@ -235,13 +248,19 @@
return ($errors, $result);
}
-sub convert_to_html($$$;$)
+sub convert_to_html($$$$$;$)
{
my $self = shift;
+ my $format = shift;
my $tree = shift;
my $parser = shift;
+ my $parser_options = shift;
my $converter_options = shift;
- $converter_options = {} if (!defined($converter_options));
+ if (!defined($converter_options)) {
+ $converter_options = {};
+ $converter_options->{'expanded_formats'} = [$format]
+ if (!defined($parser_options->{'expanded_formats'}));
+ }
my $converter =
Texinfo::Convert::HTML->converter ({'DEBUG' => $self->{'DEBUG'},
'parser' => $parser,
@@ -254,11 +273,13 @@
return ($errors, $result);
}
-sub debugcount($$$;$)
+sub debugcount($$$$$;$)
{
my $self = shift;
+ my $format = shift;
my $tree = shift;
my $parser = shift;
+ my $parser_options = shift;
my $converter_options = shift;
$converter_options = {} if (!defined($converter_options));
my $converter =
@@ -277,7 +298,7 @@
my $test_case = shift;
my $parser_options = {};
- my $converter_options = {};
+ my $converter_options = undef;
my ($test_name, $test_text);
my $tests_count = 0;
@@ -357,7 +378,8 @@
foreach my $format (@tested_formats) {
if (defined($formats{$format})) {
($converted_errors{$format}, $converted{$format})
- = &{$formats{$format}}($self, $result, $parser, $converter_options);
+ = &{$formats{$format}}($self, $format, $result, $parser,
+ $parser_options, $converter_options);
$converted_errors{$format} = undef if (address@hidden);
#print STDERR "$format: \n$converted{$format}";
}
Index: t/results/html_tests/raw_html.pl
===================================================================
RCS file: t/results/html_tests/raw_html.pl
diff -N t/results/html_tests/raw_html.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/html_tests/raw_html.pl 13 Jul 2011 20:58:55 -0000 1.1
@@ -0,0 +1,128 @@
+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{'raw_html'} = {
+ 'contents' => [
+ {
+ 'cmdname' => 'html',
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => '<i>
+',
+ 'type' => 'raw'
+ }
+ ],
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ }
+ ],
+ 'type' => 'text_root'
+};
+$result_trees{'raw_html'}{'contents'}[0]{'contents'}[0]{'extra'}{'command'} =
$result_trees{'raw_html'}{'contents'}[0];
+$result_trees{'raw_html'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'raw_html'}{'contents'}[0];
+$result_trees{'raw_html'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'raw_html'}{'contents'}[0];
+$result_trees{'raw_html'}{'contents'}[0]{'parent'} = $result_trees{'raw_html'};
+$result_trees{'raw_html'}{'contents'}[1]{'extra'}{'command'} =
$result_trees{'raw_html'}{'contents'}[0];
+$result_trees{'raw_html'}{'contents'}[1]{'parent'} = $result_trees{'raw_html'};
+
+$result_texis{'raw_html'} = '@html
+<i>
address@hidden html
+';
+
+
+$result_texts{'raw_html'} = '';
+
+$result_errors{'raw_html'} = [];
+
+
+
+$result_converted{'html'}->{'raw_html'} = '<!DOCTYPE html PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Created by texi2html, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="texi2html">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smalllisp {margin-left: 3.2em}
+pre.display {font-family: serif}
+pre.format {font-family: serif}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: serif; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: serif; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:pre}
+span.nolinebreak {white-space:pre}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#800080" alink="#FF0000">
+
+<i><p>
+
+
+</p>
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'raw_html'} = [
+ {
+ 'error_line' => 'warning: Must specify a title with a title command or @top
+',
+ 'text' => 'Must specify a title with a title command or @top',
+ 'type' => 'warning'
+ }
+];
+
+
+1;
- texinfo/tp Texinfo/Convert/HTML.pm t/html_tests...,
Patrice Dumas <=