package Solution::Tag; { use strict; use warnings; our @ISA = qw[Solution::Document]; our $VERSION = '0.9.1'; sub tag { return $_[0]->{'tag_name'}; } sub end_tag { return $_[0]->{'end_tag'} || undef; } sub conditional_tag { return $_[0]->{'conditional_tag'} || undef; } # Should be overridden by child classes sub new { return Solution::StandardError->new( 'Please define a constructor in ' . $_[0]); } sub push_block { return Solution::StandardError->( 'Please define a push_block method (for conditional tags) in ' . $_[0]); } } 1; =pod =head1 NAME Solution::Tag - Documentation for Solution's Standard and Custom Tagset =head1 Description Tags are used for the logic in your L. New tags are very easy to code, so I hope to get many contributions to the standard tag library after releasing this code. =head1 Standard Tagset Expanding the list of supported tags is easy but here's the current standard set: =head2 C Comment tags are simple blocks that do nothing during the L stage. Use these to temporarily disable blocks of code or do insert documentation into your source code. This is a {% comment %} secret {% endcomment %}line of text. For more, see L. =head2 C / C / C {% if post.body contains search_string %}

{{ post.title }}

...
{% endunless %} =head2 C / C / C This is sorta the opposite of C. {% unless some.value == 3 %} Well, the value sure ain't three. {% elseif some.value > 1 %} It's greater than one. {% else %} Well, is greater than one but not equal to three. Psst! It's {{some.value}}. {% endunless %} For more, see L. =head2 C TODO =head2 C TODO =head2 C TODO =head2 C TODO =head2 C TODO =head2 C TODO =head1 Extending Solution with Custom Tags To create a new tag, simply inherit from L and register your block Lregister_tag( ... )"> or locally with L. Your constructor should expect the following arguments: =over 4 =item C<$class> ...you know what to do with this. =item C<$args> This is a hash ref which contains these values (at least) =over 4 =item C The attributes within the tag. For example, given C<{% for x in (1..10)%}>, you would find C in the C value. =item C The direct parent of this new node. =item C The tag as it appears in the template. For example, given C<{% for x in (1..10)%}>, the full C would be C<{% for x in (1..10)%}>. =item C The name of the current tag. For example, given C<{% for x in (1..10)%}>, the C would be C. =item C