Writers that inherit from other writers and render html.
Bases: object
Base class used for functionality common to all J2 writers.
Bases: firmant.writers.j2.Jinja2PostArchiveBase, firmant.writers.posts.PostArchiveAll
Render paginated post lists with Jinja2 templates.
Return the set of attributes suitable as input for url mapping.
Attributes that identify a archived year page:
- type
- This is always post.
- page
- The 1-indexed page number of the page.
>>> obj = spaa.obj_list({'settings': settings},
... {'post': objects.posts})[0]
>>> pprint(obj)
([Post(2010-02-02-newday2), Post(2010-02-02-newday)], Paginated(None, 1, 2))
>>> pprint(spaa.key(obj))
{'page': 1, 'type': u'post'}
Return 3-tuples with the list of objects and prev/next information.
The prev/next information is stored in firmant.paginate.Paginated objects and is returned for both the groupings by year, and for the groupings into pages.
>>> spaa.obj_list({'settings': settings}, {})
[]
>>> spaa.obj_list({'settings': settings}, {'post': []})
[]
>>> pprint(spaa.obj_list({'settings': settings},
... {'post': objects.posts}))
[([Post(2010-02-02-newday2), Post(2010-02-02-newday)], Paginated(None, 1, 2)),
([Post(2010-02-01-newmonth), Post(2010-01-01-newyear)], Paginated(1, 2, 3)),
([Post(2009-12-31-party)], Paginated(2, 3, None))]
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.
Bases: firmant.writers.j2.Jinja2Base
Common functionality for rendering Jinja2 archive views.
Bases: firmant.writers.j2.Jinja2PostArchiveBase, firmant.writers.posts.PostArchiveDaily
Render paginated post lists (grouped by day) with Jinja2 templates.
Return the set of attributes suitable as input for url mapping.
Attributes that identify an archived day page:
- type
- This is always post.
- year
- The year of publication.
- month
- The month of publication.
- day
- The day of publication.
- page
- The 1-indexed page number of the page.
>>> obj = spad.obj_list({'settings': settings},
... {'post': objects.posts})[0]
>>> pprint(obj)
([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010, 2, 2), (2010, 2, 1)),
Paginated(None, 1, None))
>>> pprint(spad.key(obj))
{'day': 2, 'month': 2, 'page': 1, 'type': u'post', 'year': 2010}
Return 3-tuples with the list of objects and prev/next information.
The prev/next information is stored in firmant.paginate.Paginated objects and is returned for both the groupings by day, and for the groupings into pages.
>>> spad.obj_list({'settings': settings}, {})
[]
>>> spad.obj_list({'settings': settings}, {'post': []})
[]
>>> pprint(spad.obj_list({'settings': settings},
... {'post': objects.posts}))
[([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010, 2, 2), (2010, 2, 1)),
Paginated(None, 1, None)),
([Post(2010-02-01-newmonth)],
Paginated((2010, 2, 2), (2010, 2, 1), (2010, 1, 1)),
Paginated(None, 1, None)),
([Post(2010-01-01-newyear)],
Paginated((2010, 2, 1), (2010, 1, 1), (2009, 12, 31)),
Paginated(None, 1, None)),
([Post(2009-12-31-party)],
Paginated((2010, 1, 1), (2009, 12, 31), None),
Paginated(None, 1, None))]
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.
Bases: firmant.writers.j2.Jinja2PostArchiveBase, firmant.writers.posts.PostArchiveMonthly
Render paginated post lists (grouped by month) with Jinja2 templates.
Return the set of attributes suitable as input for url mapping.
Attributes that identify a archived month page:
- type
- This is always post.
- year
- The year of publication.
- month
- The month of publication.
- page
- The 1-indexed page number of the page.
>>> obj = spam.obj_list({'settings': settings},
... {'post': objects.posts})[0]
>>> pprint(obj)
([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010, 2), (2010, 1)),
Paginated(None, 1, 2))
>>> pprint(spam.key(obj))
{'month': 2, 'page': 1, 'type': u'post', 'year': 2010}
Return 3-tuples with the list of objects and prev/next information.
The prev/next information is stored in firmant.paginate.Paginated objects and is returned for both the groupings by month, and for the groupings into pages.
>>> spam.obj_list({'settings': settings}, {})
[]
>>> spam.obj_list({'settings': settings}, {'post': []})
[]
>>> pprint(spam.obj_list({'settings': settings},
... {'post': objects.posts}))
[([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010, 2), (2010, 1)),
Paginated(None, 1, 2)),
([Post(2010-02-01-newmonth)],
Paginated(None, (2010, 2), (2010, 1)),
Paginated(1, 2, None)),
([Post(2010-01-01-newyear)],
Paginated((2010, 2), (2010, 1), (2009, 12)),
Paginated(None, 1, None)),
([Post(2009-12-31-party)],
Paginated((2010, 1), (2009, 12), None),
Paginated(None, 1, None))]
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.
Bases: firmant.writers.j2.Jinja2PostArchiveBase, firmant.writers.posts.PostArchiveYearly
Render paginated post lists (grouped by year) with Jinja2 templates.
Return the set of attributes suitable as input for url mapping.
Attributes that identify a archived year page:
- type
- This is always post.
- year
- The year of publication.
- page
- The 1-indexed page number of the page.
>>> obj = spay.obj_list({'settings': settings},
... {'post': objects.posts})[0]
>>> pprint(obj)
([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010,), (2009,)),
Paginated(None, 1, 2))
>>> pprint(spay.key(obj))
{'page': 1, 'type': u'post', 'year': 2010}
Return 3-tuples with the list of objects and prev/next information.
The prev/next information is stored in firmant.paginate.Paginated objects and is returned for both the groupings by year, and for the groupings into pages.
>>> spay.obj_list({'settings': settings}, {})
[]
>>> spay.obj_list({'settings': settings}, {'post': []})
[]
>>> pprint(spay.obj_list({'settings': settings},
... {'post': objects.posts}))
[([Post(2010-02-02-newday2), Post(2010-02-02-newday)],
Paginated(None, (2010,), (2009,)),
Paginated(None, 1, 2)),
([Post(2010-02-01-newmonth), Post(2010-01-01-newyear)],
Paginated(None, (2010,), (2009,)),
Paginated(1, 2, None)),
([Post(2009-12-31-party)],
Paginated((2010,), (2009,), None),
Paginated(None, 1, None))]
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.
Bases: firmant.writers.j2.Jinja2Base, firmant.writers.posts.PostWriter
Render each post individually using Jinja2 templates.
Return the set of attributes suitable as input for url mapping.
Attributes that identify a post object:
- type
- This is always post.
- year
- The year of publication.
- month
- The month of publication.
- day
- The day of publication.
- slug
- The slug that is unique to the feed object.
>>> print objects.posts[0].published.date(), objects.posts[0].slug
2009-12-31 party
>>> pprint(sp.key(objects.posts[0]))
{'day': 31, 'month': 12, 'slug': u'party', 'type': u'post', 'year': 2009}
Return all objects stored under the key post.
>>> sp.obj_list(None, {})
[]
>>> sp.obj_list(None, {'post': []})
[]
>>> sp.obj_list(None, {'post': ['postobj']})
['postobj']
Render the data in a Jinja2 template.
>>> j2pw = Jinja2PostWriter(environment, objects)
>>> obj = j2pw.obj_list(environment, objects)[0]
>>> j2pw.render(environment, path, obj)
>>> cat(path)
2009-12-31 | party by John Doe
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.
Bases: firmant.writers.j2.Jinja2Base, firmant.writers.staticrst.StaticRstWriter
Render staticrst objects using the StaticRstWriter base.
Return the set of attributes suitable as input for url mapping.
Attributes that identify a static-rest object:
- type
- This is always staticrst.
- path
- A path that describes the object relative to the input/output directories.
>>> print objects.staticrst[0].path
about
>>> pprint(ssrw.key(objects.staticrst[0]))
{'path': u'about', 'type': u'staticrst'}
Return all objects stored under the key staticrst.
>>> ssrw.obj_list(None, {})
[]
>>> ssrw.obj_list(None, {'staticrst': []})
[]
>>> ssrw.obj_list(None, {'staticrst': ['staticobj']})
['staticobj']
Render the data in a Jinja2 template.
>>> j2sr = Jinja2StaticRst(environment, objects)
>>> obj = j2sr.obj_list(environment, objects)[0]
>>> j2sr.render(environment, path, obj)
>>> cat(path)
About at about
The following scheduling orders apply to writers:
The string displayed when interacting with the user.
This should be the name of the class they must specify in the configuration. The default value should not be changed.