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
• 6,710 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 10,860 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,140 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
• 56,140 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
• 56,140 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,140 points
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
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
• 10,860 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 in Python by SDeb
• 10,860 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.