diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-12-11 02:16:31 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-12-11 02:16:31 +0000 |
commit | 5ec5518d19c0c8b97c21f5e7bfb2ada9fcfd6754 (patch) | |
tree | 694d382f105a5e514dc63eaeba3cab95656ad250 | |
parent | 3cad46423f19f1d6ad7d2e1f6f9bd76ff74d21f6 (diff) | |
download | external_python_mako-5ec5518d19c0c8b97c21f5e7bfb2ada9fcfd6754.tar.gz external_python_mako-5ec5518d19c0c8b97c21f5e7bfb2ada9fcfd6754.tar.bz2 external_python_mako-5ec5518d19c0c8b97c21f5e7bfb2ada9fcfd6754.zip |
propigate main body **kwargs to top-level defs
more docs
-rw-r--r-- | doc/build/lib/toc.py | 12 | ||||
-rw-r--r-- | doc/build/read_markdown.py | 2 | ||||
-rw-r--r-- | doc/build/templates/base.html | 6 | ||||
-rw-r--r-- | doc/build/templates/content_layout.html | 4 | ||||
-rw-r--r-- | doc/build/templates/formatting.html | 12 | ||||
-rw-r--r-- | doc/build/templates/nav.html | 26 | ||||
-rw-r--r-- | doc/build/templates/toc.html | 10 | ||||
-rw-r--r-- | doc/docs.css | 5 | ||||
-rw-r--r-- | lib/mako/codegen.py | 2 |
9 files changed, 43 insertions, 36 deletions
diff --git a/doc/build/lib/toc.py b/doc/build/lib/toc.py index 2260e6a..d19e406 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 d2bec0b..b00b547 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 fc85470..acfcdba 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 7fa68c0..5816866 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 77774c6..aada383 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 493b392..c452105 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 fe9e9b8..d4ba2f3 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 0457794..dd5ea8f 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 2c9bd55..6bb505c 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) |