zzzeeksphinx-1.0.17/ 0000755 0000765 0000024 00000000000 12530636260 015123 5 ustar classic staff 0000000 0000000 zzzeeksphinx-1.0.17/LICENSE 0000644 0000765 0000024 00000002162 12444064546 016137 0 ustar classic staff 0000000 0000000 This is the MIT license: http://www.opensource.org/licenses/mit-license.php
Copyright (C) 2012 by Michael Bayer.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
zzzeeksphinx-1.0.17/MANIFEST.in 0000644 0000765 0000024 00000000132 12444066555 016665 0 ustar classic staff 0000000 0000000 recursive-include zzzeeksphinx *.py *.scss *.js *.conf *.mako
include README* LICENSE
zzzeeksphinx-1.0.17/PKG-INFO 0000644 0000765 0000024 00000011000 12530636260 016210 0 ustar classic staff 0000000 0000000 Metadata-Version: 1.1
Name: zzzeeksphinx
Version: 1.0.17
Summary: Zzzeek's Sphinx Layout and Utilities.
Home-page: http://bitbucket.org/zzzeek/zzzeeksphinx
Author: Mike Bayer
Author-email: mike@zzzcomputing.com
License: MIT
Description: =============
zzzeeksphinx
=============
This is zzzeek's own Sphinx layout, used by SQLAlchemy.
This layout is first and foremost pulled in for the SQLAlchemy documentation
builds (and possibly other related projects), but is also usable as a
standalone theme / utility set for any project.
Feel free to fork off features from it as needed, the project here first
and foremost has to work with SQLAlchemy.
Features include:
* Uses Mako templates instead of Jinja, for more programmatic capabilities
inside of templates.
* Layout includes an independently scrollable sidebar
* A unique (to Sphinx) "contextual" sidebar contents that shows the
current page in context with all sibling pages (like that of MySQL's docs).
This is a form of TOC that Sphinx doesn't typically have a lot of
capability to do (well it could, with some simple feature adds), but
IMO this kind of navigation is critical for very large and nested
documentation sets, so that the navbar stays relatively small yet provides
context as to where you are in the docs and what else is locally available.
* Modifications to autodoc which illustrate inherited classes, bases,
method documentation illustrates if a method is only inherited from the
base or overridden.
* A "dynamic base" feature that will, under ReadTheDocs, pull in optional
``.mako`` and ``.py`` files from the website of your choice
that will serve as an alternate base template and a source of extra
config setup, respectively, allowing the layout to be integrated into
the layout of an external site when viewing on the web.
* A "viewsource" extension that can provide highlighted sourcecode to any
Python file arbitrarily.
* SQLAlchemy-specific stuff, like the [SQL] popups, the dialect info
directives.
* scss support using pyscss.
Config
======
in conf.py, the extension is::
extensions = [
'zzzeeksphinx',
]
The theme is::
html_theme = 'zzzeeksphinx'
Other configs that SQLAlchemy has set up; these two are probably
needed::
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0.0"
release_date = "Not released"
Additional configs for the "dynamic site thing" look like::
site_base = os.environ.get("RTD_SITE_BASE", "http://www.sqlalchemy.org")
site_adapter_template = "docs_adapter.mako"
site_adapter_py = "docs_adapter.py"
Configs which do some last-minute translation of module names
when running autodoc to display API documentation::
autodocmods_convert_modname = {
"sqlalchemy.sql.sqltypes": "sqlalchemy.types",
"sqlalchemy.sql.type_api": "sqlalchemy.types",
"sqlalchemy.sql.schema": "sqlalchemy.schema",
"sqlalchemy.sql.elements": "sqlalchemy.sql.expression",
"sqlalchemy.sql.selectable": "sqlalchemy.sql.expression",
"sqlalchemy.sql.dml": "sqlalchemy.sql.expression",
"sqlalchemy.sql.ddl": "sqlalchemy.schema",
"sqlalchemy.sql.base": "sqlalchemy.sql.expression"
}
autodocmods_convert_modname_w_class = {
("sqlalchemy.engine.interfaces", "Connectable"): "sqlalchemy.engine",
("sqlalchemy.sql.base", "DialectKWArgs"): "sqlalchemy.sql.base",
}
Keywords: Sphinx
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Documentation
zzzeeksphinx-1.0.17/README.rst 0000644 0000765 0000024 00000006171 12444073745 016626 0 ustar classic staff 0000000 0000000 =============
zzzeeksphinx
=============
This is zzzeek's own Sphinx layout, used by SQLAlchemy.
This layout is first and foremost pulled in for the SQLAlchemy documentation
builds (and possibly other related projects), but is also usable as a
standalone theme / utility set for any project.
Feel free to fork off features from it as needed, the project here first
and foremost has to work with SQLAlchemy.
Features include:
* Uses Mako templates instead of Jinja, for more programmatic capabilities
inside of templates.
* Layout includes an independently scrollable sidebar
* A unique (to Sphinx) "contextual" sidebar contents that shows the
current page in context with all sibling pages (like that of MySQL's docs).
This is a form of TOC that Sphinx doesn't typically have a lot of
capability to do (well it could, with some simple feature adds), but
IMO this kind of navigation is critical for very large and nested
documentation sets, so that the navbar stays relatively small yet provides
context as to where you are in the docs and what else is locally available.
* Modifications to autodoc which illustrate inherited classes, bases,
method documentation illustrates if a method is only inherited from the
base or overridden.
* A "dynamic base" feature that will, under ReadTheDocs, pull in optional
``.mako`` and ``.py`` files from the website of your choice
that will serve as an alternate base template and a source of extra
config setup, respectively, allowing the layout to be integrated into
the layout of an external site when viewing on the web.
* A "viewsource" extension that can provide highlighted sourcecode to any
Python file arbitrarily.
* SQLAlchemy-specific stuff, like the [SQL] popups, the dialect info
directives.
* scss support using pyscss.
Config
======
in conf.py, the extension is::
extensions = [
'zzzeeksphinx',
]
The theme is::
html_theme = 'zzzeeksphinx'
Other configs that SQLAlchemy has set up; these two are probably
needed::
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0.0"
release_date = "Not released"
Additional configs for the "dynamic site thing" look like::
site_base = os.environ.get("RTD_SITE_BASE", "http://www.sqlalchemy.org")
site_adapter_template = "docs_adapter.mako"
site_adapter_py = "docs_adapter.py"
Configs which do some last-minute translation of module names
when running autodoc to display API documentation::
autodocmods_convert_modname = {
"sqlalchemy.sql.sqltypes": "sqlalchemy.types",
"sqlalchemy.sql.type_api": "sqlalchemy.types",
"sqlalchemy.sql.schema": "sqlalchemy.schema",
"sqlalchemy.sql.elements": "sqlalchemy.sql.expression",
"sqlalchemy.sql.selectable": "sqlalchemy.sql.expression",
"sqlalchemy.sql.dml": "sqlalchemy.sql.expression",
"sqlalchemy.sql.ddl": "sqlalchemy.schema",
"sqlalchemy.sql.base": "sqlalchemy.sql.expression"
}
autodocmods_convert_modname_w_class = {
("sqlalchemy.engine.interfaces", "Connectable"): "sqlalchemy.engine",
("sqlalchemy.sql.base", "DialectKWArgs"): "sqlalchemy.sql.base",
}
zzzeeksphinx-1.0.17/setup.cfg 0000644 0000765 0000024 00000000073 12530636260 016744 0 ustar classic staff 0000000 0000000 [egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
zzzeeksphinx-1.0.17/setup.py 0000644 0000765 0000024 00000002346 12444070232 016635 0 ustar classic staff 0000000 0000000 from setuptools import setup
import os
import re
v = open(os.path.join(os.path.dirname(__file__), 'zzzeeksphinx', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()
readme = os.path.join(os.path.dirname(__file__), 'README.rst')
setup(
name='zzzeeksphinx',
version=VERSION,
description="Zzzeek's Sphinx Layout and Utilities.",
long_description=open(readme).read(),
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Documentation',
],
keywords='Sphinx',
author='Mike Bayer',
author_email='mike@zzzcomputing.com',
url='http://bitbucket.org/zzzeek/zzzeeksphinx',
license='MIT',
packages=['zzzeeksphinx'],
install_requires=['pyscss', 'mako'],
include_package_data=True,
zip_safe=False,
entry_points={
'sphinx_themes': [
'zzzeeksphinx = zzzeeksphinx.theme:get_path',
]
},
)
zzzeeksphinx-1.0.17/zzzeeksphinx/ 0000755 0000765 0000024 00000000000 12530636260 017677 5 ustar classic staff 0000000 0000000 zzzeeksphinx-1.0.17/zzzeeksphinx/__init__.py 0000664 0000765 0000024 00000000435 12530636126 022015 0 ustar classic staff 0000000 0000000 __version__ = '1.0.17'
def setup(app):
from . import autodoc_mods, dialect_info, mako, \
sqlformatter, viewsource, scss
autodoc_mods.setup(app)
dialect_info.setup(app)
mako.setup(app)
sqlformatter.setup(app)
viewsource.setup(app)
scss.setup(app)
zzzeeksphinx-1.0.17/zzzeeksphinx/autodoc_mods.py 0000644 0000765 0000024 00000007303 12447634224 022741 0 ustar classic staff 0000000 0000000 import re
def autodoc_skip_member(app, what, name, obj, skip, options):
if what == 'class' and skip and \
name in ('__init__', '__eq__', '__ne__', '__lt__',
'__le__', '__call__') and \
obj.__doc__:
return False
else:
return skip
def _adjust_rendered_mod_name(config, modname, objname):
if (modname, objname) in config.autodocmods_convert_modname_w_class:
return config.autodocmods_convert_modname_w_class[(modname, objname)]
elif modname in config.autodocmods_convert_modname:
return config.autodocmods_convert_modname[modname]
else:
return modname
# im sure this is in the app somewhere, but I don't really
# know where, so we're doing it here.
_track_autodoced = {}
_inherited_names = set()
def autodoc_process_docstring(app, what, name, obj, options, lines):
if what == "class":
_track_autodoced[name] = obj
# need to translate module names for bases, others
# as we document lots of symbols in namespace modules
# outside of their source
bases = []
for base in obj.__bases__:
if base is not object:
adjusted_mod = _adjust_rendered_mod_name(
app.env.config, base.__module__, base.__name__)
bases.append(
":class:`%s.%s`" % (
adjusted_mod,
base.__name__))
_inherited_names.add(
"%s.%s" % (adjusted_mod, base.__name__))
if bases:
lines[:0] = [
"Bases: %s" % (", ".join(bases)),
""
]
elif what in ("attribute", "method") and options.get("inherited-members"):
m = re.match(r'(.*?)\.([\w_]+)$', name)
if m:
clsname, attrname = m.group(1, 2)
if clsname in _track_autodoced:
cls = _track_autodoced[clsname]
for supercls in cls.__mro__:
if attrname in supercls.__dict__:
break
if supercls is not cls:
adjusted_mod = _adjust_rendered_mod_name(
app.env.config,
supercls.__module__,
supercls.__name__
)
_inherited_names.add(
"%s.%s" % (adjusted_mod, supercls.__name__))
_inherited_names.add(
"%s.%s.%s" %
(adjusted_mod, supercls.__name__, attrname))
lines[:0] = [
".. container:: inherited_member",
"",
" *inherited from the* "
":%s:`~%s.%s.%s` *%s of* :class:`~%s.%s`" % (
"attr" if what == "attribute"
else "meth",
adjusted_mod,
supercls.__name__,
attrname,
what,
adjusted_mod,
supercls.__name__
),
""
]
def missing_reference(app, env, node, contnode):
if node.attributes['reftarget'] in _inherited_names:
return node.children[0]
else:
return None
def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member)
app.connect('autodoc-process-docstring', autodoc_process_docstring)
app.add_config_value("autodocmods_convert_modname", {}, 'env')
app.add_config_value("autodocmods_convert_modname_w_class", {}, 'env')
app.connect('missing-reference', missing_reference)
zzzeeksphinx-1.0.17/zzzeeksphinx/dialect_info.py 0000644 0000765 0000024 00000014403 12444067065 022700 0 ustar classic staff 0000000 0000000 import re
from sphinx.util.compat import Directive
from docutils import nodes
class DialectDirective(Directive):
has_content = True
_dialects = {}
def _parse_content(self):
d = {}
d['default'] = self.content[0]
d['text'] = []
idx = 0
for line in self.content[1:]:
idx += 1
m = re.match(r'\:(.+?)\: +(.+)', line)
if m:
attrname, value = m.group(1, 2)
d[attrname] = value
else:
break
d["text"] = self.content[idx + 1:]
return d
def _dbapi_node(self):
dialect_name, dbapi_name = self.dialect_name.split("+")
try:
dialect_directive = self._dialects[dialect_name]
except KeyError:
raise Exception(
"No .. dialect:: %s "
"directive has been established"
% dialect_name)
output = []
content = self._parse_content()
parent_section_ref = self.state.parent.children[0]['ids'][0]
self._append_dbapi_bullet(
dialect_name, dbapi_name,
content['name'], parent_section_ref)
p = nodes.paragraph(
'', '',
nodes.Text(
"Support for the %s database via the %s driver." % (
dialect_directive.database_name,
content['name']
),
"Support for the %s database via the %s driver." % (
dialect_directive.database_name,
content['name']
)
),
)
self.state.nested_parse(content['text'], 0, p)
output.append(p)
if "url" in content or "driverurl" in content:
sec = nodes.section(
'',
nodes.title("DBAPI", "DBAPI"),
ids=["dialect-%s-%s-url" % (dialect_name, dbapi_name)]
)
if "url" in content:
text = "Documentation and download information "\
"(if applicable) "\
"for %s is available at:\n" % content["name"]
uri = content['url']
sec.append(
nodes.paragraph(
'', '',
nodes.Text(text, text),
nodes.reference('', '',
nodes.Text(uri, uri),
refuri=uri,
)
)
)
if "driverurl" in content:
text = "Drivers for this database are available at:\n"
sec.append(
nodes.paragraph(
'', '',
nodes.Text(text, text),
nodes.reference('', '',
nodes.Text(
content['driverurl'],
content['driverurl']),
refuri=content['driverurl']
)
)
)
output.append(sec)
if "connectstring" in content:
sec = nodes.section(
'',
nodes.title("Connecting", "Connecting"),
nodes.paragraph(
'', '',
nodes.Text("Connect String:", "Connect String:"),
nodes.literal_block(
content['connectstring'],
content['connectstring'])
),
ids=["dialect-%s-%s-connect" % (dialect_name, dbapi_name)]
)
output.append(sec)
return output
def _dialect_node(self):
self._dialects[self.dialect_name] = self
content = self._parse_content()
self.database_name = content['name']
self.bullets = nodes.bullet_list()
text = "The following dialect/DBAPI options are available. "\
"Please refer to individual DBAPI sections "\
"for connect information."
sec = nodes.section(
'',
nodes.paragraph(
'', '',
nodes.Text(
"Support for the %s database." % content['name'],
"Support for the %s database." % content['name']
),
),
nodes.title("DBAPI Support", "DBAPI Support"),
nodes.paragraph(
'', '',
nodes.Text(text, text),
self.bullets
),
ids=["dialect-%s" % self.dialect_name]
)
return [sec]
def _append_dbapi_bullet(self, dialect_name, dbapi_name, name, idname):
env = self.state.document.settings.env
dialect_directive = self._dialects[dialect_name]
try:
relative_uri = env.app.builder.get_relative_uri(
dialect_directive.docname, self.docname)
except:
relative_uri = ""
list_node = nodes.list_item(
'',
nodes.paragraph(
'', '',
nodes.reference(
'', '',
nodes.Text(name, name),
refdocname=self.docname,
refuri=relative_uri + "#" + idname
),
#nodes.Text(" ", " "),
#nodes.reference('', '',
# nodes.Text("(connectstring)", "(connectstring)"),
# refdocname=self.docname,
# refuri=env.app.builder.get_relative_uri(
# dialect_directive.docname, self.docname) +
## "#" + ("dialect-%s-%s-connect" %
# (dialect_name, dbapi_name))
# )
)
)
dialect_directive.bullets.append(list_node)
def run(self):
env = self.state.document.settings.env
self.docname = env.docname
self.dialect_name = dialect_name = self.content[0]
has_dbapi = "+" in dialect_name
if has_dbapi:
return self._dbapi_node()
else:
return self._dialect_node()
def setup(app):
app.add_directive('dialect', DialectDirective)
zzzeeksphinx-1.0.17/zzzeeksphinx/mako.py 0000644 0000765 0000024 00000006655 12504303206 021204 0 ustar classic staff 0000000 0000000 from __future__ import absolute_import
from sphinx.application import TemplateBridge
from sphinx.jinja2glue import BuiltinTemplateLoader
from mako.lookup import TemplateLookup
from .toc import TOCMixin
import os
rtd = os.environ.get('READTHEDOCS', None) == 'True'
class MakoBridge(TOCMixin, TemplateBridge):
def init(self, builder, *args, **kw):
self.jinja2_fallback = BuiltinTemplateLoader()
self.jinja2_fallback.init(builder, *args, **kw)
builder.config.html_context['release_date'] = \
builder.config['release_date']
builder.config.html_context['site_base'] = builder.config['site_base']
self.app = builder.app
package_dir = os.path.abspath(os.path.dirname(__file__))
template_path = os.path.join(
package_dir, 'themes', builder.config.html_theme)
self.lookup = TemplateLookup(
strict_undefined=True,
directories=builder.config.templates_path + [
template_path
],
#format_exceptions=True,
imports=[
"from zzzeeksphinx import util"
]
)
if rtd and builder.config['site_base']:
import urllib2
if builder.config['site_adapter_template']:
# remote site layout / startup files
template_name = builder.config['site_adapter_template']
template = urllib2.urlopen(
builder.config['site_base'] + "/" + template_name).read()
self.lookup.put_string(template_name, template)
py_name = builder.config['site_adapter_py']
if py_name:
setup_ctx = urllib2.urlopen(
builder.config['site_base'] + "/" + py_name).read()
lcls = {}
exec(setup_ctx, lcls)
self.setup_ctx = lcls['setup_context']
def setup_ctx(self, context):
pass
def render(self, template, context):
template = template.replace(".html", ".mako")
context['prevtopic'] = context.pop('prev', None)
context['nexttopic'] = context.pop('next', None)
context['app'] = self.app
# local docs layout
context['rtd'] = False
context['toolbar'] = False
context['base'] = "static_base.mako"
context['parent_toc'] = self.get_current_subtoc
context['bridge'] = self
context.setdefault('toc', None)
context.setdefault('pdf_url', None)
context.setdefault('metatags', None)
context.setdefault("canonical_url", None)
context.setdefault("single_version", None)
context.setdefault("rtd_language", "en")
# override context attributes
self.setup_ctx(context)
context.setdefault('_', lambda x: x)
return self.lookup.get_template(template).render_unicode(**context)
def render_string(self, template, context):
# this is used for .js, .css etc. and we don't have
# local copies of that stuff here so use the jinja render.
return self.jinja2_fallback.render_string(template, context)
def setup(app):
app.config['template_bridge'] = "zzzeeksphinx.mako.MakoBridge"
app.add_config_value('release_date', "", 'env')
app.add_config_value('site_base', "", 'env')
app.add_config_value('site_adapter_template', "", 'env')
app.add_config_value('site_adapter_py', "", 'env')
app.add_config_value('build_number', "", 'env')
zzzeeksphinx-1.0.17/zzzeeksphinx/scss.py 0000644 0000765 0000024 00000003222 12516534732 021230 0 ustar classic staff 0000000 0000000 from __future__ import absolute_import
import os
from scss import Scss
# these docs aren't super accurate
# http://pyscss.readthedocs.org/en/latest/
def add_stylesheet(app):
# TODO: make this inclusive of HTML builders
# instead, or something
if app.builder.name == 'latex':
return
to_gen = []
package_dir = os.path.abspath(os.path.dirname(__file__))
static_path = os.path.join(
package_dir, 'themes', app.builder.config.html_theme, 'static')
for fname in os.listdir(static_path):
name, ext = os.path.splitext(fname)
if ext != ".scss":
continue
to_gen.append((static_path, name))
# sphinx doesn't really have a "temp" area that will persist
# down into build-finished (env.temp_data gets emptied).
# So make our own!
app._builder_scss = to_gen
for path, name in to_gen:
app.add_stylesheet('%s.css' % name)
def generate_stylesheet(app, exception):
# TODO: make this inclusive of HTML builders
# instead, or something
if app.builder.name == 'latex':
return
to_gen = app._builder_scss
compiler = Scss(scss_opts={"style": "expanded"})
if exception:
return
for static_path, name in to_gen:
css = compiler.compile(
open(os.path.join(static_path, "%s.scss" % name)).read())
dest = os.path.join(app.builder.outdir, '_static', '%s.css' % name)
#copyfile(os.path.join(source, "%s.css" % name), dest)
with open(dest, "w") as out:
out.write(css)
def setup(app):
app.connect('builder-inited', add_stylesheet)
app.connect('build-finished', generate_stylesheet)
zzzeeksphinx-1.0.17/zzzeeksphinx/sqlformatter.py 0000644 0000765 0000024 00000010173 12451607666 023010 0 ustar classic staff 0000000 0000000 from pygments.lexer import RegexLexer, bygroups, using
from pygments.token import Token
from pygments.filter import Filter
from pygments.filter import apply_filters
from pygments.lexers import PythonLexer, PythonConsoleLexer
from sphinx.highlighting import PygmentsBridge
from pygments.formatters import HtmlFormatter, LatexFormatter
import re
def _strip_trailing_whitespace(iter_):
buf = list(iter_)
if buf:
buf[-1] = (buf[-1][0], buf[-1][1].rstrip())
for t, v in buf:
yield t, v
class StripDocTestFilter(Filter):
def filter(self, lexer, stream):
for ttype, value in stream:
if ttype is Token.Comment and re.match(r'#\s*doctest:', value):
continue
yield ttype, value
class PyConWithSQLLexer(RegexLexer):
name = 'PyCon+SQL'
aliases = ['pycon+sql']
flags = re.IGNORECASE | re.DOTALL
tokens = {
'root': [
(r'{sql}', Token.Sql.Link, 'sqlpopup'),
(r'{opensql}', Token.Sql.Open, 'opensqlpopup'),
(r'.*?\n', using(PythonConsoleLexer))
],
'sqlpopup': [
(
r'(.*?\n)((?:PRAGMA|BEGIN|SELECT|INSERT|DELETE|ROLLBACK|'
'COMMIT|ALTER|UPDATE|CREATE|DROP|PRAGMA'
'|DESCRIBE).*?(?:{stop}\n?|$))',
bygroups(using(PythonConsoleLexer), Token.Sql.Popup),
"#pop"
)
],
'opensqlpopup': [
(
r'.*?(?:{stop}\n*|$)',
Token.Sql,
"#pop"
)
]
}
class PythonWithSQLLexer(RegexLexer):
name = 'Python+SQL'
aliases = ['python+sql']
flags = re.IGNORECASE | re.DOTALL
tokens = {
'root': [
(r'{sql}', Token.Sql.Link, 'sqlpopup'),
(r'{opensql}', Token.Sql.Open, 'opensqlpopup'),
(r'.*?\n', using(PythonLexer))
],
'sqlpopup': [
(
r'(.*?\n)((?:PRAGMA|BEGIN|SELECT|INSERT|DELETE|ROLLBACK'
'|COMMIT|ALTER|UPDATE|CREATE|DROP'
'|PRAGMA|DESCRIBE).*?(?:{stop}\n?|$))',
bygroups(using(PythonLexer), Token.Sql.Popup),
"#pop"
)
],
'opensqlpopup': [
(
r'.*?(?:{stop}\n*|$)',
Token.Sql,
"#pop"
)
]
}
class PopupSQLFormatter(HtmlFormatter):
def _format_lines(self, tokensource):
buf = []
for ttype, value in apply_filters(tokensource, [StripDocTestFilter()]):
if ttype in Token.Sql:
for t, v in HtmlFormatter._format_lines(self, iter(buf)):
yield t, v
buf = []
if ttype is Token.Sql:
yield 1, "
%s
" % \
re.sub(r'(?:{stop}|\n+)$', '', value)
elif ttype is Token.Sql.Link:
yield 1, "sql"
elif ttype is Token.Sql.Popup:
yield 1, "
%s
" % \
re.sub(r'(?:{stop}|\n+)$', '', value)
else:
buf.append((ttype, value))
for t, v in _strip_trailing_whitespace(
HtmlFormatter._format_lines(self, iter(buf))):
yield t, v
class PopupLatexFormatter(LatexFormatter):
def _filter_tokens(self, tokensource):
for ttype, value in apply_filters(tokensource, [StripDocTestFilter()]):
if ttype in Token.Sql:
if ttype is not Token.Sql.Link and ttype is not Token.Sql.Open:
yield Token.Literal, re.sub(r'{stop}', '', value)
else:
continue
else:
yield ttype, value
def format(self, tokensource, outfile):
LatexFormatter.format(self, self._filter_tokens(tokensource), outfile)
def setup(app):
app.add_lexer('pycon+sql', PyConWithSQLLexer())
app.add_lexer('python+sql', PythonWithSQLLexer())
PygmentsBridge.html_formatter = PopupSQLFormatter
PygmentsBridge.latex_formatter = PopupLatexFormatter
zzzeeksphinx-1.0.17/zzzeeksphinx/theme.py 0000664 0000765 0000024 00000000243 12444066250 021354 0 ustar classic staff 0000000 0000000 from os import path
package_dir = path.abspath(path.dirname(__file__))
template_path = path.join(package_dir, 'themes')
def get_path():
return template_path
zzzeeksphinx-1.0.17/zzzeeksphinx/themes/ 0000755 0000765 0000024 00000000000 12530636260 021164 5 ustar classic staff 0000000 0000000 zzzeeksphinx-1.0.17/zzzeeksphinx/themes/zzzeeksphinx/ 0000755 0000765 0000024 00000000000 12530636260 023740 5 ustar classic staff 0000000 0000000 zzzeeksphinx-1.0.17/zzzeeksphinx/themes/zzzeeksphinx/genindex.mako 0000644 0000765 0000024 00000003504 12444066361 026417 0 ustar classic staff 0000000 0000000 <%inherit file="layout.mako"/>
<%block name="show_title" filter="util.striptags">
${_('Index')}
%block>
${_('Index')}
% for i, (key, dummy) in enumerate(genindexentries):
${i != 0 and '| ' or ''}${key}
% endfor
% for i, (key, entries) in enumerate(genindexentries):
${key}
<%
breakat = genindexcounts[i] // 2
numcols = 1
numitems = 0
%>
% for entryname, (links, subitems) in entries:
% if links:
${entryname|h}
% for unknown, link in links[1:]:
, [${i}]
% endfor
% else:
${entryname|h}
% endif
for each content section. */
display:none;
font-size:2.0em;
}
#docs-body h2 {
font-size:1.8em;
border-top:1px solid;
/*border-bottom:1px solid;*/
padding-top:20px;
}
#sqlalchemy-documentation h2 {
border-top:none;
padding-top:0;
}
#docs-body h3 {
font-size:1.4em;
}
/* SQL popup, code styles */
.highlight {
background:none;
}
#docs-container {
pre {
font-size:1.2em;
background-color: #f0f0f0;
border: $border-style;
box-shadow: 2px 2px 3px #DFDFDF;
padding:10px;
margin: 5px 0px 5px 0px;
overflow:auto;
line-height:1.3em;
}
/* the [SQL] links used to display SQL */
.sql_link
{
font-weight:normal;
font-family: helvetica, arial, sans-serif;
font-size:.9em;
text-transform: uppercase;
color:#990000;
border:1px solid;
padding:1px 2px 1px 2px;
margin:0px 10px 0px 15px;
float:right;
line-height:1.2em;
}
a.sql_link, .sql_link
{
text-decoration: none;
padding:1px 2px;
}
a.sql_link:hover {
text-decoration: none;
color:#fff;
border:1px solid #900;
background-color: #900;
}
a.changeset-link {
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
}
.popup_sql, .show_sql
{
background-color: $popout-color;
padding:5px 10px;
margin:10px -5px;
border:1px dashed;
}
/* docutils-specific elements */
th.field-name {
text-align:right;
}
div.section {
}
div.note, div.warning, p.deprecated, div.topic, div.admonition {
background-color:$notebox-background-color;
}
.footnote {
font-size: .95em;
}
div.faq {
background-color: #EFEFEF;
}
div.faq ul {
list-style: square outside none;
}
div.admonition, div.topic, .deprecated, .versionadded, .versionchanged {
border: $border-style;
padding:5px 10px;
font-size:.9em;
margin-top:5px;
box-shadow: 2px 2px 3px #DFDFDF;
}
div.sidebar {
background-color: #FFFFEE;
border: 1px solid #DDDDBB;
float: right;
margin: 10px 0 10px 1em;
padding: 7px 7px 0;
width: 40%;
font-size:.9em;
}
p.sidebar-title {
font-weight: bold;
}
/* grrr sphinx changing your document structures, removing classes.... */
.versionadded .versionmodified,
.versionchanged .versionmodified,
.deprecated .versionmodified,
.versionadded > p:first-child > span:first-child,
.versionchanged > p:first-child > span:first-child,
.deprecated > p:first-child > span:first-child
{
background-color: #ECF0F3;
color: #990000;
font-style: italic;
}
div.inherited-member {
border: $border-style;
padding:5px 5px;
font-size:.9em;
box-shadow: 2px 2px 3px #DFDFDF;
}
div.warning .admonition-title {
color:#FF0000;
}
div.admonition .admonition-title, div.topic .topic-title {
font-weight:bold;
}
.viewcode-back, .viewcode-link {
float:right;
}
dl.function > dt,
dl.attribute > dt,
dl.classmethod > dt,
dl.method > dt,
dl.class > dt,
dl.exception > dt
{
background-color: #EFEFEF;
margin:25px -10px 10px 10px;
padding: 0px 10px;
}
dl.glossary > dt {
font-weight:bold;
font-size:1.1em;
padding-top:10px;
}
dt:target, span.highlight {
background-color:#FBE54E;
}
a.headerlink {
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
visibility: hidden;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
li:hover > a.headerlink,
li:hover > span > a.headerlink {
visibility: visible;
}
a.headerlink:hover {
background-color: #00f;
color: white;
}
.clearboth {
clear:both;
}
/* sphinx 1.3 now using 'code' and not 'tt' for code / docstring elements */
code.descname, tt.descname {
background-color:transparent;
font-size:1.2em;
font-weight:bold;
}
code.descclassname, tt.descclassname {
background-color:transparent;
}
code, tt {
background-color:#ECF0F3;
padding:0 1px;
}
/* syntax highlighting overrides */
.k, .kn {color:#0908CE;}
.o {color:#BF0005;}
.go {color:#804049;}
/* special "index page" sections
with specific formatting
*/
div#sqlalchemy-documentation {
font-size:.95em;
}
div#sqlalchemy-documentation em {
font-style:normal;
}
div#sqlalchemy-documentation .rubric{
font-size:14px;
background-color:#EEFFEF;
padding:5px;
border:1px solid #BFBFBF;
}
div#sqlalchemy-documentation a, div#sqlalchemy-documentation li {
padding:5px 0px;
}
div#getting-started {
border-bottom:1px solid;
}
div#sqlalchemy-documentation div#sqlalchemy-orm {
float:left;
width:48%;
}
div#sqlalchemy-documentation div#sqlalchemy-core {
float:left;
width:48%;
margin:0;
padding-left:10px;
border-left:1px solid;
}
div#dialect-documentation {
border-top:1px solid;
/*clear:left;*/
}
div .versionwarning,
div .version-warning {
font-size:12px;
font-color:red;
border:1px solid;
padding:4px 4px;
margin:8px 0px 2px 0px;
background:#FFBBBB;
}
zzzeeksphinx-1.0.17/zzzeeksphinx/themes/zzzeeksphinx/static/init.js 0000644 0000765 0000024 00000006126 12450565145 026541 0 ustar classic staff 0000000 0000000
function initSQLPopups() {
$('div.popup_sql').hide();
$('a.sql_link').click(function() {
$(this).nextAll('div.popup_sql:first').toggle();
return false;
});
}
function initFloatyThings() {
if (!$("#fixed-sidebar.withsidebar")) {
return;
}
var docsBodyOffset = $("#docs-body").offset().top;
var padding = docsBodyOffset -
($("#docs-top-navigation-container").offset().top +
$("#docs-top-navigation-container").height());
var automatedBreakpoint = $("#docs-container").position().top +
$("#docs-top-navigation-container").height();
// this turns on the whole thing, without this
// we are in graceful degradation assuming no JS
$("#fixed-sidebar.withsidebar").addClass("preautomated");
function setScroll() {
var scrolltop = $(window).scrollTop();
var fix = scrolltop >= automatedBreakpoint;
if (fix) {
$("#fixed-sidebar.withsidebar").css("top", padding);
$("#fixed-sidebar.withsidebar").css("position", "fixed");
$("#fixed-sidebar.withsidebar").css("height", '');
}
else {
$("#fixed-sidebar.withsidebar").css("top", 0);
$("#fixed-sidebar.withsidebar").css(
"height", $(window).height() - docsBodyOffset + scrolltop);
$("#fixed-sidebar.withsidebar").css("position", "absolute");
}
}
$(window).scroll(setScroll);
$(window).resize(setScroll);
setScroll();
}
function highlightLinks() {
function bisection(x){
var low = 0;
var high = divCollection.length;
var mid;
while (low < high) {
mid = (low + high) >> 1;
if (x < divCollection[mid]['active']) {
high = mid;
} else {
low = mid + 1;
}
}
return low;
}
var divCollection = [];
var currentIdx = -1;
var docHeight = $(document).height();
$("div.section").each(function(index) {
var active = $(this).offset().top - 20;
divCollection.push({
'id': this.id,
'active': active,
});
});
function setLink() {
var windowPos = $(window).scrollTop();
var windowHeight = $(window).height();
var idx;
if (windowPos + windowHeight == docHeight) {
idx = divCollection.length;
}
else {
idx = bisection(windowPos);
}
if (idx != currentIdx) {
var effectiveIdx = Math.max(0, idx - 1);
currentIdx = idx;
var ref;
if (effectiveIdx == 0) {
ref = '';
}
else {
ref = divCollection[effectiveIdx]['id'];
}
$("#docs-sidebar li.current").removeClass('current');
$("#docs-sidebar li a.reference[href='#" + ref + "']").parents("li").first().addClass('current');
}
}
$(window).scroll(setLink);
setLink();
}
$(document).ready(function() {
initSQLPopups();
if (!$.browser.mobile) {
initFloatyThings();
highlightLinks();
}
});
zzzeeksphinx-1.0.17/zzzeeksphinx/themes/zzzeeksphinx/static_base.mako 0000644 0000765 0000024 00000001661 12447641715 027106 0 ustar classic staff 0000000 0000000
${metatags and metatags or ''}
<%block name="head_title">
%block>
<%block name="css">
% for cssfile in self.attr.default_css_files + css_files:
% endfor
%block>
<%block name="headers"/>
${next.body()}
<%block name="footer"/>
<%block name="lower_scripts"/>
zzzeeksphinx-1.0.17/zzzeeksphinx/themes/zzzeeksphinx/theme.conf 0000664 0000765 0000024 00000000121 12444073063 025705 0 ustar classic staff 0000000 0000000 [theme]
inherit = basic
stylesheet = docs.css
pygments_style = sphinx
[options]
zzzeeksphinx-1.0.17/zzzeeksphinx/toc.py 0000644 0000765 0000024 00000021556 12450431343 021043 0 ustar classic staff 0000000 0000000 #!coding: utf-8
from docutils import nodes as docutils_nodes
from sphinx import addnodes
class TOCMixin(object):
def get_current_subtoc(self, current_page_name, start_from=None):
"""Return a TOC for sub-files and sub-elements of the current file.
This is to provide a "contextual" navbar that shows the current page
in context of all of its siblings, not just the immediate "previous"
and "next".
This allows a very long page with many sections to be broken
into smaller pages while not losing the navigation of the overall
section, with the added bonus that only the page-level bullets for
the current subsection are expanded, thus making for a much shorter,
"drill-down" style navigation.
"""
raw_tree = self.app.env.get_toctree_for(
current_page_name, self.app.builder, True, maxdepth=-1)
local_tree = self.app.env.get_toc_for(
current_page_name, self.app.builder)
# start with the bullets inside the doc's toc,
# not the top level bullet, as we get that from the other tree
if not local_tree.children or len(local_tree.children[0].children) < 2:
local_tree = None
else:
local_tree = local_tree.children[0].children[1]
def _locate_nodes(nodes, level, outer=True):
# this is a lazy way of getting at all the info in a
# series of docutils nodes, with an absolute mimimal
# reliance on the actual structure of the nodes.
# we just look for refuris and the fact that a node
# is dependent on another somehow, that's it, then we
# flatten it out into a clean "tree" later.
# An official Sphinx feature/extension
# here would probably make much more use of direct
# knowledge of the structure
for elem in nodes:
if hasattr(elem, 'attributes'):
refuri = elem.attributes.get('refuri', None)
else:
refuri = None
name = None
if refuri is not None:
for index, sub_elem in enumerate(elem.children, 1):
if isinstance(
sub_elem,
(docutils_nodes.Text, docutils_nodes.literal)):
continue
else:
break
local_text = elem.children[0:index]
name = local_text[0].rawsource
remainders = elem.children[index:]
# a little bit of extra filtering of when/where
# we want internal nodes vs. page-level nodes,
# this is usually not needed except in a certain
# edge case
if (
not outer and refuri.startswith("#")
) or (
outer and "#" not in refuri
):
yield level, refuri, name, local_text
else:
remainders = elem.children
# try to embed the item-level get_toc_for() inside
# the file-level get_toctree_for(), otherwise if we
# just get the full get_toctree_for(), it's enormous.
if outer and refuri == '':
if local_tree is not None:
for ent in _locate_nodes(
[local_tree], level + 1, False):
yield ent
else:
for ent in _locate_nodes(
remainders, level + 1, outer):
yield ent
def _organize_nodes(nodes):
"""organize the nodes that we've grabbed with non-contiguous
'level' numbers into a clean hierarchy"""
stack = []
levels = []
for level, refuri, name, text_nodes in nodes:
if not levels or levels[-1] < level:
levels.append(level)
new_collection = []
if stack:
stack[-1].append(new_collection)
stack.append(new_collection)
elif level < levels[-1]:
while levels and level < levels[-1]:
levels.pop(-1)
if level > levels[-1]:
levels.append(level)
else:
stack.pop(-1)
stack[-1].append((refuri, name, text_nodes))
return stack
def _render_nodes(
stack, level=0, start_from=None, nested_element=False,
parent_element=None):
printing = False
if stack:
printing = nested_element or start_from is None or \
start_from in [
elem[0] for elem in stack
if isinstance(elem, tuple)
]
if printing:
if not isinstance(
parent_element, docutils_nodes.bullet_list):
new_list = docutils_nodes.bullet_list()
parent_element.append(new_list)
parent_element = new_list
while stack:
elem = stack.pop(0)
as_links = not isinstance(elem, tuple) or \
elem[0] != ''
if isinstance(elem, tuple):
refuri, name, text_nodes = elem
if not stack or isinstance(stack[0], tuple):
if printing:
list_item = docutils_nodes.list_item(
classes=['selected']
if not as_links else [])
list_item.append(
self._link_node(refuri, text_nodes)
if as_links else
self._strong_node(refuri, text_nodes)
)
parent_element.append(list_item)
elif isinstance(stack[0], list):
if printing:
list_item = docutils_nodes.list_item(
classes=['selected']
if not as_links else [])
list_item.append(
self._link_node(refuri, text_nodes)
if as_links else
self._strong_node(refuri, text_nodes)
)
parent_element.append(list_item)
else:
list_item = None
_render_nodes(
stack[0],
level=level + 1,
start_from=start_from,
nested_element=nested_element or
printing or
elem[0] == '',
parent_element=list_item or parent_element)
elif isinstance(elem, list):
_render_nodes(
elem,
level=level + 1,
start_from=start_from,
nested_element=nested_element,
parent_element=parent_element)
element = docutils_nodes.bullet_list()
nodes = _organize_nodes(_locate_nodes([raw_tree], 0))
_render_nodes(
nodes,
start_from=start_from,
parent_element=element
)
return self.app.builder.render_partial(element)['fragment']
def _link_node(self, refuri, text_nodes):
link = docutils_nodes.reference(
'', '', text_nodes[0],
refuri=refuri)
link.extend(text_nodes[1:])
cp = docutils_nodes.inline(classes=['link-container'])
cp.append(link)
return cp
def _strong_node(self, refuri, text_nodes):
cp = docutils_nodes.inline(classes=['link-container'])
n1 = docutils_nodes.strong()
n1.extend(text_nodes)
cp.append(n1)
paramlink = docutils_nodes.reference(
'', '',
docutils_nodes.Text(u"¶", u"¶"),
refid="",
# paramlink is our own CSS class, headerlink
# is theirs. Trying to get everything we can for existing
# symbols...
classes=['paramlink', 'headerlink']
)
cp.append(paramlink)
return cp
zzzeeksphinx-1.0.17/zzzeeksphinx/util.py 0000644 0000765 0000024 00000000617 12522717573 021242 0 ustar classic staff 0000000 0000000 import sphinx
import re
SPHINX_VERSION = tuple(
int(dig) for dig in re.findall("\d+", sphinx.__version__)
)
def striptags(text):
return re.compile(r'<[^>]*>').sub('', text)
def go(m):
# .html with no anchor if present, otherwise "#" for top of page
return m.group(1) or '#'
def strip_toplevel_anchors(text):
return re.compile(r'(\.html)?#[-\w]+-toplevel').sub(go, text)
zzzeeksphinx-1.0.17/zzzeeksphinx/viewsource.py 0000644 0000765 0000024 00000015413 12522720617 022451 0 ustar classic staff 0000000 0000000 from docutils import nodes
from sphinx.ext.viewcode import collect_pages
from sphinx.pycode import ModuleAnalyzer
import imp
import re
from sphinx.util.compat import Directive
import os
from docutils.statemachine import StringList
from sphinx.environment import NoUri
from sphinx.pycode.pgen2 import token
import warnings
from . import util
import sys
py2k = sys.version_info < (3, 0)
if py2k:
text_type = unicode
else:
text_type = str
def view_source(
name, rawtext, text, lineno, inliner,
options={}, content=[]):
env = inliner.document.settings.env
node = _view_source_node(env, text, None)
return [node], []
def _get_sphinx_py_module(env):
base_name = env.temp_data.get('autodoc:module', None)
if base_name is not None:
return base_name
if util.SPHINX_VERSION >= (1, 3):
base_name = env.ref_context.get('py:module', None)
if base_name is not None:
return base_name
else:
base_name = env.temp_data.get('py:module', None)
if base_name is not None:
return base_name
return None
def _view_source_node(env, text, state):
# pretend we're using viewcode fully,
# install the context it looks for
if not hasattr(env, '_viewcode_modules'):
env._viewcode_modules = {}
modname = text
text = modname.split(".")[-1] + ".py"
# imitate sphinx . syntax
if modname.startswith("."):
# see if the modname needs to be corrected in terms
# of current module context
base_module = _get_sphinx_py_module(env)
if base_module:
modname = base_module + modname
else:
warnings.warn(
"Could not get base module for relative module: %s; "
"not generating node" % modname)
return None
urito = env.app.builder.get_relative_uri
# we're showing code examples which may have dependencies
# which we really don't want to have required so load the
# module by file, not import (though we are importing)
# the top level module here...
pathname = None
for tok in modname.split("."):
try:
file_, pathname, desc = imp.find_module(
tok, [pathname] if pathname else None)
except ImportError as ie:
raise ImportError("Error trying to import %s: %s" % (modname, ie))
else:
if file_:
file_.close()
# unlike viewcode which silently traps exceptions,
# I want this to totally barf if the file can't be loaded.
# a failed build better than a complete build missing
# key content
analyzer = ModuleAnalyzer.for_file(pathname, modname)
# copied from viewcode
analyzer.find_tags()
if not isinstance(analyzer.code, text_type):
code = analyzer.code.decode(analyzer.encoding)
else:
code = analyzer.code
if state is not None:
docstring = _find_mod_docstring(analyzer)
if docstring:
# get rid of "foo.py" at the top
docstring = re.sub(r"^[a-zA-Z_0-9]+\.py", "", docstring)
# strip
docstring = docstring.strip()
# yank only first paragraph
docstring = docstring.split("\n\n")[0].strip()
else:
docstring = None
pagename = '_modules/' + modname.replace('.', '/')
try:
refuri = urito(env.docname, pagename)
except NoUri:
# if we're in the latex builder etc., this seems
# to be what we get
refuri = None
if util.SPHINX_VERSION >= (1, 3):
entry = code, analyzer.tags, {}, refuri
else:
entry = code, analyzer.tags, {}
env._viewcode_modules[modname] = entry
if docstring:
# embed the ref with the doc text so that it isn't
# a separate paragraph
if refuri:
docstring = "`%s <%s>`_ - %s" % (text, refuri, docstring)
else:
docstring = "``%s`` - %s" % (text, docstring)
para = nodes.paragraph('', '')
state.nested_parse(StringList([docstring]), 0, para)
return_node = para
else:
if refuri:
refnode = nodes.reference(
'', '',
nodes.Text(text, text),
refuri=urito(env.docname, pagename)
)
else:
refnode = nodes.Text(text, text)
if state:
return_node = nodes.paragraph('', '', refnode)
else:
return_node = refnode
return return_node
def _find_mod_docstring(analyzer):
"""attempt to locate the module-level docstring.
Note that sphinx autodoc just uses ``__doc__``. But we don't want
to import the module, so we need to parse for it.
"""
analyzer.tokenize()
for type_, parsed_line, start_pos, end_pos, raw_line in analyzer.tokens:
if type_ == token.COMMENT:
continue
elif type_ == token.STRING:
return eval(parsed_line)
else:
return None
def _parse_content(content):
d = {}
d['text'] = []
idx = 0
for line in content:
idx += 1
m = re.match(r' *\:(.+?)\:(?: +(.+))?', line)
if m:
attrname, value = m.group(1, 2)
d[attrname] = value or ''
else:
break
d["text"] = content[idx:]
return d
def _comma_list(text):
return re.split(r"\s*,\s*", text.strip())
class AutoSourceDirective(Directive):
has_content = True
def run(self):
content = _parse_content(self.content)
env = self.state.document.settings.env
self.docname = env.docname
sourcefile = self.state.document.current_source.split(os.pathsep)[0]
dir_ = os.path.dirname(sourcefile)
files = [
f for f in os.listdir(dir_) if f.endswith(".py")
and f != "__init__.py"
]
if "files" in content:
# ordered listing of files to include
files = [
fname for fname in _comma_list(content["files"])
if fname in set(files)]
node = nodes.paragraph(
'', '',
nodes.Text("Listing of files:", "Listing of files:")
)
bullets = nodes.bullet_list()
for fname in files:
modname, ext = os.path.splitext(fname)
# relative lookup
modname = "." + modname
link = _view_source_node(env, modname, self.state)
if link is not None:
list_node = nodes.list_item(
'',
link
)
bullets += list_node
node += bullets
return [node]
def setup(app):
app.add_role('viewsource', view_source)
app.add_directive('autosource', AutoSourceDirective)
# from sphinx.ext.viewcode
app.connect('html-collect-pages', collect_pages)
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/ 0000755 0000765 0000024 00000000000 12530636260 021371 5 ustar classic staff 0000000 0000000 zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/dependency_links.txt 0000644 0000765 0000024 00000000001 12530636260 025437 0 ustar classic staff 0000000 0000000
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/entry_points.txt 0000644 0000765 0000024 00000000074 12530636260 024670 0 ustar classic staff 0000000 0000000 [sphinx_themes]
zzzeeksphinx = zzzeeksphinx.theme:get_path
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/not-zip-safe 0000644 0000765 0000024 00000000001 12444070077 023621 0 ustar classic staff 0000000 0000000
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/pbr.json 0000644 0000765 0000024 00000000057 12530636260 023051 0 ustar classic staff 0000000 0000000 {"is_release": false, "git_version": "b1b4e9a"} zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/PKG-INFO 0000644 0000765 0000024 00000011000 12530636260 022456 0 ustar classic staff 0000000 0000000 Metadata-Version: 1.1
Name: zzzeeksphinx
Version: 1.0.17
Summary: Zzzeek's Sphinx Layout and Utilities.
Home-page: http://bitbucket.org/zzzeek/zzzeeksphinx
Author: Mike Bayer
Author-email: mike@zzzcomputing.com
License: MIT
Description: =============
zzzeeksphinx
=============
This is zzzeek's own Sphinx layout, used by SQLAlchemy.
This layout is first and foremost pulled in for the SQLAlchemy documentation
builds (and possibly other related projects), but is also usable as a
standalone theme / utility set for any project.
Feel free to fork off features from it as needed, the project here first
and foremost has to work with SQLAlchemy.
Features include:
* Uses Mako templates instead of Jinja, for more programmatic capabilities
inside of templates.
* Layout includes an independently scrollable sidebar
* A unique (to Sphinx) "contextual" sidebar contents that shows the
current page in context with all sibling pages (like that of MySQL's docs).
This is a form of TOC that Sphinx doesn't typically have a lot of
capability to do (well it could, with some simple feature adds), but
IMO this kind of navigation is critical for very large and nested
documentation sets, so that the navbar stays relatively small yet provides
context as to where you are in the docs and what else is locally available.
* Modifications to autodoc which illustrate inherited classes, bases,
method documentation illustrates if a method is only inherited from the
base or overridden.
* A "dynamic base" feature that will, under ReadTheDocs, pull in optional
``.mako`` and ``.py`` files from the website of your choice
that will serve as an alternate base template and a source of extra
config setup, respectively, allowing the layout to be integrated into
the layout of an external site when viewing on the web.
* A "viewsource" extension that can provide highlighted sourcecode to any
Python file arbitrarily.
* SQLAlchemy-specific stuff, like the [SQL] popups, the dialect info
directives.
* scss support using pyscss.
Config
======
in conf.py, the extension is::
extensions = [
'zzzeeksphinx',
]
The theme is::
html_theme = 'zzzeeksphinx'
Other configs that SQLAlchemy has set up; these two are probably
needed::
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0.0"
release_date = "Not released"
Additional configs for the "dynamic site thing" look like::
site_base = os.environ.get("RTD_SITE_BASE", "http://www.sqlalchemy.org")
site_adapter_template = "docs_adapter.mako"
site_adapter_py = "docs_adapter.py"
Configs which do some last-minute translation of module names
when running autodoc to display API documentation::
autodocmods_convert_modname = {
"sqlalchemy.sql.sqltypes": "sqlalchemy.types",
"sqlalchemy.sql.type_api": "sqlalchemy.types",
"sqlalchemy.sql.schema": "sqlalchemy.schema",
"sqlalchemy.sql.elements": "sqlalchemy.sql.expression",
"sqlalchemy.sql.selectable": "sqlalchemy.sql.expression",
"sqlalchemy.sql.dml": "sqlalchemy.sql.expression",
"sqlalchemy.sql.ddl": "sqlalchemy.schema",
"sqlalchemy.sql.base": "sqlalchemy.sql.expression"
}
autodocmods_convert_modname_w_class = {
("sqlalchemy.engine.interfaces", "Connectable"): "sqlalchemy.engine",
("sqlalchemy.sql.base", "DialectKWArgs"): "sqlalchemy.sql.base",
}
Keywords: Sphinx
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Documentation
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/requires.txt 0000644 0000765 0000024 00000000014 12530636260 023764 0 ustar classic staff 0000000 0000000 pyscss
mako
zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/SOURCES.txt 0000644 0000765 0000024 00000001743 12530636260 023262 0 ustar classic staff 0000000 0000000 LICENSE
MANIFEST.in
README.rst
setup.py
zzzeeksphinx/__init__.py
zzzeeksphinx/autodoc_mods.py
zzzeeksphinx/dialect_info.py
zzzeeksphinx/mako.py
zzzeeksphinx/scss.py
zzzeeksphinx/sqlformatter.py
zzzeeksphinx/theme.py
zzzeeksphinx/toc.py
zzzeeksphinx/util.py
zzzeeksphinx/viewsource.py
zzzeeksphinx.egg-info/PKG-INFO
zzzeeksphinx.egg-info/SOURCES.txt
zzzeeksphinx.egg-info/dependency_links.txt
zzzeeksphinx.egg-info/entry_points.txt
zzzeeksphinx.egg-info/not-zip-safe
zzzeeksphinx.egg-info/pbr.json
zzzeeksphinx.egg-info/requires.txt
zzzeeksphinx.egg-info/top_level.txt
zzzeeksphinx/themes/zzzeeksphinx/genindex.mako
zzzeeksphinx/themes/zzzeeksphinx/layout.mako
zzzeeksphinx/themes/zzzeeksphinx/page.mako
zzzeeksphinx/themes/zzzeeksphinx/search.mako
zzzeeksphinx/themes/zzzeeksphinx/static_base.mako
zzzeeksphinx/themes/zzzeeksphinx/theme.conf
zzzeeksphinx/themes/zzzeeksphinx/static/detectmobile.js
zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss
zzzeeksphinx/themes/zzzeeksphinx/static/init.js zzzeeksphinx-1.0.17/zzzeeksphinx.egg-info/top_level.txt 0000644 0000765 0000024 00000000015 12530636260 024117 0 ustar classic staff 0000000 0000000 zzzeeksphinx