@echo " html to make standalone HTML files"
@echo " gettext to make PO message catalogs"
@echo " dist-html same as html, but places files in /doc"
- @echo " site-mako to make sqlalchemy.org Mako files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo
@echo "Build finished. The HTML pages are in ../."
-site-mako:
- $(SPHINXBUILD) -b html -A mako_layout=site $(ALLSPHINXOPTS) $(BUILDDIR)/site
- $(MAKE) latexpdf
- cp $(BUILDDIR)/latex/*.pdf $(BUILDDIR)/site/
- @echo
- @echo "Build finished. The Mako pages are in $(BUILDDIR)/site."
-
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
from mako.lookup import TemplateLookup
from mako.template import Template
from mako import __version__
+import os
-if __version__ < "0.4.1":
- raise Exception("Mako 0.4.1 or greater is required for "
- "documentation build.")
+rtd = os.environ.get('READTHEDOCS', None) == 'True'
class MakoBridge(TemplateBridge):
def init(self, builder, *args, **kw):
self.jinja2_fallback = BuiltinTemplateLoader()
self.jinja2_fallback.init(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']
+ builder.config.html_context['site_base'] = builder.config['site_base']
self.lookup = TemplateLookup(directories=builder.config.templates_path,
#format_exceptions=True,
]
)
+ if rtd:
+ import urllib2
+ template_url = builder.config['site_base'] + "/docs_base.mako"
+ template = urllib2.urlopen(template_url).read()
+ self.lookup.put_string("/rtd_base.mako", template)
+
def render(self, template, context):
template = template.replace(".html", ".mako")
context['prevtopic'] = context.pop('prev', None)
context['nexttopic'] = context.pop('next', None)
- context['mako_layout'] = self.layout == 'html' and 'static_base.mako' or 'site_base.mako'
- # sphinx 1.0b2 doesn't seem to be providing _ for some reason...
+ version = context['version']
+ pathto = context['pathto']
+
+ # RTD layout
+ if rtd:
+ # add variables if not present, such
+ # as if local test of READTHEDOCS variable
+ if 'MEDIA_URL' not in context:
+ context['MEDIA_URL'] = "http://media.readthedocs.org/"
+ if 'slug' not in context:
+ context['slug'] = context['project'].lower()
+ if 'url' not in context:
+ context['url'] = "/some/test/url"
+ if 'current_version' not in context:
+ context['current_version'] = "latest"
+
+ if 'name' not in context:
+ context['name'] = context['project'].lower()
+
+ context['rtd'] = True
+ context['toolbar'] = True
+ context['layout'] = "rtd_layout.mako"
+ context['base'] = "rtd_base.mako"
+ context['pdf_url'] = "%spdf/%s/%s/%s.pdf" % (
+ context['MEDIA_URL'],
+ context['slug'],
+ context['current_version'],
+ context['slug']
+ )
+ # local docs layout
+ else:
+ context['rtd'] = False
+ context['toolbar'] = False
+ context['layout'] = "layout.mako"
+ context['base'] = "static_base.mako"
+
context.setdefault('_', lambda x:x)
return self.lookup.get_template(template).render_unicode(**context)
app.add_lexer('pycon+sql', PyConWithSQLLexer())
app.add_lexer('python+sql', PythonWithSQLLexer())
app.add_config_value('release_date', "", True)
- app.add_config_value('versions', "", True)
+ app.add_config_value('site_base', "", True)
+ app.add_config_value('build_number', "", 1)
app.connect('autodoc-skip-member', autodoc_skip_member)
PygmentsBridge.html_formatter = PopupSQLFormatter
PygmentsBridge.latex_formatter = PopupLatexFormatter
# General information about the project.
project = u'SQLAlchemy'
-copyright = u'2007-2011, the SQLAlchemy authors and contributors'
+copyright = u'2007-2012, the SQLAlchemy authors and contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
release_date = "December 9, 2011"
-versions = [('0.7', '07'), ('0.6', '06'), ('0.5', '05')]
+site_base = "http://www.sqlalchemy.org"
+
+# arbitrary number recognized by builders.py, incrementing this
+# will force a rebuild
+build_number = 2
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
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;
+}
+
-$(document).ready(function(){
+
+function initSQLPopups() {
$('div.popup_sql').hide();
$('a.sql_link').click(function() {
$(this).nextAll('div.popup_sql:first').toggle();
return false;
})
+}
+
+$(document).ready(function() {
+ initSQLPopups();
});
+
-<%inherit file="layout.mako"/>
+<%inherit file="${context['layout']}"/>
-<%def name="show_title()">${_('Index')}</%def>
+<%block name="show_title" filter="util.striptags">
+ ${_('Index')}
+</%block>
<h1 id="index">${_('Index')}</h1>
## coding: utf-8
+<%!
+ local_script_files = []
+%>
+
<%doc>
Structural elements are all prefixed with "docs-"
to prevent conflicts when the structure is integrated into the
docs-copyright
</%doc>
-<%inherit file="${context['mako_layout']}"/>
+<%inherit file="${context['base']}"/>
<%
withsidebar = bool(toc) and current_page_name != 'index'
%>
+<%block name="head_title">
+ % if current_page_name != 'index':
+ ${capture(self.show_title) | util.striptags} —
+ % endif
+ ${docstitle|h}
+</%block>
+
<div id="docs-container">
<%block name="headers">
<div id="docs-version-header">
Release: <span class="version-num">${release}</span> | Release Date: ${release_date}
- % if self.attr.site_layout:
- | <a href="${pathto('sqlalchemy_' + release.replace('.', '_') + '.pdf', 1)}">Download PDF</a>
+ % if pdf_url:
+ | <a href="${pdf_url}">Download PDF</a>
% endif
- % if self.attr.site_layout and not version.startswith(versions[0][0]):
- <div class="version-warning">
- The current version of SQLAlchemy is ${versions[0][0]}. <a href="/docs/">View current SQLAlchemy Documentation</a>
- </div>
- % endif
</div>
</div>
<h2>
<%block name="show_title">
- % if title:
${title}
- % endif
</%block>
</h2>
</div>
</p>
% endif
+ % if rtd:
+ <h4>Project Versions</h4>
+ <ul class="version-listing">
+ </ul>
+ % endif
+
<h4>Quick Search</h4>
<p>
<form class="search" action="${pathto('search')}" method="get">
</div>
-<%block name="footer">
- <div id="docs-bottom-navigation" class="docs-navigation-links">
- % if prevtopic:
- Previous:
- <a href="${prevtopic['link']|h}" title="${_('previous chapter')}">${prevtopic['title']}</a>
- % endif
- % if nexttopic:
- Next:
- <a href="${nexttopic['link']|h}" title="${_('next chapter')}">${nexttopic['title']}</a>
- % endif
+<div id="docs-bottom-navigation" class="docs-navigation-links">
+ % if prevtopic:
+ Previous:
+ <a href="${prevtopic['link']|h}" title="${_('previous chapter')}">${prevtopic['title']}</a>
+ % endif
+ % if nexttopic:
+ Next:
+ <a href="${nexttopic['link']|h}" title="${_('next chapter')}">${nexttopic['title']}</a>
+ % endif
- <div id="docs-copyright">
- % if hasdoc('copyright'):
- © <a href="${pathto('copyright')}">Copyright</a> ${copyright|h}.
- % else:
- © Copyright ${copyright|h}.
- % endif
- % if show_sphinx:
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> ${sphinx_version|h}.
- % endif
- </div>
+ <div id="docs-copyright">
+ % if hasdoc('copyright'):
+ © <a href="${pathto('copyright')}">Copyright</a> ${copyright|h}.
+ % else:
+ © Copyright ${copyright|h}.
+ % endif
+ % if show_sphinx:
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> ${sphinx_version|h}.
+ % endif
</div>
-</%block>
+</div>
</div>
-<%inherit file="layout.mako"/>
+<%inherit file="${context['layout']}"/>
${body| util.strip_toplevel_anchors}
\ No newline at end of file
--- /dev/null
+<%inherit file="/layout.mako"/>
+
+<%
+ newscript = []
+ # strip out script files that RTD wants to provide
+ for script in script_files:
+ for token in ("jquery.js", "underscore.js", "doctools.js"):
+ if token in script:
+ break
+ else:
+ newscript.append(script)
+ script_files[:] = newscript
+%>
+
+<%block name="headers">
+<!-- RTD <head> -->
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
+<script type="text/javascript" src="${MEDIA_URL}javascript/underscore.js"></script>
+<script type="text/javascript" src="${MEDIA_URL}javascript/doctools.js"></script>
+<script type="text/javascript" src="${MEDIA_URL}javascript/searchtools.js"></script>
+ <script type="text/javascript">
+ var doc_version = "${current_version}";
+ var doc_slug = "${slug}";
+ var static_root = "${pathto('_static', 1)}"
+ </script>
+<!-- end RTD <head> -->
+ ${parent.headers()}
+</%block>
+
+${next.body()}
+
+<%block name="footer">
+${parent.footer()}
+ <!-- End original user content -->
+## Keep this here, so that the RTD logo doesn't stomp on the bottom of the theme.
+<br>
+<br>
+<br>
+
+<style type="text/css">
+ .badge {
+ position: fixed;
+ display: block;
+ bottom: 5px;
+ height: 40px;
+ text-indent: -9999em;
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
+ -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
+ -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
+ }
+ #version_menu {
+ position: fixed;
+ display: none;
+ bottom: 11px;
+ right: 166px;
+ list-style-type: none;
+ margin: 0;
+ }
+ .footer_popout:hover #version_menu {
+ display: block;
+ }
+ #version_menu li {
+ display: block;
+ float: right;
+ }
+ #version_menu li a {
+ display: block;
+ padding: 6px 10px 4px 10px;
+ margin: 7px 7px 0 0;
+ font-weight: bold;
+ font-size: 14px;
+ height: 20px;
+ line-height: 17px;
+ text-decoration: none;
+ color: #fff;
+ background: #8ca1af url(../images/gradient-light.png) bottom left repeat-x;
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ box-shadow: 0 1px 1px #465158;
+ -moz-box-shadow: 0 1px 1px #465158;
+ -webkit-box-shadow: 0 1px 1px #465158;
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
+ }
+ #version_menu li a:hover {
+ text-decoration: none;
+ background-color: #697983;
+ box-shadow: 0 1px 0px #465158;
+ -moz-box-shadow: 0 1px 0px #465158;
+ -webkit-box-shadow: 0 1px 0px #465158;
+ }
+ .badge.rtd {
+ background: #257597 url(http://media.readthedocs.org/images/badge-rtd.png) top left no-repeat;
+ border: 1px solid #282E32;
+ width: 160px;
+ right: 5px;
+ }
+ .badge.revsys { background: #465158 url(http://media.readthedocs.org/images/badge-revsys.png) top left no-repeat;
+ border: 1px solid #1C5871;
+ width: 290px;
+ right: 173px;
+ }
+ .badge.revsys-inline-sponsored {
+ position: inherit;
+ margin-left: auto;
+ margin-right: 175px;
+ margin-bottom: 5px;
+ background: #465158 url(http://media.readthedocs.org/images/badge-revsys.png) top left no-repeat;
+ border: 1px solid #1C5871;
+ width: 290px;
+ right: 173px;
+ }
+ .badge.revsys-inline {
+ position: inherit;
+ margin-left: auto;
+ margin-right: 175px;
+ margin-bottom: 5px;
+ background: #465158 url(http://media.readthedocs.org/images/badge-revsys-sm.png) top left no-repeat;
+ border: 1px solid #1C5871;
+ width: 205px;
+ right: 173px;
+ }
+
+</style>
+<div class="rtd_doc_footer">
+ <div class="footer_popout">
+ <a href="http://readthedocs.org/projects/${slug}/?fromdocs=${slug}" class="badge rtd">Brought to you by Read the Docs</a>
+ <ul id="version_menu">
+ ## rtd fills this in client side
+ </ul>
+ </div>
+</div>
+<!-- RTD Analytics Code -->
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-17997319-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+</script>
+
+% if analytics_code:
+<!-- User Analytics Code -->
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', '${analytics_code}']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+</script>
+% endif
+
+</%block>
-<%inherit file="layout.mako"/>
+<%inherit file="${context['layout']}"/>
<%!
local_script_files = ['_static/searchtools.js']
+++ /dev/null
-<%text>#coding:utf-8
-<%inherit file="/base.html"/>
-<%page cache_type="file" cached="True"/>
-<%!
- in_docs=True
-%>
-</%text>
-
-${'<%text>'}
-${next.body()}
-${'</%text>'}
-
-<%text><%def name="style()"></%text>
- <%block name="headers"/>
-
- <%text>${parent.style()}</%text>
- <link href="/css/site_docs.css" rel="stylesheet" type="text/css"></link>
-<%text></%def></%text>
-
-<%text><%def name="title()"></%text>${capture(self.show_title)|util.striptags} — ${docstitle|h}<%text></%def></%text>
-
-<%!
- local_script_files = []
- site_layout=True
-%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
${metatags and metatags or ''}
- <title>${capture(self.show_title)|util.striptags} — ${docstitle|h}</title>
+ <title>
+ <%block name="head_title">
+ </%block>
+ </title>
<%block name="headers"/>
</head>
<body>
${next.body()}
+ <%block name="footer"/>
</body>
</html>
-<%!
- local_script_files = []
- site_layout=False
-%>