1 Installation
Install Racket, which includes DrRacket.
1 Installation
Install Racket, which includes DrRacket.
raco pkg install pollen |
raco pkg update pollen |
9.4 Pagetree
(require pollen/pagetree) | package: pollen |
A pagetree is a hierarchical list of Pollen output files. A pagetree source file has the extension .ptree. A pagetree provides a convenient way of separating the structure of the pages from the page sources, and navigating around this structure.
Pagetrees are made of pagenodes. Usually these pagenodes will be names of output files in your project. (If you think it would’ve been more logical to just call them “pages,” perhaps. When I think of a web page, I think of a file on a disk. Whereas pagenodes may — and often do — refer to files that don’t yet exist.)
Books and other long documents are usually organized in a structured way — at minimum they have a sequence of pages, but more often they have sections with subsequences within. Individual Pollen source files don’t know anything about how they’re connected to other files. In theory, you could maintain this information within each source file. This would be a poor use of human energy. Let the pagetree figure it out.
Examples: | ||||||||||||||||
|
procedure
possible-pagetree : any/c
Examples: | ||||||
|
Pagenodes are symbols (rather than strings) so that pagetrees will be valid tagged X-expressions, which is a more convenient format for validation & processing.
Examples: | ||||||
|
Example: | ||
|
Examples: | ||||
|
9.4.1 Navigation
parameter
(current-pagetree pagetree) → void? pagetree : pagetree?
procedure
(parent p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||
|
procedure
(children p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||
|
procedure
(siblings p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||
|
procedure
(previous p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
procedure
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||||||
|
procedure
(next p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
procedure
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||||||
|
9.4.2 Utilities
procedure
(pagetree->list pagetree) → list?
pagetree : pagetree?
procedure
(in-pagetree? pagenode [pagetree]) → boolean?
pagenode : pagenode? pagetree : pagetree? = (current-pagetree)
procedure
p : pathish?
9.4 Pagetree
(require pollen/pagetree) | package: pollen |
A pagetree is a hierarchical list of Pollen output files. A pagetree source file has the extension .ptree. A pagetree provides a convenient way of separating the structure of the pages from the page sources, and navigating around this structure.
Pagetrees are made of pagenodes. Usually these pagenodes will be names of output files in your project. (If you think it would’ve been more logical to just call them “pages,” perhaps. When I think of a web page, I think of a file on a disk. Whereas pagenodes may — and often do — refer to files that don’t yet exist.)
Books and other long documents are usually organized in a structured way — at minimum they have a sequence of pages, but more often they have sections with subsequences within. Individual Pollen source files don’t know anything about how they’re connected to other files. In theory, you could maintain this information within each source file. This would be a poor use of human energy. Let the pagetree figure it out.
Examples: | ||||||||||||||||
|
procedure
possible-pagetree : any/c
Examples: | ||||||
|
Pagenodes are symbols (rather than strings) so that pagetrees will be valid tagged X-expressions, which is a more convenient format for validation & processing.
Examples: | ||||||
|
Example: | ||
|
Examples: | ||||
|
9.4.1 Navigation
parameter
(current-pagetree pagetree) → void? pagetree : pagetree?
procedure
(parent p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||
|
procedure
(children p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||
|
procedure
(siblings p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||
|
procedure
(previous p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
procedure
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||||||
|
procedure
(next p [pagetree]) → (or/c #f pagenode?)
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
procedure
p : (or/c #f pagenodeish?) pagetree : pagetree? = (current-pagetree)
Examples: | |||||||||||||||
|
9.4.2 Utilities
procedure
(pagetree->list pagetree) → list?
pagetree : pagetree?
procedure
(in-pagetree? pagenode [pagetree]) → boolean?
pagenode : pagenode? pagetree : pagetree? = (current-pagetree)
procedure
p : pathish?