Publishable - publishable component interface (super class)
Should not be used directly, see synopsys of subclasses. Although this component class is not pure virtual, it is hard to use directly, because it does not contain any useful non-publishing-mechanism property.
Publishable components usualy contain other publishable components. This package provides methods to manage, publish and preview publishable components recursively.
the Exception manpage, the Debug manpage, the Podius::Component manpage, the Podius::Property::ScalarTable manpage, the Podius::Template manpage, the File::Operations manpage, the Parse::PerlConf manpage.
* class name like all constructors * optional init hash, see L<Podius::Component>
$ok = $component->parse_template(\"<h1><{get_name}></h1>");
This method calls Podius::Template::set_template_home() to set the component template home directory.
After that it calls Podius::Template::parse_template() with the same parameters.
* template content to parse - scalar ref * optional template stash - hash ref
$ok = $component->parse_template_page("template.html");
Calls parse_template method, see above.
* template file-name to parse (scalar) * optional template stash (hashref)
$ok = $component->save_published_page("index2.html", \"<HTML></HTML>");
* published file-name to save to - scalar * published page content to save - scalar ref
$component->publish_self();
$component->publish_self({
unpublish => 1,
templates => ['Master1.html', 'Master2.html'],
published => undef,
published_cb => undef,
extra_stash => {},
update_lastdate => 0,
});
Property last_published is updated to hold the appropriate time unless update_lastdate flag is set to 0 (but the time is updated once for the first publish anyway) or if it is set to 2 (then the time is forced to be always undefined).
This method is equivalent to publish(0, 1), but without debugging messages.
* unpublish (0 (default) or 1) - publish (create) or unpublish (remove)
* templates (array ref) - process only these template pages;
default is undef - process all template pages
* published (array ref) - process only these published pages;
default is undef - process all published pages
* published_cb (code ref) - if specified, call the callback when every
single page is published with parameters:
(I<$component, $template, $published, $stash, $unpublish>) -
(I<Podius::Component, scalar, scalar, hash, boolean>)
* extra_stash (hash ref) - add to configured stash of page_names entries
* reset_pagenames (0 or 1) - reset pagenames
default is PUBLISH_RESETS_PAGENAMES in project.cfg
* update_lastdate (0 skip, 1 set, 2 null) - update last_published property
default is PUBLISH_UPDATES_LASTDATE in project.cfg
* properties (0 or 1 or undef) - publish properties too
default is undef - lazy publish
* property_names (array ref) - limit to these properties only
publish, which uses this method; used methods save_published_page,
parse_template_page.
$num_published = $component->publish_sons();
$num_published = $component->publish_sons(1, 20);
$num_published = $component->publish_sons({
unpublish => 1,
templates => ['Master1.html', 'Master2.html'],
published => undef,
published_cb => undef,
});
Optional argument hash is not used directly, it is passed to publish
method for all sons.
The recursive argument (usually must be non zero) is not used directly,
it is passed to publish method for all sons.
Can be limited to the given number of recursive publish's. When limiting, DFS is used, not BFS, this means sons can be processed, even if not all brothers are going to be published. This feature can be changed later.
publish, which uses this method and which is used in this method.
* optional argument hash (see C<publish_self>)
* recursive - optional
-1: publish sons after the component itself (default)
0: don't publish sons (== contained publishable components)
1: publish sons before the component itself
* limit - optional total number of components to publish, when recursive,
default is -1 - unlimited.
If called in array context, two scalars are returned - total number of published components and total number of published direct sons.
$num_published = $component->publish();
$num_published = $component->publish(1, 20);
$num_published = $component->publish({
unpublish => 1,
templates => ['Master1.html', 'Master2.html'],
published => undef,
published_cb => undef,
});
Property last_published is updated by default, but see the description of update_lastdate flag above; if this flag is not explicitly passed then it defaults to the project constant PUBLISH_UPDATES_LASTDATE.
Optional argument hash is not used directly, it is passed to publish_self
method.
This method calls publish method of all contained publishable components,
if recursive.
Can be limited to the given number of recursive publish's. When limiting, DFS is used, not BFS, this means sons can be processed, even if not all brothers are going to be published. This feature can be changed later.
The component itself is always published (last or first) unless the given
limit is 0, use publish_sons to publish only its sons.
* optional argument hash (see C<publish_self>)
* recursive - optional
-1: publish sons after the component itself (default)
0: don't publish sons (== contained publishable components)
1: publish sons before the component itself
* limit - optional total number of components to publish, when recursive,
default is -1 - unlimited.
$num_previewed = $component->preview();
The method actually calls publish method but in PREVIEW_HOME directory.
* recursive - optional, if 0, don't publish contained publishable components (default 1). * limit - optional total number of components to publish, when recursive. default is -1 - unlimited.
<img src="<{ @t get_backdir_to_publish_home }>/images/some.png">
or even shorter:
<link rel="stylesheet" href="<{~backdir}>/style.css">
The return value is either ``.'' (if the published filename contains no slashes), or one or more ``..'' separated with ``/''.
* optional index of page_names row (default: 0)