I'm creating documentation using Sphinx Doc for one of my projects and I'm using many times some words in whole doc, for example - IP address, port numbers and many other things that may change in time. If, for some reason, one of it will be changed, I want to change it simply in one place, not manually in every file. What I'm looking for, is some simple way to create some kind of resource file/variables, which can be easily accessible from all my .rst files.
I found this one:
my_config_value = 'test'
rst_epilog = '.. |my_conf_val| replace:: %s' % my_config_value
It's almost perfect, but I want to have many variables. Using method above, I'm able to use only one - that's not enough.
Also I have found method using sphinx.ext.extlinks
. It's working, but not exactly in the way I wanted to. I'm using this in my conf.py
:
extlinks = {'test': ('bla_bla_bla', None)}
And then, in some .rst:
:test:`1`
with result bla_bla_bla1
First, this is hyperlink to nowhere. Second, I can't write
:test:` `
or even just :test:
, because it doesn't work.
And there come my question: is there any simple way to create variables, which can be used in whole doc?