getnikola / plugins

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

[sphinx_roles] abbr eplanation not taken into account #294

Closed matclab closed 5 years ago

matclab commented 5 years ago

Using :abbr:`WTF (Want To Fly)` get translated into <abbr>WTF</abbr> with sphinx_roles plugin 0.4 on Nikola 8.0.1 with python 3.7.1 on Arch Linux;

Putting some debugging info, it looks like visit_abbreviation is never called.

ralsina commented 5 years ago

Hmmm ... ok, taking a look.

ralsina commented 5 years ago

Ok, seems like I should actually remove this soonish.

According to sphinx source code, this is deprecated because docutils has added abbreviation support. And according to the docutils code, it's not working:

    def visit_abbreviation(self, node):
        # @@@ implementation incomplete ("title" attribute)

I will take a shot at fixing it but I have no idea why the visitor is not working.

matclab commented 5 years ago

@ralsina, by chance did you manage to get some result on this one ?

matclab commented 5 years ago

after some investigation, it looks like add_node change the visitor of docutils.writers.html5_polyglot.HTMLTranslator whereas the abbr_visitor used is the one from docutils.writers.html4css1.HTMLTranslator.

matclab commented 5 years ago

Replacing html5_polyglot with html4css1 in nikola/plugins/compile/rest/__init__.py works. Shall I propose a PR or could you elaborate on the difference between the two writers and why one is selected preferably to another ?

ralsina commented 5 years ago

Honestly, I have no idea what the difference is :-(

On Mon, Jul 29, 2019 at 4:48 PM matclab notifications@github.com wrote:

Replacing html5_polyglot with html4css1 in nikola/plugins/compile/rest/init.py works. Shall I propose a PR or could you elaborate on the difference between the two writers and why one is selected preferably to another ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/294?email_source=notifications&email_token=AAAAMK4Y2F7W3FFWJTH2KBDQB5CPBA5CNFSM4GOMUBWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3BZ2DQ#issuecomment-516136206, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAMKZCG22VPSHPD6FODNDQB5CPBANCNFSM4GOMUBWA .

matclab commented 5 years ago

The difference is documented here : http://docutils.sourceforge.net/docs/user/html.html Replacing writer_name='html' with writer_name='html5_polyglot' in nikola/plugins/compile/rest/__init__.py:rst2html parameter initialization does the job.

matclab commented 5 years ago

But then the math rendering is broken… Still investigating.

matclab commented 5 years ago

The math problem is unrelated… It was a glitch in the network connection.

ralsina commented 5 years ago

I suppose if the tests pass it's ok.

On Mon, Jul 29, 2019 at 5:08 PM matclab notifications@github.com wrote:

The difference is documented here : http://docutils.sourceforge.net/docs/user/html.html Replacing writer_name='html' with writer_name='html5_polyglot' in nikola/plugins/compile/rest/init.py:rst2html parameter initialization does the job.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/294?email_source=notifications&email_token=AAAAMK6UGCD4KOCQ5LNKKLDQB5E3RA5CNFSM4GOMUBWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3B3NQA#issuecomment-516142784, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAMK2Y2TZS5YJ5IGK6WWLQB5E3RANCNFSM4GOMUBWA .