exhibition.node module
- class exhibition.node.Node(path, parent, meta=None)[source]
Bases:
objectA node represents a file or directory
- Parameters:
path – A
pathlib.Paththat is either thecontent_pathor a child of it.parent – Either another
NodeorNonemeta – A dict-like object that will be passed to a
Configinstance
- add_child(child)[source]
Add a child to the current Node
If the child doesn’t already have its
parentset to this Node, then anAssertionErroris raised.
- property cache_bust
- property content
Get the actual content of the Node
If
filterhas been specified inmeta, that filter will be used to further process the content.
- property data
Extracts data from contents of file
For example, a YAML file
- property dependencies
- classmethod from_path(path, parent=None, meta=None)[source]
Given a
pathlib.Path, create a Node from that path as well as any children. Children are loaded in Unicode codepoint order - this order is preserved inNode.childrenif you’re unsure what that means.If the path is not a file or a dir, an
AssertionErroris raised- Parameters:
path – A
pathlib.Paththat is either thecontent_pathor a child of it.parent – Either another
NodeorNonemeta – A dict-like object that will be passed to a
Configinstance
- property full_path
Full path of node when deployed
- property full_url
Get full URL for node, including trailing slash
- get_from_path(path)[source]
Given a relative or absolute path, return the
Nodethat represents that path.- Parameters:
path – A
strorpathlib.Path
- property index_file
- property marks
Marked sections from content
- property meta
Configuration object
Finds and processes the YAML front matter at the top of a file
If the file does not start with
---\n, then it’s assumed the file does not contain any meta YAML for us to process
- render()[source]
Process node and either create the directory or write contents of file to
deploy_path
- property siblings
Returns all children of the parent Node, except for itself
- property strip_exts