Skip to content

Commit

Permalink
Split the Template::TT3::Elements libraries into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
abw committed Dec 19, 2009
1 parent b63d67e commit 95bc376
Show file tree
Hide file tree
Showing 58 changed files with 1,595 additions and 1,266 deletions.
54 changes: 41 additions & 13 deletions docs/pod/Template/TT3/Status.pod
Expand Up @@ -27,6 +27,10 @@ This is my immediate stack as of Saturday 19th December.
* T~Element::Text # subclass of literal (extract from T~Es~Text)
* ...then other elements currently in the T~Elements::* modules

Sidetracked onto cleaning up factories:

* Template::TT3::Types

=head1 ELEMENT MODULES

Elements are the basic nodes that comprise a parsed template tree. They're
Expand All @@ -53,14 +57,14 @@ These are the current element library modules. This list should eventually
dwindle to nothing as they are split up and replaced by individual element
modules.

[ ] Template::TT3::Element::Boolean
[ ] Template::TT3::Element::Core
[ ] Template::TT3::Element::Number
[ ] Template::TT3::Element::Operator
[ ] Template::TT3::Element::Punctuation
[ ] Template::TT3::Element::Structure
[ ] Template::TT3::Element::Text
[ ] Template::TT3::Element::Whitespace
[ ] Template::TT3::Elements::Boolean
[ ] Template::TT3::Elements::Core
[ ] Template::TT3::Elements::Number ** WORKING ON THIS **
[ ] Template::TT3::Elements::Operator
[ ] Template::TT3::Elements::Punctuation
[ ] Template::TT3::Elements::Structure
[ ] Template::TT3::Elements::Text ** WORKING ON THIS **
[ ] Template::TT3::Elements::Whitespace

=head2 Core Elements

Expand All @@ -72,6 +76,15 @@ modules.
[ ] Template::TT3::Element::Text
[ ] Template::TT3::Element::Word

Newly added (split out from Template::TT3::Elements::XXX libraries.

[ ] Template::TT3::Element::String;
[ ] Template::TT3::Element::Squote;
[ ] Template::TT3::Element::Dquote;
[ ] Template::TT3::Element::Padding;
[ ] Template::TT3::Element::TagStart;
[ ] Template::TT3::Element::Whitespace;

=head2 Variable Elements

These elements are used to represent variables and operations relating to
Expand Down Expand Up @@ -102,8 +115,10 @@ These elements implement various operators of the language.

[ ] Template::TT3::Element::Operator::Assign
[ ] Template::TT3::Element::Operator::Dot
[ ] Template::TT3::Element::Operator::Number ** WORKING ON THIS **
[ ] Template::TT3::Element::Operator::Pair
[ ] Template::TT3::Element::Operator::Ternary
[ ] Template::TT3::Element::Operator::Text ** WORKING ON THIS **

=head2 Sigils

Expand Down Expand Up @@ -205,6 +220,24 @@ at them.
[ ] Template::TT3::Element::HTML::Table
[ ] Template::TT3::Element::HTML

=head1 Factory Modules

Factory modules are responsible for loading modules and instantiating objects.
I'm in the process of migrating Template::TT3::Factory::Class to T~Class::Factory.

[X] Template::TT3::Factory # base class
[X] Template::TT3::Class::Factory # metaprogramming class

[X] Template::TT3::Engines
[X] Template::TT3::Exceptions
[X] Template::TT3::Dialects
[X] Template::TT3::Providers

[ ] Template::TT3::Types
- remove pre-defined types and have T~Variables manage the list
instead


=head1 Other Modules

Until I get a chance to properly organise a list of the other modules, I'll
Expand All @@ -213,11 +246,6 @@ just dump everything else here.
The following modules are believed to be complete, clean, tested and
documented.

[X] Template::TT3::Factory
[X] Template::TT3::Factory::Class
[X] Template::TT3::Engines
[X] Template::TT3::Dialects
[X] Template::TT3::Providers

=head1 AUTHOR

Expand Down
6 changes: 6 additions & 0 deletions docs/pod/Template/TT3/TODO.pod
Expand Up @@ -227,6 +227,12 @@ Probably best to cleave it back into 3 parts like it (well, its predecessor)
used to be.


=head1 Class Modules

These should all be moved to sit under the C<Template::TT3::Class> namespace.
e.g. C<Template::TT3::Factory::Class> should be
C<Template::TT3::Class::Factory>.

=head1 Configuration

=head2 Amalgamating Arguments
Expand Down
20 changes: 14 additions & 6 deletions lib/Template/TT3/Class.pm
Expand Up @@ -59,6 +59,8 @@ sub view {
}


# TODO: this is being deprecated in favour of dedicated
# Template::TT3::Class::Element subclass
sub as {
my ($self, $roles) = @_;
my $base = $self->AS_ROLE;
Expand Down Expand Up @@ -146,7 +148,7 @@ sub generate {
}


sub subclass {
sub OLD_subclass {
my $self = shift;
my $base = $self->{ name };
my $classes = @_ == 1 ? shift : [ @_ ];
Expand Down Expand Up @@ -188,6 +190,12 @@ sub subclass {
}


sub subclass {
my ($self, $name) = @_;
class( $self->{ name }.PKG.camel_case($name), ref $self );
}


# TODO: change this to generate_elements() because it's no longer specific
# to operators

Expand Down Expand Up @@ -285,39 +293,39 @@ sub generate_pre_post_ops {
}


sub generate_number_ops {
sub OLD_generate_number_ops {
shift->generate_ops(
{ id => 'num', methods => 'text number value values' },
@_
);
}


sub generate_number_assign_ops {
sub OLD_generate_number_assign_ops {
shift->generate_ops(
{ id => 'num', methods => 'number value values' },
@_
);
}


sub generate_text_ops {
sub OLD_generate_text_ops {
shift->generate_ops(
{ id => 'txt', methods => 'text value values' },
@_
);
}


sub generate_text_assign_ops {
sub OLD_generate_text_assign_ops {
shift->generate_ops(
{ id => 'txt', methods => 'value values' },
@_
);
}


sub generate_boolean_ops {
sub OLD_generate_boolean_ops {
shift->generate_ops(
{ id => 'bool', methods => 'value values' },
@_
Expand Down

0 comments on commit 95bc376

Please sign in to comment.