getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
59 stars 95 forks source link

ReST plugin strips single title #153

Closed felixfontein closed 8 years ago

felixfontein commented 8 years ago

I've noticed that if I have a .rst post which has one header, that one will be removed from the output. So if I have two pages:

Page 1:

Test
====

This is a test.

Page 2:

Test
====

This is a test.

Test2
=====

This is another test.

Then I would expect that Page 1 looks like Page 2 with the second section removed, but it ends up being just "This is a test." for Page 1 with the section header removed. I don't know why this is the default behavior, but I noticed it can be changed by modifying the ReST plugin by replacing

return pub.writer.parts['docinfo'] + pub.writer.parts['fragment'], pub.document.reporter.max_level, pub.settings.record_dependencies

with

return pub.writer.parts['html_title'] + pub.writer.parts['docinfo'] + pub.writer.parts['fragment'], pub.document.reporter.max_level, pub.settings.record_dependencies

at the end of rst2html.

I guess changing the default is not a good idea, but would it be acceptable to add an option to force inclusion of the HTML title?

Kwpolska commented 8 years ago

Mind reporting this in the main repo (getnikola/nikola) instead and closing this?

felixfontein commented 8 years ago

Whoops. I thought I was there... :)