Something seems to have changed between ``pygments==2.1.0`` and
``pygments==2.1.1`` causing an extra ``<span></span>`` to be generated
by the Jinja2 and Markdown code block tests. This commit updates the
tests to reflect that change, but a more permanent solution should be
developed if possible.
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.
In hyde 0.8.9, when marking text files for simple copying, as in:
simple_copy:
- media/**/*.js
- "**/*.ppm"
- "**/*.htm"
Following exceptions are raised on (re)generation:
**"pure" HTML file** (in ISO8859-1, French):
21:35:19 hyde Unicode error when processing archive/05-06/article-02.htm
Traceback (most recent call last):
File "/home/ales/bin/hyde", line 9, in <module>
load_entry_point('hyde==0.8.9', 'console_scripts', 'hyde')()
File "/usr/lib/python2.7/site-packages/hyde/main.py", line 11, in main
Engine().run()
File "/usr/lib/python2.7/site-packages/commando/application.py", line 309, in run
args.run(self, args)
File "/usr/lib/python2.7/site-packages/hyde/engine.py", line 102, in gen
gen.generate_all(incremental=incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 216, in generate_all
self.__generate_node__(self.site.content, incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 313, in __generate_node__
self.__generate_resource__(resource, incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 321, in __generate_resource__
if incremental and not self.has_resource_changed(resource):
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 184, in has_resource_changed
deps = self.get_dependencies(resource)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 129, in get_dependencies
else self.update_deps(resource)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 153, in update_deps
deps.extend(self.template.get_dependencies(rel_path))
File "/usr/lib/python2.7/site-packages/hyde/ext/templates/jinja.py", line 799, in get_dependencies
text = self.env.loader.get_source(self.env, path)[0]
File "/usr/lib/python2.7/site-packages/hyde/ext/templates/jinja.py", line 652, in get_source
"Unicode error when processing %s" % template, sys.exc_info())
File "/usr/lib/python2.7/site-packages/hyde/ext/templates/jinja.py", line 649, in get_source
environment, template)
File "/usr/lib/python2.7/site-packages/jinja2/loaders.py", line 175, in get_source
contents = f.read().decode(self.encoding)
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
hyde.exceptions.HydeException: Unicode error when processing archive/05-06/article-02.htm
** Minified javascript** ({{ sequence detected as Jinja directive):
21:39:46 hyde Error processing media/lightbox/js/lightbox.min.js:
expected token 'end of print statement', got 'a'
Traceback (most recent call last):
File "/home/ales/bin/hyde", line 9, in <module>
load_entry_point('hyde==0.8.9', 'console_scripts', 'hyde')()
File "/usr/lib/python2.7/site-packages/hyde/main.py", line 11, in main
Engine().run()
File "/usr/lib/python2.7/site-packages/commando/application.py", line 309, in run
args.run(self, args)
File "/usr/lib/python2.7/site-packages/hyde/engine.py", line 102, in gen
gen.generate_all(incremental=incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 216, in generate_all
self.__generate_node__(self.site.content, incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 313, in __generate_node__
self.__generate_resource__(resource, incremental)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 321, in __generate_resource__
if incremental and not self.has_resource_changed(resource):
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 184, in has_resource_changed
deps = self.get_dependencies(resource)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 129, in get_dependencies
else self.update_deps(resource)
File "/usr/lib/python2.7/site-packages/hyde/generator.py", line 153, in update_deps
deps.extend(self.template.get_dependencies(rel_path))
File "/usr/lib/python2.7/site-packages/hyde/ext/templates/jinja.py", line 806, in get_dependencies
sys.exc_info())
File "/usr/lib/python2.7/site-packages/hyde/ext/templates/jinja.py", line 802, in get_dependencies
ast = self.env.parse(text)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 466, in parse
self.handle_exception(exc_info, source_hint=source)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "<unknown>", line 9, in template
hyde.exceptions.HydeException: Error processing media/lightbox/js/lightbox.min.js:
expected token 'end of print statement', got 'a'
All tests* currently pass under Python 2.7 and Python 3.3 - 3.5. This
does not mean that Python 3 support is stable, however. As a plan
forward, we should encourage interested users to run Hyde with Python 3,
report bugs, and submit patches. This change references the Python 3
Support issue on GitHub (#270). Once this becomes a bit more tested and
stable, that issue should be closed, and Hyde should announce official,
stable support for Python 3 (i.e. new changes must also support 3,
issues with running hyde under 3 should be considered bugs rather than
feature requests, etc.).
Changes:
- Add ``hyde/_compat.py`` for 2-to-3 compatibility helpers.
- Replace uses of 2-specific code with their ``hyde._compat`` versions.
- Tests remain largely unchanged (for good reason). The exceptions here
are to ``print`` function calls, and ``str`` type usage, and
compatibility imports.
- Replace explicit calls to ``foo.next()`` with ``next(foo)``. This
keeps code portable between Python 2's ``next`` and Python 3's
``__next__`` methods without the need for any compatibility functions
and is the recommended API for interacting with these methods.
- Replace deprecated (and, in Python 3, removed) ``except Exception, e:``
statements with their updated ``except Exception as e:`` versions.
- Replace print statements with print function calls (because of how
parentheses work in Python, this is transparently
cross-version-compatible).
- Add Python 3.3, 3.4, and 3.5 to ``tox.ini``, ``.travis.yml``, and
classifiers in ``setup.py``.
- Add ``{posargs}`` to ``tox.ini`` command invocations to improve usage
during development.
- Add Python 3 note in changelog.
* asciidoc does not support Python 3, and fixing that far beyond the
scope of this task, so the test that deals with it is conditionally
skipped when run using versions of Python 3.
Add contributing guidelines taken almost verbatim from the commando
project (removes the requirement to update a version because new
releases may include more than one set of changes). Fixes#303.