Skip to content

Commit 9954935

Browse files
committed
convert templates to Text::Xslate
Text::Xslate is meant to be faster than other templating engines, and provides some other capabilities to make templates more reusable, such as template inheritance. Previously we were using Template::Alloy, but it has some inconsistent behaviors, such as either not outputting overloaded objects, or not applying automatic escaping to them, depending on which version is used.
1 parent 83e2842 commit 9954935

File tree

170 files changed

+2713
-2478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2713
-2478
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ insert_final_newline = true
2020
# There's no reason to keep this, it just seems to be the overwhelming style currently.
2121
[*.html]
2222
indent_size = 2
23+
[*.tx]
24+
indent_size = 2
2325

2426
[.travis.yml]
2527
indent_size = 2

cpanfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ requires 'Catalyst::Plugin::ConfigLoader';
1212
requires 'Catalyst::Plugin::Static::Simple';
1313
requires 'Catalyst::TraitFor::Request::REST::ForBrowsers';
1414
requires 'Catalyst::View::JSON';
15-
requires 'Catalyst::View::TT::Alloy';
15+
requires 'Catalyst::View::Xslate';
1616
requires 'CatalystX::Fastly::Role::Response', '0.06';
1717
requires 'Config::General';
1818
requires 'Config::ZOMG', '1.000000';
@@ -71,10 +71,12 @@ requires 'Plack::Session';
7171
requires 'Plack::Test';
7272
requires 'Ref::Util', '>= 0.008';
7373
requires 'Starman', '>= 0.4008';
74-
requires 'Template::Alloy', '== 1.020';
7574
requires 'Term::Size::Any';
7675
requires 'Text::MultiMarkdown';
7776
requires 'Text::Pluralize';
77+
requires 'Text::Xslate::Bridge';
78+
requires 'Text::Xslate::Bridge::Star';
79+
requires 'Text::Xslate::Util';
7880
requires 'Try::Tiny', '0.24';
7981
requires 'Type::Library';
8082
requires 'Types::Common::Numeric';
@@ -94,7 +96,6 @@ requires 'aliased', '0.34';
9496
requires 'App::Prove';
9597
requires 'Code::TidyAll', '>= 0.74';
9698
requires 'Code::TidyAll::Plugin::Test::Vars', '0.04';
97-
requires 'Path::Iterator::Rule', '1.008';
9899
requires 'Perl::Critic', '1.136';
99100
requires 'Perl::Tidy' => '20210402';
100101
requires 'Test::Code::TidyAll';

cpanfile.snapshot

Lines changed: 110 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -526,23 +526,18 @@ DISTRIBUTIONS
526526
ExtUtils::MakeMaker 0
527527
JSON::MaybeXS 1.003000
528528
MRO::Compat 0
529-
Catalyst-View-TT-Alloy-0.00007
530-
pathname: D/DJ/DJZORT/Catalyst-View-TT-Alloy-0.00007.tar.gz
529+
Catalyst-View-Xslate-0.00019
530+
pathname: D/DM/DMAKI/Catalyst-View-Xslate-0.00019.tar.gz
531531
provides:
532-
Catalyst::Helper::View::TT::Alloy 0.00007
533-
Catalyst::View::TT::Alloy 0.00007
532+
Catalyst::Helper::View::Xslate undef
533+
Catalyst::View::Xslate 0.00019
534534
requirements:
535-
Carp 0
536-
Catalyst 5.7
537-
Data::Dump 0
538-
ExtUtils::MakeMaker 0
539-
Path::Class 0
535+
Catalyst 5.8
536+
ExtUtils::MakeMaker 6.36
537+
File::Find 0
538+
Module::Build 0.38
540539
Scalar::Util 0
541-
Template::Alloy 0
542-
parent 0
543-
perl 5.006
544-
strict 0
545-
warnings 0
540+
Text::Xslate 0.1045
546541
CatalystX-Fastly-Role-Response-0.07
547542
pathname: L/LL/LLAP/CatalystX-Fastly-Role-Response-0.07.tar.gz
548543
provides:
@@ -870,6 +865,18 @@ DISTRIBUTIONS
870865
Symbol 0
871866
Test 0
872867
perl 5.006
868+
Data-MessagePack-1.01
869+
pathname: S/SY/SYOHEX/Data-MessagePack-1.01.tar.gz
870+
provides:
871+
Data::MessagePack 1.01
872+
Data::MessagePack::Boolean undef
873+
Data::MessagePack::PP undef
874+
requirements:
875+
ExtUtils::CBuilder 0
876+
Math::BigInt 1.89
877+
Module::Build 0.4005
878+
Module::Build::XSUtil 0.19
879+
perl 5.008001
873880
Data-OptList-0.110
874881
pathname: R/RJ/RJBS/Data-OptList-0.110.tar.gz
875882
provides:
@@ -2847,6 +2854,21 @@ DISTRIBUTIONS
28472854
perl 5.006
28482855
strict 0
28492856
warnings 0
2857+
Module-Build-XSUtil-0.19
2858+
pathname: H/HI/HIDEAKIO/Module-Build-XSUtil-0.19.tar.gz
2859+
provides:
2860+
Module::Build::XSUtil 0.19
2861+
requirements:
2862+
Devel::CheckCompiler 0
2863+
Devel::PPPort 0
2864+
Exporter 0
2865+
ExtUtils::CBuilder 0
2866+
File::Basename 0
2867+
File::Path 0
2868+
Module::Build 0.4005
2869+
XSLoader 0
2870+
parent 0
2871+
perl 5.008001
28502872
Module-Implementation-0.09
28512873
pathname: D/DR/DROLSKY/Module-Implementation-0.09.tar.gz
28522874
provides:
@@ -3539,6 +3561,44 @@ DISTRIBUTIONS
35393561
perl 5.008
35403562
strict 0
35413563
warnings 0
3564+
Mouse-v2.5.10
3565+
pathname: S/SK/SKAJI/Mouse-v2.5.10.tar.gz
3566+
provides:
3567+
Mouse v2.5.10
3568+
Mouse::Exporter undef
3569+
Mouse::Meta::Attribute undef
3570+
Mouse::Meta::Class undef
3571+
Mouse::Meta::Method undef
3572+
Mouse::Meta::Method::Accessor undef
3573+
Mouse::Meta::Method::Constructor undef
3574+
Mouse::Meta::Method::Delegation undef
3575+
Mouse::Meta::Method::Destructor undef
3576+
Mouse::Meta::Module undef
3577+
Mouse::Meta::Role undef
3578+
Mouse::Meta::Role::Application undef
3579+
Mouse::Meta::Role::Application::RoleSummation undef
3580+
Mouse::Meta::Role::Composite undef
3581+
Mouse::Meta::Role::Method undef
3582+
Mouse::Meta::TypeConstraint undef
3583+
Mouse::Object undef
3584+
Mouse::PurePerl undef
3585+
Mouse::Role v2.5.10
3586+
Mouse::Spec v2.5.10
3587+
Mouse::TypeRegistry undef
3588+
Mouse::Util v2.5.10
3589+
Mouse::Util::MetaRole undef
3590+
Mouse::Util::TypeConstraints undef
3591+
Squirrel undef
3592+
Squirrel::Role undef
3593+
Test::Mouse undef
3594+
ouse undef
3595+
requirements:
3596+
ExtUtils::CBuilder 0
3597+
Module::Build 0.4005
3598+
Module::Build::XSUtil 0.19
3599+
Scalar::Util 1.14
3600+
XSLoader 0.02
3601+
perl 5.008005
35423602
Mozilla-CA-20200520
35433603
pathname: A/AB/ABH/Mozilla-CA-20200520.tar.gz
35443604
provides:
@@ -3807,13 +3867,6 @@ DISTRIBUTIONS
38073867
POSIX 0
38083868
Socket 0
38093869
Time::HiRes 0
3810-
Number-Compare-0.03
3811-
pathname: R/RC/RCLAMP/Number-Compare-0.03.tar.gz
3812-
provides:
3813-
Number::Compare 0.03
3814-
requirements:
3815-
ExtUtils::MakeMaker 0
3816-
Test::More 0
38173870
Number-Format-1.75
38183871
pathname: W/WR/WRW/Number-Format-1.75.tar.gz
38193872
provides:
@@ -4253,26 +4306,6 @@ DISTRIBUTIONS
42534306
overload 0
42544307
parent 0
42554308
strict 0
4256-
Path-Iterator-Rule-1.014
4257-
pathname: D/DA/DAGOLDEN/Path-Iterator-Rule-1.014.tar.gz
4258-
provides:
4259-
PIR 1.014
4260-
Path::Iterator::Rule 1.014
4261-
requirements:
4262-
Carp 0
4263-
ExtUtils::MakeMaker 6.17
4264-
File::Basename 0
4265-
File::Spec 0
4266-
List::Util 0
4267-
Number::Compare 0.02
4268-
Scalar::Util 0
4269-
Text::Glob 0
4270-
Try::Tiny 0
4271-
if 0
4272-
perl 5.008001
4273-
strict 0
4274-
warnings 0
4275-
warnings::register 0
42764309
Path-Tiny-0.118
42774310
pathname: D/DA/DAGOLDEN/Path-Tiny-0.118.tar.gz
42784311
provides:
@@ -5122,29 +5155,6 @@ DISTRIBUTIONS
51225155
Scalar::Util 1.14
51235156
perl 5.006
51245157
strict 0
5125-
Template-Alloy-1.020
5126-
pathname: R/RH/RHANDOM/Template-Alloy-1.020.tar.gz
5127-
provides:
5128-
Template::Alloy 1.020
5129-
Template::Alloy::Compile undef
5130-
Template::Alloy::Context undef
5131-
Template::Alloy::EvalPerlHandle undef
5132-
Template::Alloy::Exception undef
5133-
Template::Alloy::HTE undef
5134-
Template::Alloy::Iterator undef
5135-
Template::Alloy::Operator undef
5136-
Template::Alloy::Parse undef
5137-
Template::Alloy::Perl undef
5138-
Template::Alloy::Play undef
5139-
Template::Alloy::Stream undef
5140-
Template::Alloy::TT undef
5141-
Template::Alloy::Tmpl undef
5142-
Template::Alloy::VMethod undef
5143-
Template::Alloy::Velocity undef
5144-
Template::Alloy::_ContextStash undef
5145-
requirements:
5146-
Digest::MD5 1
5147-
ExtUtils::MakeMaker 0
51485158
Term-Size-Any-0.002
51495159
pathname: F/FE/FERREIRA/Term-Size-Any-0.002.tar.gz
51505160
provides:
@@ -5497,15 +5507,6 @@ DISTRIBUTIONS
54975507
Exporter 0
54985508
ExtUtils::MakeMaker 0
54995509
perl 5.006
5500-
Text-Glob-0.11
5501-
pathname: R/RC/RCLAMP/Text-Glob-0.11.tar.gz
5502-
provides:
5503-
Text::Glob 0.11
5504-
requirements:
5505-
Exporter 0
5506-
ExtUtils::MakeMaker 0
5507-
constant 0
5508-
perl 5.00503
55095510
Text-Markdown-1.000031
55105511
pathname: B/BO/BOBTFISH/Text-Markdown-1.000031.tar.gz
55115512
provides:
@@ -5549,6 +5550,42 @@ DISTRIBUTIONS
55495550
ExtUtils::MakeMaker 0
55505551
Test::More 0
55515552
perl 5.008001
5553+
Text-Xslate-v3.5.8
5554+
pathname: S/SK/SKAJI/Text-Xslate-v3.5.8.tar.gz
5555+
provides:
5556+
Text::Xslate v3.5.8
5557+
Text::Xslate::Bridge undef
5558+
Text::Xslate::Bridge::Star undef
5559+
Text::Xslate::Compiler undef
5560+
Text::Xslate::Engine v3.5.8
5561+
Text::Xslate::HashWithDefault undef
5562+
Text::Xslate::PP v3.5.8
5563+
Text::Xslate::PP::Const undef
5564+
Text::Xslate::PP::Method undef
5565+
Text::Xslate::PP::Opcode v3.5.8
5566+
Text::Xslate::PP::State undef
5567+
Text::Xslate::PP::Type::Macro undef
5568+
Text::Xslate::PP::Type::Pair undef
5569+
Text::Xslate::PP::Type::Raw undef
5570+
Text::Xslate::Parser undef
5571+
Text::Xslate::Runner undef
5572+
Text::Xslate::Symbol undef
5573+
Text::Xslate::Syntax::Kolon undef
5574+
Text::Xslate::Syntax::Metakolon undef
5575+
Text::Xslate::Syntax::TTerse undef
5576+
Text::Xslate::Type::Raw undef
5577+
Text::Xslate::Util undef
5578+
requirements:
5579+
Data::MessagePack 0.38
5580+
Encode 2.26
5581+
ExtUtils::CBuilder 0
5582+
Module::Build 0.4005
5583+
Module::Build::XSUtil 0.19
5584+
Mouse v2.5.0
5585+
Scalar::Util 1.14
5586+
Storable 2.15
5587+
parent 0.221
5588+
perl 5.008001
55525589
Tie-ToObject-0.03
55535590
pathname: N/NU/NUFFIN/Tie-ToObject-0.03.tar.gz
55545591
provides:

lib/MetaCPAN/Web.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ __PACKAGE__->response_class_traits( [ qw(
2525

2626
__PACKAGE__->config(
2727
name => 'MetaCPAN::Web',
28+
default_view => 'Xslate',
2829
disable_component_resolution_regex_fallback => 1,
2930
encoding => 'UTF-8',
3031
'Plugin::Authentication' => {

lib/MetaCPAN/Web/Controller/About.pm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@ sub auto : Private {
1111
$c->add_surrogate_key('STATIC');
1212
$c->browser_max_age('1d');
1313
$c->cdn_max_age('1y');
14-
1514
}
1615

1716
sub about : Path : Args(0) {
1817
my ( $self, $c ) = @_;
19-
$c->stash( template => 'about.html' );
2018
}
2119

2220
sub contributors : Local : Args(0) {
2321
my ( $self, $c ) = @_;
24-
$c->stash( template => 'about/contributors.html' );
2522
}
2623

2724
sub contact : Local : Args(0) {
2825
my ( $self, $c ) = @_;
29-
$c->stash( template => 'about/contact.html' );
3026
}
3127

3228
sub meta_hack : Local : Args(0) {
3329
my ( $self, $c ) = @_;
34-
$c->stash( template => 'about/meta_hack.html' );
3530
}
3631

3732
sub resources : Local : Args(0) {
@@ -42,27 +37,22 @@ sub resources : Local : Args(0) {
4237

4338
sub sponsors : Local : Args(0) {
4439
my ( $self, $c ) = @_;
45-
$c->stash( template => 'about/sponsors.html' );
4640
}
4741

4842
sub development : Local : Args(0) {
4943
my ( $self, $c ) = @_;
50-
$c->stash( template => 'about/development.html' );
5144
}
5245

5346
sub missing_modules : Local : Args(0) {
5447
my ( $self, $c ) = @_;
55-
$c->stash( template => 'about/missing_modules.html' );
5648
}
5749

5850
sub faq : Local : Args(0) {
5951
my ( $self, $c ) = @_;
60-
$c->stash( template => 'about/faq.html' );
6152
}
6253

6354
sub metadata : Local : Args(0) {
6455
my ( $self, $c ) = @_;
65-
$c->stash( template => 'about/metadata.html' );
6656
}
6757

6858
sub stats : Local : Args(0) {

lib/MetaCPAN/Web/Controller/Account/Turing.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sub index : Path('') : Args(0) {
1919
} );
2020
}
2121
$c->stash( {
22-
template => 'account/turing.html',
22+
template => 'account/turing.tx',
2323
recaptcha_key => $self->public_key,
2424
} );
2525

lib/MetaCPAN/Web/Controller/Activity.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ sub index : Path : Args(0) {
1616

1717
$c->res->content_type('image/svg+xml');
1818
$c->res->headers->expires( time + 86400 );
19-
$c->stash( { data => $line->{activity}, template => 'activity.xml' } );
20-
$c->detach('View::Raw');
19+
$c->stash( {
20+
data => $line->{activity},
21+
template => 'activity.svg.tx',
22+
} );
2123
}
2224

2325
__PACKAGE__->meta->make_immutable;

lib/MetaCPAN/Web/Controller/Author.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ sub index : Chained('root') PathPart('') Args(0) {
6767
faves => $faves,
6868
releases => $releases->{releases},
6969
profiles => $profiles,
70-
template => 'author.html',
7170
took => $took,
7271
total => $releases->{total},
72+
template => 'author.tx',
7373
} );
7474

7575
$c->stash( author_country_name =>

lib/MetaCPAN/Web/Controller/ContributingDoc.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ sub get : Private {
5555
}
5656

5757
$c->stash( {
58-
template => 'contributing_not_found.html'
58+
template => 'contributing_not_found.tx',
5959
} );
6060
$c->response->status(404);
6161
}

0 commit comments

Comments
 (0)