build: properly handle i18n tags with whitespace strip tokens in i18n-scan.pl
[project/luci.git] / build / i18n-scan.pl
index a31952b..8c01a99 100755 (executable)
@@ -24,6 +24,7 @@ sub dec_lua_str
 sub dec_tpl_str
 {
        my $s = shift;
+       $s =~ s/-$//;
        $s =~ s/[\s\n]+/ /g;
        $s =~ s/^ //;
        $s =~ s/ $//;
@@ -31,7 +32,7 @@ sub dec_tpl_str
 }
 
 
-if( open F, "find @ARGV -type f '(' -name '*.htm' -or -name '*.lua' ')' |" )
+if( open F, "find @ARGV -type f '(' -name '*.htm' -o -name '*.lua' ')' |" )
 {
        while( defined( my $file = readline F ) )
        {
@@ -71,7 +72,7 @@ if( open F, "find @ARGV -type f '(' -name '*.htm' -or -name '*.lua' ')' |" )
 
                        $text = $raw;
 
-                       while( $text =~ s/ ^ .*? <% [:_] -? /<%/sgx )
+                       while( $text =~ s/ ^ .*? <% -? [:_] /<%/sgx )
                        {
                                ( my $code, $text ) = extract_tagged($text, '<%', '%>');