-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d3d8829
Showing
12 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build/ | ||
dist/ | ||
env/ | ||
*.egg-info/ | ||
__pycache__/ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Sphinx JSON Domain | ||
================== | ||
I was surprised that this didn't already exist somewhere when I wanted to | ||
describe a JSON document outside of using `sphinxcontrib-httpdomain`_ to | ||
document one of my APIs. This extension simplifies describing structured | ||
JSON documents using a new `Sphinx domain`_. | ||
|
||
.. code-block:: rst | ||
.. json:object:: Github User | ||
What Github's API thinks a user looks like. | ||
:property string login: the user's login | ||
:property integer id: Github assigned unique user identifier | ||
:property string avatar_url: url to user's selected avatar image | ||
or the empty string | ||
:property string gravatar_url: url to the user's gravatar image | ||
or the empty string | ||
This will format to something pretty and make references to | ||
`:json:object:`Github User`` work as expected. | ||
|
||
.. _sphinxcontrib-httpdomain: https://pythonhosted.org/sphinxcontrib-httpdomain/ | ||
.. _sphinx domain: http://www.sphinx-doc.org/en/stable/domains.html#what-is-a-domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1.logo {font-size: 14pt} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import alabaster | ||
from sphinxcontrib import jsondomain | ||
|
||
|
||
project = 'sphinx-jsondomain' | ||
copyright = '2016, Dave Shawley' | ||
release = '.'.join(str(v) for v in jsondomain.version_info[:2]) | ||
version = jsondomain.__version__ | ||
needs_sphinx = '1.0' | ||
extensions = [ | ||
'sphinx.ext.intersphinx', | ||
] | ||
|
||
master_doc = 'index' | ||
html_theme = 'alabaster' | ||
html_static_path = ['_static'] | ||
html_theme_path = [alabaster.get_path()] | ||
html_sidebars = { | ||
'**': ['about.html', | ||
'navigation.html'], | ||
} | ||
html_theme_options = { | ||
'description': 'Describe JSON documents', | ||
'github_user': 'dave-shawley', | ||
'github_repo': 'sphinx-jsondomain', | ||
} | ||
intersphinx_mapping = { | ||
'python': ('https://docs.python.org/3', None), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Contributing | ||
============ | ||
|
||
Setting up your environment | ||
--------------------------- | ||
First of all, build yourself a nice clean virtual environment using the | ||
:mod:`venv` module (or `virtualenv`_ if you must). Then pull in the | ||
requirements:: | ||
|
||
sphinx-jsondomain$ python3 -mvenv env | ||
sphinx-jsondomain$ env/bin/pip install -qr requires/development.txt | ||
|
||
Giving it Back | ||
-------------- | ||
Once you have something substantial that you would like to contribute back | ||
to the extension, push your branch up to github.com and issue a Pull Request | ||
against the main repository. | ||
|
||
.. _virtualenv: https://virtualenv.pypa.io/en/stable/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Release History | ||
=============== | ||
|
||
`Next Release`_ | ||
--------------- | ||
|
||
.. _Next Release: https://github.com/dave-shawley/sphinx-jsondomain/compare/0.0.0...HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.. include:: ../README.rst | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
contributing | ||
history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-r installation.txt | ||
wheel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sphinx>=1.4,<2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
|
||
import os.path | ||
|
||
import setuptools | ||
|
||
from sphinxcontrib import jsondomain | ||
|
||
|
||
def read_requirements(name): | ||
requirements = [] | ||
with open(os.path.join('requires', name)) as req_file: | ||
for line in req_file: | ||
if '#' in line: | ||
line = line[:line.index('#')] | ||
line = line.strip() | ||
if line.startswith('-r'): | ||
requirements.extend(read_requirements(line[2:].strip())) | ||
elif line and not line.startswith('-'): | ||
requirements.append(line) | ||
return requirements | ||
|
||
|
||
setuptools.setup( | ||
name='sphinx-jsondomain', | ||
version=jsondomain.__version__, | ||
url='https://github.com/dave-shawley/sphinx-jsondomain', | ||
description='Describe JSON document structures in sphinx', | ||
long_description='\n'+open('README.rst').read(), | ||
author='Dave Shawley', | ||
author_email='daveshawley+python@gmail.com', | ||
packages=setuptools.find_packages(), | ||
namespace_packages=['sphinxcontrib'], | ||
install_requires=read_requirements('installation.txt'), | ||
classifiers=[ | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
'Framework :: Sphinx :: Extension', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
version_info = (0, 0, 0) | ||
__version__ = '.'.join(str(c) for c in version_info) |