Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
package HTML::Template::Documentation; use base qw( HTML::Template ); use strict; #use warnings; #use diagnostics; sub documentation { my $self = shift; my $template = __PACKAGE__->new( filehandle => *main::DATA ); $template->param( title => $self->{ options }->{ filepath } || 'HT +ML::Template' ); my $content = { VAR => [], LOOP => [] }; for my $param ( sort { $self->query( name => $b ) cmp $self->query( name => $a ) || $a cmp $b } $self->param ) { my $type = $self->query( name => $param ); push @{ $content->{ $type } }, +{ name => $param } if $type eq + 'VAR'; $self->_query_loops( $content->{ LOOP }, $param, 2 ) if $type +eq 'LOOP'; } $template->param( %$content ); return $template->output; } sub _query_loops { my( $self, $loops, $name, $level, $chain ) = @_; my @path = $name; unshift @path, @$chain if $chain; push @{ $loops }, +{ name => $name, level => $level, VAR => [] }; for my $param ( sort { $self->query( name => [ @path, $b ] ) cmp $self->query( name => [ @path, $a ] ) || $a cmp $b } $self->query( loop => \@path ) ) { my $type = $self->query( name => [ @path, $param ] ); push @{ $loops->[ $#{ $loops } ]->{ $type } }, { name => $para +m } if $type eq 'VAR'; $self->_query_loops( $loops, $param, $level + 1, \@path ) if $ +type eq 'LOOP'; } } package main; print HTML::Template::Documentation->new( filename => shift )->documen +tation; __DATA__ =head1 NAME <!-- TMPL_VAR NAME="title" --> - Template Documentation =head1 DESCRIPTION The following is auto-generated documention for the supplied HTML::Tem +plate data. =head1 VARIABLES <!-- TMPL_IF NAME="var" --> =over 4 <!-- TMPL_LOOP NAME="var" --> =item * <!-- TMPL_VAR NAME="name" --> <!-- /TMPL_LOOP --> =back <!-- /TMPL_IF --> =head1 LOOPS <!-- TMPL_IF NAME="loop" --> <!-- TMPL_LOOP NAME="loop" --> =head<!-- TMPL_VAR NAME="level" --> <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="var" --> =over 4 <!-- TMPL_LOOP NAME="var" --> =item * <!-- TMPL_VAR NAME="name" --> <!-- /TMPL_LOOP --> =back <!-- /TMPL_IF --> <!-- /TMPL_LOOP --> <!-- /TMPL_IF -->

In reply to tmpldoc.pl - generate documentation for HTML::Template templates by LTjake

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found