[Pkg-mozext-commits] [adblock-plus] 61/464: Added handling of entities in DTD files, also recognizing [link] and [/link] as placeholders now

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 2916e3c85d9d1b9b47797f4c19be46687b056f02
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Jan 11 09:29:19 2010 +0100

    Added handling of entities in DTD files, also recognizing [link] and [/link] as placeholders now
---
 LocaleTester.pm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/LocaleTester.pm b/LocaleTester.pm
index 32b62ac..6cebae1 100644
--- a/LocaleTester.pm
+++ b/LocaleTester.pm
@@ -13,6 +13,8 @@ my %keepAccessKeys = map {$_ => $_} (
 my @placeholders = (
   '--',
   '%S',
+  '[link]',
+  '[/link]',
 );
 
 sub testLocales
@@ -168,14 +170,23 @@ sub parseDTDFile
   my $PEReference = qr/%$Name;/;
   my $EntityValue = qr/\"((?:[^%&\"]|$PEReference|$Reference)*)\"|'((?:[^%&']|$PEReference|$Reference)*)'/;
 
+  sub processEntityValue
+  {
+    my $text = shift;
+    $text =~ s/&#(\d+);/chr($1)/ge;
+    $text =~ s/&#x([\da-fA-F]+);/chr(hex($1))/ge;
+    $text =~ s/'/'/g;
+    return $text;
+  }
+
   # Remove comments
   $data =~ s/<!--([^\-]|-[^\-])*-->//gs;
 
   # Process entities
   while ($data =~ /<!ENTITY$S+($Name)$S+$EntityValue$S*>/gs)
   {
-    $result{$1} = $2 || $3;
-    $result{$1} =~ s/'/'/g;
+    my ($name, $value) = ($1, $2 || $3);
+    $result{$name} = processEntityValue($value);
   }
 
   # Remove entities

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list