+
<%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))
+ regexp = re.compile(r"__FORMAT:LINK{(.*?)(?:\|(.*?))?(?:\@text=(.+?))?}")
+ def link(matchobj):
+ path = matchobj.group(1)
+ text = matchobj.group(3)
+ xtra = matchobj.group(2)
+
+ try:
+ element = item.lookup(path)
+ if xtra is not None:
+ return '
%s' % (element.get_link(includefile), xtra, text or xtra)
+ else:
+ return '
%s' % (element.get_link(includefile), text or element.description)
+ except KeyError:
+ if xtra is not None:
+ return '
%s' % (text or xtra)
+ else:
+ return '
%s' % text or path
+
+ m.write(regexp.sub(link, item.content))
%python>
-
+
-% for i in item.children:
- <& printitem, item=i, indentlevel=indentlevel + 1, includefile = includefile, root=root &>
+% 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:
-
%
% if indentlevel == 0:
-% if includefile:
- <& SELF:pagenav, item=item, includefile=includefile &>
-% else:
-
+% if includefile:
+ <& SELF:pagenav, item=item, includefile=includefile &>
+% else:
+
% #
%
@@ -151,14 +149,14 @@
<%method pagenav>
<%args>
- item
- includefile
+ item
+ includefile
%args>
% if not includefile:
-
Top |
+
Top |
%
% if item.previous is not None:
@@ -178,19 +176,19 @@
%method>
<%method itemlink trim="both">
- <%args>
- item
- includefile
- %args>
-
<% item.description %>
+ <%args>
+ item
+ includefile
+ %args>
+
<% item.description %>
%method>
<%method paramtable>
-
+
%method>
<%method param>
@@ -198,94 +196,94 @@
name
classname
type
- users = 'all'
+ users = 'all'
default = None
- version = None
+ version = None
%args>
% if default is None: default = 'None'
<&|SELF:fliprow, flip=True &>
-
-
- <% name %> (<% type %>) |
-
-
+
+
+ <% name %> (<% type %>) |
+
+
% if users is not None:
- for users: <% users %>
+ for users: <% users %>
%
- default: <% default %>
- used by: <% classname %>
+ default: <% default %>
+ used by: <% classname %>
% if version:
- since version: <% version %>
+ since version: <% version %>
%
-
- |
+
+ |
&>
<&|SELF:fliprow, flip=False &>
-
- <% m.content() %>
+ |
+ <% m.content() %>
- |
+
&>
%method>
<%method function_doc>
- <%args>
- name = ""
- alt = None
- arglist = []
- rettype = None
- %args>
- <&|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 %>
+ <%args>
+ name = ""
+ alt = None
+ arglist = []
+ rettype = None
+ %args>
+ <&|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>
<%method member_doc>
- <%args>
- name = ""
- type = None
- %args>
- <&|SELF:fliprow, flip=True&>
-
-
- <% name %> |
-
|
- &>
- <&|SELF:fliprow, flip=False&>
-
<% m.content() %>
-
-
- |
- &>
+ <%args>
+ name = ""
+ type = None
+ %args>
+ <&|SELF:fliprow, flip=True&>
+
+
+ <% name %> |
+
|
+ &>
+ <&|SELF:fliprow, flip=False&>
+
<% m.content() %>
+
+
+ |
+ &>
%method>
<%method fliprow trim="both">
- <%args>flip=True%args>
- <%python>
- flipper = m.get_attribute("formatflipper")
- if flipper is None:
- flipper = Value("light")
- m.set_attribute("formatflipper", flipper)
- %python>
-
+ <%args>flip=True%args>
+ <%python>
+ flipper = m.get_attribute("formatflipper")
+ if flipper is None:
+ flipper = Value("light")
+ m.set_attribute("formatflipper", flipper)
+ %python>
+
% if flip: flipper({"light":"dark", "dark": "light"}[flipper()])
-
<% m.content() %>
+
<% m.content() %>
%method>
@@ -296,57 +294,94 @@
<%method code autoflush=False>
<%args>
- title = None
- syntaxtype = 'python'
+ title = None
+ syntaxtype = 'python'
%args>
<%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)
+ 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:
+ line = re.sub(r"^%s" % whitespace, "", line)
- if whitespace is not None or re.search(r"\w", line) is not None:
- g += (line + "\n")
+ if whitespace is not None or re.search(r"\w", line) is not None:
+ g += (line + "\n")
- return g.rstrip()
+ return g.rstrip()
- content = highlight.highlight(fix_indent(m.content()), syntaxtype = syntaxtype)
+ content = highlight.highlight(fix_indent(m.content()), syntaxtype = syntaxtype)
%init>
% if title is not None:
-
<% title %>
+
<% title %>
%
<% content %>
%method>
<%method link trim="both">
- <%args>
- path = None
- param = None
- method = None
- member = None
- %args>
- <%init>
- if path is None:
- path = m.comp('doclib.myt:current').path
-
- extra = (param or method or member)
- %init>
-__FORMAT:LINK{<%path%><% extra and "|" + extra or "" %>}
+ <%args>
+ path = None
+ param = None
+ method = None
+ member = None
+ text = None
+ %args>
+ <%init>
+ if path is None:
+ path = m.comp('doclib.myt:current').path
+
+ extra = (param or method or member)
+ %init>
+__FORMAT:LINK{<%path%><% extra and "|" + extra or "" %><% text and "@text=" + text or "" %>}
%method>
+<%method uniqueblock>
+<%args>
+ blockname
+ uniquename
+%args>
+<%init>
+ context = m.attributes.setdefault('ubcontext', {})
+ try:
+ writer = context[blockname]
+ except KeyError:
+ context[blockname] = uniquename
+ writer = uniquename
+%init>
+
+% if writer == uniquename:
+ <% m.content() %>
+%
+%method>
+
+#<&| /components/uniqueblock.mhtml, blockname=>'popboxscript', uniquename=>$name &>
+#
+#&>