tardyp / sphinx-jinja

MIT License
28 stars 22 forks source link

Support embedding Sphinx context variables #13

Open fatalaa opened 4 years ago

fatalaa commented 4 years ago

It would be useful to have access for the Sphinx context variables. I'd use this with conditional rendering(where Sphinx's ifconfig falls short) like:

.. jinja:: my_context

  {% if platform == 'something' %}
  * An element that is only available on the platform `something`
  {% endif %}

So i wouldn't have to write this in my conf.py:

jinja_contexts: {'my_context': {'platform': 'something'}}

as I'd pass the platform variable via command line to Sphinx.

I can implement this, I just like to have your approval on it.

tardyp commented 4 years ago

sounds like a good improvement. I'll merge it when you submit it.

thanks!