| 1 | # ABSTRACT: The modified form of HiD::Proccessor::Handlebars we use to publish II's blog | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package HiD::Processor::IIBlog; | ||||||||||||||||||||||||||||
| 5 | 1 | our $AUTHORITY = 'cpan:GENEHACK'; | |||||||||||||||||||||||||||
| 6 | 1 | $HiD::Processor::IIBlog::VERSION = '1.96'; | |||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | extends 'HiD::Processor'; | |||||||||||||||||||||||||||
| 9 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use 5.014; # strict, unicode_strings | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use autodie; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use warnings qw/ FATAL utf8 /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use open qw/ :std :utf8 /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use charnames qw/ :full /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Text::Xslate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | has 'txs' => ( | |||||||||||||||||||||||||||
| 21 | is => 'ro' , | ||||||||||||||||||||||||||||
| 22 | isa => 'Text::Xslate' , | ||||||||||||||||||||||||||||
| 23 | required => 1 , | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # FIXME this should really probably be a builder on the 'tt' attr | ||||||||||||||||||||||||||||
| 27 | # ...which should be called something more generic | ||||||||||||||||||||||||||||
| 28 | # ...and which should get args via a second attr that's required | ||||||||||||||||||||||||||||
| 29 | sub BUILDARGS { | ||||||||||||||||||||||||||||
| 30 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my %args = ( ref $_[0] && ref $_[0] eq 'HASH' ) ? %{ $_[0] } : @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_[0] and ref $_[0] eq "HASH"
MC/DC0%0/2
ref $_[0] and ref $_[0] eq "HASH"
ref $_[0]
ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= ref $_[0]B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | my $path = [ '.' , './_layouts' ]; | |||||||||||||||||||||||||||
| 35 | 0 | ▶ | push @$path , './_includes' if -e -d './_includes'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | return { | ||||||||||||||||||||||||||||
| 38 | txs => Text::Xslate->new( | ||||||||||||||||||||||||||||
| 39 | function => { | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | commafy => sub { my $a = shift; join ',' , @$a }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | lc => sub { lc( shift ) } , | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | pretty_date => sub { shift->strftime( "%d %b %Y" ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 43 | } , | ||||||||||||||||||||||||||||
| 44 | 0 | path => $path , | |||||||||||||||||||||||||||
| 45 | ), | ||||||||||||||||||||||||||||
| 46 | }; | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | sub process { | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my( $self , $input_ref , $args , $output_ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | $$output_ref = $self->txs->render_string( $$input_ref , $args ); | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | return 1; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 58 | 1 | 1; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =pod | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 NAME | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | HiD::Processor::IIBlog - The modified form of HiD::Proccessor::Handlebars we use to publish II's blog | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | my $processor = HiD::Proccessor::IIBlog->new({ arg => $val }); | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | Wraps up a L<Text::Xslate> object and allows it to be used during HiD | ||||||||||||||||||||||||||||
| 77 | publication. | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =head1 VERSION | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | version 1.96 | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | John SJ Anderson <genehack@genehack.org> | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | This software is copyright (c) 2015 by John SJ Anderson. | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 92 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||