wikipedia
¶
Sphinx extension to create links to Wikipedia articles.
New in version 0.2.0.
Enable sphinx_toolbox.wikipedia
by adding the following
to the extensions
variable in your conf.py
:
extensions = [
...
'sphinx_toolbox.wikipedia',
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .
Configuration¶
Usage¶
-
:wikipedia:
¶ Role which shows a link to the given article on Wikipedia.
The title and language can be customised.
Example
:wikipedia:`Sphinx` :wikipedia:`mythical creature <Sphinx>` :wikipedia:`Answer to the Ultimate Question of Life, the Universe, and Everything <:de:42 (Antwort)>`
Answer to the Ultimate Question of Life, the Universe, and Everything
:wikipedia:`:zh:斯芬克斯`
API Reference¶
Functions:
|
Adds a link to the given article on Wikipedia. |
|
Setup |
-
make_wikipedia_link
(name, rawtext, text, lineno, inliner, options={}, content=[])[source]¶ Adds a link to the given article on Wikipedia.
- Parameters:
name (
str
) – The local name of the interpreted role, the role name actually used in the document.rawtext (
str
) – A string containing the entire interpreted text input, including the role and markup.text (
str
) – The interpreted text content.lineno (
int
) – The line number where the interpreted text begins.inliner (
Inliner
) – Thedocutils.parsers.rst.states.Inliner
object that calledsource_role()
. It contains the several attributes useful for error reporting and document tree access.options (
Dict
) – A dictionary of directive options for customization (from therole
directive), to be interpreted by the function. Used for additional attributes for the generated elements and other functionality. Default{}
.content (
List
[str
]) – A list of strings, the directive content for customization (from therole
directive). To be interpreted by the function. Default[]
.
- Return type:
- Returns:
A list containing the created node, and a list containing any messages generated during the function.
-
setup
(app)[source]¶ Setup
sphinx_toolbox.wikipedia
.New in version 1.0.0.
- Parameters:
app (
Sphinx
) – The Sphinx application.- Return type: