t::lib::QA::TemplateFilters - Module used by tests and QA script to catch missing filters in template files
my $content = read_file($filename); my $new_content = t::lib::QA::TemplateFilters::fix_filters($content); my $errors = t::lib::QA::TemplateFilters::missing_filters($content);
The goal of this module is to make the subroutine reusable from the QA scripts and to not duplicate the code.
Take a template content file in parameter and return the same content with the correct (guessed) filters. It will also add the [% USE raw %] statement if it is needed.
Take a template content file in parameter and return an arrayref of errors. An error is a hashref with 3 keys, error and line, line_number. * error can be: asset_must_be_raw - When Asset is called without using raw missing_filter - When a TT variable is displayed without filter wrong_html_filter - When a TT variable is using the html filter when uri (or url) should be used instead. * line is the line where the error has been found. * line_number is the line number where the error has been found.
Jonathan Druart <firstname.lastname@example.org>
Copyright 2017 - Koha Development Team
This file is part of Koha.
Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Koha; if not, see <http://www.gnu.org/licenses>.