HTML-Transmorgify

 view release on metacpan or  search on metacpan

lib/HTML/Transmorgify/Metatags.pod  view on Meta::CPAN


=head1 MACROS

The C<E<lt>macroE<gt>> tag is used to expand a variable or macro.  
The form of the call is:

 <macro VAR_NAME>
 <macro name=VAR_NAME>
 <macro name=VAR_NAME encode=ENCODING=>

Macro expansions can be done inside attribute values of other tags:

 <img alt="<macro alttag>">

Some macro values are evaluated at runtime.  These might in turn
use other macros.  All named attributes to a E<lt>macroE<gt> 
are added as temporary macros while doing a lookup.

=head2 Defining Macro Values

Macro values can be set in the invocation of HTML::Transmorgify:

 my $output = $magic->process($input_text, { %options }, 
 	alt_tag => 'my image',
	my_title => 'yea, we did it',
	an_array => [ 'foo', 'bar' ],
	a_hash => { foo => 'bar' },
	an_object => $object,
 );

If a macro name has periods in it, then variable is expected to be

lib/HTML/Transmorgify/Metatags.pod  view on Meta::CPAN

example, the result would be C<bar>.

When a variable refers to an object, if there are additional elements
to the variable name, they will be looked up by using the 
C<lookup> method.  If there are no additional elements to refine the
lookup, then the object is turned to text with the C<text> method.

A virtual base clase that objects can inherit from is defined in
L<HTML::Transmorgify::ObjectGlue>.

Macros can also be defined with the C<E<lt>defineE<gt>> 
directive.  All of these do the same thing:

 <define title>my new title</define>
 
 <define name="title">my new title</define>
 
 <define title value="my new title" />
  
 <define name="title" value="my new title" />

lib/HTML/Transmorgify/Metatags.pod  view on Meta::CPAN


 <define fullname><macro firstname> <macro lastname></define>

Compile-time only happens once so if C<firstname> and C<lastname>
are parameters that change from invocation to invocation, evaluating
them should be deferred until runtime by using the C<eval="true">
attribute.

=item name

The name of the Macro being defined. 

=item value

The text of the new defintion.

=item trim

The trim attribute will eleminate some of the whitespace from
within the new value:



( run in 0.650 second using v1.01-cache-2.11-cpan-49f99fa48dc )