mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2901 from MinchinWeb/writer-docs
Document how to add a new writer
This commit is contained in:
commit
0919507ae7
2 changed files with 32 additions and 5 deletions
|
|
@ -274,6 +274,33 @@ Adding a new generator is also really easy. You might want to have a look at
|
||||||
signals.get_generators.connect(get_generators)
|
signals.get_generators.connect(get_generators)
|
||||||
|
|
||||||
|
|
||||||
|
Adding a new writer
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Adding a writer will allow you to output additional file formats to disk, or
|
||||||
|
change how the existing formats are written to disk. Note that only one writer
|
||||||
|
will be active at a time, so be sure to either subclass the built-in Writer, or
|
||||||
|
completely re-implement it.
|
||||||
|
|
||||||
|
Here is a basic example of how to set up your own writer::
|
||||||
|
|
||||||
|
from pelican.writers import Writer
|
||||||
|
from pelican import signals
|
||||||
|
|
||||||
|
class MyWriter(Writer):
|
||||||
|
# define new writer functionality
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def add_writer(pelican_object):
|
||||||
|
# use pelican_instance to setup stuff if needed
|
||||||
|
return MyWriter
|
||||||
|
|
||||||
|
|
||||||
|
def register():
|
||||||
|
signals.get_writer.connect(add_writer)
|
||||||
|
|
||||||
|
|
||||||
.. _Pip: https://pip.pypa.io/
|
.. _Pip: https://pip.pypa.io/
|
||||||
.. _pelican-plugins bug #314: https://github.com/getpelican/pelican-plugins/issues/314
|
.. _pelican-plugins bug #314: https://github.com/getpelican/pelican-plugins/issues/314
|
||||||
.. _Blinker: https://pythonhosted.org/blinker/
|
.. _Blinker: https://pythonhosted.org/blinker/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue