Statocles::Page::Document - Render document objects into HTML
version 0.098
This page class takes a single document and renders it as HTML.
The document this page will render.
The title of the page.
The author of the page.
Get the date of this page by checking the document.
The tag links for this document. An array of link objects. The most important attributes are:
text - The text of the link href - The page of the link
The data hash for this page. Defaults to the data attribute from the Document.
data
If true, disables the processing of the content as a template. This will improve performance if you're not using any template directives in your content.
This can be set in the document ("disable_content_template" in Statocles::Document), the application ("disable_content_template" in Statocles::App), or the site ("disable_content_template" in Statocles::Site).
The path to the next document if it is part of a list. Defaults to the "path" in Statocles::Document from "next_page" if it exists.
The path to the previous document if it is part of a list. Defaults to the "path" in Statocles::Document from "prev_page" if it exists.
The Statocles::Page::Document instance of the next document if it is part of a list.
The Statocles::Page::Document instance of the previous document if it is part of a list.
my $html = $page->content( %vars );
Generate the document HTML by processing template directives and converting Markdown. vars is a set of name-value pairs to give to the template.
vars
my %vars = $page->vars;
Get the template variables for this page.
my @sections = $page->sections; my $number_of_sections = $page->sections; my @first_sections = $page->sections( 0, 1 );
Get a list of rendered HTML content divided into sections. The Markdown "---" marker divides sections. In scalar context, returns the number of sections. You can also pass the indexes of the sections you want as arguments.
For example, to loop over sections in the template:
% for my $i ( 0..$page->sections ) { <%= $page->sections( $i ) %> % }
my @tags = $page->tags;
Get the list of tags for this page.
my $tmpl = $page->template;
The template object for this page. If the document has a template, it will be used. Otherwise, the template attribute will be used.
my $tmpl = $page->layout;
The layout template object for this page. If the document has a layout, it will be used. Otherwise, the layout attribute will be used.
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Statocles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Statocles
CPAN shell
perl -MCPAN -e shell install Statocles
For more information on module installation, please visit the detailed CPAN module installation guide.