How to use the docutils.utils.unescape function in docutils

To help you get started, we’ve selected a few docutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mosra / m.css / plugins / m / sphinx.py View on Github external
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
github Akuli / porcupine / docs / extensions.py View on Github external
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], []
github mosra / m.css / plugins / m / vk.py View on Github external
def parse_link(text):
    link = utils.unescape(text)
    m = link_regexp.match(link)
    if m: return m.group('title', 'link')
    return None, link
github axnsan12 / drf-yasg / docs / conf.py View on Github external
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)
github mosra / m.css / plugins / m / abbr.py View on Github external
def parse_link(text):
    link = utils.unescape(text)
    m = link_regexp.match(link)
    if m: return m.group('title', 'link')
    return None, link
github spatialaudio / python-sounddevice / doc / conf.py View on Github external
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], []