Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reST HTML5 compiler plugin #72

Merged
merged 4 commits into from Apr 5, 2015
Merged

Conversation

@pellenilsson
Copy link
Contributor

@pellenilsson pellenilsson commented Feb 15, 2015

reST compiler plugin based on this HTML5 writer:

https://bitbucket.org/andre_felipe_dias/rst2html5

Code changes from the original reST plugin are rather trivial, as shown if you diff the two plugins.

Some settings recognised by the HTML4 writer are not recognised by rst2html5: record_dependencies, stylesheet_path and math_output. I haven't investigated the consequences of this (MathJax support might be broken?).

rst2html5 interprets initial_header_level differently than the official
docutils HTML4 writer.
@ralsina
Copy link
Member

@ralsina ralsina commented Feb 15, 2015

record_dependencies is critical, it breaks recompiling the post when included files change and other similar things

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 17, 2015

Actually, the post is recompiled if an included file (using the reST include directive) changes when using rest_html5. The dependency seems to be managed by the reST parser in docutils, not the HTML writer (and this seems more natural to me).

Still, the HTML4 writer does update record_dependencies for images and stylesheets, seemingly repeating the code present in the reST parser, but I don't know what this repetition is good for. Do you have a concrete scenario where this causes a problem?

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 22, 2015

I also discovered that rst2html5 doesn't handle HTML comments, and this breaks the TEASER_END mechanism. I'll see if I can get this fixed, so please keep this pull request on hold for now.

@andredias
Copy link

@andredias andredias commented Feb 22, 2015

Could you show me an example of which rst income and html5 outcome would you like from rst2html5? I mean, is there any special case for rst or html5 comments to Nikola?

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 23, 2015

This reST code:

.. TEASER_END

needs to produce this HTML:

<!-- TEASER_END -->

With current docutil, it seems that any non-implemented reST directive produces an HTML comment. Nikola relies on this by looking for this HTML comment in a later step of the build process.

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 23, 2015

Oh, and this:

.. TEASER_END: Any string

also needs to produce

<!-- TEASER_END: Any string -->
@andredias
Copy link

@andredias andredias commented Feb 23, 2015

ok. I'll do it

@andredias
Copy link

@andredias andredias commented Feb 23, 2015

I've just pushed the implementation at BitBucket. Could you test the development version or do you need me to release a new version? I intend to release it after you test this feature.

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 23, 2015

I've confirmed that your pushed change fixed the TEASER_END issue, thank you very much!

ralsina: Do you still think that missing support for record_dependencies in rst2html5 is a problem?

@ralsina
Copy link
Member

@ralsina ralsina commented Feb 23, 2015

I am not sure, to be honest :-)

We can always just try it.

@andredias
Copy link

@andredias andredias commented Feb 23, 2015

Please, keep me informed. I am willing to help.

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 23, 2015

As far as I can tell, the plugin is ready. Dependencies on included files seem to work. MathJax works.

I guess we should let @andredias make the new release before merging this, so that the normal pip install -r requirements.txt procedure works when this plugin lands on the plugins site.

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Feb 23, 2015

I've also tested most of the old Nikola reST plugins (media, youtube, soundcloud, code-block, chart...)

@andredias
Copy link

@andredias andredias commented Feb 23, 2015

rst2html5 1.5 released!

@pellenilsson
Copy link
Contributor Author

@pellenilsson pellenilsson commented Apr 5, 2015

My site that uses this plugin is now live and happy, is there anything I need to do to get this accepted?

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Apr 5, 2015

I guess we could accept this into the repo — we are not forcing this down peoples’ throats yet. We might, one day.

Kwpolska added a commit that referenced this pull request Apr 5, 2015
reST HTML5 compiler plugin
@Kwpolska Kwpolska merged commit f651301 into getnikola:master Apr 5, 2015
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants