Skip to content

Commit

Permalink
Merge pull request #32 from apiaryio/kylef/sphinx
Browse files Browse the repository at this point in the history
Move to sphinx from MKDocs
  • Loading branch information
kylef committed Jan 24, 2018
2 parents 4b9626d + 8f48235 commit ce7eea4
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build/
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = APIElements
SOURCEDIR = docs
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20 changes: 20 additions & 0 deletions docs/_templates/sidebar_intro.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<h1><a href="/">API Elements</a></h1>

<p>
<iframe
src="https://ghbtns.com/github-btn.html?user=apiaryio&repo=api-elements&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px">
</iframe>
</p>

<p>API Elements is a structure for describing APIs and the complex data structures used within them.</p>

<div class="social">
<p>
<iframe
src="https://ghbtns.com/github-btn.html?user=apiaryio&type=follow&count=false"
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20">
</iframe>
</p>
</div>

193 changes: 193 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# a documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 15 14:21:21 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import recommonmark
from recommonmark.transform import AutoStructify
from recommonmark.parser import CommonMarkParser


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']

source_parsers = {
'.md': CommonMarkParser,
}

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'API Elements'
copyright = '2018, Apiary'
author = 'Apiary'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars

# Custom sidebar templates, maps document names to template names.
html_sidebars = {
'index': ['sidebar_intro.html', 'globaltoc.html', 'searchbox.html'],
'**': ['sidebar_intro.html', 'localtoc.html', 'relations.html', 'searchbox.html'],
}

html_show_sourcelink = False
html_show_sphinx = False


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'adoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'a.tex', 'a Documentation',
'a', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'a', 'a Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'a', 'a Documentation',
author, 'a', 'One line description of project.',
'Miscellaneous'),
]


github_doc_root = 'https://github.com/apiaryio/api-elements/tree/master/doc/'


def setup_recommonmark(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'enable_eval_rst': True,
'auto_toc_tree_section': 'Contents',
'enable_auto_doc_ref': False,
}, True)
app.add_transform(AutoStructify)


def setup(app):
setup_recommonmark(app)
15 changes: 14 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ API Elements is a structure for describing APIs and the complex data structures

## Getting Started

To start learning about and using API Elements, please check out the [overview](./overview.md), which includes explanations and examples. If you are interested in finding libraries and tools for building and consuming API Elements, you will find this information on the [tools](./tools.md) page.
To start learning about and using API Elements, please check out the [overview](overview.html), which includes explanations and examples. If you are interested in finding libraries and tools for building and consuming API Elements, you will find this information on the [tools](tools.html) page.

## Contributing

Expand All @@ -19,6 +19,19 @@ This documentation conforms to [RFC 2119][], which says:
[MSON][] is used throughout this document to define elements and structures.

## Contents

```eval_rst
.. toctree::
:maxdepth: 1
overview
element-definitions
examples
tools
additional-information
```

## License

MIT License. See the [LICENSE][] file.
Expand Down
2 changes: 1 addition & 1 deletion docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Every element defined with API Elements has four primary pieces of data.
- `attributes` (object) - user-specified attributes for a given element
- `content` - value of the element based on its type

This structure is based on [Refract][], and is expanded and defined better in the [element definition](./element-definitions.md) file.
This structure is based on [Refract][], and is expanded and defined better in the [element definition](./element-definitions.html) file.

Here is an example of what an element MAY look like.

Expand Down
15 changes: 0 additions & 15 deletions mkdocs.yml

This file was deleted.

27 changes: 27 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
alabaster==0.7.10
argh==0.26.2
Babel==2.5.3
certifi==2017.11.5
chardet==3.0.4
CommonMark==0.5.4
docutils==0.14
idna==2.6
imagesize==0.7.1
Jinja2==2.10
livereload==2.5.1
MarkupSafe==1.0
pathtools==0.1.2
port-for==0.3.1
Pygments==2.2.0
pytz==2017.3
PyYAML==3.12
recommonmark==0.4.0
requests==2.18.4
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.6.6
sphinx-autobuild==0.7.1
sphinxcontrib-websupport==1.0.1
tornado==4.5.3
urllib3==1.22
watchdog==0.8.3

0 comments on commit ce7eea4

Please sign in to comment.