mythmon / wok

A static website generator - Toss some content, templates, and media in a pan and fry it up!
http://wok.mythmon.com
Other
113 stars 46 forks source link

Fix issue #144 - use source_path for docutils ReST renderer #150

Closed matt-garman closed 7 years ago

matt-garman commented 8 years ago

This changes the structure of the wok/renderers.py module such that all render() functions become object instance methods, rather than static class methods. The rationale is to allow various per-file metadata to live with the renderer object. In particular, this allows the ReStructuredText renderer object to remember the source filename, so the source_path param can be passed to the docutils.core.publish_parts() method, thus solving issue #144.

Previously, the per-page renderer was chosen in wok/engine.py. Now the correct renderer is chosen by a new function in wok/renderers.py: factory(). This will pick the right renderer and instantiate an object appropriately.

I can envision further modifications to go along with this new structure to make the code a bit more elegant. But I thought I'd throw it out here as a proof-of-concept in its simplest form before taking it too far.

Thank you for your thoughts and feedback!

homu commented 8 years ago

:umbrella: The latest upstream changes (presumably #152) made this pull request unmergeable. Please resolve the merge conflicts.

edunham commented 8 years ago

Sorry, it looks like landing the other PR broke this. I'll leave it for now in case you're around to rebase, or fix it myself next time I take a look at this repo (probably in a few months)

matt-garman commented 7 years ago

I submitted a new "take2" PR. So I will close this PR.