Merge pull request #10 from keimlink/no-issue-link

Generate no links by setting ticket number to 0
This commit is contained in:
Jeff Forcier 2013-11-05 15:49:05 -08:00
commit b34f814011
2 changed files with 9 additions and 3 deletions

View file

@ -58,6 +58,8 @@ Mimic the format seen `in Fabric's changelog
backporting to bugfix releases; will show up in both release types.
* ``major``: Given on bug issues to denote inclusion in feature, instead
of bugfix, releases.
* If ``number`` is ``0`` no issue link will be generated. You can use this
for items without a related issue.
* Regular Sphinx content may be given after issue roles and will be preserved
as-is when rendering. For example, in ``:bug:`123` Fixed a bug, thanks

View file

@ -32,14 +32,18 @@ def issues_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
May give a 'ticket number' of '<number> backported' to indicate a
backported feature or support ticket. This extra info will be stripped out
prior to parsing. May also give 'major' in the same vein, implying the bug
was a major bug released in a feature release.
was a major bug released in a feature release. May give a 'ticket number'
of 0 to generate no hyperlink.
"""
# Old-style 'just the issue link' behavior
issue_no, _, ported = utils.unescape(text).partition(' ')
# Lol @ access back to Sphinx
config = inliner.document.settings.env.app.config
ref = config.releases_issue_uri % issue_no
link = nodes.reference(rawtext, '#' + issue_no, refuri=ref, **options)
if issue_no != '0':
ref = config.releases_issue_uri % issue_no
link = nodes.reference(rawtext, '#' + issue_no, refuri=ref, **options)
else:
link = None
# Additional 'new-style changelog' stuff
if name in issue_types:
nodelist = issue_nodelist(name, link)