API
gresiblos - greyrat's simple blog system.
Template
A class realising a template with optional fields and fields to replace by given values
| Attributes: |
|
|---|
__init__(template)
Initialize a Template object with a given string template.
| Parameters: |
|
|---|
process_optional_fields(tpl, values)
Remove optional fields from the template string. Optional fields are enclosed in [[[:?key:?]] ... [[key?:]].
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
encode_topics(values, topics_format)
Encodes the 'topics' field from a dictionary into HTML format based on a given format string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
embed(values, topics_format='[[:topic:]]')
Embeds the given values into a template.
| Parameters: |
|
|---|
Entry
Represents a blog entry with metadata and content.
| Attributes: |
|
|---|
__init__(fields=None)
Initializes an Entry object with default values.
| Parameters: |
|
|---|
get_date()
Returns the date the entry was written at.
| Returns: |
|
|---|
get_destination()
Returns the path and complete filename the entry shall be written to.
| Returns: |
|
|---|
get(key)
Returns the value of a field by key.
| Parameters: |
|
|---|
| Returns: |
|
|---|
has_key(key)
Returns whether the key is known.
| Parameters: |
|
|---|
| Returns: |
|
|---|
_consolidate(filename, date_format, extension)
Consolidates the entry fields from a file.
| Parameters: |
|
|---|
load(filename, date_format, extension)
Loads entry data from a filename.
| Parameters: |
|
|---|
apply_processors(apply_markdown, prettifier, to_html)
Applies text processors optionally: a) converts markdown to HTML b) applies degrotesque
| Parameters: |
|
|---|
PlainStorage
Stores blog entries.
| Attributes: |
|
|---|
__init__()
Initialize a new instance of PlainStorage.
This method initializes an empty dictionary to store entries.
add(entry)
Adds an entry's metadata to the storage.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_entries()
Returns all stored entries' metadata as a list.
| Returns: |
|
|---|
build_json_index(index_indent)
Returns all stored entries' metadata as a list.
| Parameters: |
|
|---|
| Returns: |
|
|---|
load_template(path, filename)
Loads a template either from a given path or from the data folder.
| Parameters: |
|
|---|
| Returns: |
|
|---|
write_list(title, dest_path, template, entries, topic_format='[[:topic:]]')
Generates an unordered list from the given list of entry metadata, embeds it into the given template, and saves the result under the given path.
| Parameters: |
|---|
write_feed(storage, feed_type, args, dest_path)
Generates a simple RSS 2.0 or Atom feed listing the entries stored in the given storage.
| Parameters: |
|
|---|
get_args(arguments=None)
Parse command line arguments.
| Parameters: |
|
|---|
| Returns: |
|
|---|
collect_files_sorted(input_arg)
Collects the files defined by the given input definition.
| Parameters: |
|
|---|
| Returns: |
|
|---|
main(arguments=None)
The main method using parameters from the command line.
| Parameters: |
|
|---|
| Returns: |
|
|---|
script_run()
Execute from command line.