Sphinx: local conf for a page?

0 votes
How can I have page-local value of a conf variable?

For example, I have

hyphenator_language = "en-us"

in conf.py. Can I have it like:

hyphenator_language = "ru"

for a given ReST page of the sphinx document?
May 27, 2019 in Python by ana1504.k
• 7,890 points

1 answer to this question.

0 votes

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 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.
answered May 27, 2019 by SDeb
• 13,250 points

Related Questions In Python

0 votes
1 answer

What is the Python equivalent for a case/switch statement?

if x == 'a':  # Do the ...READ MORE

answered Jul 26, 2018 in Python by Priyaj
• 57,550 points
0 votes
1 answer

Python equivalent for static variables within a function?

You can use the following code, that ...READ MORE

answered Oct 17, 2018 in Python by Priyaj
• 57,550 points
0 votes
1 answer

In python how to test a string for a substring

if "ABCD" in "xxxxABCDyyyy": This can be used ...READ MORE

answered Oct 24, 2018 in Python by Priyaj
• 57,550 points
0 votes
1 answer

Limit max RAM consumption for a application

Using Job Objects. First you need to ...READ MORE

answered Nov 15, 2018 in Python by findingbugs
• 3,200 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,184 views
0 votes
0 answers
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

answered Sep 21, 2018 in Python by SDeb
• 13,250 points
0 votes
1 answer

Shorter way to write a Python for loop

You can use the enumerate iterator: for i, ...READ MORE

answered Jan 17, 2019 in Python by SDeb
• 13,250 points