This is the starting point of documenting Hyde using Sphinx. This provides several benefits: 1. Code and documentation live together, so it's easier to track and enforce that there exists documentation for new or changing code. 2. This lets us get Hyde on Read The Docs. 3. We can use things like `autoclass` where appropriate to pull documentation directly from source code without reinventing the wheel. I've tried to replicate what currently exists on hyde.github.io. The first pass of this effort is concerned with parity, and we can continue to improve from there on. Steps: 1. Convert all existing documentation on hyde.github.io to Sphinx. This is covered by this commit and should be considered "in review". 2. Open issues for core parts of Hyde that are missing documentation. 3. Close these issues individually. This is a great opportunity for community members wishing to get involved to contribute. 4. Require significant changes in code to be accompanied by updated / new documentation the same way we would require tests. While these steps are in progress, the following should also be done: 1. Deprecate the docs at hyde.github.io, linking users to Read The Docs. 2. Replace the content currently hosted at hyde.github.io with a new brochure site showing off some of Hyde's uses and linking to other interesting content (e.g. a list of themes, links to sites powered by Hyde, etc.). References #188, #209, and quite a few other issues. @lakshmivyas, @llonchj: please review. This is a starting point for Sphinx docs, and the PR is labelled as a work in progress, but I have no specific threshold for it being "done". Once we're all satisfied with the first pass, I'll set up RTD, and we can start filing issues for specific areas lacking docs.main
@@ -44,6 +44,7 @@ env: | |||
- TOX_ENV=py34 | |||
- TOX_ENV=py35 | |||
- TOX_ENV=pep8 | |||
- TOX_ENV=docs | |||
before_script: | |||
- export PATH=$(pwd)/node_modules/.bin:$PATH | |||
@@ -11,7 +11,8 @@ with hyde. | |||
`Hyde layout for bootstrap`_ by `auzigog`_ is also a good alternative if you | |||
like Twitter's `bootstrap framework`_. | |||
You can also take a look at `Hyde Powered Websites`_ for inspiration and reference. | |||
You can also take a look at `Hyde Powered Websites`_ for inspiration and | |||
reference. | |||
Currently hyde is only supported on python 2.7.x. Python 3.x support is in | |||
progress, thanks to `jonafato`_. | |||
@@ -0,0 +1,3 @@ | |||
doc8 | |||
sphinx | |||
sphinxcontrib-napoleon |
@@ -0,0 +1,192 @@ | |||
# Makefile for Sphinx documentation | |||
# | |||
# You can set these variables from the command line. | |||
SPHINXOPTS = | |||
SPHINXBUILD = sphinx-build | |||
PAPER = | |||
BUILDDIR = _build | |||
# User-friendly check for sphinx-build | |||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) | |||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) | |||
endif | |||
# Internal variables. | |||
PAPEROPT_a4 = -D latex_paper_size=a4 | |||
PAPEROPT_letter = -D latex_paper_size=letter | |||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . | |||
# the i18n builder cannot share the environment and doctrees with the others | |||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . | |||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext | |||
help: | |||
@echo "Please use \`make <target>' where <target> is one of" | |||
@echo " html to make standalone HTML files" | |||
@echo " dirhtml to make HTML files named index.html in directories" | |||
@echo " singlehtml to make a single large HTML file" | |||
@echo " pickle to make pickle files" | |||
@echo " json to make JSON files" | |||
@echo " htmlhelp to make HTML files and a HTML help project" | |||
@echo " qthelp to make HTML files and a qthelp project" | |||
@echo " applehelp to make an Apple Help Book" | |||
@echo " devhelp to make HTML files and a Devhelp project" | |||
@echo " epub to make an epub" | |||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" | |||
@echo " latexpdf to make LaTeX files and run them through pdflatex" | |||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" | |||
@echo " text to make text files" | |||
@echo " man to make manual pages" | |||
@echo " texinfo to make Texinfo files" | |||
@echo " info to make Texinfo files and run them through makeinfo" | |||
@echo " gettext to make PO message catalogs" | |||
@echo " changes to make an overview of all changed/added/deprecated items" | |||
@echo " xml to make Docutils-native XML files" | |||
@echo " pseudoxml to make pseudoxml-XML files for display purposes" | |||
@echo " linkcheck to check all external links for integrity" | |||
@echo " doctest to run all doctests embedded in the documentation (if enabled)" | |||
@echo " coverage to run coverage check of the documentation (if enabled)" | |||
clean: | |||
rm -rf $(BUILDDIR)/* | |||
html: | |||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html | |||
@echo | |||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html." | |||
dirhtml: | |||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml | |||
@echo | |||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." | |||
singlehtml: | |||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml | |||
@echo | |||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." | |||
pickle: | |||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle | |||
@echo | |||
@echo "Build finished; now you can process the pickle files." | |||
json: | |||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json | |||
@echo | |||
@echo "Build finished; now you can process the JSON files." | |||
htmlhelp: | |||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp | |||
@echo | |||
@echo "Build finished; now you can run HTML Help Workshop with the" \ | |||
".hhp project file in $(BUILDDIR)/htmlhelp." | |||
qthelp: | |||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp | |||
@echo | |||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \ | |||
".qhcp project file in $(BUILDDIR)/qthelp, like this:" | |||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Hyde.qhcp" | |||
@echo "To view the help file:" | |||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Hyde.qhc" | |||
applehelp: | |||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp | |||
@echo | |||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp." | |||
@echo "N.B. You won't be able to view it unless you put it in" \ | |||
"~/Library/Documentation/Help or install it in your application" \ | |||
"bundle." | |||
devhelp: | |||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp | |||
@echo | |||
@echo "Build finished." | |||
@echo "To view the help file:" | |||
@echo "# mkdir -p $$HOME/.local/share/devhelp/Hyde" | |||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Hyde" | |||
@echo "# devhelp" | |||
epub: | |||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub | |||
@echo | |||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub." | |||
latex: | |||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex | |||
@echo | |||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." | |||
@echo "Run \`make' in that directory to run these through (pdf)latex" \ | |||
"(use \`make latexpdf' here to do that automatically)." | |||
latexpdf: | |||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex | |||
@echo "Running LaTeX files through pdflatex..." | |||
$(MAKE) -C $(BUILDDIR)/latex all-pdf | |||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." | |||
latexpdfja: | |||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex | |||
@echo "Running LaTeX files through platex and dvipdfmx..." | |||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja | |||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." | |||
text: | |||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text | |||
@echo | |||
@echo "Build finished. The text files are in $(BUILDDIR)/text." | |||
man: | |||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man | |||
@echo | |||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man." | |||
texinfo: | |||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo | |||
@echo | |||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." | |||
@echo "Run \`make' in that directory to run these through makeinfo" \ | |||
"(use \`make info' here to do that automatically)." | |||
info: | |||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo | |||
@echo "Running Texinfo files through makeinfo..." | |||
make -C $(BUILDDIR)/texinfo info | |||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." | |||
gettext: | |||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale | |||
@echo | |||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." | |||
changes: | |||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes | |||
@echo | |||
@echo "The overview file is in $(BUILDDIR)/changes." | |||
linkcheck: | |||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | |||
@echo | |||
@echo "Link check complete; look for any errors in the above output " \ | |||
"or in $(BUILDDIR)/linkcheck/output.txt." | |||
doctest: | |||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest | |||
@echo "Testing of doctests in the sources finished, look at the " \ | |||
"results in $(BUILDDIR)/doctest/output.txt." | |||
coverage: | |||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage | |||
@echo "Testing of coverage in the sources finished, look at the " \ | |||
"results in $(BUILDDIR)/coverage/python.txt." | |||
xml: | |||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml | |||
@echo | |||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml." | |||
pseudoxml: | |||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml | |||
@echo | |||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." |
@@ -0,0 +1,5 @@ | |||
========= | |||
Changelog | |||
========= | |||
.. include:: ../CHANGELOG.rst |
@@ -0,0 +1,235 @@ | |||
====================== | |||
Command Line Reference | |||
====================== | |||
The ``hyde`` command line supports the following subcommands: | |||
.. TODO: This is a really good candidate for an autoclass. | |||
+-------------+---------------------------------------------------------+ | |||
| ``create`` | Initialize a new site at a given path. | | |||
+-------------+---------------------------------------------------------+ | |||
| ``gen`` | Generate the website to a configured deploy folder. | | |||
+-------------+---------------------------------------------------------+ | |||
| ``serve`` | Start a local HTTP server that regenerates based on the | | |||
| | requested file. | | |||
+-------------+---------------------------------------------------------+ | |||
| ``publish`` | Publish the generated site based on configuration. | | |||
+-------------+---------------------------------------------------------+ | |||
create | |||
====== | |||
Create a new Hyde website:: | |||
hyde create | |||
hyde [-s </site/path>] [-v] create [-l <layout>] [-f] [-h] | |||
Options: | |||
``-s SITEPATH``, ``--sitepath SITEPATH`` | |||
Specify where the site should be created. | |||
A new site will only be created if ``SITEPATH`` does not exist. To overwrite an | |||
existing directory, use the ``--force`` option. | |||
Defaults to the current directory. | |||
---- | |||
``-f``, ``--force`` | |||
Overwrite files and folders at the given site path. | |||
``hyde create`` will raise an exception if the target directory is not empty | |||
unless this option is specified. | |||
Defaults to false. | |||
---- | |||
``-l LAYOUT``, ``--layout LAYOUT`` | |||
The name of the layout to use for creating the initial site. Hyde provides | |||
three layouts: ``basic``, ``test``, and ``doc``. | |||
Hyde tries to locate the specified layout in the following folders: | |||
1. In the ``layouts`` folder under the path specified by the ``HYDE_DATA`` | |||
environment variable. | |||
2. In ``hyde``'s own ``layouts`` folder. | |||
Assuming the ``HYDE_DATA`` environment variable is empty and the folder | |||
``~/test`` is empty, the following command will create a new Hyde site at | |||
``~/test`` with the contents of the ``layouts/doc`` folder:: | |||
hyde -s ~/test create -l doc | |||
Defaults to ``basic``. | |||
---- | |||
``-v``, ``--verbose`` | |||
Log detailed messages to the console. | |||
Defaults to false. Show only essential messages if this option is omitted. | |||
---- | |||
``-h``, ``--help`` | |||
Display the help text for the ``create`` command. | |||
generate | |||
======== | |||
Generate the given website:: | |||
hyde gen | |||
hyde [-s <site/path>] [-v] gen [-r] [-d <deploy/path>] [-c <config/path>] [-h] | |||
Options: | |||
``-s SITEPATH``, ``--sitepath SITEPATH`` | |||
The path to the site to be generated.th to the site to be generated. | |||
Defaults to the current directory. | |||
---- | |||
``-r``, ``regen`` | |||
Regenerate the entire website. By default, ``hyde gen`` performs incremental | |||
generation. While Hyde does a good job at understanding dependencies, its far | |||
from perfect. When there are cases where the incremental generation does not | |||
yield the desired results, you can provide this option to generate the website | |||
from scratch. | |||
Defaults to incremental generation. | |||
---- | |||
``-d DEPLOY_PATH``, ``--deploy-path DEPLOY_PATH`` | |||
Location where the site should be generated. This option overrides any setting | |||
specified in the Hyde `configuration <config>`_. The path is assumed to be | |||
relative to the site path unless a preceding path separator is found. | |||
Defaults to the option specified in the config file or the ``deploy`` folder | |||
under the current site path if no config entry exists. | |||
---- | |||
``-c CONFIG``, ``--config-path CONFIG`` | |||
Specify an alternate configuration file to use for generating the site. This is | |||
useful if you have two different configurations for you production versus | |||
development websites. The path is assumed to be relative to the site path | |||
unless a preceding path separator is found. | |||
The following command will use ``production.yaml`` as the configuration file | |||
and generate the website at ``~/test`` to the ``~/production_site`` directory:: | |||
cd ~/test | |||
hyde gen -c production.yaml -d ~/production_site | |||
Defaults to ``site.yaml``. | |||
---- | |||
``-v``, ``--verbose`` | |||
Log detailed messages to the console. | |||
Defaults to false. Show only essential messages if this option is omitted. | |||
---- | |||
``-h``, ``--help`` | |||
Display the help text for the ``gen`` command. | |||
serve | |||
===== | |||
Start the built in web server that also regenerates based on the request if | |||
there are changes:: | |||
hyde serve | |||
hyde [-s </site/path>] [-v] gen [-d </deploy/path>] [-c <config/path>] [-h] | |||
Options: | |||
``-s SITEPATH``, ``--sitepath SITEPATH`` | |||
``-d DEPLOY_PATH``, ``--deploy-path DEPLOY_PATH`` | |||
``-c CONFIG``, ``--config-path CONFIG`` | |||
Since the ``serve`` command auto generates if there is a need, it needs the | |||
same parameters as the ``gen`` command. The above parameters serve the same | |||
purpose here as in the ``gen`` command. | |||
---- | |||
``-a ADDRESS``, ``--address ADDRESS`` | |||
The address to serve the website. | |||
Defaults to ``localhost``. | |||
---- | |||
``-p PORT``, ``--port PORT`` | |||
The port to serve the website. | |||
The following command will serve the website at http://localhost:8181:: | |||
hyde serve -p 8181 | |||
Defaults to 8080. | |||
---- | |||
``-h``, ``--help`` | |||
Display the help text for the ``serve`` command. | |||
publish | |||
======= | |||
Publish the site based on configuration. Currently, the only supported | |||
publishing target is a git repository. See the `publisher documentation | |||
<publisher>`_ for more information. | |||
Options: | |||
``-s SITEPATH``, ``--sitepath SITEPATH`` | |||
The path to the site to be generated. | |||
Defaults to the current working directory. | |||
---- | |||
``-p CONFIG`` | |||
The key for configuration section in the site configuration that has the | |||
settings for the publisher. For example, the following configuration, when | |||
invoked with ``hyde publish -p github`` will use the ``Git`` publisher to | |||
publish the generated site to ``hyde/hyde.github.com`` repository:: | |||
publisher: | |||
github: | |||
type: hyde.ext.publishers.dvcs.Git | |||
path: ../hyde.github.com | |||
url: git@github.com:hyde/hyde.github.com.git |
@@ -0,0 +1,297 @@ | |||
#!/usr/bin/env python3 | |||
# -*- coding: utf-8 -*- | |||
# | |||
# Hyde documentation build configuration file, created by | |||
# sphinx-quickstart on Sat Feb 13 21:35:00 2016. | |||
# | |||
# 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. | |||
import sys | |||
import os | |||
import shlex | |||
import pkg_resources | |||
# 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. | |||
#sys.path.insert(0, os.path.abspath('.')) | |||
# -- 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 = [ | |||
'sphinx.ext.autodoc', | |||
'sphinx.ext.intersphinx', | |||
'sphinx.ext.todo', | |||
'sphinx.ext.ifconfig', | |||
'sphinx.ext.viewcode', | |||
] | |||
# 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_suffix = '.rst' | |||
# The encoding of source files. | |||
#source_encoding = 'utf-8-sig' | |||
# The master toctree document. | |||
master_doc = 'index' | |||
# General information about the project. | |||
project = 'Hyde' | |||
copyright = '2009-2016, Hyde Developers' | |||
author = 'Hyde Developers' | |||
# 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 full version, including alpha/beta/rc tags. | |||
release = pkg_resources.get_distribution('hyde').version | |||
# The short X.Y version. | |||
version = release.rsplit('.', 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 | |||
# There are two options for replacing |today|: either, you set today to some | |||
# non-false value, then it is used: | |||
#today = '' | |||
# Else, today_fmt is used as the format for a strftime call. | |||
#today_fmt = '%B %d, %Y' | |||
# List of patterns, relative to source directory, that match files and | |||
# directories to ignore when looking for source files. | |||
exclude_patterns = ['_build'] | |||
# The reST default role (used for this markup: `text`) to use for all | |||
# documents. | |||
#default_role = None | |||
# If true, '()' will be appended to :func: etc. cross-reference text. | |||
#add_function_parentheses = True | |||
# If true, the current module name will be prepended to all description | |||
# unit titles (such as .. function::). | |||
#add_module_names = True | |||
# If true, sectionauthor and moduleauthor directives will be shown in the | |||
# output. They are ignored by default. | |||
#show_authors = False | |||
# The name of the Pygments (syntax highlighting) style to use. | |||
pygments_style = 'sphinx' | |||
# A list of ignored prefixes for module index sorting. | |||
#modindex_common_prefix = [] | |||
# If true, keep warnings as "system message" paragraphs in the built documents. | |||
#keep_warnings = False | |||
# If true, `todo` and `todoList` produce output, else they produce nothing. | |||
todo_include_todos = True | |||
# -- 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 = 'sphinx_rtd_theme' | |||
# 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 themes here, relative to this directory. | |||
#html_theme_path = [] | |||
# The name for this set of Sphinx documents. If None, it defaults to | |||
# "<project> v<release> documentation". | |||
#html_title = None | |||
# A shorter title for the navigation bar. Default is the same as html_title. | |||
#html_short_title = None | |||
# The name of an image file (relative to this directory) to place at the top | |||
# of the sidebar. | |||
#html_logo = None | |||
# The name of an image file (within the static path) to use as favicon of the | |||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 | |||
# pixels large. | |||
#html_favicon = None | |||
# 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'] | |||
# Add any extra paths that contain custom files (such as robots.txt or | |||
# .htaccess) here, relative to this directory. These files are copied | |||
# directly to the root of the documentation. | |||
#html_extra_path = [] | |||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, | |||
# using the given strftime format. | |||
#html_last_updated_fmt = '%b %d, %Y' | |||
# If true, SmartyPants will be used to convert quotes and dashes to | |||
# typographically correct entities. | |||
#html_use_smartypants = True | |||
# Custom sidebar templates, maps document names to template names. | |||
#html_sidebars = {} | |||
# Additional templates that should be rendered to pages, maps page names to | |||
# template names. | |||
#html_additional_pages = {} | |||
# If false, no module index is generated. | |||
#html_domain_indices = True | |||
# If false, no index is generated. | |||
#html_use_index = True | |||
# If true, the index is split into individual pages for each letter. | |||
#html_split_index = False | |||
# If true, links to the reST sources are added to the pages. | |||
#html_show_sourcelink = True | |||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. | |||
#html_show_sphinx = True | |||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. | |||
#html_show_copyright = True | |||
# If true, an OpenSearch description file will be output, and all pages will | |||
# contain a <link> tag referring to it. The value of this option must be the | |||
# base URL from which the finished HTML is served. | |||
#html_use_opensearch = '' | |||
# This is the file name suffix for HTML files (e.g. ".xhtml"). | |||
#html_file_suffix = None | |||
# Language to be used for generating the HTML full-text search index. | |||
# Sphinx supports the following languages: | |||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' | |||
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' | |||
#html_search_language = 'en' | |||
# A dictionary with options for the search language support, empty by default. | |||
# Now only 'ja' uses this config value | |||
#html_search_options = {'type': 'default'} | |||
# The name of a javascript file (relative to the configuration directory) that | |||
# implements a search results scorer. If empty, the default will be used. | |||
#html_search_scorer = 'scorer.js' | |||
# Output file base name for HTML help builder. | |||
htmlhelp_basename = 'Hydedoc' | |||
# -- 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, 'Hyde.tex', 'Hyde Documentation', | |||
'Hyde Developers', 'manual'), | |||
] | |||
# The name of an image file (relative to this directory) to place at the top of | |||
# the title page. | |||
#latex_logo = None | |||
# For "manual" documents, if this is true, then toplevel headings are parts, | |||
# not chapters. | |||
#latex_use_parts = False | |||
# If true, show page references after internal links. | |||
#latex_show_pagerefs = False | |||
# If true, show URL addresses after external links. | |||
#latex_show_urls = False | |||
# Documents to append as an appendix to all manuals. | |||
#latex_appendices = [] | |||
# If false, no module index is generated. | |||
#latex_domain_indices = True | |||
# -- 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, 'hyde', 'Hyde Documentation', | |||
[author], 1) | |||
] | |||
# If true, show URL addresses after external links. | |||
#man_show_urls = False | |||
# -- 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, 'Hyde', 'Hyde Documentation', | |||
author, 'Hyde', 'One line description of project.', | |||
'Miscellaneous'), | |||
] | |||
# Documents to append as an appendix to all manuals. | |||
#texinfo_appendices = [] | |||
# If false, no module index is generated. | |||
#texinfo_domain_indices = True | |||
# How to display URL addresses: 'footnote', 'no', or 'inline'. | |||
#texinfo_show_urls = 'footnote' | |||
# If true, do not generate a @detailmenu in the "Top" node's menu. | |||
#texinfo_no_detailmenu = False | |||
# Example configuration for intersphinx: refer to the Python standard library. | |||
intersphinx_mapping = {'https://docs.python.org/': None} |
@@ -0,0 +1,131 @@ | |||
============= | |||
Configuration | |||
============= | |||
Hyde is configured using one or more ``yaml`` files. On top of all the niceties | |||
``yaml`` provides out of the box, Hyde also adds a few power features to manage | |||
complex websites. | |||
If a site has a ``site.yaml`` file in the root directory, it is used as the | |||
configuration for generating the website. This can be overridden by providing a | |||
command line option. See the `command line reference <CLI>`_ for details. | |||
Inheritance | |||
=========== | |||
Configuration files can inherit from another file using the ``extends`` option. | |||
For example, the following configuration will inherit all properties from | |||
``site.yaml`` and override the ``mode`` property:: | |||
extends: site.yaml | |||
mode: production | |||
This is useful for customizing the site to operate in different modes. For | |||
example, when running locally you may want your media files to come from | |||
``/media`` but on production you may have a subdomain and want the media to | |||
come from ``http://abc.example.com/media``. | |||
This can be accomplished by creating an ``extended`` configuration file and | |||
overriding the ``media_url`` property. | |||
.. todo:: Add link to real example config. | |||
The following settings can be defined for use in templates: | |||
Paths & URLs | |||
============ | |||
+----------------+-----------------------------------------------------------+ | |||
| ``media_root`` | The root path where media files (images, CSS, JavaScript, | | |||
| | etc.) can be found. This may be used by plugins for | | |||
| | special processing. If your website does not have a | | |||
| | folder that contains all media, you can safely omit this | | |||
| | property. Defaults to ``media``. | | |||
+----------------+-----------------------------------------------------------+ | |||
| ``media_url`` | The url prefix for serving media files. If you are using | | |||
| | a CDN like Amazon S3 or the Rackspace cloud and host all | | |||
| | of your media files from there, you can make use of this | | |||
| | property to specify the prefix for all media files. | | |||
| | Defaults to ``/media``. | | |||
+----------------+-----------------------------------------------------------+ | |||
| ``base_url`` | The base url from which the site is served. If you are | | |||
| | hosting the website in a subdomain or as part of a larger | | |||
| | website, you can specify this property to indicate the | | |||
| | path of this project in your website. Defaults to ``/``. | | |||
+----------------+-----------------------------------------------------------+ | |||
Plugins and Templates | |||
===================== | |||
+--------------+--------------------------------------------------------------+ | |||
| ``template`` | The template engine to use for processing the website can be | | |||
| | specified in the configuration file as a Python class path. | | |||
| | Currently, only ``Jinja2`` is supported. Reserved for future | | |||
| | use. Defaults to | | |||
| | ``hyde.ext.templates.jinja.jinja2template``. | | |||
+--------------+--------------------------------------------------------------+ | |||
| ``plugins`` | Plugins are specified as list of Python class paths. Events | | |||
| | that are raised during the generation of the website are | | |||
| | issued to the plugins in the same order as they are listed | | |||
| | here. You can learn more about how the individual plugins | | |||
| | are configured in the `plugin documentation <plugins>`_. | | |||
| | Optional. By default, no plugins are enabled. | | |||
+--------------+--------------------------------------------------------------+ | |||
.. _object-model: | |||
Context Data | |||
============ | |||
The context section contains key / value pairs that are simply passed on to the | |||
templates. | |||
For example, given the following configuration, the statement | |||
``{{ app.current_version }}`` in any template will output ``0.6``:: | |||
context: | |||
data: | |||
app: | |||
version: 0.6 | |||
By default, no context variables are provided. | |||
Context Data Providers | |||
====================== | |||
Providers are special constructs used to import data into the context. For | |||
example, data from a database can be exported as ``yaml`` and imported as a | |||
provider. For example, the following snippets would import the data in | |||
``app-versions.yaml`` into ``context[versions]``. This data can then be used | |||
directly in templates in this manner: ``{{ versions.latest }}``. | |||
.. TODO: Investigate code-block captions here. This feature was added in sphinx | |||
1.3, but doc8 seems to not support that yet. | |||
.. code:: | |||
# site.yaml | |||
context: | |||
providers: | |||
versions: app-versions.yaml | |||
.. code:: | |||
# app-versions.yaml | |||
latest: 0.6 | |||
Markdown | |||
======== | |||
Extensions and extension configuration for markdown can be configured in the | |||
``markdown`` property. You can read about markdown extensions in the | |||
`Python-Markdown documentation <https://pythonhosted.org/Markdown/>`_. | |||
The following configuration will use the ``def_list``, ``tables``, ``headerid`` | |||
extensions in Python-Markdown. |
@@ -0,0 +1,108 @@ | |||
==== | |||
Hyde | |||
==== | |||
Overview | |||
======== | |||
Hyde is a static website generator written in Python. While Hyde took life as | |||
`Jekyll <https://jekyllrb.com/>`_'s evil twin, it has since been completely | |||
consumed by `the dark side <https://www.python.org/>`_ and has taken on an | |||
`identity of its own <https://groups.google.com/forum/#!forum/hyde-dev>`_. | |||
Hyde desires to fulfill the lofty goal of removing the pain points involved in | |||
creating and maintaining static websites. | |||
Spotlight | |||
========= | |||
- Support for powerful template languages like `Jinja2 | |||
<http://jinja.pocoo.org>`_ complemented with custom tags and filters. | |||
- Rich :ref:`object model <object-model>` and overridable hierarchical | |||
:doc:`metadata </configuration>` available for use in templates. | |||
- Configurable sorting, tagging, and grouping support. | |||
- Extensible :doc:`plugins` architecture with text preprocessing and HTML | |||
postprocessing support for complex content transformations. | |||
- Instant preview using built-in :doc:`webserver <server>` that regenerates | |||
content if needed. | |||
Installation | |||
============ | |||
Hyde is available on `PyPI <https://pypi.python.org/pypi/hyde>`_. | |||
Installing hyde is as simple as running the following command:: | |||
$ python -m pip install hyde | |||
Quickstart | |||
========== | |||
After installing ``hyde``, creating and generating a website is extremely | |||
simple. | |||
To create a new Hyde website:: | |||
$ hyde -s /path/to/your/site create | |||
To generate the HTML:: | |||
$ cd /path/to/your/site | |||
$ hyde gen | |||
To serve the generated content, use Hyde's built-in web server:: | |||
$ hyde serve | |||
The website is now accessible at `http://localhost:8080 | |||
<http://localhost:8080>`_. | |||
The webserver regenerates the necessary files to serve your request. So, you | |||
can make your changes and simply refresh your browser to view them. | |||
For all the supported options, read the :doc:`cli` documentation or run:: | |||
$ hyde --help | |||
Your First Hyde Website | |||
======================= | |||
Hyde uses the ``basic`` layout to generate your website by default. When you | |||
view your generated website, you will see the following dummy pages: | |||
#FIXME: images | |||
You can now continue to edit the content, layout and styles to customize it to | |||
your needs. Please see the :doc:`templates` documentation for more information. | |||
Source | |||
====== | |||
Hyde is `socially coded <https://github.com/hyde/hyde>`_. Feel free to fork. | |||
Contents: | |||
.. toctree:: | |||
:maxdepth: 1 | |||
installation | |||
cli | |||
configuration | |||
plugins | |||
server | |||
templates | |||
changelog | |||
Indices and tables | |||
================== | |||
* :ref:`genindex` | |||
* :ref:`modindex` | |||
* :ref:`search` | |||
@@ -0,0 +1,53 @@ | |||
============ | |||
Installation | |||
============ | |||
Installing hyde is as simple as running the following command:: | |||
python -m pip install hyde | |||
However, based on your choice and use of plugins you may need to install | |||
additional packages. The requirements for each plugin is outlined in the | |||
corresponding :doc:`plugins` documentation. | |||
Dependencies | |||
============ | |||
While your mileage may vary, we consider the following to be essential for | |||
generating a static website with Hyde. These are a part of the requirements | |||
file, and the above command will download and install all of them as part of | |||
Hyde. | |||
It is also recommended that you use `virtualenv <http://virtualenv.rtfd.org>`_ | |||
to separate the Hyde environment from other python projects. Note that | |||
installing Hyde using ``pip`` would install all of the below. However, if you’d | |||
like finer grained control over the packages, you can install these | |||
individually: | |||
1. ``argparse``: argparse is required if you are on python 2.6. | |||
2. ``commando``: commando is a wrapper on top of argparse to give better syntax | |||
and support for multi-command applications. | |||
3. ``Jinja2``: While Hyde will support many more template languages in the | |||
future, currently only Jinja2 is wholly supported and recommended. | |||
4. ``Markdown``: While there are plans to add support for other markups | |||
(textile, restructured text, asciidoc etc..,), markdown is the one thats | |||
currently completely supported. | |||
5. ``Pyyaml``: Much of Hyde’s :doc:`/configuration` is done using YAML. | |||
6. ``pygments``: For syntax highlighting. | |||
7. ``Typogrify``: Typogrify automatically fixes and enhances the typographical | |||
accuracy of your content. While this is not a technical requirement for | |||
Hyde, it is absolutely essential to create good looking content. | |||
The following commands can be used to install the dependencies for Hyde | |||
individually:: | |||
python -m pip install argparse | |||
python -m pip install commando | |||
python -m pip install jinja2 | |||
python -m pip install markdown | |||
python -m pip install pyyaml | |||
python -m pip install pygments | |||
python -m pip install smartypants | |||
python -m pip install typogrify |
@@ -0,0 +1,82 @@ | |||
======= | |||
Plugins | |||
======= | |||
Hyde is built with a nuclear engine that is stripped down but powerful. Even | |||
core features like ``metadata`` are added as plugins to keep the engine bloat | |||
free. | |||
Hyde’s plugin architecture is event driven; plugins get notified during the | |||
course of the generation to allow them to alter/guide the generation process. | |||
If you are interested in creating plugins for Hyde, you can read the developer | |||
documentation. | |||
Configuration | |||
============= | |||
Hyde’s plugins get loaded if they are listed in the plugins section of | |||
:doc:`configuration`. Plugins also accept additional parameters in their | |||
respective sections. For example, ``MyAwesomePlugin`` will get parameters from | |||
``myawesome`` section in the configuration file. | |||
In the box | |||
========== | |||
Hyde is shipped with the following plugins: | |||
Metadata | |||
======== | |||
Metadata | |||
-------- | |||
.. autoclass:: hyde.ext.plugins.meta.MetaPlugin | |||
AutoExtend | |||
---------- | |||
.. autoclass:: hyde.ext.plugins.meta.AutoExtendPlugin | |||
Sorter | |||
------ | |||
.. autoclass:: hyde.ext.plugins.meta.SorterPlugin | |||
CSS | |||
=== | |||
Less CSS | |||
-------- | |||
.. autoclass:: hyde.ext.plugins.css.LessCSSPlugin | |||
Text Replacement | |||
================ | |||
Blockdown | |||
--------- | |||
.. autoclass:: hyde.ext.plugins.text.BlockdownPlugin | |||
Mark | |||
---- | |||
.. autoclass:: hyde.ext.plugins.text.MarkingsPlugin | |||
Refer | |||
----- | |||
.. autoclass:: hyde.ext.plugins.text.ReferencePlugin | |||
Textlinks | |||
--------- | |||
.. autoclass:: hyde.ext.plugins.text.TextlinksPlugin | |||
Syntext | |||
------- | |||
.. autoclass:: hyde.ext.plugins.text.SyntextPlugin | |||
Structure | |||
========= | |||
Folder Flattener | |||
---------------- | |||
.. autoclass:: hyde.ext.plugins.structure.FlattenerPlugin |
@@ -0,0 +1,34 @@ | |||
========== | |||
Web Server | |||
========== | |||
The Hyde web server is a simple, bare-bones webserver based on Python's `Simple | |||
HTTP Request Handler <http://docs.python.org/library/simplehttpserver.html>`_. | |||
The following command starts the built in webserver:: | |||
hyde serve | |||
You can now access your website at ``http://localhost:8080``. | |||
The webserver regenerates the necessary files to serve your request. So, you | |||
can make your changes and simply refresh your browser to view them. | |||
Special Parameters | |||
================== | |||
The Hyde webserver supports just one special parameter: ``refresh``. | |||
If you add ``?refresh`` to the URL, the server regenerates the site completely | |||
and refreshes your browser. Note that for larger sites, this may take a few | |||
seconds to complete. | |||
Dependencies | |||
============ | |||
Information about dependencies between pages are stored in your site root | |||
directory in the ``.hyde_deps`` file. If regeneration is not consistent with | |||
your expectations, you can simply delete this file, and Hyde will build the | |||
dependency tree again. |
@@ -0,0 +1,59 @@ | |||
========= | |||
Templates | |||
========= | |||
Creating Layouts | |||
================ | |||
Hyde is designed to support more than one template language for creating | |||
layouts, however, it currently only supports `Jinja2 | |||
<http://jinja.pocoo.org>`_. This section of the documentation will focus on | |||
creating templates using Jinja2. If you are not familiar with Jinja2, it's a | |||
good idea to go through the `most excellent Jinja2 documentation | |||
<http://jinja.pocoo.org/docs/dev/templates/>`_. | |||
Site Structure | |||
============== | |||
Hyde encourages separation of content from layout. The following shows a | |||
typical structure of a Hyde website:: | |||
├── content/ | |||
│ ├── about.html | |||
│ ├── blog/ | |||
│ ├── index.html | |||
│ ├── layout/ | |||
│ │ ├── base.j2 | |||
│ │ └── macros.j2 | |||
│ ├── media/ | |||
│ │ ├── css/ | |||
│ │ ├── images/ | |||
│ │ └── js/ | |||
│ ├── portfolio/ | |||
│ └── projects/ | |||
└── site.yml | |||
good objective is to have all the files in content contain as little layout as | |||
possible and be written with a text oriented markup language like `markdown | |||
<https://daringfireball.net/projects/markdown/>`_. While its not always | |||
possible to achieve 100% separation, hyde provides several nice tools to get | |||
very close to that goal. | |||
Context Variables | |||
================= | |||
Hyde by default makes the following variables available for templates: | |||
- ``site``: Represents the container object of the entire site. | |||
- ``node``: The node (folder) where the current file resides. | |||
- ``resource``: The resource (file) that is currently being processed. | |||
- Context variables: all variables defined under the ``context`` section of the | |||
site configuration are available to the templates. | |||
Read more information about the ``site``, ``mode``, and ``resource`` variables | |||
in the `site model documentation <#>`_. | |||
Read more information about context variables in the `configuration | |||
documentation <#config>`_. |
@@ -55,12 +55,14 @@ class MetaPlugin(Plugin): | |||
Metadata plugin for hyde. Loads meta data in the following order: | |||
1. meta.yaml: files in any folder | |||
2. frontmatter: any text file with content enclosed within three dashes | |||
or three equals signs. | |||
Example: | |||
--- | |||
abc: def | |||
--- | |||
2. frontmatter: any text file with content enclosed within three | |||
dashes or three equals signs. | |||
Example:: | |||
--- | |||
abc: def | |||
--- | |||
Supports YAML syntax. | |||
""" | |||
@@ -497,24 +499,24 @@ class SorterPlugin(Plugin): | |||
to support prebuilt sorting methods. These methods | |||
can be used in the templates directly. | |||
Configuration example | |||
--------------------- | |||
#yaml | |||
Configuration example:: | |||
sorter: | |||
kind: | |||
# Sorts by this attribute name | |||
# Uses `attrgetter` on the resource object | |||
attr: source_file.kind | |||
# The filters to be used before sorting | |||
# This can be used to remove all the items | |||
# that do not apply. For example, | |||
# filtering non html content | |||
filters: | |||
source_file.kind: html | |||
is_processable: True | |||
meta.is_listable: True | |||
#yaml | |||
sorter: | |||
kind: | |||
# Sorts by this attribute name | |||
# Uses `attrgetter` on the resource object | |||
attr: source_file.kind | |||
# The filters to be used before sorting | |||
# This can be used to remove all the items | |||
# that do not apply. For example, | |||
# filtering non html content | |||
filters: | |||
source_file.kind: html | |||
is_processable: True | |||
meta.is_listable: True | |||
""" | |||
def __init__(self, site): | |||
@@ -1,5 +1,5 @@ | |||
[tox] | |||
envlist = py{27,33,34,35},pep8 | |||
envlist = py{27,33,34,35},pep8,docs | |||
[testenv] | |||
usedevelop = True | |||
@@ -12,8 +12,14 @@ commands = nosetests --with-coverage --cover-package=hyde --cover-erase {posargs | |||
[testenv:pep8] | |||
deps = flake8 | |||
commands = flake8 {posargs} | |||
commands = flake8 hyde {posargs} | |||
[flake8] | |||
exclude = .tox | |||
show-source = true | |||
[testenv:docs] | |||
deps = -rdocs-requirements.txt | |||
commands = | |||
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html | |||
doc8 --allow-long-titles README.rst docs/ --ignore-path docs/_build/ |