---
 misc/translator/TTParser.pm      |    7 ++++++-
 misc/translator/tmpl_process3.pl |   24 +++++++++++++++---------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/misc/translator/TTParser.pm b/misc/translator/TTParser.pm
index 94000bc..d5895ad 100755
--- a/misc/translator/TTParser.pm
+++ b/misc/translator/TTParser.pm
@@ -42,7 +42,7 @@ sub build_tokens{
     $self->handler(end => "end", "self, line, tag, attr, text"); #signature is 
end( self, linenumber, tagename, origional text )
     $self->handler(declaration => "declaration", "self, line, text, 
is_cdata"); # declaration
     $self->handler(comment => "comment", "self, line, text, is_cdata"); # 
comments
-    $self->handler(default => "default", "self, line, text, is_cdata"); # 
anything else
+#    $self->handler(default => "default", "self, line, text, is_cdata"); # 
anything else
     $self->marked_sections(1); #treat anything inside CDATA tags as text, 
should really make it a TmplTokenType::CDATA
     $self->unbroken_text(1); #make contiguous whitespace into a single token 
(can span multiple lines)
     $self->parse_file($filename);
@@ -120,7 +120,12 @@ sub start{
     # tags seem to be uses in an 'interesting' way elsewhere..
     for my $key( %$hash ) {
         next unless defined $hash->{$key};
+        if ($key eq "/"){
+            $attr{+lc($key)} = [ $key, $hash->{$key}, $key."=".$hash->{$key}, 
1 ];
+            }
+        else {
         $attr{+lc($key)} = [ $key, $hash->{$key}, $key."=".$hash->{$key}, 0 ];
+            }
     }
     $t->set_attributes( \%attr );
     push @tokens, $t;
diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl
index 2a12e6b..17b6b4c 100755
--- a/misc/translator/tmpl_process3.pl
+++ b/misc/translator/tmpl_process3.pl
@@ -48,6 +48,7 @@ sub find_translation ($) {
 sub text_replace_tag ($$) {
     my($t, $attr) = @_;
     my $it;
+
     # value [tag=input], meta
     my $tag = lc($1) if $t =~ /^<(\S+)/s;
     my $translated_p = 0;
@@ -55,8 +56,8 @@ sub text_replace_tag ($$) {
     if ($attr->{$a}) {
         next if $a eq 'label' && $tag ne 'optgroup';
         next if $a eq 'content' && $tag ne 'meta';
-        next if $a eq 'value' && ($tag ne 'input'
-        || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ 
/^(?:checkbox|hidden|radio|text)$/)); # FIXME
+        next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && 
$attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME
+
         my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME
         if ($val =~ /\S/s) {
         my $s = find_translation($val);
@@ -69,17 +70,22 @@ sub text_replace_tag ($$) {
     }
     }
     if ($translated_p) {
-    $it = "<$tag"
-        . join('', map {
-            sprintf(' %s=%s', $_, $attr->{$_}->[2]) #FIXME
-        } sort {
-            $attr->{$a}->[3] <=> $attr->{$b}->[3] #FIXME
-        } keys %$attr);
+     $it = "<$tag"
+          . join('', map { if ($_ ne '/'){
+                             sprintf(' %s="%s"', $_, $attr->{$_}->[1]);
+          }
+              else {
+                  sprintf(' %s',$_);
+                  }
+                         
+              } sort {
+                  $attr->{$a}->[3] <=> $attr->{$b}->[3] #FIXME
+              } keys %$attr);
        if ($tag eq 'img'){
            $it .= ' />';
        }
        else {      
-           $it .= ' >';
+           $it .= '>';
        }
     } 
     else {
-- 
1.5.6.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to