Skip to content

Instantly share code, notes, and snippets.

@anthony-dandrea
Created May 7, 2015 19:08
Show Gist options
  • Save anthony-dandrea/a2f14947dc7a5f21921d to your computer and use it in GitHub Desktop.
Save anthony-dandrea/a2f14947dc7a5f21921d to your computer and use it in GitHub Desktop.
Halp, pelican plugin
"""
For reference I'm trying to create a Pelican plugin
that will load templates from a python package before
loading the regular template path in the repo.
https://github.com/getpelican/pelican/blob/807b3bced38bff7b83a2efa2ce8cda9d644ebad3/pelican/generators.py#L61-L70
http://docs.getpelican.com/en/3.5.0/plugins.html#list-of-signals
"""
class Generator(object):
"""Baseclass generator"""
def __init__(self, context, settings, path, theme, output_path, readers_cache_name='', **kwargs):
self.foo = 'bar' # I wanna change dis
class StaticGenerator():
def __init__(self, *args, **kwargs):
super(StaticGenerator, self).__init__(*args, **kwargs)
# HERE I want to change foo to baz
@Shiggiddie
Copy link

In my_plugin.py:

from pelican import signals

def my_shit(generator):
    import pdb; pdb.set_trace() # This will drop you into the Python interpreter once your plugin is invoked

def register():
    signals. generator_init.connect(my_shit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment