Skip to content

Commit

Permalink
Merge #18 Build a ReadTheDocs documentation for >= v0.5
Browse files Browse the repository at this point in the history
Build a ReadTheDocs documentation for >= v0.5
  • Loading branch information
davidomarf committed Oct 22, 2019
2 parents c3141e8 + e9394ef commit aababd4
Show file tree
Hide file tree
Showing 12 changed files with 782 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![PyPI](https://img.shields.io/pypi/v/ginpar)](https://pypi.org/project/ginpar/)
[![Build](https://github.com/davidomarf/ginpar/workflows/build/badge.svg)](https://github.com/davidomarf/ginpar/actions?workflow=build)
[![Documentation Status](https://readthedocs.org/projects/ginpar/badge/?version=stable)](https://ginpar.readthedocs.io/?badge=stable)

---

Expand Down
20 changes: 20 additions & 0 deletions docs/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, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
6 changes: 6 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ginpar
pallets_sphinx_themes
pallets_sphinx_themes
sphinx-prompt
sphinx_click
sphinxcontrib-programoutput
9 changes: 9 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
API Docs
========

.. toctree::
:maxdepth: 2

config
data
params
36 changes: 36 additions & 0 deletions docs/source/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
CLI Commands
============

This is a list of the available CLI commands for Ginpar.

This page contains the same information you'd get if you run

.. prompt:: bash

ginpar --help

and then,

.. prompt:: bash

ginpar COMMAND --help

for every command available.

.. click:: ginpar.cli:cli
:prog: ginpar

.. click:: ginpar.cli:build
:prog: ginpar build

.. click:: ginpar.cli:init
:prog: ginpar init

.. click:: ginpar.cli:new
:prog: ginpar new

.. click:: ginpar.cli:quickstart
:prog: ginpar quickstart

.. click:: ginpar.cli:serve
:prog: ginpar serve
81 changes: 81 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# 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('.'))

from pallets_sphinx_themes import ProjectLink

# -- Project information -----------------------------------------------------

project = 'Ginpar'
copyright = '2019, David Omar Flores Chavez'
author = 'David Omar Flores Chavez'

# The full version, including alpha/beta/rc tags
release = 'v0.5.0'


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

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

master_doc = 'index'


autosectionlabel_prefix_document = True

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

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

# -- 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 = 'click'

# 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']

html_context = {
"project_links": [
ProjectLink("Source Code", "https://github.com/davidomarf/ginpar/"),
ProjectLink("PyPI releases", "https://pypi.org/project/ginpar/"),
ProjectLink("Example website", "https://gen.davidomar.com"),
ProjectLink("Introduction", "/intro.html")
]
}

html_sidebars = {
"index": ["project.html", "localtoc.html", "searchbox.html"],
"**": ["localtoc.html", "relations.html", "searchbox.html"],
}

singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
114 changes: 114 additions & 0 deletions docs/source/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
Site configuration
==================

This is the API documentation for the configuration file of a Ginpar site:
``config.yaml``.

This file contains all the metadata for your site, such as your name, the name
of the site, the repository, social links, etc.

The following data fields are the ones used by Ginpar. However, you can design
a custom theme or template that makes uses of extra fields.

author
------

*String, optional* [**Not defined by default**]

The name of the author of the site. This will be used to set Copyright messages
and meta tags.

sitename
--------

*String, optional* [**Not defined by default**]

The name of the site. This will be used to set Copyright messages
and meta tags.

description
-----------

*String, optional* [**Not defined by default**]

The description of the site. This will be used as a meta tag, and will appear
in the index of the site.

url
---

*String, optional* [**Not defined by default**]

The URL you'll be using to redirect to the site's content.

theme
-----

*String, required* [**davidomarf/gart**]

If the theme you want to use is a GitHub repository, set this value to
``AUTHOR/REPO``.

If it's a git repository in a different server, add the ``.git`` address.

Alternatively, you can add a string that matches the name of one directory
inside the ``themes/`` folder for a locally designed theme.

The default value is ``davidomarf/ginpar``

content_path
------------

*String, required* [**sketches**]

The directory that contains the project sketches. This path is referenced
when you run :ref:`cli:ginpar build` and :ref:`cli:ginpar serve`.

build_path
----------

*String, required* [**public**]

The directory Ginpar will use to build the site.

scripts
-------

*List, Optional* [**Not defined by default**]

This is a list of scripts and the url to fetch them. You can later reference
the items of this list to include them in individual sketches.

The structure is this:

.. code-block:: yaml
scripts:
p5:
"p5-url"
extra:
"extra-url"
lib:
"lib-url"
sketch_defaults
---------------

*Object, Optional* [**Not defined by default**]

Here you'll add the same content you'd otherwise manually add to every sketch
in your project.

For example, if you'd like all your sketches to **not allow a global_seed**,
you'd need to add this to your config.json file:

.. code-block:: YAML
sketch_defaults:
global_seed: False
Now, all your sketches will automatically have the value
``global_seed: False``. However, you can manually replace that value for a
single sketch.

For all the available values, check :ref:`data:Sketch data`.

0 comments on commit aababd4

Please sign in to comment.