Skip to content

[MRG + 2] DOC adding :user: role to whats_new #7818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions doc/sphinxext/sphinx_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

try:
from docutils import nodes, utils
from sphinx.util.nodes import split_explicit_title
except ImportError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to keep this variation

# Load lazily so that test-sphinxext does not require docutils dependency
pass
Expand All @@ -45,13 +46,20 @@ def user_role(name, rawtext, text, lineno,
"""
options = options or {}
content = content or []
username = utils.unescape(text).strip()
has_explicit_title, title, target = split_explicit_title(text)

target = utils.unescape(target).strip()
title = utils.unescape(title).strip()
config = inliner.document.settings.env.app.config
if config.issues_user_uri:
ref = config.issues_user_uri.format(user=username)
ref = config.issues_user_uri.format(user=target)
else:
ref = 'https://github.com/{0}'.format(target)
if has_explicit_title:
text = title
else:
ref = 'https://github.com/{0}'.format(username)
text = '@{0}'.format(username)
text = '@{0}'.format(target)

link = nodes.reference(text=text, refuri=ref, **options)
return [link], []

Expand Down
Loading