Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_link(text):
link = utils.unescape(text)
m = link_regexp.match(link)
if m:
title, link, hash = m.group('title', 'link', 'hash')
if not hash: hash = '' # it's None otherwise
else:
title, hash = '', ''
return title, link, hash
def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
has_t, title, target = split_explicit_title(text)
title = docutils.utils.unescape(title)
target = docutils.utils.unescape(target)
refnode = docutils.nodes.reference(
title, title, refuri=SOURCE_URI + target)
return [refnode], []
def parse_link(text):
link = utils.unescape(text)
m = link_regexp.match(link)
if m: return m.group('title', 'link')
return None, link
raise ValueError
except ValueError:
return sphinx_err(
inliner, lineno, rawtext,
'GitHub pull request or issue number must be a number greater than or equal to 1; "%s" is invalid.' % text
)
if name == 'pr':
ref = gh_pr_uri
elif name == 'issue':
ref = gh_issue_uri
else:
return sphinx_err(inliner, lineno, rawtext, 'unknown role name for GitHub reference - "%s"' % name)
ref = ref.format(text)
text = '#' + utils.unescape(text)
return sphinx_ref(options, rawtext, text, ref)
def parse_link(text):
link = utils.unescape(text)
m = link_regexp.match(link)
if m: return m.group('title', 'link')
return None, link
def gh_example_role(rolename, rawtext, text, lineno, inliner,
options={}, content=()):
from docutils import nodes, utils
github_url = 'https://github.com/spatialaudio/python-sounddevice'
base_url = github_url + '/blob/' + release + '/examples/%s'
text = utils.unescape(text)
full_url = base_url % text
pnode = nodes.reference(internal=False, refuri=full_url)
pnode += nodes.literal(text, text, classes=['file'])
return [pnode], []