From: Mike Bayer Date: Thu, 7 Jul 2005 06:03:24 +0000 (+0000) Subject: docs X-Git-Tag: rel_0_1_0~899 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2809c4d83c558f22484d7cf153394c88c76ff002;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git docs --- diff --git a/doc/build/components/formatting.myt b/doc/build/components/formatting.myt new file mode 100644 index 0000000000..c10f259e34 --- /dev/null +++ b/doc/build/components/formatting.myt @@ -0,0 +1,352 @@ +<%doc>formatting.myt - library of HTML formatting functions to operate on a TOCElement tree + +<%global> + import string, re + import highlight + + + +<%def printtocelement> +<%doc>prints a TOCElement as a table of contents item and prints its immediate child items + <%args> + item + includefile + bold = False + full = False + children = True + + + + +% if children: + +% + + +<%def printsmtocelem> + <%args> + item + includefile + children = False + + + + + +<%method printtoc> +<%args> + root + includefile + current = None + full = False + children = True + + +% header = False +% for i in root.children: + +% if i.header: +% if header: + +% +% header = True + <% i.header %>
+
+% + <& printtocelement, item=i, includefile = includefile, bold = (i == current and includefile), full = full, children=children &> +% + +% if header: +
+% + + + +<%method printitem> +<%doc>prints the description and contents of a TOC element and recursively prints its child items + +<%args> + item + indentlevel = 0 + includefile + omitheader = False + root = None + + +% if root is None: root = item + +% if not omitheader: + +% + +
+ +% if not omitheader: + <% item.description %> +% +
+ +<%python> + regexp = re.compile(r"__FORMAT:LINK{(.*?)(?:\|(.*?))?}") + def link(matchobj): + path = matchobj.group(1) + if matchobj.lastindex >= 2: + xtra = matchobj.group(2) + else: + xtra = None + + try: + element = item.lookup(path) + if xtra is not None: + return '%s' % (element.get_link(includefile), xtra, xtra) + else: + return '%s' % (element.get_link(includefile), element.description) + except KeyError: + if xtra is not None: + return '%s' % (xtra) + else: + return '%s' % path + + m.write(regexp.sub(link, item.content)) + + +
+ +% for i in item.children: + <& printitem, item=i, indentlevel=indentlevel + 1, includefile = includefile, root=root &> +% + +% if root is not None and len(item.children) == 0: + back to section top +% + +% if indentlevel == 0: +% if includefile: + <& SELF:pagenav, item=item, includefile=includefile &> +% else: +
+% # +% + +
+ + + +<%method pagenav> +<%args> + item + includefile + +
+
+ +% if not includefile: + Top | +% + +% if item.previous is not None: + Previous: <& SELF:itemlink, item=item.previous, includefile = includefile &> +% # end if + +% if item.next is not None: +% if item.previous is not None: + | +% # end if + + Next: <& SELF:itemlink, item=item.next, includefile = includefile &> +% # end if + +
+
+ + +<%method itemlink trim="both"> + <%args> + item + includefile + + <% item.description %> + + + + +<%method paramtable> + + <% m.content() %> +
+ + +<%method param> + <%args> + name + classname + type + users = 'all' + default = None + version = None + +% if default is None: default = 'None' + +<&|SELF:fliprow, flip=True &> + + + <% name %> (<% type %>) + +
+% if users is not None: + for users: <% users %>
+% + default: <% default %>
+ used by: <% classname %> +% if version: +
since version: <% version %> +% +
+ + + +<&|SELF:fliprow, flip=False &> + +

<% m.content() %>

+ + + + + + +<%method function_doc> + <%args> + name = "" + alt = None + arglist = [] + rettype = None + + <&|SELF:fliprow, flip=True&> + + + <% name %>(<% string.join(map(lambda k: "%s" % k, arglist), ", ")%>) + + + <&|SELF:fliprow, flip=False&> +
<% m.content() %> +% if alt is not None: +

Also called as: <% alt %> +% +
+ + + + + +<%method member_doc> + <%args> + name = "" + type = None + + <&|SELF:fliprow, flip=True&> + + + <% name %> + + + <&|SELF:fliprow, flip=False&> +
<% m.content() %> +
+ + + + + + +<%method fliprow trim="both"> + <%args>flip=True + <%python> + flipper = m.get_attribute("formatflipper") + if flipper is None: + flipper = Value("light") + m.set_attribute("formatflipper", flipper) + + +% if flip: flipper({"light":"dark", "dark": "light"}[flipper()]) + <% m.content() %> + + + + +<%method codeline trim="both"> +<% m.content() %> + + +<%method code autoflush=False> +<%args> + title = None + syntaxtype = 'myghty' + + +<%init> + def fix_indent(f): + f =string.expandtabs(f, 4) + g = '' + lines = string.split(f, "\n") + whitespace = None + for line in lines: + if whitespace is None: + match = re.match(r"^([ ]+)", line) + if match is not None: + whitespace = match.group(1) + + if whitespace is not None: + line = re.sub(r"^%s" % whitespace, "", line) + + if whitespace is not None or re.search(r"\w", line) is not None: + g += (line + "\n") + + + return g.rstrip() + + content = highlight.highlight(fix_indent(m.content()), syntaxtype = syntaxtype) + + +
+% if title is not None: +
<% title %>
+% +
<% content %>
+ + + +<%method link trim="both"> + <%args> + path = None + param = None + method = None + member = None + + <%init> + if path is None: + path = m.comp('doclib.myt:current').path + + extra = (param or method or member) + +__FORMAT:LINK{<%path%><% extra and "|" + extra or "" %>} + + + +