File: ext.py

package info (click to toggle)
mutagen 1.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,832 kB
  • ctags: 3,199
  • sloc: python: 15,807; makefile: 33
file content (16 lines) | stat: -rw-r--r-- 433 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from docutils import nodes


def bug_role(name, rawtext, text, lineno, inliner, *args, **kwargs):
    app = inliner.document.settings.env.app
    url_tmpl = app.config.bug_url_template or "missing/%s"
    node = nodes.reference(
        rawtext,
        "[%s]" % text,
        refuri=url_tmpl % text)
    return [node], []


def setup(app):
    app.add_role('bug', bug_role)
    app.add_config_value('bug_url_template', None, 'env')