NAME
PFT::Map::Node - Node of a PFT site map
SYNOPSIS
PFT::Map::Node->new($seqnr, $id, $content);
PFT::Map::Node->new($seqnr, $id, undef, $header);
PFT::Map::Node->new($seqnr, $id, $content, $header);
DESCRIPTION
Objects of type PFT::Map::Node
are nodes of the site map. They are created within a PFT::Map
object. Each node is identified by a unique sequence number and by a mnemonic identifier.
The first form of constructor in the SYNOPSIS creates a PFT::Map::Node
without providing a header. This is possible because a content item (PFT::Map::Content::Base
instance) is provided. The constructor will make an attempt to read the header.
The second and third forms shall be used when the header is already available (as optimization to avoid the system to fetch it again), or in those situation in which the header cannot be retrieved.
The header cannot be retrieved from entries which do not correspond to a real file (virtual contents). Nodes referring to virtual contents are called virtual nodes. They represent an auto-generated pages within a PFT site (typical case: tag pages and month pages.
See the PFT::Map::Node
implementation for further details.
Properties
- header
-
Header associated with this node.
This property could return
undef
if the node is associated with a non-textual content (something whichPFT::Content::Base
but not aPFT::Content::Entry
). - content
-
The content associated with this node.
This property could return undefined for the nodes which do not correspond to any content.
- date
-
Returns the date of the content, or undef if the content is not recording any date.
- seqnr
-
Returns the sequential id of the node.
Reported verbatim as by constructor parameter.
- id
-
Returns the mnemonic identifier, unique for the whole site.
Reported verbatim as by constructor parameter.
- title
-
Returns the title of the content.
The title is retrieved from the header. Content items like pictures do not have a header, so they don't have a title:
undef
is returned if this is the case. -
Returns the author of the content.
The author is retrieved from the header. Content items like pictures do not have a header, so they don't have an author:
undef
is returned if this is the case. - virtual
-
Returns 1 if the node is virtual.
- content_type
-
Returns the type of the content. Short for
ref($node->content)
Routing properties
Routing properties allow to access other nodes. For instance, the prev
property of a node will correspond to the previous node in chronological sense. They can be undef
(e.g. if the node does not have a predecessor).
The properties are:
prev
: previous node;next
: next node;tagged
: non-empty only for tag nodes, list of tagged nodes;days
: non-empty only for month nodes, list of days in the month;inlinks
: list of nodes whose text is pointing to this node;outlinks
: links of node pointed by the text of this node;children
: union oftagged
anddays
symbols
: list of symbols referenced in the text, sorted by occourence-
Other methods are defined as setters for the mentioned properties. They are currently not documented, but used in
PFT::Map
.
More complex methods
- html
-
Expand HTML of the content, translating outbound links into hyper-references (hrefs).
Requires as parameter a callback mapping a
PFT::Map::Node
object into a string representing path within the site. The callback is applied to all symbols, and the resulting string will replace the symbol placeholder in the HTML.Returns a string HTML, or an empty string if the node is virtual.