line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Liquid::Tag::Unless; |
2
|
|
|
|
|
|
|
our $VERSION = '1.0.23'; |
3
|
25
|
|
|
25
|
|
180
|
use strict; |
|
25
|
|
|
|
|
70
|
|
|
25
|
|
|
|
|
798
|
|
4
|
25
|
|
|
25
|
|
148
|
use warnings; |
|
25
|
|
|
|
|
81
|
|
|
25
|
|
|
|
|
977
|
|
5
|
|
|
|
|
|
|
require Template::Liquid::Error; |
6
|
|
|
|
|
|
|
require Template::Liquid::Utility; |
7
|
25
|
|
|
25
|
|
152
|
use base 'Template::Liquid::Tag::If'; |
|
25
|
|
|
|
|
59
|
|
|
25
|
|
|
|
|
6961
|
|
8
|
25
|
|
|
25
|
|
89
|
sub import { Template::Liquid::register_tag('unless') } |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub render { |
11
|
42
|
|
|
42
|
0
|
80
|
my ($s) = @_; |
12
|
|
|
|
|
|
|
return $s->{'blocks'}->[0]->render() |
13
|
41
|
100
|
|
|
|
108
|
if !(grep { $_->is_true ? 1 : 0 } |
14
|
42
|
100
|
|
|
|
57
|
@{$s->{'blocks'}->[0]->{'conditions'}}); |
|
42
|
|
|
|
|
106
|
|
15
|
15
|
|
|
|
|
28
|
for my $index (1 .. $#{$s->{'blocks'}}) { |
|
15
|
|
|
|
|
70
|
|
16
|
4
|
|
|
|
|
10
|
my $block = $s->{'blocks'}->[$index]; |
17
|
4
|
100
|
|
|
|
6
|
return $block->render() if grep { $_ || 0 } @{$block->{'conditions'}}; |
|
4
|
100
|
|
|
|
12
|
|
|
4
|
|
|
|
|
8
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding UTF-8 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=begin stopwords |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Lütke jadedPixel |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=end stopwords |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Template::Liquid::Tag::Unless - Unless: The Opposite of If |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 Description |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Unless is the opposite of L<if|Template::Liquid::Tag::If>. The block is |
39
|
|
|
|
|
|
|
rendered I<unless> the condition is true. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 Synopsis |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
{% unless value == 5 %} |
44
|
|
|
|
|
|
|
Doesn't equal five! |
45
|
|
|
|
|
|
|
{% else %} |
46
|
|
|
|
|
|
|
Aww... it does equal five. |
47
|
|
|
|
|
|
|
{% endunless %} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 Bugs |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Since L<unless|Template::Liquid::Tag::Unless> is simply a subclass, see the |
52
|
|
|
|
|
|
|
list of bugs for L<if|Template::Liquid::Tag::If>. They basically apply here |
53
|
|
|
|
|
|
|
too. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 See Also |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
See L<Template::Liquid::Condition|Template::Liquid::Condition> for a list of |
58
|
|
|
|
|
|
|
supported inequalities. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 Author |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The original Liquid template system was developed by jadedPixel |
65
|
|
|
|
|
|
|
(http://jadedpixel.com/) and Tobias Lütke (http://blog.leetsoft.com/). |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 License and Legal |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Copyright (C) 2009-2022 by Sanko Robinson E<lt>sanko@cpan.orgE<gt> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
72
|
|
|
|
|
|
|
the terms of The Artistic License 2.0. See the F<LICENSE> file included with |
73
|
|
|
|
|
|
|
this distribution or http://www.perlfoundation.org/artistic_license_2_0. For |
74
|
|
|
|
|
|
|
clarification, see http://www.perlfoundation.org/artistic_2_0_notes. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
When separated from the distribution, all original POD documentation is covered |
77
|
|
|
|
|
|
|
by the Creative Commons Attribution-Share Alike 3.0 License. See |
78
|
|
|
|
|
|
|
http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For clarification, |
79
|
|
|
|
|
|
|
see http://creativecommons.org/licenses/by-sa/3.0/us/. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |