4

Can I have page-local value of a conf variable (normally found in conf.py)?

For example, I have

hyphenator_language = "en-us"

in conf.py. Can I have it

hyphenator_language = "ru"

for a given ReST page of the sphinx document?

Adobe
  • 12,967
  • 10
  • 85
  • 126
  • 1
    Maybe you can use a custom hyphenator for those pages? – Kuzgun Nov 04 '13 at 15:48
  • once you were able to say $ sphinx-build -D hyphenator_language="..." I can not test it right now, but is it that what you are looking for or am i totally wrong? – CodeFanatic Nov 06 '13 at 15:03
  • @FelixLama: but it will set the var for the whole doc. While I want to change the var for a single page. – Adobe Nov 06 '13 at 15:37

1 Answers1

1

As far as I know there's no general way to do this for an arbitrary config variable, but in your case, for hyphenator in particular, you have a couple of options:

  • Convince the author of the Sphinx hyphenator extension to add support for a directive that sets the panguage per page.
  • Since the hyphenator extension uses hyphenator.js, which is a JS library, you could probably use some raw html (using the raw directive) to inject a script tag that would set the language on that page.
  • Create a custom template (or extend your existing one) to contain the logic which sets the language for the page.
Kevin Horn
  • 4,167
  • 28
  • 30