From d64aacee330baad036622b55f64c0bba37400f0e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 17 Jan 2012 17:38:42 -0500 Subject: merge 4be2ca3ed8be8e48795f351bb47ad51c9ca1a555 from head, docs update --- doc/build/Makefile | 6 ---- doc/build/builder/builders.py | 67 +++++++++++++++-------------------- doc/build/templates/base.mako | 51 ++++++++++++++++++++++++++ doc/build/templates/genindex.mako | 2 +- doc/build/templates/layout.mako | 12 +++++-- doc/build/templates/makoorg/root.mako | 58 ------------------------------ doc/build/templates/page.mako | 2 +- doc/build/templates/pre_layout.mako | 2 -- doc/build/templates/search.mako | 2 +- doc/build/templates/site_base.mako | 26 -------------- 10 files changed, 91 insertions(+), 137 deletions(-) create mode 100644 doc/build/templates/base.mako delete mode 100644 doc/build/templates/makoorg/root.mako delete mode 100644 doc/build/templates/pre_layout.mako delete mode 100644 doc/build/templates/site_base.mako 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 ' where 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/base.mako b/doc/build/templates/base.mako new file mode 100644 index 0000000..89854a1 --- /dev/null +++ b/doc/build/templates/base.mako @@ -0,0 +1,51 @@ + + + + +<%block name="head_title">Mako Templates for Python</%block> +<%block name="headers"> + + + + + + +
+
+
+ Hyperfast and lightweight templating for the Python platform. +
+ + % if toolbar: +
+ Home +   |   + Trac +   |   + Community +   |   + Documentation +   |   + Download +
+ % endif + +
+ + + +
+ + ${next.body()} +
+<%block name="footer"> +
+ + + +
+
+ + 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 -<%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} — + % endif + ${docstitle|h} + + +
<%block name="headers"> @@ -120,9 +128,7 @@ withsidebar = bool(toc) and current_page_name != 'index'

<%block name="show_title"> - % if title: ${title} - % endif

diff --git a/doc/build/templates/makoorg/root.mako b/doc/build/templates/makoorg/root.mako deleted file mode 100644 index 35240d8..0000000 --- a/doc/build/templates/makoorg/root.mako +++ /dev/null @@ -1,58 +0,0 @@ -<% -in_docs = getattr(next.module, 'in_docs', False) -%> - - -<%def name="title()"> -Mako Templates for Python - - - - -${self.title()} -<%block name="headers"> - - - - - - -
-
-
- Hyperfast and lightweight templating for the Python platform. -
- - % if toolbar: -
- Home -   |   - Trac -   |   - Community -   |   - Documentation -   |   - Download -
- % endif - -
- - - -
- - ${next.body()} -
-<%block name="footer"> -
- - - -
-
- - 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>'} -${next.body()} -${''} - -<%text><%def name="style()"> - <%block name="headers"/> - - <%text>${parent.style()} - -<%text> - -<%text><%def name="title()">${self.show_title()} — ${docstitle|h}<%text> - - -<%! - local_script_files = [] -%> -- cgit v1.2.1