View | Details | Raw Unified | Return to bug 22007
Collapse All | Expand All

(-)a/t/lib/QA/TemplateFilters.pm (+4 lines)
Lines 134-139 sub process_tt_block { Link Here
134
        # Already escaped with a special filter
134
        # Already escaped with a special filter
135
        # We could escape it but should be safe
135
        # We could escape it but should be safe
136
        or $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*$}
136
        or $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*$}
137
        or $tt_block =~ m{\s?\|\s?\$Price[^\|]*$}
138
        or $tt_block =~ m{\s?\|\s?\$HtmlTags[^\|]*$}
137
139
138
        # Already escaped correctly with raw
140
        # Already escaped correctly with raw
139
        or $tt_block =~ m{\|\s?\$raw}
141
        or $tt_block =~ m{\|\s?\$raw}
Lines 166-171 sub process_tt_block { Link Here
166
      : q| |;
168
      : q| |;
167
169
168
    if (   $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*\|.*$}
170
    if (   $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*\|.*$}
171
        or $tt_block =~ m{\s?\|\s?\$Price[^\|]*\|.*$}
172
        or $tt_block =~ m{\s?\|\s?\$HtmlTags[^\|]*\|.*$}
169
    ) {
173
    ) {
170
        $tt_block =~
174
        $tt_block =~
171
          s/\s*\|\s*(uri|url|html)\s*$//;    # Could be another filter...
175
          s/\s*\|\s*(uri|url|html)\s*$//;    # Could be another filter...
(-)a/t/template_filters.t (-2 / +5 lines)
Lines 261-273 INPUT Link Here
261
    is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' );
261
    is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' );
262
};
262
};
263
263
264
subtest 'Do not escape KohaDates output' => sub {
264
subtest 'Do not escape KohaDates|Prices|HtmlTags output' => sub {
265
    plan tests => 2;
265
    plan tests => 2;
266
    my $input = <<INPUT;
266
    my $input = <<INPUT;
267
[% var | \$KohaDates %]
267
[% var | \$KohaDates %]
268
[% var | \$KohaDates with_hours => 1 %]
268
[% var | \$KohaDates with_hours => 1 %]
269
[% var | \$KohaDates | html %]
269
[% var | \$KohaDates | html %]
270
[% var | \$KohaDates with_hours => 1 | html %]
270
[% var | \$KohaDates with_hours => 1 | html %]
271
[% var | \$Price %]
272
[% var | \$HtmlTags %]
271
INPUT
273
INPUT
272
274
273
    my $expected = <<EXPECTED;
275
    my $expected = <<EXPECTED;
Lines 275-280 INPUT Link Here
275
[% var | \$KohaDates with_hours => 1 %]
277
[% var | \$KohaDates with_hours => 1 %]
276
[% var | \$KohaDates %]
278
[% var | \$KohaDates %]
277
[% var | \$KohaDates with_hours => 1 %]
279
[% var | \$KohaDates with_hours => 1 %]
280
[% var | \$Price %]
281
[% var | \$HtmlTags %]
278
EXPECTED
282
EXPECTED
279
283
280
    my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
284
    my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
281
- 

Return to bug 22007