summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-01-17 17:38:42 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-01-17 17:38:42 -0500
commitd64aacee330baad036622b55f64c0bba37400f0e (patch)
tree7b3044f3f6d5634f0b77b39575c4cb97f811fdac
parente30d492ac1aeb3d3545f7d49af20c8239b304b88 (diff)
downloadmako-rel_0_5.tar.gz
merge 4be2ca3ed8be8e48795f351bb47ad51c9ca1a555 from head, docs updaterel_0_5
-rw-r--r--doc/build/Makefile6
-rw-r--r--doc/build/builder/builders.py67
-rw-r--r--doc/build/templates/base.mako (renamed from doc/build/templates/makoorg/root.mako)9
-rw-r--r--doc/build/templates/genindex.mako2
-rw-r--r--doc/build/templates/layout.mako12
-rw-r--r--doc/build/templates/page.mako2
-rw-r--r--doc/build/templates/pre_layout.mako2
-rw-r--r--doc/build/templates/search.mako2
-rw-r--r--doc/build/templates/site_base.mako26
9 files changed, 41 insertions, 87 deletions
diff --git a/doc/build/Makefile b/doc/build/Makefile
index 67d8484..1ca5b74 100644
--- a/doc/build/Makefile
+++ b/doc/build/Makefile
@@ -18,7 +18,6 @@ help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dist-html same as html, but places files in /doc"
- @echo " site-mako build Mako files for usage on the Mako site"
@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"
@@ -48,11 +47,6 @@ dist-html:
@echo
@echo "Build finished. The HTML pages are in ../."
-site-mako:
- $(SPHINXBUILD) -b html -A mako_layout=site $(ALLSPHINXOPTS) $(BUILDDIR)/site
- @echo
- @echo "Build finished. The Mako pages are in $(BUILDDIR)/site."
-
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
diff --git a/doc/build/builder/builders.py b/doc/build/builder/builders.py
index 600beab..66cc14a 100644
--- a/doc/build/builder/builders.py
+++ b/doc/build/builder/builders.py
@@ -21,7 +21,6 @@ class MakoBridge(TemplateBridge):
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['site_base'] = builder.config['site_base']
self.lookup = TemplateLookup(
@@ -36,45 +35,35 @@ class MakoBridge(TemplateBridge):
context['prevtopic'] = context.pop('prev', None)
context['nexttopic'] = context.pop('next', None)
- # site layout
- if self.layout == 'site':
- context['mako_layout'] = 'site_base.mako'
- context['mako_pre_layout'] = "layout.mako"
- # overrides site_base from conf.py
- context['site_base'] = "/"
- context['docs_base'] = "/"
- else:
- # 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'] = "mako-test-slug"
- if 'url' not in context:
- context['url'] = "/some/test/url"
- if 'current_version' not in context:
- context['current_version'] = "some_version"
- if 'versions' not in context:
- context['versions'] = [('default', '/default/')]
-
- context['docs_base'] = "http://readthedocs.org"
- context['toolbar'] = True
- context['mako_pre_layout'] = "rtd_layout.mako"
- context['pdf_url'] = "%spdf/%s/%s/%s.pdf" % (
- context['MEDIA_URL'],
- context['slug'],
- context['current_version'],
- context['slug']
- )
- # local docs layout
- else:
- context['toolbar'] = False
- context['docs_base'] = "/"
- context['mako_pre_layout'] = "layout.mako"
+ # 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'] = "mako-test-slug"
+ if 'url' not in context:
+ context['url'] = "/some/test/url"
+ if 'current_version' not in context:
+ context['current_version'] = "some_version"
+ if 'versions' not in context:
+ context['versions'] = [('default', '/default/')]
- context['mako_layout'] = 'makoorg/root.mako'
+ context['docs_base'] = "http://readthedocs.org"
+ context['toolbar'] = True
+ context['layout'] = "rtd_layout.mako"
+ context['pdf_url'] = "%spdf/%s/%s/%s.pdf" % (
+ context['MEDIA_URL'],
+ context['slug'],
+ context['current_version'],
+ context['slug']
+ )
+ # local docs layout
+ else:
+ context['toolbar'] = False
+ context['docs_base'] = "/"
+ context['layout'] = "layout.mako"
context.setdefault('_', lambda x:x)
return self.lookup.get_template(template).render_unicode(**context)
diff --git a/doc/build/templates/makoorg/root.mako b/doc/build/templates/base.mako
index 35240d8..89854a1 100644
--- a/doc/build/templates/makoorg/root.mako
+++ b/doc/build/templates/base.mako
@@ -1,15 +1,8 @@
-<%
-in_docs = getattr(next.module, 'in_docs', False)
-%>
-
<html>
-<%def name="title()">
-Mako Templates for Python
-</%def>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<head>
-<title>${self.title()} </title>
+<title><%block name="head_title">Mako Templates for Python</%block></title>
<%block name="headers">
</%block>
<link rel="stylesheet" href="${pathto('_static/site.css', 1)}"></link>
diff --git a/doc/build/templates/genindex.mako b/doc/build/templates/genindex.mako
index 4f535f4..fce20f2 100644
--- a/doc/build/templates/genindex.mako
+++ b/doc/build/templates/genindex.mako
@@ -1,4 +1,4 @@
-<%inherit file="pre_layout.mako"/>
+<%inherit file="${context['layout']}"/>
<%block name="show_title" filter="util.striptags">
${_('Index')}
diff --git a/doc/build/templates/layout.mako b/doc/build/templates/layout.mako
index 5402ac1..a2a3020 100644
--- a/doc/build/templates/layout.mako
+++ b/doc/build/templates/layout.mako
@@ -21,12 +21,20 @@
docs-copyright
</%doc>
-<%inherit file="${context['mako_layout']}"/>
+<%inherit file="base.mako"/>
<%
withsidebar = bool(toc) and current_page_name != 'index'
%>
+<%block name="head_title">
+ % if current_page_name != 'index':
+ ${capture(self.show_title) | util.striptags} &mdash;
+ % endif
+ ${docstitle|h}
+</%block>
+
+
<div id="docs-container">
<%block name="headers">
@@ -120,9 +128,7 @@ withsidebar = bool(toc) and current_page_name != 'index'
<h2>
<%block name="show_title">
- % if title:
${title}
- % endif
</%block>
</h2>
</div>
diff --git a/doc/build/templates/page.mako b/doc/build/templates/page.mako
index e134ab4..61cf9a0 100644
--- a/doc/build/templates/page.mako
+++ b/doc/build/templates/page.mako
@@ -1,2 +1,2 @@
-<%inherit file="pre_layout.mako"/>
+<%inherit file="${context['layout']}"/>
${body| util.strip_toplevel_anchors} \ No newline at end of file
diff --git a/doc/build/templates/pre_layout.mako b/doc/build/templates/pre_layout.mako
deleted file mode 100644
index 5b1c508..0000000
--- a/doc/build/templates/pre_layout.mako
+++ /dev/null
@@ -1,2 +0,0 @@
-<%inherit file="${context['mako_pre_layout']}"/>
-${next.body()} \ No newline at end of file
diff --git a/doc/build/templates/search.mako b/doc/build/templates/search.mako
index ff03d5e..0eaa8f9 100644
--- a/doc/build/templates/search.mako
+++ b/doc/build/templates/search.mako
@@ -1,4 +1,4 @@
-<%inherit file="pre_layout.mako"/>
+<%inherit file="${context['layout']}"/>
<%!
local_script_files = ['_static/searchtools.js']
diff --git a/doc/build/templates/site_base.mako b/doc/build/templates/site_base.mako
deleted file mode 100644
index 30ace37..0000000
--- a/doc/build/templates/site_base.mako
+++ /dev/null
@@ -1,26 +0,0 @@
-<%text>#coding:utf-8
-<%inherit file="/root.mako"/>
-<%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>${self.show_title()} &mdash; ${docstitle|h}<%text></%def></%text>
-
-
-<%!
- local_script_files = []
-%>