[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.44,1.45"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Wed Apr 12 23:14:01 UTC 2006
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv14369/lib/Locale/Po4a
Modified Files:
Xml.pm
Log Message:
Add support for CDATA sections.
Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- Xml.pm 12 Apr 2006 22:33:09 -0000 1.44
+++ Xml.pm 12 Apr 2006 23:13:59 -0000 1.45
@@ -341,6 +341,9 @@
}
} elsif ($options->{'type'} eq "attribute") {
$comment = "Attribute '".$options->{'attribute'}."' of: ".$self->get_path;
+ } elsif ($options->{'type'} eq "CDATA") {
+ $comment = "CDATA";
+ $wrap = 0;
} else {
die wrap_ref_mod($ref, "po4a::xml", dgettext("po4a", "Internal error: unknown type identifier '%s'."), $options->{'type'});
}
@@ -419,6 +422,11 @@
breaking => 1,
f_extract => \&tag_extract_doctype,
f_translate => \&tag_trans_doctype},
+ { beginning => "![CDATA[",
+ end => "",
+ breaking => 1,
+ f_extract => \&CDATA_extract,
+ f_translate => \&CDATA_trans},
{ beginning => "/",
end => "",
f_breaking => \&tag_break_close,
@@ -571,6 +579,20 @@
return $self->join_lines(@tag);
}
+sub CDATA_extract {
+ my ($self,$remove)=(shift,shift);
+ my ($eof, @tag) = $self->get_string_until(']]>',{include=>1,unquoted=>1,remove=>$remove});
+
+ return ($eof, @tag);
+}
+
+sub CDATA_trans {
+ my ($self, at tag)=@_;
+ return $self->found_string($self->join_lines(@tag),
+ $tag[1],
+ {'type' => "CDATA"});
+}
+
sub tag_break_alone {
my ($self, at tag)=@_;
if ($self->tag_in_list($self->get_path."<".
More information about the Po4a-commits
mailing list