Reputation: 654
In my Sphinx-doc instance, I have:
at the end of my conf.py
file:
rst_prolog = """
.. role:: LaTeXLogo
"""
in some of my .rst
files:
:LaTeXLogo:`LaTeX`
But this doesn't work since make html
returns:
WARNING: Unknown interpreted text role "LaTeXLogo".
Am I missing something?
Upvotes: 3
Views: 1882
Reputation: 12890
You have to distinguish 4 things "roles", "directives", "domains" and "options".
Punctuation distinguishes them, in shortened syntax :role:
and .. directive::
. In complete syntax (without omitting the domain) :domain:role:
and .. domain:directive::
. Lastly, "options" go under the "directives" and less frequently under "roles", eg:
.. domain:directive::
:option:
or
:domain:role:
So what is a domain? Most times it refers to a context of a programming language that has roles and directives specific to it. (Notice the sidebar in the documentation for directives is divided into domains).
Having said that let's look at the stated problem:
at the end of my conf.py file:
rst_prolog = """ .. role:: LaTeXLogo """
We notice 3 things immediately:
LaTeXLogo
...:role:
because each role has a name (the word :role:
is just used for generic examples.)Next we look at the second example:
in some of my
.rst
files::LaTeXLogo:`LaTeX`
Now we notice:
LaTexLogo
was the "directive argument"...In conclusion, the only case where the above is used are "Custom Interpreted Text Roles" that have a brief syntax description in the reStructuredText Markup Specification. If we dig deeper a general description is given in reStructuredText Interpreted Text Roles, with a more specific definition in "Creating reStructuredText Interpreted Text Roles", where a constraint on using lower case is present:
- Add an entry to the roles dictionary in docutils/parsers/rst/languages/en.py for the role, mapping the English name to the canonical name (both lowercase).
Most users of reStructuredText will probably not need this kind of intricacy. It's well past beginner level and bordering the DTD definition of the docutils parser. If you finally look at "Custom attribute types" a further specification explains the error you were having:
In reStructuredText, custom class names can be specified using (...) custom interpreted text roles. Docutils normalizes them to conform to both, HTML4.1 and CSS1.0 name requirements (the regular expression a-z*) via the identifier normalization.
Upvotes: 4