Skip to content
Merged
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
13 changes: 8 additions & 5 deletions sphinxcontrib_github_alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes

from sphinx.util import logging
logger = logging.getLogger(__name__)


def make_link_node(rawtext, app, type, slug, options):
"""Create a link to a github resource.

Expand Down Expand Up @@ -73,7 +77,7 @@ def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
app = inliner.document.settings.env.app
#app.info('issue %r' % text)
# logger.info('issue %r' % text)
if 'pull' in name.lower():
category = 'pull'
elif 'issue' in name.lower():
Expand Down Expand Up @@ -102,8 +106,7 @@ def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
:param options: Directive options for customization.
:param content: The directive content for customization.
"""
app = inliner.document.settings.env.app
#app.info('user link %r' % text)
# logger.info('user link %r' % text)
ref = 'https://www.github.com/' + text
node = nodes.reference(rawtext, text, refuri=ref, **options)
return [node], []
Expand All @@ -124,7 +127,7 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
:param content: The directive content for customization.
"""
app = inliner.document.settings.env.app
#app.info('user link %r' % text)
# logger.info('user link %r' % text)
try:
base = app.config.github_project_url
if not base:
Expand All @@ -144,7 +147,7 @@ def setup(app):

:param app: Sphinx application context.
"""
app.info('Initializing GitHub plugin')
logger.info('Initializing GitHub plugin')
app.add_role('ghissue', ghissue_role)
app.add_role('ghpull', ghissue_role)
app.add_role('ghuser', ghuser_role)
Expand Down