Closed matt-garman closed 7 years ago
:umbrella: The latest upstream changes (presumably #152) made this pull request unmergeable. Please resolve the merge conflicts.
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)
I submitted a new "take2" PR. So I will close this PR.
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!