Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make sure the default templates directory is included #17

Closed
wants to merge 3 commits into from

1 participant

@bradleywright

In #13 you missed the commit that added the templates into the site-packages when building from setup.py. This commit re-adds that functionality so the various layouts work out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 3 deletions.
  1. +20 −3 rstblog/builder.py
  2. +1 −0  setup.py
View
23 rstblog/builder.py
@@ -135,9 +135,26 @@ def render_rst(self, contents):
'initial_header_level': self.config.get('rst_header_level', 2),
'rstblog_context': self
}
- parts = publish_parts(source=contents,
- writer_name='html4css1',
- settings_overrides=settings)
+ kwargs = {
+ 'source': contents,
+ 'settings_overrides': settings
+ }
+ html_writer = None
+ if self.config.get('html_writer'):
+ # TODO: at the moment this only supports
+ # module1.module2.ClassHere type imports
+
+ # first we need to split up the importer
+ writer_parts = self.config.get('html_writer').split('.')
+ # import using fromlist
+ importer = __import__('.'.join(writer_parts[:-1]),
+ fromlist=writer_parts[-1:])
+ # fetch the class itself
+ html_writer = getattr(importer, writer_parts[-1])
+ kwargs['writer'] = html_writer()
+ else:
+ kwargs['writer_name'] = 'html4css1'
+ parts = publish_parts(**kwargs)
return {
'title': Markup(parts['title']).striptags(),
'html_title': Markup(parts['html_title']),
View
1  setup.py
@@ -8,6 +8,7 @@
description='',
long_description='',
license='BSD License',
+ include_package_data=True,
entry_points = {
'console_scripts': ['run-rstblog = rstblog.cli:main'],
},
Something went wrong with that request. Please try again.