pax_global_header00006660000000000000000000000064136515205510014515gustar00rootroot0000000000000052 comment=d53e47dba537ae17ebecd66e1d23ff05ad94cce3 sphinxcontrib_github_alt-1.2/000077500000000000000000000000001365152055100164535ustar00rootroot00000000000000sphinxcontrib_github_alt-1.2/.github/000077500000000000000000000000001365152055100200135ustar00rootroot00000000000000sphinxcontrib_github_alt-1.2/.github/workflows/000077500000000000000000000000001365152055100220505ustar00rootroot00000000000000sphinxcontrib_github_alt-1.2/.github/workflows/venv_install.yml000066400000000000000000000012671365152055100253050ustar00rootroot00000000000000name: Cover installation and module import on: - pull_request - push jobs: pip_detect_outdated: name: Cover installation and module import runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Set up Python 3.8 uses: actions/setup-python@v1.1.1 with: python-version: 3.8 - name: Install build dependencies run: |- sudo apt-get install --yes --no-install-recommends virtualenv - name: Install and import with fresh virtualenv run: |- set -e virtualenv --python=python3 venv venv/bin/pip install . venv/bin/python -c 'import sphinxcontrib_github_alt' sphinxcontrib_github_alt-1.2/.gitignore000066400000000000000000000000421365152055100204370ustar00rootroot00000000000000__pycache__/ *.pyc /dist/ /build/ sphinxcontrib_github_alt-1.2/COPYING.md000066400000000000000000000025621365152055100201120ustar00rootroot00000000000000This project is a fork of sphinxcontrib-bitbucket, by Doug Hellman. Copyright (c) 2010- by Doug Hellmann & Jupyter Development Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sphinxcontrib_github_alt-1.2/README.rst000066400000000000000000000016561365152055100201520ustar00rootroot00000000000000Link to GitHub issues, pull requests, commits and users for a particular project. To use this extension, add it to the ``extensions`` list in ``conf.py``, and set the variable ``github_project_url``: .. code-block:: python extensions = [... 'sphinxcontrib_github_alt', ] github_project_url = "https://github.com/ipython/ipython" Then use these roles in your documentation: .. code-block:: rst * :ghissue:`12` - link to issue #12 * :ghpull:`35` - link to pull request #35 * :ghcommit:`3a1cb54` - link to commit * :ghuser:`ipython` - link to a user or organisation It's called 'alt' because `sphinxcontrib-github `__ already exists. IPython & Jupyter projects have been using the syntax defined in this extension for some time before we made it into its own package, so we didn't want to switch to ``sphinxcontrib-github``. sphinxcontrib_github_alt-1.2/pyproject.toml000066400000000000000000000012361365152055100213710ustar00rootroot00000000000000[build-system] requires = ["flit_core >=2,<4"] build-backend = "flit_core.buildapi" [tool.flit.metadata] module = "sphinxcontrib_github_alt" author = "Jupyter Development Team" author-email = "jupyter@googlegroups.com" home-page = "https://github.com/jupyter/sphinxcontrib_github_alt" description-file = "README.rst" requires = [ "docutils", "sphinx", ] classifiers = [ "Framework :: Sphinx :: Extension", "License :: OSI Approved :: BSD License", "Topic :: Documentation :: Sphinx", "Topic :: Software Development :: Bug Tracking", "Topic :: Software Development :: Documentation", "Topic :: Software Development :: Version Control" ] sphinxcontrib_github_alt-1.2/sphinxcontrib_github_alt.py000066400000000000000000000130111365152055100241150ustar00rootroot00000000000000"""Link to GitHub issues, pull requests, commits and users from Sphinx docs. This extension adds the following roles: * ghissue - Issue * ghpull - Pull Request * ghcommit - Commit * ghuser - User Adapted from bitbucket example here: https://bitbucket.org/dhellmann/sphinxcontrib-bitbucket """ # Copyright (c) 2010- Doug Hellmann & Jupyter Development Team. All rights reserved. # Distributed under the 2-clause BSD license: see COPYING.md for license text. __version__ = '1.2' 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. :param rawtext: Text being replaced with link node. :param app: Sphinx application context :param type: Link type (issues, changeset, etc.) :param slug: ID of the thing to link to :param options: Options dictionary passed to role func. """ try: base = app.config.github_project_url if not base: raise AttributeError if not base.endswith('/'): base += '/' except AttributeError as err: raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) ref = base + type + '/' + slug + '/' set_classes(options) prefix = "#" if type == 'pull': prefix = "PR " + prefix node = nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref, **options) return node def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]): """Link to a GitHub issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. :param name: The role name used in the document. :param rawtext: The entire markup snippet, with role. :param text: The text marked with the role. :param lineno: The line number where rawtext appears in the input. :param inliner: The inliner instance that called us. :param options: Directive options for customization. :param content: The directive content for customization. """ try: issue_num = int(text) if issue_num <= 0: raise ValueError except ValueError: msg = inliner.reporter.error( 'GitHub issue number must be a number greater than or equal to 1; ' '"%s" is invalid.' % text, line=lineno) prb = inliner.problematic(rawtext, rawtext, msg) return [prb], [msg] app = inliner.document.settings.env.app # logger.info('issue %r' % text) if 'pull' in name.lower(): category = 'pull' elif 'issue' in name.lower(): category = 'issues' else: msg = inliner.reporter.error( 'GitHub roles include "ghpull" and "ghissue", ' '"%s" is invalid.' % name, line=lineno) prb = inliner.problematic(rawtext, rawtext, msg) return [prb], [msg] node = make_link_node(rawtext, app, category, str(issue_num), options) return [node], [] def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]): """Link to a GitHub user. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. :param name: The role name used in the document. :param rawtext: The entire markup snippet, with role. :param text: The text marked with the role. :param lineno: The line number where rawtext appears in the input. :param inliner: The inliner instance that called us. :param options: Directive options for customization. :param content: The directive content for customization. """ # logger.info('user link %r' % text) ref = 'https://www.github.com/' + text node = nodes.reference(rawtext, text, refuri=ref, **options) return [node], [] def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): """Link to a GitHub commit. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. :param name: The role name used in the document. :param rawtext: The entire markup snippet, with role. :param text: The text marked with the role. :param lineno: The line number where rawtext appears in the input. :param inliner: The inliner instance that called us. :param options: Directive options for customization. :param content: The directive content for customization. """ app = inliner.document.settings.env.app # logger.info('user link %r' % text) try: base = app.config.github_project_url if not base: raise AttributeError if not base.endswith('/'): base += '/' except AttributeError as err: raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) ref = base + text node = nodes.reference(rawtext, text[:6], refuri=ref, **options) return [node], [] def setup(app): """Install the plugin. :param app: Sphinx application context. """ logger.info('Initializing GitHub plugin') app.add_role('ghissue', ghissue_role) app.add_role('ghpull', ghissue_role) app.add_role('ghuser', ghuser_role) app.add_role('ghcommit', ghcommit_role) app.add_config_value('github_project_url', None, 'env') metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} return metadata