Bugzilla – Attachment 194812 Details for
Bug 8937
Translation process removes CDATA in RSS XML
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8937: Translation process removes CDATA in RSS XML
Bug-8937-Translation-process-removes-CDATA-in-RSS-.patch (text/plain), 2.63 KB, created by
Hammat wele
on 2026-03-06 16:49:41 UTC
(
hide
)
Description:
Bug 8937: Translation process removes CDATA in RSS XML
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2026-03-06 16:49:41 UTC
Size:
2.63 KB
patch
obsolete
>From 5cf09abfae7928e618beda39c2327c705d510a43 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Fri, 6 Mar 2026 16:48:15 +0000 >Subject: [PATCH] Bug 8937: Translation process removes CDATA in RSS XML > >During template translation, CDATA sections in RSS templates are not handled consistently. >When parsing RSS content containing Template Toolkit directives inside CDATA blocks, the CDATA markers (<![CDATA[ ... ]]>) are only preserved only for the <title> tag. > >To reproduce > >1. Install the other language (i used fr-CA here) > 1.1. gulp po:update fr-CA > 1.2. /misc/translator/translate install fr-CA >2. open and compare files that contain <!CDATA in description example: > ./koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt > ./koha-tmpl/opac-tmpl/bootstrap/fr-CA/modules/opac-opensearch.tt >3. In the fr-CA file the description tag > ==> the <!CDATA is removed >3. Apply the patch >4. Repeat step 1.2, 2 and 3 > ==> the <!CDATA is not removed >--- > C4/TTParser.pm | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > >diff --git a/C4/TTParser.pm b/C4/TTParser.pm >index f1556206a56..cc61fbfae94 100644 >--- a/C4/TTParser.pm >+++ b/C4/TTParser.pm >@@ -52,7 +52,8 @@ sub peep_token { > #signature build_tokens( self, filename) > sub build_tokens { > my ( $self, $filename ) = @_; >- $self->{filename} = $filename; >+ $self->{filename} = $filename; >+ $self->{current_tag} = ''; > $self->handler( start => "start", "self, line, tagname, attr, text" ) > ; #signature is start( self, linenumber, tagname, hash of attributes, original text ) > $self->handler( text => "text", "self, line, text, is_cdata" ) >@@ -79,6 +80,10 @@ sub text { > my $work = shift; # original text > my $is_cdata = shift; > >+ if ( $self->{current_tag} ne 'script' && $self->{current_tag} ne 'style' && $is_cdata ) { >+ $work = "<![CDATA[$work]]>"; >+ } >+ > # If there is a split template toolkit tag > if ( $work =~ m/^(?:(?!\[%).)*?%\]/s ) { > my @strings = ($&); >@@ -191,6 +196,8 @@ sub start { > my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); > my %attr; > >+ $self->{current_tag} = $tag; >+ > # tags seem to be uses in an 'interesting' way elsewhere.. > for my $key (%$hash) { > next unless defined $hash->{$key}; >@@ -216,6 +223,8 @@ sub end { > my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); > my %attr; > >+ $self->{current_tag} = ''; >+ > # tags seem to be uses in an 'interesting' way elsewhere.. > for my $key (%$hash) { > next unless defined $hash->{$key}; >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8937
:
96076
|
194708
|
194718
| 194812