[Po4a-commits] r2314 - in /trunk: MANIFEST lib/Locale/Po4a/Xml.pm t/27-xml.t t/data-27/cdata.po t/data-27/cdata.xml

barbier-guest at users.alioth.debian.org barbier-guest at users.alioth.debian.org
Wed Nov 3 21:29:31 UTC 2010


Author: barbier-guest
Date: Wed Nov  3 21:29:29 2010
New Revision: 2314

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2314
Log:
Fix handling of CDATA text

Fixes bug#312773 on the Alioth tracker.
Add a test case in t/27-xml.t

Added:
    trunk/t/data-27/cdata.po
    trunk/t/data-27/cdata.xml
Modified:
    trunk/MANIFEST
    trunk/lib/Locale/Po4a/Xml.pm
    trunk/t/27-xml.t

Modified: trunk/MANIFEST
URL: http://svn.debian.org/wsvn/po4a/trunk/MANIFEST?rev=2314&op=diff
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Wed Nov  3 21:29:29 2010
@@ -280,6 +280,8 @@
 t/data-26/test1.ini
 
 t/27-xml.t
+t/data-27/cdata.xml
+t/data-27/cdata.po
 t/data-27/general.xml
 t/data-27/general.po
 t/data-27/general-normalized.xml

Modified: trunk/lib/Locale/Po4a/Xml.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/lib/Locale/Po4a/Xml.pm?rev=2314&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/Xml.pm (original)
+++ trunk/lib/Locale/Po4a/Xml.pm Wed Nov  3 21:29:29 2010
@@ -734,7 +734,7 @@
 		f_extract	=> \&tag_extract_doctype,
 		f_translate	=> \&tag_trans_doctype},
 	{	beginning	=> "![CDATA[",
-		end		=> "",
+		end		=> "]]",
 		breaking	=> 1,
 		f_extract	=> \&CDATA_extract,
 		f_translate	=> \&CDATA_trans},

Modified: trunk/t/27-xml.t
URL: http://svn.debian.org/wsvn/po4a/trunk/t/27-xml.t?rev=2314&op=diff
==============================================================================
--- trunk/t/27-xml.t (original)
+++ trunk/t/27-xml.t Wed Nov  3 21:29:29 2010
@@ -28,8 +28,14 @@
             ' && perl ../compare-po.pl ../data-27/options-normalized.xml po4a-normalize.output',
   'doc' => 'normalisation test',
   };
+push @tests, {
+  'run' => "perl ../../po4a-normalize -f guide ../data-27/cdata.xml",
+  'test'=> 'perl ../compare-po.pl ../data-27/cdata.po po4a-normalize.po'.
+            ' && perl ../compare-po.pl ../data-27/cdata.xml po4a-normalize.output',
+  'doc' => 'normalisation test',
+  };
 
-use Test::More tests => 6;
+use Test::More tests => 8;
 
 chdir "t/tmp" || die "Can't chdir to my test directory";
 

Added: trunk/t/data-27/cdata.po
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-27/cdata.po?rev=2314&op=file
==============================================================================
--- trunk/t/data-27/cdata.po (added)
+++ trunk/t/data-27/cdata.po Wed Nov  3 21:29:29 2010
@@ -1,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2010-11-03 22:18+0100\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"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. type: Content of: <doc><foo>
+#: ../data-27/cdata.xml:3
+#, no-wrap
+msgid "brackets ]] inside a tag "
+msgstr ""
+
+#. type: CDATA
+#: ../data-27/cdata.xml:4
+#, no-wrap
+msgid "Example on a single line"
+msgstr ""
+
+#. type: CDATA
+#: ../data-27/cdata.xml:5
+#, no-wrap
+msgid ""
+"Example on\n"
+"multiple lines\n"
+msgstr ""

Added: trunk/t/data-27/cdata.xml
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-27/cdata.xml?rev=2314&op=file
==============================================================================
--- trunk/t/data-27/cdata.xml (added)
+++ trunk/t/data-27/cdata.xml Wed Nov  3 21:29:29 2010
@@ -1,0 +1,9 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<doc>
+  <foo>brackets ]] inside a tag </foo>
+  <![CDATA[Example on a single line]]>
+  <![CDATA[
+Example on
+multiple lines
+]]>
+</doc>




More information about the Po4a-commits mailing list