[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.42,1.43"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Wed Apr 12 20:43:50 UTC 2006
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv26793/lib/Locale/Po4a
Modified Files:
Xml.pm
Log Message:
>From the XML grammar:
doctypedecl::='<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
So we must match ]\s*> when there is a Internal Subset.
This required a change in get_string_until to search not for a fixed
string but for a regular expression.
Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- Xml.pm 12 Apr 2006 19:51:48 -0000 1.42
+++ Xml.pm 12 Apr 2006 20:43:48 -0000 1.43
@@ -489,7 +489,7 @@
if (not $found) {
($eof, at tag)=$self->get_string_until('>',{include=>1,remove=>$remove,unquoted=>1});
} else {
- ($eof, at tag)=$self->get_string_until(']>',{include=>1,remove=>$remove,unquoted=>1});
+ ($eof, at tag)=$self->get_string_until(']\s*>',{include=>1,remove=>$remove,unquoted=>1,regex=>1});
}
return ($eof, at tag);
}
@@ -1269,25 +1269,27 @@
sub get_string_until {
my ($self,$search) = (shift,shift);
my $options = shift;
- my ($include,$remove,$unquoted) = (0,0,0);
+ my ($include,$remove,$unquoted, $regex) = (0,0,0,0);
if (defined($options->{include})) { $include = $options->{include}; }
if (defined($options->{remove})) { $remove = $options->{remove}; }
if (defined($options->{unquoted})) { $unquoted = $options->{unquoted}; }
+ if (defined($options->{regex})) { $regex = $options->{regex}; }
my ($line,$ref) = $self->shiftline();
my (@text,$paragraph);
my ($eof,$found) = (0,0);
+ $search = "\Q$search\E" unless $regex;
while (defined($line) and !$found) {
push @text, ($line,$ref);
$paragraph .= $line;
if ($unquoted) {
- if ( $paragraph =~ /^((\".*?\")|(\'.*?\')|[^\"\'])*\Q$search\E.*/s ) {
+ if ( $paragraph =~ /^((\".*?\")|(\'.*?\')|[^\"\'])*$search.*/s ) {
$found = 1;
}
} else {
- if ( $paragraph =~ /.*\Q$search\E.*/s ) {
+ if ( $paragraph =~ /.*$search.*/s ) {
$found = 1;
}
}
@@ -1301,16 +1303,16 @@
if ( $found ) {
$line = "";
if($unquoted) {
- $text[$#text-1] =~ /^(((\".*?\")|(\'.*?\')|[^\"\'])*?\Q$search\E)(.*)/s;
+ $text[$#text-1] =~ /^(((\".*?\")|(\'.*?\')|[^\"\'])*?$search)(.*)/s;
$text[$#text-1] = $1;
$line = $5;
} else {
- $text[$#text-1] =~ /(.*?\Q$search\E)(.*)/s;
+ $text[$#text-1] =~ /(.*?$search)(.*)/s;
$text[$#text-1] = $1;
$line = $2;
}
if(!$include) {
- $text[$#text-1] =~ /(.*)(\Q$search\E.*)/s;
+ $text[$#text-1] =~ /(.*)($search.*)/s;
$text[$#text-1] = $1;
$line = $2.$line;
}
More information about the Po4a-commits
mailing list