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={})

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)
class rst.linker.SCMTimestamp(defn)

Bases: rst.linker.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: rst.linker.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.setup(app)

Indices and tables