[Po4a-devel] XHTML update

Yves Rutschle debian.anti-spam at rutschle.net
Sun Jun 11 14:14:09 UTC 2006


Hi all,

update of the Xhtml module:
- Support for new Xml behaviour (no need to define all the
  tags)
- Adapted old HTML tests to Xhtml. 22-html now tests Xhtml
  instead of Html.

In the process, I've suppressed the following files:

t/data-22/attribute.html
t/data-22/attribute_out.html
t/data-22/spaces.html
t/data-22/spaces_out.html
t/data-22/spaces.po

The patch also folds in the previous patch to Xml.pm I sent
earlier this week, which prevents Xml.pm from eating SSI
statements ( <!--# ... --> ). While it's necessary for my
application, it'll have to be moved to Xhtml.pm once the API
to modify @tag_types has been added.

Cheers,
Y.
-------------- next part --------------
? html.pl
? html.po
? mylo
? mypo
? out.po
? po4a-normalize.output
? po4a-normalize.po
? t/tmp
? t/data-22/po4a-normalize.output
? t/data-22/po4a-normalize.po
Index: lib/Locale/Po4a/Xhtml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xhtml.pm,v
retrieving revision 1.2
diff -u -r1.2 Xhtml.pm
--- lib/Locale/Po4a/Xhtml.pm	4 Sep 2005 07:09:09 -0000	1.2
+++ lib/Locale/Po4a/Xhtml.pm	11 Jun 2006 14:01:58 -0000
@@ -86,32 +86,9 @@
 	my %options = @_;
 
 	$self->SUPER::initialize(%options);
-        #$self->{options}{'tagsonly'}=1;
 	$self->{options}{'wrap'}=1;
-        $self->{options}{'doctype'}=$self->{options}{'doctype'} || 'docbook xml';
-        $self->{options}{'tags'}.='
-                 <p> 
-                 <dl> 
-                 <div> 
-                 <noscript> 
-                 <blockquote> 
-                 <form> 
-                 <hr> 
-                 <table> 
-                 <fieldset> 
-                 <address> 
-                 <h1> 
-                 <h2> 
-                 <h3> 
-                 <h4> 
-                 <h5> 
-                 <h6> 
-                 <ul> 
-                 <ol> 
-                 <li> 
-                 <pre> 
-                 <title>
- 	';
+        $self->{options}{'doctype'}=$self->{options}{'doctype'} || 'html';
+
 	$self->{options}{'inline'}.='
                 <a> 
                 <object> 
Index: lib/Locale/Po4a/Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.46
diff -u -r1.46 Xml.pm
--- lib/Locale/Po4a/Xml.pm	12 Apr 2006 23:46:01 -0000	1.46
+++ lib/Locale/Po4a/Xml.pm	11 Jun 2006 14:01:59 -0000
@@ -404,6 +404,9 @@
 ##### Generic XML tag types #####' 
 
 my @tag_types = ( 
+	{	beginning	=> "!--#",
+		end		=> "--",
+		breaking	=> 0},
 	{	beginning	=> "!--",
 		end		=> "--",
 		breaking	=> 0,
Index: t/22-html.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/22-html.t,v
retrieving revision 1.1
diff -u -r1.1 22-html.t
--- t/22-html.t	28 Nov 2004 22:38:57 -0000	1.1
+++ t/22-html.t	11 Jun 2006 14:02:00 -0000
@@ -8,30 +8,23 @@
 
 my @tests;
 
-mkdir "t/tmp" unless -e "t/tmp";
+mkdir "t/tmp" unless -e "t/tmp" or die "Can't create test directory t/tmp\n";
 
 my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
   "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
 
 push @tests, {
-  'run' => 'perl ../../po4a-gettextize -f html -m ../data-22/html.html -p html.po',
-  'test'=> "diff -u $diff_po_flags ../data-22/html.po html.po",
-  'doc' => 'General',
-}, {
-  'run' => 'perl ../../po4a-normalize -f html ../data-22/spaces.html',
-  'test'=> "diff -u $diff_po_flags ../data-22/spaces.po po4a-normalize.po".
-            "&& diff -u $diff_po_flags ../data-22/spaces_out.html po4a-normalize.output",
-  'doc' => 'Spaces',
-}, {
-  'run' => 'perl ../../po4a-gettextize -f html -m ../data-22/attribute.html -p attribute.po;'.
-           'sed "s/msgstr \"\"/msgstr \"baz\"/" attribute.po > attribute2.po;'.
-           'perl ../../po4a-translate -f html -m ../data-22/attribute.html -p attribute2.po -l attribute.html'
-  ,
-  'test'=> "diff -u $diff_po_flags ../data-22/attribute_out.html attribute.html",
-  'doc' => 'Attribute replacement'
-};
+      'run' => 'perl ../../po4a-gettextize -f xhtml -m ../data-22/html.html -p html.po',
+          'test'=> "diff -u $diff_po_flags ../data-22/html.po html.po",
+          'doc' => 'Text extraction',
+  }, {
+  'run' => 'perl ../../po4a-normalize -f xhtml ../data-22/html.html',
+  'test'=> "diff -u $diff_po_flags ../data-22/html.po po4a-normalize.po".
+            "&& diff -u $diff_po_flags ../data-22/po4a-normalize.output po4a-normalize.output",
+  'doc' => 'normalisation test',
+  };
 
-use Test::More tests => 6;
+use Test::More tests => 4;
 
 chdir "t/tmp" || die "Can't chdir to my test directory";
 
Index: t/data-22/html.html
===================================================================
RCS file: /cvsroot/po4a/po4a/t/data-22/html.html,v
retrieving revision 1.1
diff -u -r1.1 html.html
--- t/data-22/html.html	28 Nov 2004 22:38:57 -0000	1.1
+++ t/data-22/html.html	11 Jun 2006 14:02:00 -0000
@@ -15,12 +15,16 @@
                 alt="Some text" title="My picture" />
 
               <p><strong>Strong</strong>not strong</p>
+              <p><strong>Another line</strong> with space and no closing.</p>
               <p>
                 <a href="somelink.html">My link</a>,
-                <a href="nextline.html">link on next line<a>, <a href="sameline.html">line on same line</a>.
+                <a href="nextline.html">link on next line</a>, <a href="sameline.html">line on same line</a>.
       </p>
 
-      <img src="picture.jpg" alt="picture">
+      <img src="picture.jpg" alt="picture" />
+
+      and some text without a paragraph mark.
+    </div>
   </body>
 </html>
 
Index: t/data-22/html.po
===================================================================
RCS file: /cvsroot/po4a/po4a/t/data-22/html.po,v
retrieving revision 1.1
diff -u -r1.1 html.po
--- t/data-22/html.po	28 Nov 2004 22:38:57 -0000	1.1
+++ t/data-22/html.po	11 Jun 2006 14:02:00 -0000
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2004-11-28 15:24+0000\n"
+"POT-Creation-Date: 2006-06-11 15:30+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -14,62 +14,49 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING"
 
-# type: title
-#: FIXME:0
-#, no-wrap
+# type: Content of: <html><head><title>
+#: ../data-22/html.html:8
 msgid "Title string"
 msgstr ""
 
-# type: h1
-#: FIXME:0
-#, no-wrap
+# type: Content of: <html><body><div><h1>
+#: ../data-22/html.html:13
 msgid "Header"
 msgstr ""
 
-# type: img_title
-#: FIXME:0
-#, no-wrap
-msgid "My picture"
-msgstr ""
-
-# type: img_alt
-#: FIXME:0
-#, no-wrap
+# type: Attribute 'alt' of: <html><body><div><img>
+#: ../data-22/html.html:15
 msgid "Some text"
 msgstr ""
 
-# type: strong
-#: FIXME:0
-#, no-wrap
-msgid "Strong"
+# type: Attribute 'title' of: <html><body><div><img>
+#: ../data-22/html.html:15
+msgid "My picture"
 msgstr ""
 
-# type: p
-#: FIXME:0
-#, no-wrap
-msgid "not strong"
+# type: Content of: <html><body><div><p>
+#: ../data-22/html.html:17
+msgid "<strong>Strong</strong>not strong"
 msgstr ""
 
-# type: a
-#: FIXME:0
-#, no-wrap
-msgid "My link"
+# type: Content of: <html><body><div><p>
+#: ../data-22/html.html:18
+msgid "<strong>Another line</strong> with space and no closing."
 msgstr ""
 
-# type: a
-#: FIXME:0
-#, no-wrap
-msgid "link on next line"
+# type: Content of: <html><body><div><p>
+#: ../data-22/html.html:20
+msgid ""
+"<a href=\"somelink.html\">My link</a>, <a href=\"nextline.html\">link on "
+"next line</a>, <a href=\"sameline.html\">line on same line</a>."
 msgstr ""
 
-# type: a
-#: FIXME:0
-#, no-wrap
-msgid "line on same line"
+# type: Attribute 'alt' of: <html><body><div><img>
+#: ../data-22/html.html:24
+msgid "picture"
 msgstr ""
 
-# type: img_alt
-#: FIXME:0
-#, no-wrap
-msgid "picture"
+# type: Content of: <html><body><div>
+#: ../data-22/html.html:26
+msgid "and some text without a paragraph mark."
 msgstr ""


More information about the Po4a-devel mailing list