Improve reporting of odd tempalte behaviour
This commit is contained in:
parent
6182b9aec1
commit
22b2ef875a
@ -123,7 +123,7 @@ package Webperl::Template;
|
|||||||
use experimental qw(smartmatch);
|
use experimental qw(smartmatch);
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
use Webperl::Utils qw(path_join superchomp);
|
use Webperl::Utils qw(path_join superchomp);
|
||||||
use Carp qw(longmess);
|
use Carp qw(longmess carp);
|
||||||
use HTML::WikiConverter;
|
use HTML::WikiConverter;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
use v5.12;
|
use v5.12;
|
||||||
@ -516,10 +516,16 @@ sub process_template {
|
|||||||
my $varmap = shift;
|
my $varmap = shift;
|
||||||
my $nocharfix = shift;
|
my $nocharfix = shift;
|
||||||
|
|
||||||
|
carp("No text passed to process_template")
|
||||||
|
unless($text);
|
||||||
|
|
||||||
# If text is a reference already, we can just use it. Otherwise we need
|
# If text is a reference already, we can just use it. Otherwise we need
|
||||||
# to make a reference to the text to simplify the code in the loop below.
|
# to make a reference to the text to simplify the code in the loop below.
|
||||||
my $textref = ref($text) ? $text : \$text;
|
my $textref = ref($text) ? $text : \$text;
|
||||||
|
|
||||||
|
carp("No text passed to process_template")
|
||||||
|
unless($$textref);
|
||||||
|
|
||||||
# replace all the keys in the text with the appropriate value.
|
# replace all the keys in the text with the appropriate value.
|
||||||
my ($key, $value, $count);
|
my ($key, $value, $count);
|
||||||
my $limit = 0;
|
my $limit = 0;
|
||||||
@ -551,6 +557,9 @@ sub process_template {
|
|||||||
|
|
||||||
# Convert horrible smart quote crap from windows
|
# Convert horrible smart quote crap from windows
|
||||||
foreach my $char (keys(%$entities)) {
|
foreach my $char (keys(%$entities)) {
|
||||||
|
carp("Error replacing entitiy: $char, no replacement.")
|
||||||
|
if(!$char || !$entities -> {$char});
|
||||||
|
|
||||||
$$textref =~ s/$char/$entities->{$char}/g;
|
$$textref =~ s/$char/$entities->{$char}/g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user