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 in Python by ana1504.k
• 7,430 points
11 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 by SDeb
• 12,280 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
• 56,160 points
69 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
• 56,160 points
249 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
• 56,160 points
52 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,140 points
16 views
+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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 127 views
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
• 12,280 points
42 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 in Python by SDeb
• 12,280 points
20 views