1PFT::Map::Node(3) User Contributed Perl Documentation PFT::Map::Node(3)
2
3
4
6 PFT::Map::Node - Node of a PFT site map
7
9 PFT::Map::Node->new($seqnr, $id, $content);
10 PFT::Map::Node->new($seqnr, $id, undef, $header);
11 PFT::Map::Node->new($seqnr, $id, $content, $header);
12
14 Objects of type "PFT::Map::Node" are nodes of the site map. They are
15 created within a "PFT::Map" object. Each node is identified by a
16 unique sequence number and by a mnemonic identifier.
17
18 The first form of constructor in the SYNOPSIS creates a
19 "PFT::Map::Node" without providing a header. This is possible because a
20 content item ("PFT::Map::Content::Base" instance) is provided. The
21 constructor will make an attempt to read the header.
22
23 The second and third forms shall be used when the header is already
24 available (as optimization to avoid the system to fetch it again), or
25 in those situation in which the header cannot be retrieved.
26
27 The header cannot be retrieved from entries which do not correspond to
28 a real file (virtual contents). Nodes referring to virtual contents are
29 called virtual nodes. They represent an auto-generated pages within a
30 PFT site (typical case: tag pages and month pages.
31
32 See the "PFT::Map::Node" implementation for further details.
33
34 Properties
35 header
36 Header associated with this node.
37
38 This property could return "undef" if the node is associated with a
39 non-textual content (something which "PFT::Content::Base" but not a
40 "PFT::Content::Entry").
41
42 content
43 The content associated with this node.
44
45 This property could return undefined for the nodes which do not
46 correspond to any content.
47
48 date
49 Returns the date of the content, or undef if the content is not
50 recording any date.
51
52 seqnr
53 Returns the sequential id of the node.
54
55 Reported verbatim as by constructor parameter.
56
57 id
58 Returns the mnemonic identifier, unique for the whole site.
59
60 Reported verbatim as by constructor parameter.
61
62 title
63 Returns the title of the content.
64
65 The title is retrieved from the header. Content items like pictures do
66 not have a header, so they don't have a title: "undef" is returned if
67 this is the case.
68
69 author
70 Returns the author of the content.
71
72 The author is retrieved from the header. Content items like pictures
73 do not have a header, so they don't have an author: "undef" is
74 returned if this is the case.
75
76 virtual
77 Returns 1 if the node is virtual.
78
79 content_type
80 Returns the type of the content. Short for "ref($node->content)"
81
82 This has nothing to do with HTTP content-type header (nor with HTTP at
83 all).
84
85 Routing properties
86 Routing properties allow to access other nodes. For instance, the
87 "prev" property of a node will correspond to the previous node in
88 chronological sense. They can be "undef" (e.g. if the node does not
89 have a predecessor).
90
91 The properties are:
92
93 "prev": previous node;
94 "next": next node;
95 "tags": list of tag nodes, possibly virtual;
96 "tagged": non-empty only for tag nodes, list of tagged nodes;
97 "days": non-empty only for month nodes, list of days in the month;
98 "inlinks": list of nodes whose text is pointing to this node;
99 "outlinks": links of node pointed by the text of this node;
100 "children": union of "tagged" and "days"
101 "symbols": list of symbols referenced in the text, sorted by occourence
102 Other methods are defined as setters for the mentioned properties.
103 They are currently not documented, but used in "PFT::Map".
104
105 More complex methods
106 html
107 Expand HTML of the content, translating outbound links into hyper-
108 references (hrefs).
109
110 Requires as parameter a callback mapping a "PFT::Map::Node" object
111 into a string representing path within the site. The callback is
112 applied to all symbols, and the resulting string will replace the
113 symbol placeholder in the HTML.
114
115 Returns a string HTML, or an empty string if the node is virtual.
116
117
118
119perl v5.34.0 2021-07-22 PFT::Map::Node(3)