Welcome to rst.linker documentation!¶
Sphinx plugin to add links and timestamps to the changelog.
- class rst.linker.Repl(defn)¶
Bases:
object
- classmethod from_defn(defn)¶
Return the first Repl subclass that works with this
- matches(text)¶
- class rst.linker.Replacer(iterable=(), /)¶
Bases:
list
- classmethod from_definition(defn, names: Mapping = {})¶
A definition may contain the following members:
using: a dictionary of variables available for substitution
replace: a list of replacement definitions.
- static load(filename)¶
- replace(match)¶
- run(source)¶
- write_links(source, target)¶
- class rst.linker.SCMTimestamp(defn)¶
Bases:
Repl
Replace content with a version number to include the date stamp from the SCM.
For example, consider a changelog with the following:
1.0 --- Changed something.
The following replacement definition would add a datestamp after the heading:
{ pattern: r"(?m:^((?P<scm_version>\d+(\.\d+){1,2})\n-+\n))", with_scm: "{text}\nTagged {rev[timestamp]}\n", }
If the scm_version is detected, a timestamp will be added to the namespace.
If detected, the rev[timestamp] is a datetime-aware timestamp, so arbitrary formatting operators may be applied to it, such as the following which will render as “Dec 2000”:
{ with_scm: "{rev[timestamp]:%b %Y}", }
- replace(match, replacer_vars)¶
- class rst.linker.URLLinker(defn)¶
Bases:
Repl
Each replacement should have the form:
{ pattern: "Issue #?(?P<number>\d+)", url: "{bitbucket}/jaraco/rst.linker/issues/{number}", bitbucket: https://bitbucket.org }
Currently, each named group must be unique across all Repl objects used in a replacement.
- replace(match, replacer_vars)¶
- rst.linker.config_dict(config)¶
Given a Sphinx config object, return a dictionary of config values.
- rst.linker.make_links(app)¶
- rst.linker.setup(app)¶