From 1172886530eba5c9f6f4df5df3f381844f81ab89 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 Jul 2011 22:38:20 -0400 Subject: [PATCH] - fix documentation versions in conf.py, other changes to site layout --- doc/build/builder/builders.py | 22 ++++++++++++---------- doc/build/conf.py | 10 +++++++--- doc/build/templates/layout.mako | 15 ++++++++++----- doc/build/templates/site_base.mako | 2 +- lib/sqlalchemy/__init__.py | 2 +- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/doc/build/builder/builders.py b/doc/build/builder/builders.py index b82480ad3a..1941618af9 100644 --- a/doc/build/builder/builders.py +++ b/doc/build/builder/builders.py @@ -14,14 +14,15 @@ from mako.template import Template class MakoBridge(TemplateBridge): def init(self, builder, *args, **kw): self.layout = builder.config.html_context.get('mako_layout', 'html') - + builder.config.html_context['release_date'] = builder.config['release_date'] + builder.config.html_context['versions'] = builder.config['versions'] self.lookup = TemplateLookup(directories=builder.config.templates_path, format_exceptions=True, imports=[ "from builder import util" ] ) - + def render(self, template, context): template = template.replace(".html", ".mako") context['prevtopic'] = context.pop('prev', None) @@ -30,8 +31,8 @@ class MakoBridge(TemplateBridge): # sphinx 1.0b2 doesn't seem to be providing _ for some reason... context.setdefault('_', lambda x:x) return self.lookup.get_template(template).render_unicode(**context) - - + + def render_string(self, template, context): context['prevtopic'] = context.pop('prev', None) context['nexttopic'] = context.pop('next', None) @@ -44,7 +45,7 @@ class MakoBridge(TemplateBridge): "from builder import util" ] ).render_unicode(**context) - + class StripDocTestFilter(Filter): def filter(self, lexer, stream): for ttype, value in stream: @@ -116,7 +117,7 @@ def _strip_trailing_whitespace(iter_): buf[-1] = (buf[-1][0], buf[-1][1].rstrip()) for t, v in buf: yield t, v - + class PopupSQLFormatter(HtmlFormatter): def _format_lines(self, tokensource): buf = [] @@ -134,7 +135,7 @@ class PopupSQLFormatter(HtmlFormatter): yield 1, "" % 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 @@ -148,7 +149,7 @@ class PopupLatexFormatter(LatexFormatter): continue else: yield ttype, value - + def format(self, tokensource, outfile): LatexFormatter.format(self, self._filter_tokens(tokensource), outfile) @@ -162,7 +163,8 @@ def setup(app): app.add_lexer('pycon+sql', PyConWithSQLLexer()) app.add_lexer('python+sql', PythonWithSQLLexer()) app.connect('autodoc-skip-member', autodoc_skip_member) + app.add_config_value('release_date', "", True) + app.add_config_value('versions', "", True) PygmentsBridge.html_formatter = PopupSQLFormatter PygmentsBridge.latex_formatter = PopupLatexFormatter - - \ No newline at end of file + diff --git a/doc/build/conf.py b/doc/build/conf.py index eaf51a6281..04868bc538 100644 --- a/doc/build/conf.py +++ b/doc/build/conf.py @@ -51,9 +51,13 @@ copyright = u'2007, 2008, 2009, the SQLAlchemy authors and contributors' # built documents. # # The short X.Y version. -version = sqlalchemy.__version__ +version = "0.5" # The full version, including alpha/beta/rc tags. -release = sqlalchemy.__version__ +release = "0.5.8" + +release_date = "Jan 16, 2010" + +versions = [('0.7', '07'), ('0.6', '06'), ('0.5', '05')] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -100,7 +104,7 @@ html_style = 'default.css' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = "%s %s Documentation" % (project, release) +html_title = "%s %s Documentation" % (project, version) # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None diff --git a/doc/build/templates/layout.mako b/doc/build/templates/layout.mako index 62bbc383af..505a7a758b 100644 --- a/doc/build/templates/layout.mako +++ b/doc/build/templates/layout.mako @@ -51,7 +51,12 @@
- Version: ${release} Last Updated: ${last_updated} + Release: ${release} | Release Date: ${release_date} + % if not version.startswith(versions[0][0]): +
+ The current version of SQLAlchemy is ${versions[0][0]}. View current SQLAlchemy Documentation +
+ % endif
@@ -60,12 +65,12 @@ API Reference | Index - + % if sourcename: % endif - + - +
${next.body()} diff --git a/doc/build/templates/site_base.mako b/doc/build/templates/site_base.mako index 6dc2ebb3fd..1bc15affc4 100644 --- a/doc/build/templates/site_base.mako +++ b/doc/build/templates/site_base.mako @@ -7,7 +7,7 @@
-Quick Select: 0.6 | 0.5
+Quick Select: ${" | ".join('%s' % (link, vers) for vers, link in versions)}
PDF Download: download
diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 3ddb020997..031b9f1af2 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -106,7 +106,7 @@ from sqlalchemy.engine import create_engine, engine_from_config __all__ = sorted(name for name, obj in locals().items() if not (name.startswith('_') or inspect.ismodule(obj))) - + __version__ = '0.5.8' del inspect, sys -- 2.47.2