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

Bug: Missing heading when using rst sources with lonely 1st level heading #124

Open gchriz opened 10 years ago

gchriz commented 10 years ago

Hi! When I'm using rst sources with a 1st level heading that is occuring only once in the document the underlying docutils treat that heading as title. As such it is not included in the parts['body'] that is used in renderers.py and so it's not in the output wok creates.

Example:

heading1
========

some text

heading2
--------

more text

gives (shortened):

<p>some text</p>
<h1>heading2</h1>
<p>more text</p>

Using parts['html_body'] instead makes it appearing, but an even better solution might be to disable this docutils behaviour by:

overrides = {'doctitle_xform': False}
return docutils.core.publish_parts(plain, writer=w, settings_overrides=overrides)['body']

Here the corresponding commit in my wok fork, including some more documentation: https://github.com/gchriz/wok/commit/ddaf7df673a4238c5c3eae9f20e1867ecc2bc802

gchriz commented 10 years ago

Now I made that fix configurable. For backwards compatibility and for users who might need the old behaviour: https://github.com/gchriz/wok/commit/cb47b5dc994106e30c82cf492b9454286292e8d7

gchriz commented 8 years ago

After doing some "git for dummies" I finally managed to create my first pull request here (#152). As far as I understand Travis is happy with it too.