From 5f2f31982d7036a922fded93960cb514586275d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Zapke-Gru=CC=88ndemann?= Date: Wed, 9 Oct 2013 17:01:00 +0200 Subject: [PATCH] Generate no links by setting ticket number to 0 --- README.rst | 2 ++ releases/__init__.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index fdf0b9b..f65b523 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/releases/__init__.py b/releases/__init__.py index 7322716..a5c24ec 100644 --- a/releases/__init__.py +++ b/releases/__init__.py @@ -32,14 +32,18 @@ def issues_role(name, rawtext, text, lineno, inliner, options={}, content=[]): May give a 'ticket number' of ' 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)