[Python-modules-commits] [quark-sphinx-theme] 01/10: Imported Upstream version 0.3.2
Felix Krull
fkrull-guest at moszumanska.debian.org
Sat Aug 13 15:41:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
fkrull-guest pushed a commit to branch master
in repository quark-sphinx-theme.
commit c16fde27246052a33c5a4db137dc883589a943e1
Author: Felix Krull <f_krull at gmx.de>
Date: Fri Jul 22 00:08:29 2016 +0200
Imported Upstream version 0.3.2
---
MANIFEST.in | 4 +
PKG-INFO | 102 ++++++
README.rst | 83 +++++
quark_sphinx_theme.egg-info/PKG-INFO | 102 ++++++
quark_sphinx_theme.egg-info/SOURCES.txt | 46 +++
quark_sphinx_theme.egg-info/dependency_links.txt | 1 +
quark_sphinx_theme.egg-info/entry_points.txt | 3 +
quark_sphinx_theme.egg-info/not-zip-safe | 1 +
quark_sphinx_theme.egg-info/top_level.txt | 1 +
quark_sphinx_theme/__init__.py | 17 +
quark_sphinx_theme/__version__.py | 7 +
quark_sphinx_theme/_lovelace.py | 103 ++++++
quark_sphinx_theme/_mixin.py | 65 ++++
quark_sphinx_theme/ext/__init__.py | 4 +
quark_sphinx_theme/ext/html_compat.py | 8 +
quark_sphinx_theme/ext/html_rewrite/__init__.py | 56 +++
quark_sphinx_theme/ext/html_rewrite/boxes.py | 42 +++
quark_sphinx_theme/ext/html_rewrite/compat.py | 42 +++
.../ext/html_rewrite/literal_blocks.py | 30 ++
quark_sphinx_theme/quark/domainindex.html | 50 +++
quark_sphinx_theme/quark/genindex-single.html | 35 ++
quark_sphinx_theme/quark/genindex.html | 45 +++
quark_sphinx_theme/quark/layout.html | 71 ++++
quark_sphinx_theme/quark/static/quark.css_t | 406 +++++++++++++++++++++
quark_sphinx_theme/quark/theme.conf | 37 ++
setup.cfg | 11 +
setup.py | 47 +++
test/__init__.py | 0
test/test_core.py | 17 +
test/test_html_rewrite.py | 126 +++++++
test/test_import.py | 29 ++
test/test_mixin.py | 123 +++++++
test/test_theme.py | 148 ++++++++
test/testdoc-html_rewrite/conf.py | 6 +
test/testdoc-html_rewrite/contents.rst | 11 +
test/testdoc-html_rewrite/test_admonition.rst | 11 +
test/testdoc-html_rewrite/test_citation.rst | 15 +
test/testdoc-html_rewrite/test_footnote.rst | 15 +
test/testdoc-html_rewrite/test_literal_block.rst | 15 +
test/testdoc-html_rewrite/test_pre_block.rst | 22 ++
test/testdoc-html_rewrite/test_sidebar.rst | 12 +
test/testdoc-html_rewrite/test_topic.rst | 11 +
test/testdoc-html_rewrite/test_warning.rst | 11 +
test/testdoc-theme/conf.py | 5 +
test/testdoc-theme/contents.rst | 19 +
test/util.py | 127 +++++++
tox.ini | 23 ++
47 files changed, 2165 insertions(+)
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..7ee478d
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,4 @@
+recursive-include quark_sphinx_theme/quark *
+recursive-include test/testdoc-* *
+include test/*.py
+include tox.ini
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..ec4378c
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,102 @@
+Metadata-Version: 1.1
+Name: quark-sphinx-theme
+Version: 0.3.2
+Summary: A Sphinx theme designed for QTextBrowser
+Home-page: https://bitbucket.org/fk/quark-sphinx-theme
+Author: Felix Krull
+Author-email: f_krull at gmx.de
+License: BSD
+Description: ========================================
+ Quark: a Sphinx theme for QTextBrowser
+ ========================================
+
+ About
+ =====
+
+ Quark is a Sphinx theme specifically designed to look and work well within the
+ limitations of the Qt toolkit's ``QTextBrowser``.
+
+ This theme was originally designed for the bundled manual of `SpeedCrunch`_.
+
+ .. _SpeedCrunch: http://speedcrunch.org
+
+
+ Installation
+ ============
+
+ * ``pip install quark-sphinx-theme``
+ * In your ``conf.py``::
+
+ import quark_sphinx_theme
+ html_theme_path = [quark_sphinx_theme.get_path()]
+ html_theme = 'quark'
+ # To enable more QTextBrowser-compatible HTML generation:
+ extensions = ['quark_sphinx_theme.ext.html_rewrite']
+
+
+ Changelog
+ =========
+
+ * quark-sphinx-theme 0.3.2 "I'll get it right some day" *(2016-05-23)*
+
+ - Include a copy of the lovelace style for compatibility with Pygments < 2.1.
+
+ * quark-sphinx-theme 0.3.1 *(2016-05-23)*
+
+ - Skip CSS syntax tests if tinycss isn't available.
+ - Make sure to include theme itself.
+ - Include test/util.py in source packages.
+
+ * quark-sphinx-theme 0.3 *(2016-05-22)*
+
+ - Remove ``hide_sidebar_in_index`` option.
+ - Fix styling of index pages.
+ - The ``quark_sphinx_theme.ext.html_compat`` extension has been renamed to
+ ``quark_sphinx_theme.ext.html_rewrite``. The old name remains supported for
+ backwards compatibility.
+ - The ``html_rewrite`` extension now supports wrapping admonitions in tables,
+ allowing for more styling options. The theme has been updated to take
+ advantage of this. Admonitions, topics, and sidebars look very different and
+ much better. If ``html_rewrite`` is not enabled, a fallback style will be
+ used for these.
+ - ``html_rewrite`` supports wrapping literal blocks in tables. If enabled,
+ this provides better styling for Pygments styles with non-white backgrounds.
+ - Smaller design changes:
+
+ - Don't use background color on code elements in headings and normal links.
+ - Display terms in definition lists in bold.
+ - Remove left and top margins for definition list bodies.
+ - Switch default code color scheme to 'lovelace'.
+
+ * quark-sphinx-theme 0.2.1 *(2016-03-02)*
+
+ - Change license to 2-clause BSD (in practice, it's the same thing).
+
+ * quark-sphinx-theme 0.2.0 *(2016-02-28)*
+
+ - Add ``quark_sphinx_theme.ext.html_compat`` extension.
+ - Add styling for citations, footnotes, table captions, and ``rubric``
+ directives.
+
+ * quark-sphinx-theme 0.1.2 *(2016-02-27)*
+
+ - Fix compatibility with Jinja2 2.3.
+
+ * quark-sphinx-theme 0.1.1 *(2016-02-24)*
+
+ - Fix spacing of navigation links.
+
+ * quark-sphinx-theme 0.1.0 *(2016-02-24)*
+
+ - Initial release.
+
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Framework :: Sphinx :: Theme
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: Documentation :: Sphinx
+Classifier: Topic :: Software Development :: Documentation
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..cb1f2c0
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,83 @@
+========================================
+Quark: a Sphinx theme for QTextBrowser
+========================================
+
+About
+=====
+
+Quark is a Sphinx theme specifically designed to look and work well within the
+limitations of the Qt toolkit's ``QTextBrowser``.
+
+This theme was originally designed for the bundled manual of `SpeedCrunch`_.
+
+.. _SpeedCrunch: http://speedcrunch.org
+
+
+Installation
+============
+
+* ``pip install quark-sphinx-theme``
+* In your ``conf.py``::
+
+ import quark_sphinx_theme
+ html_theme_path = [quark_sphinx_theme.get_path()]
+ html_theme = 'quark'
+ # To enable more QTextBrowser-compatible HTML generation:
+ extensions = ['quark_sphinx_theme.ext.html_rewrite']
+
+
+Changelog
+=========
+
+* quark-sphinx-theme 0.3.2 "I'll get it right some day" *(2016-05-23)*
+
+ - Include a copy of the lovelace style for compatibility with Pygments < 2.1.
+
+* quark-sphinx-theme 0.3.1 *(2016-05-23)*
+
+ - Skip CSS syntax tests if tinycss isn't available.
+ - Make sure to include theme itself.
+ - Include test/util.py in source packages.
+
+* quark-sphinx-theme 0.3 *(2016-05-22)*
+
+ - Remove ``hide_sidebar_in_index`` option.
+ - Fix styling of index pages.
+ - The ``quark_sphinx_theme.ext.html_compat`` extension has been renamed to
+ ``quark_sphinx_theme.ext.html_rewrite``. The old name remains supported for
+ backwards compatibility.
+ - The ``html_rewrite`` extension now supports wrapping admonitions in tables,
+ allowing for more styling options. The theme has been updated to take
+ advantage of this. Admonitions, topics, and sidebars look very different and
+ much better. If ``html_rewrite`` is not enabled, a fallback style will be
+ used for these.
+ - ``html_rewrite`` supports wrapping literal blocks in tables. If enabled,
+ this provides better styling for Pygments styles with non-white backgrounds.
+ - Smaller design changes:
+
+ - Don't use background color on code elements in headings and normal links.
+ - Display terms in definition lists in bold.
+ - Remove left and top margins for definition list bodies.
+ - Switch default code color scheme to 'lovelace'.
+
+* quark-sphinx-theme 0.2.1 *(2016-03-02)*
+
+ - Change license to 2-clause BSD (in practice, it's the same thing).
+
+* quark-sphinx-theme 0.2.0 *(2016-02-28)*
+
+ - Add ``quark_sphinx_theme.ext.html_compat`` extension.
+ - Add styling for citations, footnotes, table captions, and ``rubric``
+ directives.
+
+* quark-sphinx-theme 0.1.2 *(2016-02-27)*
+
+ - Fix compatibility with Jinja2 2.3.
+
+* quark-sphinx-theme 0.1.1 *(2016-02-24)*
+
+ - Fix spacing of navigation links.
+
+* quark-sphinx-theme 0.1.0 *(2016-02-24)*
+
+ - Initial release.
diff --git a/quark_sphinx_theme.egg-info/PKG-INFO b/quark_sphinx_theme.egg-info/PKG-INFO
new file mode 100644
index 0000000..ec4378c
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/PKG-INFO
@@ -0,0 +1,102 @@
+Metadata-Version: 1.1
+Name: quark-sphinx-theme
+Version: 0.3.2
+Summary: A Sphinx theme designed for QTextBrowser
+Home-page: https://bitbucket.org/fk/quark-sphinx-theme
+Author: Felix Krull
+Author-email: f_krull at gmx.de
+License: BSD
+Description: ========================================
+ Quark: a Sphinx theme for QTextBrowser
+ ========================================
+
+ About
+ =====
+
+ Quark is a Sphinx theme specifically designed to look and work well within the
+ limitations of the Qt toolkit's ``QTextBrowser``.
+
+ This theme was originally designed for the bundled manual of `SpeedCrunch`_.
+
+ .. _SpeedCrunch: http://speedcrunch.org
+
+
+ Installation
+ ============
+
+ * ``pip install quark-sphinx-theme``
+ * In your ``conf.py``::
+
+ import quark_sphinx_theme
+ html_theme_path = [quark_sphinx_theme.get_path()]
+ html_theme = 'quark'
+ # To enable more QTextBrowser-compatible HTML generation:
+ extensions = ['quark_sphinx_theme.ext.html_rewrite']
+
+
+ Changelog
+ =========
+
+ * quark-sphinx-theme 0.3.2 "I'll get it right some day" *(2016-05-23)*
+
+ - Include a copy of the lovelace style for compatibility with Pygments < 2.1.
+
+ * quark-sphinx-theme 0.3.1 *(2016-05-23)*
+
+ - Skip CSS syntax tests if tinycss isn't available.
+ - Make sure to include theme itself.
+ - Include test/util.py in source packages.
+
+ * quark-sphinx-theme 0.3 *(2016-05-22)*
+
+ - Remove ``hide_sidebar_in_index`` option.
+ - Fix styling of index pages.
+ - The ``quark_sphinx_theme.ext.html_compat`` extension has been renamed to
+ ``quark_sphinx_theme.ext.html_rewrite``. The old name remains supported for
+ backwards compatibility.
+ - The ``html_rewrite`` extension now supports wrapping admonitions in tables,
+ allowing for more styling options. The theme has been updated to take
+ advantage of this. Admonitions, topics, and sidebars look very different and
+ much better. If ``html_rewrite`` is not enabled, a fallback style will be
+ used for these.
+ - ``html_rewrite`` supports wrapping literal blocks in tables. If enabled,
+ this provides better styling for Pygments styles with non-white backgrounds.
+ - Smaller design changes:
+
+ - Don't use background color on code elements in headings and normal links.
+ - Display terms in definition lists in bold.
+ - Remove left and top margins for definition list bodies.
+ - Switch default code color scheme to 'lovelace'.
+
+ * quark-sphinx-theme 0.2.1 *(2016-03-02)*
+
+ - Change license to 2-clause BSD (in practice, it's the same thing).
+
+ * quark-sphinx-theme 0.2.0 *(2016-02-28)*
+
+ - Add ``quark_sphinx_theme.ext.html_compat`` extension.
+ - Add styling for citations, footnotes, table captions, and ``rubric``
+ directives.
+
+ * quark-sphinx-theme 0.1.2 *(2016-02-27)*
+
+ - Fix compatibility with Jinja2 2.3.
+
+ * quark-sphinx-theme 0.1.1 *(2016-02-24)*
+
+ - Fix spacing of navigation links.
+
+ * quark-sphinx-theme 0.1.0 *(2016-02-24)*
+
+ - Initial release.
+
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Framework :: Sphinx :: Theme
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: Documentation :: Sphinx
+Classifier: Topic :: Software Development :: Documentation
diff --git a/quark_sphinx_theme.egg-info/SOURCES.txt b/quark_sphinx_theme.egg-info/SOURCES.txt
new file mode 100644
index 0000000..966ccfc
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/SOURCES.txt
@@ -0,0 +1,46 @@
+MANIFEST.in
+README.rst
+setup.cfg
+setup.py
+tox.ini
+quark_sphinx_theme/__init__.py
+quark_sphinx_theme/__version__.py
+quark_sphinx_theme/_lovelace.py
+quark_sphinx_theme/_mixin.py
+quark_sphinx_theme.egg-info/PKG-INFO
+quark_sphinx_theme.egg-info/SOURCES.txt
+quark_sphinx_theme.egg-info/dependency_links.txt
+quark_sphinx_theme.egg-info/entry_points.txt
+quark_sphinx_theme.egg-info/not-zip-safe
+quark_sphinx_theme.egg-info/top_level.txt
+quark_sphinx_theme/ext/__init__.py
+quark_sphinx_theme/ext/html_compat.py
+quark_sphinx_theme/ext/html_rewrite/__init__.py
+quark_sphinx_theme/ext/html_rewrite/boxes.py
+quark_sphinx_theme/ext/html_rewrite/compat.py
+quark_sphinx_theme/ext/html_rewrite/literal_blocks.py
+quark_sphinx_theme/quark/domainindex.html
+quark_sphinx_theme/quark/genindex-single.html
+quark_sphinx_theme/quark/genindex.html
+quark_sphinx_theme/quark/layout.html
+quark_sphinx_theme/quark/theme.conf
+quark_sphinx_theme/quark/static/quark.css_t
+test/__init__.py
+test/test_core.py
+test/test_html_rewrite.py
+test/test_import.py
+test/test_mixin.py
+test/test_theme.py
+test/util.py
+test/testdoc-html_rewrite/conf.py
+test/testdoc-html_rewrite/contents.rst
+test/testdoc-html_rewrite/test_admonition.rst
+test/testdoc-html_rewrite/test_citation.rst
+test/testdoc-html_rewrite/test_footnote.rst
+test/testdoc-html_rewrite/test_literal_block.rst
+test/testdoc-html_rewrite/test_pre_block.rst
+test/testdoc-html_rewrite/test_sidebar.rst
+test/testdoc-html_rewrite/test_topic.rst
+test/testdoc-html_rewrite/test_warning.rst
+test/testdoc-theme/conf.py
+test/testdoc-theme/contents.rst
\ No newline at end of file
diff --git a/quark_sphinx_theme.egg-info/dependency_links.txt b/quark_sphinx_theme.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/quark_sphinx_theme.egg-info/entry_points.txt b/quark_sphinx_theme.egg-info/entry_points.txt
new file mode 100644
index 0000000..86e5906
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[sphinx_themes]
+path = quark_sphinx_theme:get_path
+
diff --git a/quark_sphinx_theme.egg-info/not-zip-safe b/quark_sphinx_theme.egg-info/not-zip-safe
new file mode 100644
index 0000000..d3f5a12
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/quark_sphinx_theme.egg-info/top_level.txt b/quark_sphinx_theme.egg-info/top_level.txt
new file mode 100644
index 0000000..4b789df
--- /dev/null
+++ b/quark_sphinx_theme.egg-info/top_level.txt
@@ -0,0 +1 @@
+quark_sphinx_theme
diff --git a/quark_sphinx_theme/__init__.py b/quark_sphinx_theme/__init__.py
new file mode 100644
index 0000000..76d04fb
--- /dev/null
+++ b/quark_sphinx_theme/__init__.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+import os
+
+from .__version__ import __version_info__, __version__
+_package_dir = os.path.dirname(os.path.abspath(__file__))
+
+
+def get_path():
+ """Get theme path."""
+ return _package_dir
+
+
+__all__ = ["__version__", "__version_info__", "get_path"]
diff --git a/quark_sphinx_theme/__version__.py b/quark_sphinx_theme/__version__.py
new file mode 100644
index 0000000..4cb45cd
--- /dev/null
+++ b/quark_sphinx_theme/__version__.py
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+__version_info__ = (0, 3, 2)
+__version__ = '.'.join(map(str, __version_info__))
diff --git a/quark_sphinx_theme/_lovelace.py b/quark_sphinx_theme/_lovelace.py
new file mode 100644
index 0000000..243aacf
--- /dev/null
+++ b/quark_sphinx_theme/_lovelace.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+
+# Note: This file was copied from pygments into quark-sphinx-theme. The original
+# copyright and license apply, as below. Since quark-sphinx-theme and pygments
+# are released under the same license, the reference to the LICENSE file still
+# applies.
+
+"""
+ pygments.styles.lovelace
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lovelace by Miikka Salminen
+
+ Pygments style by Miikka Salminen (https://github.com/miikkas)
+ A desaturated, somewhat subdued style created for the Lovelace interactive
+ learning environment.
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.style import Style
+from pygments.token import Keyword, Name, Comment, String, Error, \
+ Number, Operator, Punctuation, Generic, Whitespace
+
+
+class LovelaceStyle(Style):
+ """
+ The style used in Lovelace interactive learning environment. Tries to avoid
+ the "angry fruit salad" effect with desaturated and dim colours.
+ """
+ _KW_BLUE = '#2838b0'
+ _NAME_GREEN = '#388038'
+ _DOC_ORANGE = '#b85820'
+ _OW_PURPLE = '#a848a8'
+ _FUN_BROWN = '#785840'
+ _STR_RED = '#b83838'
+ _CLS_CYAN = '#287088'
+ _ESCAPE_LIME = '#709030'
+ _LABEL_CYAN = '#289870'
+ _EXCEPT_YELLOW = '#908828'
+
+ default_style = '#222222'
+
+ styles = {
+ Whitespace: '#a89028',
+ Comment: 'italic #888888',
+ Comment.Hashbang: _CLS_CYAN,
+ Comment.Multiline: '#888888',
+ Comment.Preproc: 'noitalic '+_LABEL_CYAN,
+
+ Keyword: _KW_BLUE,
+ Keyword.Constant: 'italic #444444',
+ Keyword.Declaration: 'italic',
+ Keyword.Type: 'italic',
+
+ Operator: '#666666',
+ Operator.Word: _OW_PURPLE,
+
+ Punctuation: '#888888',
+
+ Name.Attribute: _NAME_GREEN,
+ Name.Builtin: _NAME_GREEN,
+ Name.Builtin.Pseudo: 'italic',
+ Name.Class: _CLS_CYAN,
+ Name.Constant: _DOC_ORANGE,
+ Name.Decorator: _CLS_CYAN,
+ Name.Entity: _ESCAPE_LIME,
+ Name.Exception: _EXCEPT_YELLOW,
+ Name.Function: _FUN_BROWN,
+ Name.Function.Magic: _DOC_ORANGE,
+ Name.Label: _LABEL_CYAN,
+ Name.Namespace: _LABEL_CYAN,
+ Name.Tag: _KW_BLUE,
+ Name.Variable: '#b04040',
+ Name.Variable.Global:_EXCEPT_YELLOW,
+ Name.Variable.Magic: _DOC_ORANGE,
+
+ String: _STR_RED,
+ String.Affix: '#444444',
+ String.Char: _OW_PURPLE,
+ String.Delimiter: _DOC_ORANGE,
+ String.Doc: 'italic '+_DOC_ORANGE,
+ String.Escape: _ESCAPE_LIME,
+ String.Interpol: 'underline',
+ String.Other: _OW_PURPLE,
+ String.Regex: _OW_PURPLE,
+
+ Number: '#444444',
+
+ Generic.Deleted: '#c02828',
+ Generic.Emph: 'italic',
+ Generic.Error: '#c02828',
+ Generic.Heading: '#666666',
+ Generic.Subheading: '#444444',
+ Generic.Inserted: _NAME_GREEN,
+ Generic.Output: '#666666',
+ Generic.Prompt: '#444444',
+ Generic.Strong: 'bold',
+ Generic.Traceback: _KW_BLUE,
+
+ Error: 'bg:'+_OW_PURPLE,
+ }
diff --git a/quark_sphinx_theme/_mixin.py b/quark_sphinx_theme/_mixin.py
new file mode 100644
index 0000000..bb02904
--- /dev/null
+++ b/quark_sphinx_theme/_mixin.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+
+"""
+Support module to build a class from a base class and one or several mixins.
+
+A ``mixin`` is simply a class defining any number of methods. When mixed into a
+base class, methods in the mixin override any methods of the same name in the
+base class. When specifying multiple mixins, they are assumed to be in
+descending order of precedence, i.e. earlier mixins override later ones.
+
+The base class is available in the ``__super__`` attribute on the final combined
+class. Overridden methods can use it to delegate to the base class method.
+Delegating to another mixin is not supported.
+
+Mixin classes may optionally define a class ``__name_prefix`` attribute. When
+combining classes, this value will be incorporated into the name.
+"""
+
+
+def _name_tag(mixin):
+ if hasattr(mixin, '__name_tag__'):
+ return mixin.__name_tag__
+ else:
+ return mixin.__name__
+
+
+class _NewStyleBase(object):
+ """Helper class to make sure all compound classes include ``object``."""
+
+ __name_tag__ = ''
+
+ def __init__(self, *args, **kwargs):
+ object.__init__(self)
+
+
+def create_compound_class(base_class, mixins, name=None):
+ """Create a combined class from a base class and several mixins.
+
+ The elements of the ``mixin`` sequence are mixed into the base class; the
+ first element in the sequence has the highest priority. If ``name`` is
+ supplied, it sets the name of the final class, otherwise a name is derived
+ from the base class and mixins.
+ """
+ all_bases = list(mixins)
+ all_bases.append(base_class)
+ if not issubclass(base_class, object):
+ all_bases.append(_NewStyleBase)
+ clsname = name if name else '_'.join(_name_tag(base) for base in all_bases
+ if _name_tag(base))
+
+ def __init__(self, *args, **kwargs):
+ for base in reversed(all_bases):
+ if hasattr(base, '__init__'):
+ base.__init__(self, *args, **kwargs)
+
+ cls_dict = {
+ '__init__': __init__,
+ '__super__': base_class,
+ }
+
+ return type(clsname, tuple(all_bases), cls_dict)
diff --git a/quark_sphinx_theme/ext/__init__.py b/quark_sphinx_theme/ext/__init__.py
new file mode 100644
index 0000000..d587059
--- /dev/null
+++ b/quark_sphinx_theme/ext/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
diff --git a/quark_sphinx_theme/ext/html_compat.py b/quark_sphinx_theme/ext/html_compat.py
new file mode 100644
index 0000000..a2fe8d3
--- /dev/null
+++ b/quark_sphinx_theme/ext/html_compat.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+from .html_rewrite import setup
+
+__all__ = ['setup']
diff --git a/quark_sphinx_theme/ext/html_rewrite/__init__.py b/quark_sphinx_theme/ext/html_rewrite/__init__.py
new file mode 100644
index 0000000..2c4cf0d
--- /dev/null
+++ b/quark_sphinx_theme/ext/html_rewrite/__init__.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+from sphinx.builders.html import StandaloneHTMLBuilder
+from sphinx.writers.html import HTMLTranslator, SmartyPantsHTMLTranslator
+
+from ... import __version__
+from ..._mixin import create_compound_class
+from .compat import HTMLCompatMixin
+from .boxes import BoxesMixin
+from .literal_blocks import LiteralBlocksMixin
+
+
+KNOWN_TRANSLATORS = [
+ HTMLTranslator,
+ SmartyPantsHTMLTranslator,
+]
+# List so it has a stable order. Descending order of precedence.
+FEATURE_CLASSES = [
+ ('boxes', BoxesMixin),
+ ('literal_blocks', LiteralBlocksMixin),
+ ('compat', HTMLCompatMixin),
+]
+ALL_FEATURES = [f[0] for f in FEATURE_CLASSES]
+# This may change.
+DEFAULT_FEATURES = ALL_FEATURES
+
+
+def setup_translators(app):
+ # So this is a bit hacky; the "proper" way would be to use the new
+ # app.set_translator function added in Sphinx 1.3, but that's much more
+ # awkward because
+ # a) it's new in 1.3
+ # b) there's no extension hook after the configuration is loaded, but
+ # before the builder is created; meaning we would have to replace the
+ # translator class much more broadly and sort out any settings later.
+ cls = app.builder.translator_class
+ is_html = isinstance(app.builder, StandaloneHTMLBuilder)
+ if is_html and cls in KNOWN_TRANSLATORS:
+ mixins = []
+ for feature, mixin in FEATURE_CLASSES:
+ if feature in app.config.quark_html_rewrite_features:
+ mixins.append(mixin)
+ app.builder.translator_class = create_compound_class(cls, mixins)
+
+
+def setup(app):
+ app.add_config_value('quark_html_rewrite_features',
+ DEFAULT_FEATURES, 'html')
+ app.connect('builder-inited', setup_translators)
+ return {
+ 'version': __version__,
+ 'parallel_read_safe': True,
+ }
diff --git a/quark_sphinx_theme/ext/html_rewrite/boxes.py b/quark_sphinx_theme/ext/html_rewrite/boxes.py
new file mode 100644
index 0000000..d7a6d83
--- /dev/null
+++ b/quark_sphinx_theme/ext/html_rewrite/boxes.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+
+class BoxesMixin(object):
+ __name_tag__ = 'Boxes'
+
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def visit_admonition(self, node, name=''):
+ self.body.append('<table class="-x-quark-box -x-quark-admonition %s">'
+ '<tbody><tr>'
+ '<td width="100%%" class="-x-quark-box-td">'
+ % ('-x-quark-%s' % name if name else ''))
+ self.__super__.visit_admonition(self, node, name)
+
+ def depart_admonition(self, node=None):
+ self.__super__.depart_admonition(self, node)
+ self.body.append("</td></tr></tbody></table>")
+
+ def visit_topic(self, node):
+ self.body.append('<table class="-x-quark-box -x-quark-topic">'
+ '<tbody><tr>'
+ '<td width="100%" class="-x-quark-box-td">')
+ self.__super__.visit_topic(self, node)
+
+ def depart_topic(self, node):
+ self.__super__.depart_topic(self, node)
+ self.body.append('</td></tr></tbody></table>')
+
+ def visit_sidebar(self, node):
+ self.body.append('<table class="-x-quark-box -x-quark-sidebar">'
+ '<tbody><tr>'
+ '<td width="35%" class="-x-quark-box-td">')
+ self.__super__.visit_sidebar(self, node)
+
+ def depart_sidebar(self, node):
+ self.__super__.depart_sidebar(self, node)
+ self.body.append('</td></tr></tbody></table>')
diff --git a/quark_sphinx_theme/ext/html_rewrite/compat.py b/quark_sphinx_theme/ext/html_rewrite/compat.py
new file mode 100644
index 0000000..e0e41c9
--- /dev/null
+++ b/quark_sphinx_theme/ext/html_rewrite/compat.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+from pygments.formatters import HtmlFormatter
+
+
+class CompatHtmlFormatter(HtmlFormatter):
+ def _wrap_pre(self, inner):
+ # TODO: Yeah, this is pretty awkward.
+ for i, s in HtmlFormatter._wrap_pre(self, inner):
+ yield i, s.replace('<span></span>', '')
+
+
+class HTMLCompatMixin(object):
+ __name_tag__ = "Compat"
+
+ def __init__(self, *args, **kwargs):
+ self.highlighter.formatter = CompatHtmlFormatter
+
+ def visit_citation(self, node):
+ no_id_node = node.copy()
+ no_id_node.delattr('ids')
+ self.body.append('<div id="%s" class="-x-quark-citation-wrapper">'
+ % node.get('ids')[0])
+ self.__super__.visit_citation(self, no_id_node)
+
+ def depart_citation(self, node):
+ self.__super__.depart_citation(self, node)
+ self.body.append('</div>')
+
+ def visit_footnote(self, node):
+ no_id_node = node.copy()
+ no_id_node.delattr('ids')
+ self.body.append('<div id="%s" class="-x-quark-footnote-wrapper">'
+ % node.get('ids')[0])
+ self.__super__.visit_footnote(self, no_id_node)
+
+ def depart_footnote(self, node):
+ self.__super__.depart_footnote(self, node)
+ self.body.append('</div>')
diff --git a/quark_sphinx_theme/ext/html_rewrite/literal_blocks.py b/quark_sphinx_theme/ext/html_rewrite/literal_blocks.py
new file mode 100644
index 0000000..bc2ce55
--- /dev/null
+++ b/quark_sphinx_theme/ext/html_rewrite/literal_blocks.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# This file is part of quark-sphinx-theme.
+# Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+# Released under the terms of the BSD license; see LICENSE.
+
+from docutils import nodes
+
+
+class LiteralBlocksMixin(object):
+ __name_tag__ = 'Literal'
+
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def __append_epilog(self):
+ self.body.append('</td></tr></tbody></table>')
+
+ def visit_literal_block(self, node):
+ self.body.append('<table class="-x-quark-literal-block">'
+ '<tbody><tr>'
+ '<td width="100%" class="-x-quark-literal-block-td">')
+ try:
+ self.__super__.visit_literal_block(self, node)
+ except nodes.SkipNode:
+ self.__append_epilog()
+ raise
+
+ def depart_literal_block(self, node):
+ self.__super__.depart_literal_block(self, node)
+ self.__append_epilog()
diff --git a/quark_sphinx_theme/quark/domainindex.html b/quark_sphinx_theme/quark/domainindex.html
new file mode 100644
index 0000000..c35a01f
--- /dev/null
+++ b/quark_sphinx_theme/quark/domainindex.html
@@ -0,0 +1,50 @@
+{#
+ This file is part of quark-sphinx-theme.
+ Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+ Released under the terms of the BSD license; see LICENSE.
+
+ Based on code from the Sphinx project (http://sphinx-doc.org).
+ Copyright 2007-2016 by the Sphinx team.
+ Originally released under the terms of the BSD license.
+#}
+
+{% extends 'basic/domainindex.html' %}
+
+{% block body %}
+
+ {%- set groupid = idgen() %}
+
+ <h1>{{ indextitle }}</h1>
+
+ <div class="modindex-jumpbox">
+ {%- for (letter, entries) in content %}
+ <a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a>
+ {%- if not loop.last %} | {% endif %}
+ {%- endfor %}
+ </div>
+
+ <table class="indextable modindextable" cellspacing="0" cellpadding="2">
+ {%- for letter, entries in content %}
+ <tr class="pcap"><td></td><td> </td><td></td></tr>
+ <tr class="cap"><td></td><td>
+ {#- QTextBrowser can't jump to <tr> elements so we move the id. -#}
+ <strong id="cap-{{ letter }}">{{ letter }}</strong></td><td></td></tr>
+ {%- for (name, grouptype, page, anchor, extra, qualifier, description)
+ in entries %}
+ <tr{% if grouptype == 2 %} class="cg-{{ groupid.current() }}"{% endif %}>
+ <td>{% if grouptype == 1 -%}
+ <img src="{{ pathto('_static/minus.png', 1) }}" class="toggler"
+ id="toggle-{{ groupid.next() }}" style="display: none" alt="-" />
+ {%- endif %}</td>
+ <td>{% if grouptype == 2 %} {% endif %}
+ {% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%}
+ <code class="xref">{{ name|e }}</code>
+ {%- if page %}</a>{% endif %}
+ {%- if extra %} <em>({{ extra|e }})</em>{% endif -%}
+ </td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %}
+ <em>{{ description|e }}</em></td></tr>
+ {%- endfor %}
+ {%- endfor %}
+ </table>
+
+{% endblock %}
diff --git a/quark_sphinx_theme/quark/genindex-single.html b/quark_sphinx_theme/quark/genindex-single.html
new file mode 100644
index 0000000..50e7115
--- /dev/null
+++ b/quark_sphinx_theme/quark/genindex-single.html
@@ -0,0 +1,35 @@
+{#
+ This file is part of quark-sphinx-theme.
+ Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+ Released under the terms of the BSD license; see LICENSE.
+
+ Based on code from the Sphinx project (http://sphinx-doc.org).
+ Copyright 2007-2016 by the Sphinx team.
+ Originally released under the terms of the BSD license.
+#}
+
+{% extends 'basic/genindex-single.html' %}
+
+{% block body %}
+
+<h1 id="index">{% trans key=key %}Index – {{ key }}{% endtrans %}</h1>
+
+{#- Also set width as table and td attributes for QTextBrowser. -#}
+<table width="100%" style="width: 100%" class="indextable"><tr>
+ {%- for column in entries|slice(2) if column %}
+ <td width="50%" style="width: 50%" valign="top"><dl>
+ {%- for entryname, entry in column %}
+ {{ indexentries(entryname, entry[0]) }}
+ {%- if entry[1] %}
+ <dd><dl>
+ {%- for subentryname, subentrylinks in entry[1] %}
+ {{ indexentries(subentryname, subentrylinks) }}
+ {%- endfor %}
+ </dl></dd>
+ {%- endif -%}
+ {%- endfor %}
+ </dl></td>
+ {%- endfor %}
+</tr></table>
+
+{% endblock %}
diff --git a/quark_sphinx_theme/quark/genindex.html b/quark_sphinx_theme/quark/genindex.html
new file mode 100644
index 0000000..05eda7a
--- /dev/null
+++ b/quark_sphinx_theme/quark/genindex.html
@@ -0,0 +1,45 @@
+{#
+ This file is part of quark-sphinx-theme.
+ Copyright (c) 2016 Felix Krull <f_krull at gmx.de>
+ Released under the terms of the BSD license; see LICENSE.
+
+ Based on code from the Sphinx project (http://sphinx-doc.org).
+ Copyright 2007-2016 by the Sphinx team.
+ Originally released under the terms of the BSD license.
+#}
+
... 1500 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/quark-sphinx-theme.git
More information about the Python-modules-commits
mailing list