exhibition.main module¶
-
class
exhibition.main.
Config
(data=None, parent=None)[source]¶ Bases:
object
Configuration object that implements a dict-like interface
If a key cannot be found in this instance, the parent
Config
will be searched (and its parent, etc.)Parameters: - data – Can be one of a string, a file-like object, a dict-like object, or
None
. The first two will be assumed as YAML - parent – Parent
Config
orNone
if this is the root configuration object
- data – Can be one of a string, a file-like object, a dict-like object, or
-
class
exhibition.main.
Node
(path, parent, meta=None)[source]¶ Bases:
object
A node represents a file or directory
Parameters: -
add_child
(child)[source]¶ Add a child to the current Node
If the child doesn’t already have its
parent
set to this Node, then anAssertionError
is raised.
-
data
¶ Extracts data from contents of file
For example, a YAML file
-
classmethod
from_path
(path, parent=None, meta=None)[source]¶ Given a
pathlib.Path
, create a Node from that path as well as any childrenIf the path is not a file or a dir, an
AssertionError
is raisedParameters:
-
full_path
¶ Full path of node when deployed
-
full_url
¶ Get full URL for node, including trailing slash
-
get_content
()[source]¶ Get the actual content of the Node
First calls
process_meta()
to find the end any front matter that might be present and then returns the rest of the fileIf
filter
has been specified inmeta
, that filter will be used to further process the content.
-
marks
¶ Marked sections from content
Calls
get_content()
to process content if that hasn’t been done already
-
meta
¶ Configuration object
Automatically loads front-matter if applicable
-
process_meta
()[source]¶ Finds and processes the YAML fonrt 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
-
siblings
¶ Returns all children of the parent Node, except for itself
-