Index: lib/Locale/Po4a/Sgml.pm =================================================================== RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v retrieving revision 1.47 diff -u -r1.47 Sgml.pm --- lib/Locale/Po4a/Sgml.pm 8 May 2005 22:12:47 -0000 1.47 +++ lib/Locale/Po4a/Sgml.pm 8 May 2005 23:55:44 -0000 @@ -449,7 +449,19 @@ # protect the conditional inclusions in the file $origfile =~ s//{PO4A-end}/g; # cond. incl. end - + + my $tmp1 = $origfile; + $origfile = ""; + while ($tmp1 =~ m/^(.*?{PO4A-beg-[^}]*})(.+?)({PO4A-end}.*)$/s) { + my ($begin, $tmp) = ($1, $2); + $tmp1 = $3; + $tmp =~ s//{PO4A-gt}/gs; + $tmp =~ s/&/{PO4A-amp}/gs; + $origfile .= $begin.$tmp; + } + $origfile .= $tmp1; + # Deal with the %entities; in the prolog. God damn it, this code is gross! # Try hard not to change the number of lines to not fuck up the references my %prologentincl; @@ -532,7 +544,7 @@ } # Change the entities including files in the document - while ($origfile =~ /^(.*?)&([^;\s]*);(.*)$/s) { + while ($origfile =~ /^(.*?)&([A-Za-z_:][-_:.A-Za-z0-9]*?);(.*)$/s) { if (defined $entincl{$2}) { my ($begin,$key,$end)=($1,$2,$3); $end =~ s/^\s*\n//s; @@ -792,20 +804,22 @@ elsif ($event->type eq 'cdata') { my $cdata = $event->data; - if ($cdata =~ /^(({PO4A-(beg|end)[^\}]*})|\s)+$/ && + $cdata =~ s/{PO4A-lt}//g; + $cdata =~ s/{PO4A-amp}/&/g; + if ($cdata =~ /(({PO4A-(beg|end)[^\}]*})|\s)+$/ && $cdata =~ /\S/) { $cdata =~ s/\s*{PO4A-end}/\]\]>\n/g; $cdata =~ s/\s*{PO4A-beg-([^\}]+)}/pushline($cdata); } else { if (!$verb) { $cdata =~ s/\\t/ /g; $cdata =~ s/\s+/ /g; $cdata =~ s/^\s//s if $lastchar eq ' '; } - $lastchar = substr($cdata, -1, 1); - $buffer .= $cdata; } + $lastchar = substr($cdata, -1, 1); + $buffer .= $cdata; } # end of type eq 'cdata' elsif ($event->type eq 'sdata') {