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,910 points
494 views

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,300 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
• 58,020 points
976 views
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
• 58,020 points
4,884 views
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
• 58,020 points
827 views
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,260 points
574 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,464 views
0 votes
1 answer
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 22, 2018 in Python by SDeb
• 13,300 points
5,059 views
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,300 points
2,230 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP