-
Notifications
You must be signed in to change notification settings - Fork 60
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
Respect the html_use_smartypants option #24
base: master
Are you sure you want to change the base?
Conversation
I was just hit by this problem today, thanks @tbekolay! 😄 |
I think there might be an easier way to do this using app.add_node rather than subclassing one of the HTML translators... I'll look into this shortly. |
Cool thanks. Taking a look at this now, and I'm getting an error when building the demo:
|
5b9e288
to
47d080f
Compare
I've updated this PR; the main commit now uses I also added a commit to remove some unused imports; if you want me to remove that commit let me know, or feel free to omit it in the merge! |
Previously, this was ignored because the config option is implemented by using a different HTMLTranslator in the case that the option is True (which is the default). This PR switches from subclassing the non-SmartyPants HTMLTranslator and instead uses calls to `app.add_node` to override the visit/depart functions. This removes the need to use `app.set_translator`, making our Sphinx requirement more flexible. I tested building the demo with the current version of Sphinx and earlier, and it worked all the way to Sphinx 1.1, which failed for something unrelated to this change. `setup.py` was updated accordingly.
And fixed some indentation to follow PEP8 style.
280d5bb
to
302bf83
Compare
@mtdowling
The reasoning being that if you remove the You can even see that in a related commit: arximboldi/immer@4b82bbb, the If this change goes out in a minor version bump, it won't affect our doc build: https://github.com/boto/boto3/blob/develop/requirements-docs.txt#L2. But it could affect other developer's doc builds if they do not lock to a specific version. Looking into the sphinx docs, it looks like that option is deprecated: http://www.sphinx-doc.org/en/stable/config.html so I am not sure how many people is using it. But just wanted to give a heads up. |
We can introduce this with backwards compatibility if desired (by doing something like |
See the
html_use_smartypants
option docs. The way Sphinx implements this is by using a differentHTMLTranslator
subclass. This PR respects that config option by subclassing theSmartyPantsHTMLTranslator
when the option is True (which is the default).Note that this PR's branch is based on the
set_translator
branch from #23, so that one should be reviewed/merged first.