diff --git a/doc/build/lib/toc.py b/doc/build/lib/toc.py index 2260e6aef7c66e4d2af8fc6459d0c2721e76c690..d19e406bc3ce20726f763ab077407796689062d3 100644 --- a/doc/build/lib/toc.py +++ b/doc/build/lib/toc.py @@ -57,11 +57,15 @@ class TOCElement(object): def get_by_file(self, filename): return self.toc_by_file[filename] - def get_link(self, extension='html', anchor=True): - if anchor: - return "%s.%s#%s" % (self.filename, extension, self.path) + def get_link(self, extension='html', anchor=True, usefilename=True): + if usefilename: + if anchor: + return "%s.%s#%s" % (self.filename, extension, self.path) + else: + return "%s.%s" % (self.filename, extension) else: - return "%s.%s" % (self.filename, extension) + return "#%s" % (self.path) + def _create_path(self): elem = self diff --git a/doc/build/read_markdown.py b/doc/build/read_markdown.py index d2bec0bd74f4704341acf5e244e7cb5908b85211..b00b5475deffe4f43d5740c38e997a6b1577cf08 100644 --- a/doc/build/read_markdown.py +++ b/doc/build/read_markdown.py @@ -74,7 +74,7 @@ def create_toc(filename, tree, tocroot): level[0] = taglevel - tag = et.Element("MAKO:formatting.section", path=repr(current[0].path), toc="toc") + tag = et.Element("MAKO:formatting.section", path=repr(current[0].path), toc="toc", paged="paged") tag.text = (node.tail or "") + '\n' tag.tail = '\n' tag[:] = content diff --git a/doc/build/templates/base.html b/doc/build/templates/base.html index fc85470ba8683cbb7322a7e891edfdc4ec178641..acfcdba3a6dfcda5a46aaeb619850b11573f990d 100644 --- a/doc/build/templates/base.html +++ b/doc/build/templates/base.html @@ -23,6 +23,10 @@ version = toc.version last_updated = toc.last_updated + if paged is UNDEFINED: + ispaged = True + else: + ispaged = paged %> <div id="topanchor"><a name="top"></a> </div> @@ -33,7 +37,7 @@ <div class="versionheader">Version: ${version} Last Updated: ${time.strftime('%x %X', time.localtime(last_updated))}</div> -${next.body(toc=toc)} +${next.body(toc=toc, paged=ispaged)} diff --git a/doc/build/templates/content_layout.html b/doc/build/templates/content_layout.html index 7fa68c01dfd70475d67fef22a26a3f9e373502ac..581686630b74db39d7be6278b2a81c105b98e745 100644 --- a/doc/build/templates/content_layout.html +++ b/doc/build/templates/content_layout.html @@ -9,6 +9,6 @@ <A name="<% current.path %>"></a> -${topnav(item=current)} +${topnav(item=current, paged=paged)} -${next.body(toc=toc)} +${next.body(toc=toc, paged=paged)} diff --git a/doc/build/templates/formatting.html b/doc/build/templates/formatting.html index 77774c6f02db31938596d273cbe51dbea0c75161..aada3834f7c02a58978eaaaef55f2f0cc2ef3008 100644 --- a/doc/build/templates/formatting.html +++ b/doc/build/templates/formatting.html @@ -19,8 +19,10 @@ item = toc.get_by_path(path) subsection = item.depth > 1 %> + % if subsection: <A name="${item.path}"></a> - + % endif + <div class="${subsection and 'subsection' or 'section'}"> <% content = capture(caller.body) @@ -32,13 +34,17 @@ ${content} - % if item.depth > 1: + % if subsection: % if (item.next and item.next.depth >= item.depth): <a href="#${ item.get_page_root().path }">back to section top</a> % endif % else: + % if paged: + <div class="prevnext"> + ${nav.pagenav(item=item, paged=paged)} + </div> + % endif <a href="#${ item.get_page_root().path }">back to section top</a> - ${nav.pagenav(item=item)} % endif </div> diff --git a/doc/build/templates/nav.html b/doc/build/templates/nav.html index 493b392758eec4d65a7183a3a74ac566d3ae2123..c452105244446882e8fa1d9f9bc652c5c812c8e8 100644 --- a/doc/build/templates/nav.html +++ b/doc/build/templates/nav.html @@ -2,8 +2,8 @@ # individual hyperlinks as well as navigational toolbars and table-of-content listings. <%namespace name="tocns" file="toc.html"/> -<%def name="itemlink(item, anchor=True, extension='html')" filter="trim"> - <a href="${ item.get_link(extension=extension, anchor=anchor) }">${ item.description }</a> +<%def name="itemlink(item, anchor=True, extension='html', paged=True)" filter="trim"> + <a href="${ item.get_link(extension=extension, anchor=anchor, usefilename=paged) }">${ item.description }</a> </%def> <%def name="toclink(toc, path, description=None)" filter="trim"> @@ -27,38 +27,28 @@ <a href="${ href }" ${ class_ and (('class=\"%s\"' % class_) or '')}>${ text }</a> </%def> -<%def name="topnav(item, extension='html')"> +<%def name="topnav(item, extension='html', paged=True)"> <div class="topnav"> <div class="prevnext"> - % if item.previous is not None: - Previous: ${itemlink(item=item.previous, anchor=False)} - % endif - - % if item.previous is not None and item.next is not None: - | - % endif - - % if item.next is not None: - Next: ${itemlink(item=item.next, anchor=False)} - % endif + ${pagenav(item, paged=paged)} </div> <h3><a href="index.${ extension }">Table of Contents</a></h3> <br/> <h3>${ item.description }</h3> - ${tocns.printtoc(root=item, current=None, full=True, anchor_toplevel=True)} + ${tocns.printtoc(root=item, current=None, full=True, anchor_toplevel=True, paged=paged)} </div> </%def> -<%def name="pagenav(item)"> +<%def name="pagenav(item, paged=True)"> % if item.previous is not None: - Previous: ${itemlink(item=item.previous)} + Previous: ${itemlink(item=item.previous, paged=paged)} % endif % if item.next is not None: ${item.previous is not None and "|" or ""} - Next: ${itemlink(item=item.next)} + Next: ${itemlink(item=item.next, paged=paged)} % endif </%def> diff --git a/doc/build/templates/toc.html b/doc/build/templates/toc.html index fe9e9b84512b107e8946507291806f8696024960..d4ba2f361ca02c4bac5e2ffdbd9ef89ec32f7e4d 100644 --- a/doc/build/templates/toc.html +++ b/doc/build/templates/toc.html @@ -1,24 +1,24 @@ # toc.myt - prints full table of contents listings given toc.TOCElement strucures -<%def name="toc(toc)"> +<%def name="toc(toc, paged=True)"> <div class="topnav"> <a name="full_index"></a> <h3>Table of Contents</h3> - ${printtoc(root=toc,current=None,full=True,children=True,anchor_toplevel=False)} + ${printtoc(root=toc,current=None,full=True,children=True,anchor_toplevel=False, paged=paged)} </div> </%def> -<%def name="printtoc(root,current=None,full=False,children=True,anchor_toplevel=False,extension='html')"> +<%def name="printtoc(root,current=None,full=False,children=True,anchor_toplevel=False,extension='html',paged=True)"> <ul> % for item in root.children: - <li><A style="${item is current and "font-weight:bold;" or "" }" href="${item.get_link(extension=extension,anchor=anchor_toplevel) }">${item.description}</a></li> + <li><A style="${item is current and "font-weight:bold;" or "" }" href="${item.get_link(extension=extension,anchor=anchor_toplevel, usefilename=paged) }">${item.description}</a></li> % if children: - ${printtoc(item, current=current, full=full,children=True,anchor_toplevel=anchor_toplevel)} + ${printtoc(item, current=current, full=full,children=True,anchor_toplevel=True, paged=paged)} % endif % endfor </ul> diff --git a/doc/docs.css b/doc/docs.css index 04577941b267b4ed1d951a129452c48718a9e85c..dd5ea8f527f9f2e58fb1c7321a4b83af4d0a0fe3 100644 --- a/doc/docs.css +++ b/doc/docs.css @@ -57,6 +57,9 @@ h2 { .smalllink { font-size:.80em; } +code { + font-size:1.1em; +} .code { font-family:monospace; } @@ -78,7 +81,7 @@ pre { line-height:1em; background-color: #eee; border: 1px solid #ccc; - width:450px; + width:600px; overflow:auto; } diff --git a/lib/mako/codegen.py b/lib/mako/codegen.py index 2c9bd55319f463f67d674538512349ffbb1d8d78..6bb505c31f0f71f995adc6af64cdd8ef7f480ce8 100644 --- a/lib/mako/codegen.py +++ b/lib/mako/codegen.py @@ -135,7 +135,7 @@ class _GenerateRenderMethod(object): self.identifier_stack.append(self.compiler.identifiers.branch(self.node)) if not self.in_def and len(self.identifiers.locally_assigned) > 0: - self.printer.writeline("__locals = {}") + self.printer.writeline("__locals = kwargs") self.write_variable_declares(self.identifiers, toplevel=True)