Python Sphinx/rest substitution for long names defining substitution rule in same source file -
post python sphinx referencing long names provided 1 answer close looking regards substitution directives long class names.
def examplefunction(): '''here example docstring referencing |reallylongexampleclassname| .. |reallylongexampleclassname| replace:: :class:`.reallylongexampleclassname`
in example provided however, definition replacement rule within same pydoc block. hoping this:
"""define rst links/substitutions used in file .. |reallylongexampleclassname| replace:: :class:`.reallylongexampleclassname` .. |anotherexampleclassname| replace:: :class:`.anotherexampleclassname` """ # more code # more code def examplefunction(): '''here example docstring referencing |reallylongexampleclassname| # define function
since every file in question specific, use of rst_epilog doesn't extend well. possible.
you can variable rst_epilog
in conf.py
file. taken straight rst_epilog:
rst_epilog
a string of restructuredtext included @ end of every source file read. right place add substitutions should available in every file. example:
rst_epilog = """ .. |psf| replace:: python software foundation """
but rst_epilog
not fit use case. perhaps rst include directive better approach? can put commonly used substitutions single rst document , include in documents need use them.
Comments
Post a Comment