epydoc-commits Mailing List for Python API documentation generation tool (Page 13)
Brought to you by:
edloper
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(77) |
May
|
Jun
(6) |
Jul
(8) |
Aug
(91) |
Sep
(67) |
Oct
(4) |
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(17) |
Feb
(135) |
Mar
(25) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(62) |
Oct
(1) |
Nov
(3) |
Dec
|
| 2008 |
Jan
(40) |
Feb
(102) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <dva...@us...> - 2007-02-16 02:33:28
|
Revision: 1512
http://svn.sourceforge.net/epydoc/?rev=1512&view=rev
Author: dvarrazzo
Date: 2007-02-15 18:32:56 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- HTML for fields cleaned up.
It should be easier now to change the page look providing a different CSS.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/html.py
trunk/epydoc/src/epydoc/docwriter/html_css.py
Modified: trunk/epydoc/src/epydoc/docwriter/html.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-16 02:08:51 UTC (rev 1511)
+++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-16 02:32:56 UTC (rev 1512)
@@ -1957,7 +1957,6 @@
# Write a footer for the table.
out(self.TABLE_FOOTER)
- out('\n<br />\n')
def write_summary_group(self, out, doc, name, var_docs, grouped_inh_vars):
# Split up the var_docs list, according to the way each var
@@ -2136,7 +2135,7 @@
if not var_docs: return
# Write a header
- self.write_table_header(out, "summary", heading)
+ self.write_table_header(out, "details", heading)
out(self.TABLE_FOOTER)
for var_doc in var_docs:
@@ -2145,9 +2144,7 @@
out('<br />\n')
def write_details_entry(self, out, var_doc):
- descr = self.descr(var_doc, indent=2)
- if descr: descr = '<br />'+descr
- else: descr = ''
+ descr = self.descr(var_doc, indent=2) or ''
if var_doc.is_public: div_class = ''
else: div_class = ' class="private"'
@@ -2255,25 +2252,25 @@
</table>
$self.render_callgraph(callgraph)$
$descr$
- <dl><dt></dt><dd>
+ <dl class="fields">
>>> # === parameters ===
>>> if arg_descrs:
- <dl><dt>Parameters:</dt></dl>
- <ul class="nomargin">
+ <dt>Parameters:</dt>
+ <dd><ul class="nomargin-top">
>>> for lhs, rhs in arg_descrs:
$self.labelled_list_item(lhs, rhs)$
>>> #endfor
- </ul>
+ </ul></dd>
>>> #endif
>>> # === return type ===
>>> if rdescr and rtype:
- <dl><dt>Returns: $rtype$</dt>
- <dd>$rdescr$</dd></dl>
+ <dt>Returns: $rtype$</dt>
+ <dd>$rdescr$</dd>
>>> elif rdescr:
- <dl><dt>Returns:</dt>
- <dd>$rdescr$</dd></dl>
+ <dt>Returns:</dt>
+ <dd>$rdescr$</dd>
>>> elif rtype:
- <dl><dt>Returns: $rtype$</dt></dl>
+ <dt>Returns: $rtype$</dt>
>>> #endif
>>> # === decorators ===
>>> if func_doc.decorators not in (None, UNKNOWN):
@@ -2288,17 +2285,17 @@
>>> decos = None
>>> #endif
>>> if decos:
- <dl><dt>Decorators:</dt></dl>
- <ul class="nomargin">
+ <dt>Decorators:</dt>
+ <dd><ul class="nomargin-top">
>>> for deco in decos:
<li><code>@$deco$</code></li>
>>> #endfor
- </ul>
+ </ul></dd>
>>> #endif
>>> # === exceptions ===
>>> if func_doc.exception_descrs not in (None, UNKNOWN, (), []):
- <dl><dt>Raises:</dt></dl>
- <ul class="nomargin">
+ <dt>Raises:</dt>
+ <dd><ul class="nomargin-top">
>>> for name, descr in func_doc.exception_descrs:
>>> exc_name = self.docindex.find(name, func_doc)
>>> if exc_name is not None:
@@ -2309,21 +2306,21 @@
str(name) + "</strong></code>",
self.docstring_to_html(descr, func_doc, 8))$
>>> #endfor
- </ul>
+ </ul></dd>
>>> #endif
>>> # === overrides ===
>>> if var_doc.overrides not in (None, UNKNOWN):
- <dl><dt>Overrides:
+ <dt>Overrides:
$self.href(var_doc.overrides.value, context=var_doc)$
>>> if (func_doc.docstring in (None, UNKNOWN) and
>>> var_doc.overrides.value.docstring not in (None, UNKNOWN)):
<dd><em class="note">(inherited documentation)</em></dd>
>>> #endif
- </dt></dl>
+ </dt>
>>> #endif
+ </dl>
>>> # === metadata ===
>>> self.write_standard_fields(out, func_doc)
- </dd></dl>
</td></tr></table>
</div>
''')
@@ -2375,21 +2372,21 @@
<tr><td>
<h3 class="epydoc">$var_doc.name$</h3>
$descr$
- <dl><dt></dt><dd>
+ <dl class="fields">
>>> for (name, val, summary) in accessors:
- <dl><dt>$name$ Method:</dt>
- <dd>$val$
+ <dt>$name$ Method:</dt>
+ <dd class="value">$val$
>>> if summary:
- $summary$
>>> #endif
- </dd></dl>
+ </dd>
>>> #endfor
>>> if prop_doc.type_descr not in (None, UNKNOWN):
- <dl><dt>Type:</dt>
- <dd>$self.type_descr(var_doc, indent=6)$</dd></dl>
+ <dt>Type:</dt>
+ <dd>$self.type_descr(var_doc, indent=6)$</dd>
>>> #endif
+ </dl>
>>> self.write_standard_fields(out, prop_doc)
- </dd></dl>
</td></tr></table>
</div>
''')
@@ -2407,18 +2404,19 @@
<tr><td>
<h3 class="epydoc">$var_doc.name$</h3>
$descr$
- <dl><dt></dt><dd>
+ <dl class="fields">
>>> if var_doc.type_descr not in (None, UNKNOWN):
- <dl><dt>Type:</dt>
- <dd>$self.type_descr(var_doc, indent=6)$</dd></dl>
+ <dt>Type:</dt>
+ <dd>$self.type_descr(var_doc, indent=6)$</dd>
>>> #endif
+ </dl>
>>> self.write_standard_fields(out, var_doc)
>>> if var_doc.value is not UNKNOWN:
- <dl><dt>Value:</dt>
+ <dl class="fields">
+ <dt>Value:</dt>
<dd>$self.pprint_value(var_doc.value)$</dd>
- </dl>
+ </dl>
>>> #endif
- </dd></dl>
</td></tr></table>
</div>
''')
@@ -2729,8 +2727,6 @@
fields = []
field_values = {}
- #if _sort_fields: fields = STANDARD_FIELD_NAMES [XX]
-
for (field, arg, descr) in doc.metadata:
if field not in field_values:
fields.append(field)
@@ -2740,6 +2736,9 @@
else:
field_values.setdefault(field,[]).append(descr)
+ if not fields: return
+
+ out('<div class="fields">')
for field in fields:
if field.takes_arg:
for arg, descrs in field_values[field].items():
@@ -2748,6 +2747,8 @@
else:
self.write_standard_field(out, doc, field, field_values[field])
+ out('</div>')
+
write_standard_field = compile_template(
"""
write_standard_field(self, out, doc, field, descrs, arg='')
@@ -2771,7 +2772,7 @@
</dd>
</dl>
>>> else:
- <p><strong>$field.plural+arglabel$:</strong>
+ <strong>$field.plural+arglabel$:</strong>
<ul class="nomargin-top">
>>> for descr in descrs:
<li>
@@ -3206,7 +3207,6 @@
s = '<span class="docstring">%s</span><!--end docstring-->' % s
return s
- # [XX] Just use docstring_to_html???
def description(self, parsed_docstring, where=None, indent=0):
assert isinstance(where, (APIDoc, type(None)))
if parsed_docstring in (None, UNKNOWN): return ''
Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-16 02:08:51 UTC (rev 1511)
+++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-16 02:32:56 UTC (rev 1512)
@@ -129,7 +129,8 @@
*/
table.summary { border-collapse: collapse;
background: $table_bg; color: $table_fg;
- border: $table_border; }
+ border: $table_border;
+ margin-bottom: 0.5em; }
td.summary { border: $table_border; }
code.summary-type { font-size: 85%; }
table.summary a:link { color: $table_link; }
@@ -137,7 +138,7 @@
/* Details Tables (functions, variables, etc)
- * - Each object is described in its own single-celled table.
+ * - Each object is described in its own div.
* - A single-row summary table w/ table-header is used as
* a header for each details section (CSS style for table-header
* is defined above, under 'Table Headers').
@@ -150,6 +151,13 @@
table.details a:link { color: $table_link; }
table.details a:visited { color: $table_visited_link; }
+/* Fields */
+dl.fields { margin-left: 2em; margin-top: 1em;
+ margin-bottom: 1em; }
+dl.fields dd ul { margin-left: -2em; }
+div.fields { margin-left: 2em; }
+div.fields p { margin-bottom: 0.5em; }
+
/* Index tables (identifier index, term index, etc)
* - link-index is used for indices containing lists of links
* (namely, the identifier index & term index).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-16 02:08:53
|
Revision: 1511
http://svn.sourceforge.net/epydoc/?rev=1511&view=rev
Author: dvarrazzo
Date: 2007-02-15 18:08:51 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- The parser detects te trick::
if __name__ == "__main__":
and skips the block (or else testing stuff gets parsed).
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docparser.py
Modified: trunk/epydoc/src/epydoc/docparser.py
===================================================================
--- trunk/epydoc/src/epydoc/docparser.py 2007-02-16 01:28:57 UTC (rev 1510)
+++ trunk/epydoc/src/epydoc/docparser.py 2007-02-16 02:08:51 UTC (rev 1511)
@@ -683,6 +683,15 @@
else:
container.group_specs.append( (group_name, [var_name]) )
+def script_guard(line):
+ """Detect the idiomatic trick C{if __name__ == "__main__":}"""
+ return (len(line) == 5
+ and line[1][1] == '__name__' # this is the most selective
+ and line[0][1] == 'if'
+ and line[2][1] == '=='
+ and line[4][1] == ':'
+ and line[3][1][1:-1] == '__main__')
+
#/////////////////////////////////////////////////////////////////
#{ Shallow parser
#/////////////////////////////////////////////////////////////////
@@ -787,7 +796,7 @@
docs_extracted_by='parser')
set_variable(parent, var_doc)
- if ((keyword == 'if' and PARSE_IF_BLOCKS) or
+ if ((keyword == 'if' and PARSE_IF_BLOCKS and not script_guard(line)) or
(keyword == 'elif' and PARSE_ELSE_BLOCKS) or
(keyword == 'else' and PARSE_ELSE_BLOCKS) or
(keyword == 'while' and PARSE_WHILE_BLOCKS) or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-16 01:28:59
|
Revision: 1510
http://svn.sourceforge.net/epydoc/?rev=1510&view=rev
Author: dvarrazzo
Date: 2007-02-15 17:28:57 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- Fixed tooltip for class nodes.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2007-02-15 23:53:21 UTC (rev 1509)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2007-02-16 01:28:57 UTC (rev 1510)
@@ -478,7 +478,13 @@
self.attributes.append(var)
# Initialize our dot node settings.
- DotGraphNode.__init__(self, tooltip=class_doc.canonical_name,
+ tooltip = self._summary(class_doc)
+ if tooltip:
+ # dot chokes on a \n in the attribute...
+ tooltip = " ".join(tooltip.split())
+ else:
+ tooltip = class_doc.canonical_name
+ DotGraphNode.__init__(self, tooltip=tooltip,
width=0, height=0, shape='plaintext',
href=linker.url_for(class_doc) or NOOP_URL)
@@ -634,9 +640,11 @@
"""Return a plaintext summary for `api_doc`"""
if not isinstance(api_doc, APIDoc): return ''
if api_doc.summary in (None, UNKNOWN): return ''
- summary = api_doc.summary.to_plaintext(self.linker).strip()
+ summary = api_doc.summary.to_plaintext(None).strip()
return plaintext_to_html(summary)
+ _summary = classmethod(_summary)
+
def _type_descr(self, api_doc):
"""Return a plaintext type description for `api_doc`"""
if not hasattr(api_doc, 'type_descr'): return ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-15 23:53:22
|
Revision: 1509
http://svn.sourceforge.net/epydoc/?rev=1509&view=rev
Author: dvarrazzo
Date: 2007-02-15 15:53:21 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- Fixed `ValueDoc.is_detailed()` when there are details in the variable,
but not in the value.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/apidoc.py
Modified: trunk/epydoc/src/epydoc/apidoc.py
===================================================================
--- trunk/epydoc/src/epydoc/apidoc.py 2007-02-15 19:48:33 UTC (rev 1508)
+++ trunk/epydoc/src/epydoc/apidoc.py 2007-02-15 23:53:21 UTC (rev 1509)
@@ -677,8 +677,10 @@
return [self.value]
def is_detailed(self):
- if (self.value in (None, UNKNOWN)):
- return super(VariableDoc, self).is_detailed()
+ pval = super(VariableDoc, self).is_detailed()
+ if pval or self.value in (None, UNKNOWN):
+ return pval
+
if isinstance(self.value, GenericValueDoc):
# [XX] This is a little hackish -- we assume that the
# summary lines will have SUMMARY_REPR_LINELEN chars,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-15 19:48:37
|
Revision: 1508
http://svn.sourceforge.net/epydoc/?rev=1508&view=rev
Author: dvarrazzo
Date: 2007-02-15 11:48:33 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- __revision__ is allowed as variable for the 'version' tag.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docstringparser.py
Modified: trunk/epydoc/src/epydoc/docstringparser.py
===================================================================
--- trunk/epydoc/src/epydoc/docstringparser.py 2007-02-15 19:42:28 UTC (rev 1507)
+++ trunk/epydoc/src/epydoc/docstringparser.py 2007-02-15 19:48:33 UTC (rev 1508)
@@ -109,7 +109,7 @@
# Status info
DocstringField(['version'], 'Version', multivalue=0,
- varnames=['__version__']),
+ varnames=['__version__', '__revision__']),
DocstringField(['date'], 'Date', multivalue=0,
varnames=['__date__']),
DocstringField(['status'], 'Status', multivalue=0),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-15 19:42:33
|
Revision: 1507
http://svn.sourceforge.net/epydoc/?rev=1507&view=rev
Author: dvarrazzo
Date: 2007-02-15 11:42:28 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
- Dropped double anchors definitions.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/html.py
Modified: trunk/epydoc/src/epydoc/docwriter/html.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-14 17:00:36 UTC (rev 1506)
+++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-15 19:42:28 UTC (rev 1507)
@@ -2040,11 +2040,16 @@
if var_doc.is_public: tr_class = ''
else: tr_class = ' class="private"'
+ # Decide an anchor or a link is to be generated.
+ link_name = var_doc.is_detailed()
+ anchor = not link_name
+
# Construct the HTML code for the type (cell 1) & description
# (cell 2).
if isinstance(var_doc.value, RoutineDoc):
typ = self.return_type(var_doc, indent=6)
- description = self.function_signature(var_doc, True, True)
+ description = self.function_signature(var_doc, is_summary=True,
+ link_name=link_name, anchor=anchor)
pysrc_link = self.pysrc_link(var_doc.value)
# Perpare the call-graph, if requested
@@ -2059,7 +2064,8 @@
callgraph = None
else:
typ = self.type_descr(var_doc, indent=6)
- description = self.summary_name(var_doc, link_name=True)
+ description = self.summary_name(var_doc,
+ link_name=link_name, anchor=anchor)
if isinstance(var_doc.value, GenericValueDoc):
# The summary max length has been chosen setting
# L{ValueDoc.SUMMARY_REPR_LINELEN} in the constructor
@@ -2194,7 +2200,8 @@
def property_accessor_to_html(self, val_doc):
if val_doc not in (None, UNKNOWN):
if isinstance(val_doc, RoutineDoc):
- return self.function_signature(val_doc, True, True)
+ return self.function_signature(val_doc, is_summary=True,
+ link_name=True)
elif isinstance(val_doc, GenericValueDoc):
return self.pprint_value(val_doc)
else:
@@ -2510,7 +2517,22 @@
#////////////////////////////////////////////////////////////
def function_signature(self, api_doc, is_summary=False,
- link_name=False):
+ link_name=False, anchor=False):
+ """Render a function signature in HTML.
+
+ @param api_doc: The object whose name is to be rendered. If a
+ C{VariableDoc}, its C{value} should be a C{RoutineDoc}
+ @type api_doc: L{VariableDoc} or L{RoutineDoc}
+ @param is_summary: True if the fuction is to be rendered in the summary.
+ type css_class: C{bool}
+ @param link_name: If True, the name is a link to the object anchor.
+ @type link_name: C{bool}
+ @param anchor: If True, the name is the object anchor.
+ @type anchor: C{bool}
+
+ @return: The HTML code for the object.
+ @rtype: C{str}
+ """
if is_summary: css_class = 'summary-sig'
else: css_class = 'sig'
@@ -2524,7 +2546,7 @@
(css_class, css_class, api_doc.name))
# Get the function's name.
name = self.summary_name(api_doc, css_class=css_class+'-name',
- link_name=link_name)
+ link_name=link_name, anchor=anchor)
else:
func_doc = api_doc
name = self.href(api_doc, css_class=css_class+'-name')
@@ -2547,13 +2569,34 @@
return ('<span class="%s">%s(%s)</span>' %
(css_class, name, ',\n '.join(args)))
- def summary_name(self, api_doc, css_class='summary-name', link_name=False):
- if link_name and api_doc.is_detailed():
- return self.href(api_doc, css_class=css_class)
+ def summary_name(self, api_doc, css_class='summary-name',
+ link_name=False, anchor=False):
+ """Render an object name in HTML.
+
+ @param api_doc: The object whose name is to be rendered
+ @type api_doc: L{APIDoc}
+ @param css_class: The CSS class to assign to the rendered name
+ type css_class: C{str}
+ @param link_name: If True, the name is a link to the object anchor.
+ @type link_name: C{bool}
+ @param anchor: If True, the name is the object anchor.
+ @type anchor: C{bool}
+
+ @return: The HTML code for the object.
+ @rtype: C{str}
+ """
+ if anchor:
+ rv = '<a name="%s"></a>' % api_doc.name
else:
- return '<a name="%s" /><span class="%s">%s</span>' % \
- (api_doc.name, css_class, api_doc.name)
+ rv = ''
+ if link_name:
+ rv += self.href(api_doc, css_class=css_class)
+ else:
+ rv += '<span class="%s">%s</span>' % (css_class, api_doc.name)
+
+ return rv
+
# [xx] tuple args???
def func_arg(self, name, default, css_class):
name = self._arg_name(name)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 17:00:38
|
Revision: 1506
http://svn.sourceforge.net/epydoc/?rev=1506&view=rev
Author: edloper
Date: 2007-02-14 09:00:36 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Added --include-log to several targets in the Makefile
Modified Paths:
--------------
trunk/epydoc/Makefile
Modified: trunk/epydoc/Makefile
===================================================================
--- trunk/epydoc/Makefile 2007-02-14 16:57:34 UTC (rev 1505)
+++ trunk/epydoc/Makefile 2007-02-14 17:00:36 UTC (rev 1506)
@@ -129,6 +129,7 @@
$(EPYDOC) -o $(HTML_API) --name epydoc --css white \
--url http://epydoc.sourceforge.net --pstat profile.out \
--inheritance=listed --navlink "epydoc $(VERSION)"\
+ --include-log \
--docformat plaintext -v --graph all --debug $(PY_SRC)
touch .api-html.up2date
@@ -210,6 +211,7 @@
$(EPYDOC) -o profile.tmp --name epydoc --css white --debug \
--url http://epydoc.sourceforge.net --profile-epydoc \
--inheritance=listed --navlink "epydoc $(VERSION)"\
+ --include-log \
--docformat plaintext -v --graph all $(PY_SRC)
rm -rf profile.tmp hotshot.out
@@ -236,7 +238,7 @@
@echo "Building stdlib html docs..."
@$(EPYDOC) -o $(HTML_STDLIB) --css white --name $(SLNAME) \
--url $(SLURL) --debug --no-sourcecode --debug \
- --show-imports $(SLBUILTINS) $(SLFILES)
+ --include-log --show-imports $(SLBUILTINS) $(SLFILES)
touch .stdlib-html.up2date
# (this will typically cause latex to run out of resources)
@@ -267,7 +269,7 @@
mkdir -p $(HTML)/docutils
$(EPYDOC) -o $(HTML)/docutils -n 'Docutils' --html --debug \
--docformat plaintext --ignore-param-mismatch \
- /usr/lib/python2.3/site-packages/docutils
+ --include-log /usr/lib/python2.3/site-packages/docutils
touch .docutils-html.up2date
docutils-pdf: .docutils-pdf.up2date
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 16:57:36
|
Revision: 1505
http://svn.sourceforge.net/epydoc/?rev=1505&view=rev
Author: edloper
Date: 2007-02-14 08:57:34 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Added redirect page <redirect.html> that redirects dotted names to
corresponding pages using javascript. When the user visits
<redirect.html#dotted.name>, they will automatically get redirected
to the page for the object with the given fully-qualified dotted
name. E.g., for epydoc, <redirect.html#epydoc.apidoc.UNKNOWN>
redirects the user to <epydoc.apidoc-module.html#UNKNOWN>.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/html.py
Modified: trunk/epydoc/src/epydoc/docwriter/html.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-14 12:00:32 UTC (rev 1504)
+++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-14 16:57:34 UTC (rev 1505)
@@ -430,7 +430,7 @@
if isinstance(doc, ModuleDoc) and is_src_filename(doc.filename):
self.modules_with_sourcecode.add(doc)
self._num_files = (len(self.class_list) + 2*len(self.module_list) +
- 11 + len(self.METADATA_INDICES))
+ 12 + len(self.METADATA_INDICES))
if self._incl_sourcecode:
self._num_files += len(self.modules_with_sourcecode)
if self._split_ident_index:
@@ -644,6 +644,9 @@
self._write(self.write_sourcecode, directory, filename, doc,
name_to_docs)
+ # Write the auto-redirect page.
+ self._write(self.write_redirect_page, directory, 'redirect.html')
+
# Write the index.html files.
# (this must be done last, since it might copy another file)
self._files_written += 1
@@ -1402,6 +1405,8 @@
print >> jsfile, self.HIDE_PRIVATE_JS
print >> jsfile, self.TOGGLE_CALLGRAPH_JS
print >> jsfile, html_colorize.PYSRC_JAVASCRIPTS
+ print >> jsfile, self.GET_ANCHOR_JS
+ print >> jsfile, self.REDIRECT_URL_JS
jsfile.close()
#: A javascript that is used to show or hide the API documentation
@@ -1510,6 +1515,48 @@
}
'''.strip()
+ GET_ANCHOR_JS = '''
+ function get_anchor() {
+ var href = location.href;
+ var start = href.indexOf("#")+1;
+ if ((start != 0) && (start != href.length))
+ return href.substring(start, href.length);
+ }
+ '''.strip()
+
+ #: A javascript that is used to implement the auto-redirect page.
+ #: When the user visits <redirect.html#dotted.name>, they will
+ #: automatically get redirected to the page for the object with
+ #: the given fully-qualified dotted name. E.g., for epydoc,
+ #: <redirect.html#epydoc.apidoc.UNKNOWN> redirects the user to
+ #: <epydoc.apidoc-module.html#UNKNOWN>.
+ REDIRECT_URL_JS = '''
+ function redirect_url(dottedName) {
+ // Scan through each element of the "pages" list, and check
+ // if "name" matches with any of them.
+ for (var i=0; i<pages.length; i++) {
+
+ // Each page has the form "<pagename>-m" or "<pagename>-c";
+ // extract the <pagename> portion & compare it to dottedName.
+ var pagename = pages[i].substring(0, pages[i].length-2);
+ if (pagename == dottedName.substring(0,pagename.length)) {
+
+ // We\'ve found a page that matches `dottedName`;
+ // construct its URL, using leftover `dottedName`
+ // content to form an anchor.
+ var pagetype = pages[i].charAt(pages[i].length-1);
+ var url = pagename + ((pagetype=="m")?"-module.html":
+ "-class.html");
+ if (dottedName.length > pagename.length)
+ url += "#" + dottedName.substring(pagename.length+1,
+ dottedName.length);
+ return url;
+ }
+ }
+ }
+ '''.strip()
+
+
#////////////////////////////////////////////////////////////
#{ 2.10. Graphs
#////////////////////////////////////////////////////////////
@@ -2786,6 +2833,82 @@
return "index-"+re.sub("[^a-zA-Z0-9]", "_", s)
#////////////////////////////////////////////////////////////
+ #{ Redirect page
+ #////////////////////////////////////////////////////////////
+
+ def write_redirect_page(self, out):
+ """
+ Build the auto-redirect page, which translates dotted names to
+ URLs using javascript. When the user visits
+ <redirect.html#dotted.name>, they will automatically get
+ redirected to the page for the object with the given
+ fully-qualified dotted name. E.g., for epydoc,
+ <redirect.html#epydoc.apidoc.UNKNOWN> redirects the user to
+ <epydoc.apidoc-module.html#UNKNOWN>.
+ """
+ # Construct a list of all the module & class pages that we're
+ # documenting. The redirect_url javascript will scan through
+ # this list, looking for a page name that matches the
+ # requested dotted name.
+ pages = (['%s-m' % val_doc.canonical_name
+ for val_doc in self.module_list] +
+ ['%s-c' % val_doc.canonical_name
+ for val_doc in self.class_list])
+ # Sort the pages from longest to shortest. This ensures that
+ # we find e.g. "x.y.z" in the list before "x.y".
+ pages = sorted(pages, key=lambda p:-len(p))
+
+ # Write the redirect page.
+ self._write_redirect_page(out, pages)
+
+ _write_redirect_page = compile_template(
+ '''
+ _write_redirect_page(self, out, pages)
+ ''',
+ # /------------------------- Template -------------------------\
+ '''
+ <html><head><title>Epydoc Redirect Page</title>
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="pragma" content="no-cache" />
+ <script type="text/javascript" src="epydoc.js"></script>
+ </head>
+ <body>
+ <script type="text/javascript">
+ <!--
+ var pages = $"[%s]" % ", ".join(['"%s"' % v for v in pages])$;
+ var dottedName = get_anchor();
+ if (dottedName) {
+ var target = redirect_url(dottedName);
+ if (target) window.location.replace(target);
+ }
+ // -->
+ </script>
+
+ <h3>Epydoc Auto-redirect page</h3>
+
+ <p>When javascript is enabled, this page will redirect URLs of
+ the form <tt>redirect.html#<i>dotted.name</i></tt> to the
+ documentation for the object with the given fully-qualified
+ dotted name.</p>
+ <p><a id="message"> </a></p>
+
+ <script type="text/javascript">
+ <!--
+ if (dottedName) {
+ var msg = document.getElementById("message");
+ msg.innerHTML = "No documentation found for <tt>"+
+ dottedName+"</tt>";
+ }
+ // -->
+ </script>
+
+ </body>
+ </html>
+ ''')
+ # \------------------------------------------------------------/
+
+ #////////////////////////////////////////////////////////////
#{ Helper functions
#////////////////////////////////////////////////////////////
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dva...@us...> - 2007-02-14 12:00:34
|
Revision: 1504
http://svn.sourceforge.net/epydoc/?rev=1504&view=rev
Author: dvarrazzo
Date: 2007-02-14 04:00:32 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Don't barf with non-ascii chars in reST doctest blocks.
Thanks to Nicola Larosa and David Mugnai for pointing this bug.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/markup/restructuredtext.py
Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-02-14 08:40:29 UTC (rev 1503)
+++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-02-14 12:00:32 UTC (rev 1504)
@@ -526,7 +526,7 @@
raise SkipNode()
def visit_doctest_block(self, node):
- self.body.append(doctest_to_latex(str(node[0])))
+ self.body.append(doctest_to_latex(node[0].astext()))
raise SkipNode()
class _EpydocHTMLTranslator(HTMLTranslator):
@@ -620,11 +620,11 @@
raise SkipNode()
def visit_doctest_block(self, node):
- pysrc = str(node[0])
+ pysrc = node[0].astext()
if node.get('codeblock'):
self.body.append(HTMLDoctestColorizer().colorize_codeblock(pysrc))
else:
- self.body.append(doctest_to_html(str(node[0])))
+ self.body.append(doctest_to_html(pysrc))
raise SkipNode()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 08:40:30
|
Revision: 1503
http://svn.sourceforge.net/epydoc/?rev=1503&view=rev
Author: edloper
Date: 2007-02-14 00:40:29 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Test cases for zope2 and zope3 introspection support
Added Paths:
-----------
trunk/epydoc/src/epydoc/test/zope2.doctest
trunk/epydoc/src/epydoc/test/zope3.doctest
Added: trunk/epydoc/src/epydoc/test/zope2.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/zope2.doctest (rev 0)
+++ trunk/epydoc/src/epydoc/test/zope2.doctest 2007-02-14 08:40:29 UTC (rev 1503)
@@ -0,0 +1,57 @@
+Regression Testing for Zope 2 support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:RequireModule: ExtensionClass
+
+ >>> from epydoc.test.util import runintrospecter
+
+We treat extension classes as if they were classes:
+
+ >>> from ExtensionClass import ExtensionClass
+
+ >>> runintrospecter(s='''
+ ... from ExtensionClass import ExtensionClass
+ ... ''', attribs='variables value pyval',
+ ... introspect='ExtensionClass')
+ ClassDoc [0]
+ +- pyval = <extension class ExtensionClass at 40...
+ +- variables
+ +- __basicnew__ => VariableDoc for __basicnew__ [1]
+ | +- value
+ | +- RoutineDoc [2]
+ | +- pyval = <CMethod object at ...>
+ +- __call__ => VariableDoc for __call__ [3]
+ | +- value
+ | +- RoutineDoc [4]
+ | +- pyval = <CMethod object at ...>
+ +- __delattr__ => VariableDoc for __delattr__ [5]
+ | +- value
+ | +- RoutineDoc [6]
+ | +- pyval = <CMethod object at ...>
+ +- __getattr__ => VariableDoc for __getattr__ [7]
+ | +- value
+ | +- RoutineDoc [8]
+ | +- pyval = <CMethod object at ...>
+ +- __init__ => VariableDoc for __init__ [9]
+ | +- value
+ | +- RoutineDoc [10]
+ | +- pyval = <CMethod object at ...>
+ +- __reduce__ => VariableDoc for __reduce__ [11]
+ | +- value
+ | +- RoutineDoc [12]
+ | +- pyval = <CMethod object at ...>
+ +- __repr__ => VariableDoc for __repr__ [13]
+ | +- value
+ | +- RoutineDoc [14]
+ | +- pyval = <CMethod object at ...>
+ +- __setattr__ => VariableDoc for __setattr__ [15]
+ | +- value
+ | +- RoutineDoc [16]
+ | +- pyval = <CMethod object at ...>
+ +- inheritedAttribute => VariableDoc for inheritedAttribute [17]
+ +- value
+ +- RoutineDoc [18]
+ +- pyval = <CMethod object at ...>
+
+(If we didn't add special support, `ExtensionClass` would be a
+`GenericValueDoc`.)
+
Added: trunk/epydoc/src/epydoc/test/zope3.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/zope3.doctest (rev 0)
+++ trunk/epydoc/src/epydoc/test/zope3.doctest 2007-02-14 08:40:29 UTC (rev 1503)
@@ -0,0 +1,27 @@
+Regression Testing for Zope 3 support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:RequireModule: zope.interface
+
+ >>> from epydoc.test.util import runintrospecter
+
+We treat zope interface objects as if they were classes:
+
+ >>> runintrospecter(s='''
+ ... from zope.interface import Interface, Attribute
+ ... class IExample(Interface):
+ ... """This interface represents a generic example."""
+ ...
+ ... text = Attribute("The text of the example")
+ ...
+ ... def setText(text):
+ ... "This method writes the passed text to the text attribute."
+ ...
+ ... def getText():
+ ... "This method returns the value of the text attribute."
+ ... ''', attribs='pyval canonical_name', introspect='IExample')
+ ClassDoc for epydoc_test.IExample [0]
+ +- canonical_name = DottedName('epydoc_test', 'IExample')
+ +- pyval = <InterfaceClass epydoc_test.IExample>
+
+(If we didn't add special support, `IExample` would be a
+`GenericValueDoc`.)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 08:38:46
|
Revision: 1502
http://svn.sourceforge.net/epydoc/?rev=1502&view=rev
Author: edloper
Date: 2007-02-14 00:38:44 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Fixed various test bugs; updated tests so now they run cleanly under
Python 2.3 (assuming you're using a recent version of doctest.py)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/test/__init__.py
trunk/epydoc/src/epydoc/test/docbuilder.doctest
trunk/epydoc/src/epydoc/test/docintrospecter.doctest
trunk/epydoc/src/epydoc/test/docparser.doctest
trunk/epydoc/src/epydoc/test/encoding.doctest
trunk/epydoc/src/epydoc/test/pyval_repr.doctest
trunk/epydoc/src/epydoc/test/restructuredtext.doctest
trunk/epydoc/src/epydoc/test/util.py
Modified: trunk/epydoc/src/epydoc/test/__init__.py
===================================================================
--- trunk/epydoc/src/epydoc/test/__init__.py 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/__init__.py 2007-02-14 08:38:44 UTC (rev 1502)
@@ -11,9 +11,42 @@
"""
__docformat__ = 'epytext en'
-import unittest, doctest, epydoc, os, os.path, re
+import unittest, doctest, epydoc, os, os.path, re, sys
def main():
+ try:
+ doctest.register_optionflag
+ except:
+ print ("\n"
+ "The regression test suite requires a more recent version of\n"
+ "doctest (e.g., the version that ships with Python 2.4 or 2.5).\n"
+ "Please place a new version of doctest on your path before \n"
+ "running the test suite.\n")
+ return
+
+
+ PY24 = doctest.register_optionflag('PYTHON2.4')
+ """Flag indicating that a doctest example requires Python 2.4+"""
+
+ PY25 = doctest.register_optionflag('PYTHON2.5')
+ """Flag indicating that a doctest example requires Python 2.5+"""
+
+ class DocTestParser(doctest.DocTestParser):
+ """
+ Custom doctest parser that adds support for two new flags
+ +PYTHON2.4 and +PYTHON2.5.
+ """
+ def parse(self, string, name='<string>'):
+ pieces = doctest.DocTestParser.parse(self, string, name)
+ for i, val in enumerate(pieces):
+ if (isinstance(val, doctest.Example) and
+ ((val.options.get(PY24, False) and
+ sys.version[:2] < (2,4)) or
+ (val.options.get(PY25, False) and
+ sys.version[:2] < (2,5)))):
+ pieces[i] = doctest.Example('1', '1')
+ return pieces
+
# Turn on debugging.
epydoc.DEBUG = True
@@ -21,6 +54,9 @@
options = doctest.ELLIPSIS
doctest.set_unittest_reportflags(doctest.REPORT_UDIFF)
+ # Use a custom parser
+ parser = DocTestParser()
+
# Find all test cases.
tests = []
testdir = os.path.join(os.path.split(__file__)[0])
@@ -28,7 +64,8 @@
for filename in os.listdir(testdir):
if (filename.endswith('.doctest') and
check_requirements(os.path.join(testdir, filename))):
- tests.append(doctest.DocFileSuite(filename, optionflags=options))
+ tests.append(doctest.DocFileSuite(filename, optionflags=options,
+ parser=parser))
# Run all test cases.
unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(tests))
@@ -45,8 +82,8 @@
requirements are listed.)
"""
s = open(filename).read()
- for m in re.finditer('(?mi)^[ ]*\:RequireModule:[ ]+(\w+)[ ]*$', s):
- module = m.group(1)
+ for m in re.finditer('(?mi)^[ ]*\:RequireModule:(.*)$', s):
+ module = m.group(1).strip()
try:
__import__(module)
except ImportError:
Modified: trunk/epydoc/src/epydoc/test/docbuilder.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -177,10 +177,10 @@
+- name = '__init__'
+- value
+- RoutineDoc for epydoc_test.Foo.__init__ [2]
- +- arg_descrs = [([u'x'], [u'first', u'param']), ...
+ +- arg_descrs = [([u'x'], u'first param'), ([u'y'], u...
+- arg_types = {}
+- docstring = u'__init__ doc'
- +- exception_descrs = [(DottedName(u'ValueError'), ...
+ +- exception_descrs = [(DottedName(u'ValueError'), <epydoc....
+- kwarg = None
+- posargs = [u'x', u'y']
+- vararg = None
@@ -242,8 +242,8 @@
| +- type_descr = None
| +- value
| +- RoutineDoc for epydoc_test.Foo.__init__ [2]
- | +- arg_descrs = [([u'a'], [u'init', u'param.'])]
- | +- arg_types = {u'a': [u'date']}
+ | +- arg_descrs = [([u'a'], u'init param.')]
+ | +- arg_types = {u'a': u'date'}
| +- kwarg = None
| +- posargs = ['self', 'a']
| +- vararg = None
@@ -276,8 +276,8 @@
| +- type_descr = None
| +- value
| +- RoutineDoc for epydoc_test.Foo.__init__ [2]
- | +- arg_descrs = [([u'a'], [u'init', u'param.'])]
- | +- arg_types = {u'a': [u'string']}
+ | +- arg_descrs = [([u'a'], u'init param.')]
+ | +- arg_types = {u'a': u'string'}
| +- kwarg = None
| +- posargs = ['self', 'a']
| +- vararg = None
@@ -294,6 +294,7 @@
current behavior; but should be replaced when we change the behavior.
>>> from epydoc.test.util import buildvaluedoc
+ >>> from epydoc.compat import *
>>> def print_py_reprs(s):
... value_doc = buildvaluedoc(s)
... print 'Var Score Repr\n'+'-'*50
Modified: trunk/epydoc/src/epydoc/test/docintrospecter.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docintrospecter.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/docintrospecter.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -252,7 +252,8 @@
Decorators & Wrapper Assignments
================================
- >>> runintrospecter(s="""
+ >>> runintrospecter( # doctest: +PYTHON2.4
+ ... s="""
... @classmethod
... def f(cls, x): 'docstring for f'
... """, introspect="f")
Modified: trunk/epydoc/src/epydoc/test/docparser.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docparser.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/docparser.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -82,7 +82,7 @@
| | +- ModuleDoc for epydoc_test [0] (defined above)
| +- docs_extracted_by = 'parser'
| +- parse_repr = u'[1, 2, 3]+ [4, 5]'
- | +- toktree = [[(51, u'['), (2, u'1'), (51, u','), ...
+ | +- toktree = ...
+- z => VariableDoc for epydoc_test.z [5]
+- container
| +- ModuleDoc for epydoc_test [0] (defined above)
@@ -98,7 +98,7 @@
| +- ModuleDoc for epydoc_test [0] (defined above)
+- docs_extracted_by = 'parser'
+- parse_repr = u'f(x, y)'
- +- toktree = [(1, u'f'), [(51, u'('), (1, u'x'), (...
+ +- toktree = ...
In this example, DocParser decides that the assignment to y is
creating an alias. The same `ValueDoc` is shared by both variables.
@@ -466,11 +466,12 @@
Decorators & Wrapper Assignments
================================
- >>> runparser(s="""
+ >>> runparser( # doctest: +PYTHON2.4
+ ... s="""
... @classmethod
... def f(cls, x): 'docstring for f'
... """,
- ... attribs='variables value docstring posargs')
+ ... attribs='variables value docstring posargs')
ModuleDoc for epydoc_test [0]
+- docstring = <UNKNOWN>
+- variables
Modified: trunk/epydoc/src/epydoc/test/encoding.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/encoding.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/encoding.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -122,7 +122,7 @@
>>> testencoding('''# -*- coding: shift_jis -*-
... """abc ABC 123 \xA1 \xA2 \xA3"""
- ... ''')
+ ... ''') # doctest: +PYTHON2.4
abc ABC 123 。 「 」
Str/Unicode Test
Modified: trunk/epydoc/src/epydoc/test/pyval_repr.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -42,7 +42,7 @@
Strings have their quotation marks tagged as 'quote'. Characters are
escaped using the 'string-escape' encoding.
- >>> color(''.join(chr(i) for i in range(256)))
+ >>> color(''.join([chr(i) for i in range(256)]))
<code class="variable-quote">'''</code><code class="variable-string">\x00\x01\x02\x03\x04\x05\x06\x07\x08\</code>↵
<code class="variable-string">t</code>
<code class="variable-string">\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x</code>↵
@@ -129,7 +129,7 @@
>>> def textcontent(elt):
... if isinstance(elt, basestring): return elt
- ... else: return ''.join(textcontent(c) for c in elt.children)
+ ... else: return ''.join([textcontent(c) for c in elt.children])
>>> import re
>>> def color_re(s, check_roundtrip=True):
Modified: trunk/epydoc/src/epydoc/test/restructuredtext.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/restructuredtext.doctest 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/restructuredtext.doctest 2007-02-14 08:38:44 UTC (rev 1502)
@@ -148,8 +148,8 @@
| +- type_descr = None
| +- value
| +- RoutineDoc for epydoc_test.Foo.__init__ [2]
- | +- arg_descrs = [([u'a'], [u'init', u'param.'])]
- | +- arg_types = {u'a': [u'string']}
+ | +- arg_descrs = [([u'a'], u'init param.')]
+ | +- arg_types = {u'a': u'string'}
| +- exception_descrs = [(DottedName(u'ValueError'), ...
| +- kwarg = None
| +- posargs = ['self', 'a']
Modified: trunk/epydoc/src/epydoc/test/util.py
===================================================================
--- trunk/epydoc/src/epydoc/test/util.py 2007-02-14 08:36:59 UTC (rev 1501)
+++ trunk/epydoc/src/epydoc/test/util.py 2007-02-14 08:38:44 UTC (rev 1502)
@@ -188,7 +188,7 @@
"""Conver a parsed docstring into plain text"""
if isinstance(docstring, ParsedDocstring):
docstring = docstring.to_plaintext(None)
- return docstring.rsplit()
+ return docstring.rstrip()
def fun_to_plain(val_doc):
"""Convert parsed docstrings in text from a RoutineDoc"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 08:37:02
|
Revision: 1501
http://svn.sourceforge.net/epydoc/?rev=1501&view=rev
Author: edloper
Date: 2007-02-14 00:36:59 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
- Added preliminary support for zope2 and zope3 introspection.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docintrospecter.py
Modified: trunk/epydoc/src/epydoc/docintrospecter.py
===================================================================
--- trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 06:15:18 UTC (rev 1500)
+++ trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 08:36:59 UTC (rev 1501)
@@ -514,8 +514,17 @@
C{__bases__} attribute, including objects that define
C{__getattr__} to always return a value).
"""
- return isinstance(object, (TypeType, ClassType))
+ return isinstance(object, tuple(_CLASS_TYPES))
+_CLASS_TYPES = set([TypeType, ClassType])
+"""A list of types that should be treated as classes."""
+
+def register_class_type(typ):
+ """Add a type to the lists of types that should be treated as
+ classes. By default, this list contains C{TypeType} and
+ C{ClassType}."""
+ _CLASS_TYPES.add(typ)
+
__future_check_works = None
def is_future_feature(object):
@@ -598,7 +607,7 @@
if isinstance(value, ModuleType):
dotted_name = DottedName(value.__name__)
- elif isinstance(value, (ClassType, TypeType)):
+ elif isclass(value):
if value.__module__ == '__builtin__':
dotted_name = DottedName(value.__name__)
else:
@@ -961,10 +970,39 @@
xreadlines = readlines
_dev_null = _DevNull()
+######################################################################
+## Zope InterfaceClass
+######################################################################
+try:
+ from zope.interface.interface import InterfaceClass as _ZopeInterfaceClass
+ register_class_type(_ZopeInterfaceClass)
+except:
+ pass
+######################################################################
+## Zope Extension classes
+######################################################################
+try:
+ # Register type(ExtensionClass.ExtensionClass)
+ from ExtensionClass import ExtensionClass as _ExtensionClass
+ _ZopeType = type(_ExtensionClass)
+ def _is_zope_type(val):
+ return isinstance(val, _ZopeType)
+ register_introspecter(_is_zope_type, introspect_class)
+ # Register ExtensionClass.*MethodType
+ from ExtensionClass import PythonMethodType as _ZopeMethodType
+ from ExtensionClass import ExtensionMethodType as _ZopeCMethodType
+ def _is_zope_method(val):
+ return isinstance(val, (_ZopeMethodType, _ZopeCMethodType))
+ register_introspecter(_is_zope_method, introspect_routine)
+except:
+ pass
+
+
+
# [xx]
0 # hm.. otherwise the following gets treated as a docstring! ouch!
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 06:15:19
|
Revision: 1500
http://svn.sourceforge.net/epydoc/?rev=1500&view=rev
Author: edloper
Date: 2007-02-13 22:15:18 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Fixed SF bug #1659520 (although I'm not entirely happy with the fix)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/apidoc.py
Modified: trunk/epydoc/src/epydoc/apidoc.py
===================================================================
--- trunk/epydoc/src/epydoc/apidoc.py 2007-02-14 06:12:22 UTC (rev 1499)
+++ trunk/epydoc/src/epydoc/apidoc.py 2007-02-14 06:15:18 UTC (rev 1500)
@@ -679,6 +679,16 @@
def is_detailed(self):
if (self.value in (None, UNKNOWN)):
return super(VariableDoc, self).is_detailed()
+ if isinstance(self.value, GenericValueDoc):
+ # [XX] This is a little hackish -- we assume that the
+ # summary lines will have SUMMARY_REPR_LINELEN chars,
+ # that len(name) of those will be taken up by the name,
+ # and that 3 of those will be taken up by " = " between
+ # the name & val. Note that if any docwriter uses a
+ # different formula for maxlen for this, then it will
+ # not get the right value for is_detailed().
+ maxlen = self.value.SUMMARY_REPR_LINELEN-3-len(self.name)
+ return (not self.value.summary_pyval_repr(maxlen).is_complete)
else:
return self.value.is_detailed()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 06:12:24
|
Revision: 1499
http://svn.sourceforge.net/epydoc/?rev=1499&view=rev
Author: edloper
Date: 2007-02-13 22:12:22 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Fixed some css rules (css precedence rules were preventing them
from being used in the desired places)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/html_css.py
Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 05:43:46 UTC (rev 1498)
+++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 06:12:22 UTC (rev 1499)
@@ -183,14 +183,22 @@
.sig-default { color: $sig_default; }
.summary-sig { font-family: monospace; }
.summary-sig-name { color: $summary_sig_name; font-weight: bold; }
-a.summary-sig-name:link { color: $summary_sig_name; font-weight: bold; }
-a.summary-sig-name:visited { color: $summary_sig_name; font-weight: bold; }
+table.summary a.summary-sig-name:link
+ { color: $summary_sig_name; font-weight: bold; }
+table.summary a.summary-sig-name:visited
+ { color: $summary_sig_name; font-weight: bold; }
.summary-sig-arg { color: $summary_sig_arg; }
.summary-sig-default { color: $summary_sig_default; }
/* To render variables, classes etc. like functions */
-.summary-name { color: $summary_sig_name; font-weight: bold;
+table.summary .summary-name { color: $summary_sig_name; font-weight: bold;
font-family: monospace; }
+table.summary
+ a.summary-name:link { color: $summary_sig_name; font-weight: bold;
+ font-family: monospace; }
+table.summary
+ a.summary-name:visited { color: $summary_sig_name; font-weight: bold;
+ font-family: monospace; }
/* Variable values
* - In the 'variable details' sections, each varaible's value is
@@ -281,8 +289,8 @@
.py-keyword { color: $py_keyword; }
.py-output { color: $py_output; }
.py-name { color: $py_name; }
-.py-name:link { color: $py_name; }
-.py-name:visited { color: $py_name; }
+.py-name:link { color: $py_name !important; }
+.py-name:visited { color: $py_name !important; }
.py-number { color: $py_number; }
.py-defname { color: $py_def_name; font-weight: bold; }
.py-def-name { color: $py_def_name; font-weight: bold; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 05:44:15
|
Revision: 1498
http://svn.sourceforge.net/epydoc/?rev=1498&view=rev
Author: edloper
Date: 2007-02-13 21:43:46 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Set __docformat__
Modified Paths:
--------------
trunk/epydoc/src/epydoc/markup/doctest.py
trunk/epydoc/src/epydoc/markup/pyval_repr.py
Modified: trunk/epydoc/src/epydoc/markup/doctest.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/doctest.py 2007-02-14 05:43:07 UTC (rev 1497)
+++ trunk/epydoc/src/epydoc/markup/doctest.py 2007-02-14 05:43:46 UTC (rev 1498)
@@ -15,6 +15,7 @@
(Both C{doctest_to_html()} and C{doctest_to_latex()} are defined using
C{colorize_doctest()}.)
"""
+__docformat__ = 'epytext en'
import re
from epydoc.util import plaintext_to_html, plaintext_to_latex
Modified: trunk/epydoc/src/epydoc/markup/pyval_repr.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-02-14 05:43:07 UTC (rev 1497)
+++ trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-02-14 05:43:46 UTC (rev 1498)
@@ -25,6 +25,7 @@
L{ParsedEpydocDocstring}, which can then be used to generate output in
a variety of formats.
"""
+__docformat__ = 'epytext en'
# Implementation note: we use exact tests for classes (list, etc)
# rather than using isinstance, because subclasses might override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 05:43:32
|
Revision: 1497
http://svn.sourceforge.net/epydoc/?rev=1497&view=rev
Author: edloper
Date: 2007-02-13 21:43:07 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Fixed makefile bug
Modified Paths:
--------------
trunk/epydoc/Makefile
Modified: trunk/epydoc/Makefile
===================================================================
--- trunk/epydoc/Makefile 2007-02-14 03:51:27 UTC (rev 1496)
+++ trunk/epydoc/Makefile 2007-02-14 05:43:07 UTC (rev 1497)
@@ -44,6 +44,9 @@
# Options for rst->html converter
RST2HTML = $(PYTHON) src/tools/rst2html.py
+DOCTEST_HTML_FILES := \
+ $(DOCTESTS:src/epydoc/test/%.doctest=$(HTML_DOCTEST)/%.html)
+
##//////////////////////////////////////////////////////////////////////
## Usage
##//////////////////////////////////////////////////////////////////////
@@ -104,7 +107,7 @@
epydoc --check --tests=vars,types $(PY_SRC)
.webpage.up2date: .api-html.up2date .examples.up2date .api-pdf.up2date \
- .doctest-html.up2date doc/epydoc-man.html \
+ $(DOCTEST_HTML_FILES) doc/epydoc-man.html \
doc/epydocgui-man.html $(DOCS)
rm -rf $(WEBDIR)
mkdir -p $(WEBDIR)
@@ -138,12 +141,11 @@
touch .api-pdf.up2date
# Convert doctest files to HTML, using rst2html.
-DOCTEST_HTML_FILES := \
- $(DOCTESTS:src/epydoc/test/%.doctest=$(HTML_DOCTEST)/%.html)
doctest-html: doctest-html-mkdir $(DOCTEST_HTML_FILES)
doctest-html-mkdir:
mkdir -p $(HTML_DOCTEST)
$(HTML_DOCTEST)/%.html: src/epydoc/test/%.doctest
+ mkdir -p $(HTML_DOCTEST)
$(RST2HTML) $< $@
examples: .examples.up2date
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 03:51:28
|
Revision: 1496
http://svn.sourceforge.net/epydoc/?rev=1496&view=rev
Author: edloper
Date: 2007-02-13 19:51:27 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Register a logger, to print any warnings or errors
- Added a test case for SF bug #1653486 to docbuilder.doctest
- Modified 'specifying constructor signature in class docstring'
examples to eliminate warnings (eg duplicate @type for param)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/test/apidoc.doctest
trunk/epydoc/src/epydoc/test/docbuilder.doctest
trunk/epydoc/src/epydoc/test/docintrospecter.doctest
trunk/epydoc/src/epydoc/test/docparser.doctest
trunk/epydoc/src/epydoc/test/encoding.doctest
trunk/epydoc/src/epydoc/test/epytext.doctest
trunk/epydoc/src/epydoc/test/javadoc.doctest
trunk/epydoc/src/epydoc/test/plaintext.doctest
trunk/epydoc/src/epydoc/test/pyval_repr.doctest
trunk/epydoc/src/epydoc/test/restructuredtext.doctest
Modified: trunk/epydoc/src/epydoc/test/apidoc.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/apidoc.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/apidoc.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -9,6 +9,9 @@
>>> from epydoc.apidoc import *
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Unknown Value
=============
Epydoc defines a special object, epydoc.apidoc.UNKNOWN, which is used
Modified: trunk/epydoc/src/epydoc/test/docbuilder.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -14,6 +14,9 @@
>>> from epydoc.test.util import runbuilder
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Docformat selection
===================
@@ -72,11 +75,7 @@
... @type a: date
... """
... def __init__(self, a):
- ... """The ctor docstring.
- ...
- ... @type a: str
- ... """
- ... pass
+ ... """The ctor docstring."""
... ''',
... build="Foo",
... attribs="variables name value "
@@ -106,10 +105,7 @@
... @type a: str
... """
... def __init__(self, **kwargs):
- ... """The ctor docstring.
- ...
- ... @type a: str
- ... """
+ ... """The ctor docstring."""
... ''',
... build="Foo",
... attribs="variables name value "
@@ -135,7 +131,7 @@
... @param a: a param.
... @type a: str
... """
- ... def __init__(self):
+ ... def __init__(self, a):
... pass
... ''',
... build="Foo",
@@ -150,7 +146,7 @@
+- arg_descrs = [([u'a'], ...
+- arg_types = {u'a': ...
+- kwarg = None
- +- posargs = ['self']
+ +- posargs = ['self', 'a']
+- vararg = None
Exceptions can be put in the docstring class, and they are assigned to the
@@ -336,3 +332,30 @@
h -99 u'??'
i 0 u'[Foo(), 1, 2]'
j 0 u'[<epydoc_test.Foo instance at ...>, 1, 2, 3]'
+
+Merging is_imported
+===================
+When we do both parsing & introspection, and merge the result, we
+should trust the introspected APIDoc's is_imported value more than the
+parsed APIDoc. In particular, in the following example, `x` should
+have `is_imported=True`. But if we can't tell from introspection,
+then use parse info -- so `y` should be imported, but `z` should not.
+
+ >>> import epydoc.docintrospecter
+ >>> epydoc.docintrospecter.clear_cache()
+ >>> runbuilder(s='''
+ ... import cStringIO
+ ... from re import MULTILINE as y
+ ... x = cStringIO
+ ... z = y
+ ... ''', attribs=("variables is_imported "))
+ ModuleDoc for epydoc_test [0]
+ +- variables
+ +- cStringIO => VariableDoc for epydoc_test.cStringIO [1]
+ | +- is_imported = True
+ +- x => VariableDoc for epydoc_test.x [2]
+ | +- is_imported = True
+ +- y => VariableDoc for epydoc_test.y [3]
+ | +- is_imported = True
+ +- z => VariableDoc for epydoc_test.z [4]
+ +- is_imported = False
Modified: trunk/epydoc/src/epydoc/test/docintrospecter.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docintrospecter.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/docintrospecter.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -17,6 +17,9 @@
>>> from epydoc.test.util import runintrospecter
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Module Variables
================
Each variable defined by a module is encoded as a `VariableDoc`, whose
Modified: trunk/epydoc/src/epydoc/test/docparser.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/docparser.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/docparser.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -17,6 +17,9 @@
>>> from epydoc.test.util import runparser
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Module Variables from Assignment Statements
===========================================
Variables are extracted from any assignment statements in the module,
@@ -390,6 +393,7 @@
... x = 12 #: comment2
... '''string'''""",
... attribs="variables name docstring")
+ <UNKNOWN> has both a comment-docstring and a normal (string) docstring; ignoring the comment-docstring.
ModuleDoc for epydoc_test [0]
+- docstring = <UNKNOWN>
+- variables
@@ -492,6 +496,7 @@
... class Z(B.__bases__[0]): "calculated base" # not handled!
... """,
... attribs='variables value bases docstring')
+ Unable to extract the base list for epydoc_test.Z: Bad dotted name
ModuleDoc for epydoc_test [0]
+- docstring = <UNKNOWN>
+- variables
Modified: trunk/epydoc/src/epydoc/test/encoding.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/encoding.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/encoding.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -10,7 +10,9 @@
docstrings, it monkey-patches the HMTLwriter.docstring_to_html()
method.)
- >>> from epydoc.test.util import print_warnings, testencoding
+ >>> from epydoc.test.util import testencoding
+
+ >>> from epydoc.test.util import print_warnings
>>> print_warnings()
Encoding Tests
Modified: trunk/epydoc/src/epydoc/test/epytext.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/epytext.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/epytext.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -5,6 +5,9 @@
time, esp. given that it's so much easier to write tests with doctest
than it was with unittest.
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
>>> from epydoc.markup import epytext
>>> import re
>>> def testparse(s):
Modified: trunk/epydoc/src/epydoc/test/javadoc.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/javadoc.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/javadoc.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -1,5 +1,7 @@
-Regression Testing for plaintext
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Regression Testing for javadoc
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
Summary
=======
Modified: trunk/epydoc/src/epydoc/test/plaintext.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/plaintext.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/plaintext.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -1,5 +1,7 @@
Regression Testing for plaintext
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
Summary
=======
Modified: trunk/epydoc/src/epydoc/test/pyval_repr.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -280,6 +280,9 @@
...
score: 1 (ok)
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Summary
=======
To generate summary-reprs, use maxlines=1 and linebreakok=False:
Modified: trunk/epydoc/src/epydoc/test/restructuredtext.doctest
===================================================================
--- trunk/epydoc/src/epydoc/test/restructuredtext.doctest 2007-02-14 03:49:21 UTC (rev 1495)
+++ trunk/epydoc/src/epydoc/test/restructuredtext.doctest 2007-02-14 03:51:27 UTC (rev 1496)
@@ -2,6 +2,9 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:RequireModule: docutils
+ >>> from epydoc.test.util import print_warnings
+ >>> print_warnings()
+
Summary
=======
The implementation of the summaization function works as expected.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 03:49:22
|
Revision: 1495
http://svn.sourceforge.net/epydoc/?rev=1495&view=rev
Author: edloper
Date: 2007-02-13 19:49:21 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Changed print_warnings() to make sure it doesn't register multiple
loggers.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/test/util.py
Modified: trunk/epydoc/src/epydoc/test/util.py
===================================================================
--- trunk/epydoc/src/epydoc/test/util.py 2007-02-14 03:48:35 UTC (rev 1494)
+++ trunk/epydoc/src/epydoc/test/util.py 2007-02-14 03:49:21 UTC (rev 1495)
@@ -130,7 +130,8 @@
Register a logger that will print warnings & errors.
"""
from epydoc import log
- log.register_logger(log.SimpleLogger())
+ del log._loggers[:]
+ log.register_logger(log.SimpleLogger(log.DOCSTRING_WARNING))
def testencoding(s, introspect=True, parse=True, debug=False):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 03:48:36
|
Revision: 1494
http://svn.sourceforge.net/epydoc/?rev=1494&view=rev
Author: edloper
Date: 2007-02-13 19:48:35 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Added clear_cache()
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docintrospecter.py
Modified: trunk/epydoc/src/epydoc/docintrospecter.py
===================================================================
--- trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 03:47:07 UTC (rev 1493)
+++ trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 03:48:35 UTC (rev 1494)
@@ -59,6 +59,14 @@
"""A record which values we've introspected, encoded as a dictionary from
pyid to C{bool}."""
+def clear_cache():
+ """
+ Discard any cached C{APIDoc} values that have been computed for
+ introspected values.
+ """
+ _valuedoc_cache.clear()
+ _introspected_values.clear()
+
######################################################################
## Introspection
######################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 03:47:08
|
Revision: 1493
http://svn.sourceforge.net/epydoc/?rev=1493&view=rev
Author: edloper
Date: 2007-02-13 19:47:07 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Changed MERGE_PRECEDENCE['is_imported'] to introspect -- fixes SF bug
[#1653486].
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docbuilder.py
Modified: trunk/epydoc/src/epydoc/docbuilder.py
===================================================================
--- trunk/epydoc/src/epydoc/docbuilder.py 2007-02-14 02:19:00 UTC (rev 1492)
+++ trunk/epydoc/src/epydoc/docbuilder.py 2007-02-14 03:47:07 UTC (rev 1493)
@@ -636,9 +636,11 @@
# Why?
'canonical_name': 'introspect',
- # The parser can tell if a variable is imported or not; the
- # introspector must guess.
- 'is_imported': 'parse',
+ # Only fall-back on the parser for is_imported if the introspecter
+ # isn't sure. Otherwise, we can end up thinking that vars
+ # containing modules are not imported, which can cause external
+ # modules to show up in the docs (sf bug #1653486)
+ 'is_imported': 'introspect',
# The parser can tell if an assignment creates an alias or not.
'is_alias': 'parse',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 02:19:03
|
Revision: 1492
http://svn.sourceforge.net/epydoc/?rev=1492&view=rev
Author: edloper
Date: 2007-02-13 18:19:00 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Fixed title in epydoc-log.html
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2007-02-14 02:16:36 UTC (rev 1491)
+++ trunk/epydoc/src/epydoc/cli.py 2007-02-14 02:19:00 UTC (rev 1492)
@@ -1194,7 +1194,7 @@
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>$title$</title>
+ <title>Epydoc Log</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
</head>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 02:16:39
|
Revision: 1491
http://svn.sourceforge.net/epydoc/?rev=1491&view=rev
Author: edloper
Date: 2007-02-13 18:16:36 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Reduced vertical whitespace space in epydoc-log.html
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
trunk/epydoc/src/epydoc/docwriter/html_css.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2007-02-14 01:33:29 UTC (rev 1490)
+++ trunk/epydoc/src/epydoc/cli.py 2007-02-14 02:16:36 UTC (rev 1491)
@@ -1203,7 +1203,8 @@
<h1 class="epydoc">Epydoc Log</h1>
<p class="log">Epydoc started at %s</p>''')
START_BLOCK = '<div class="log-block"><h2 class="log-hdr">%s</h2>'
- MESSAGE = '<div class="log-%s"><pre class="log"><b>%s</b>: %s</pre></div>\n'
+ MESSAGE = ('<div class="log-%s"><b>%s</b>: \n'
+ '%s</div>\n')
END_BLOCK = '</div>'
FOOTER = "</body>\n</html>\n"
@@ -1239,12 +1240,20 @@
def log(self, level, message):
if message.endswith("(-v) to display markup errors."): return
if level >= log.ERROR:
- self.out.write(self.MESSAGE % ('error', 'Error', message))
- self.is_empty = False
+ self.out.write(self._message('error', message))
+ elif level >= log.WARNING:
+ self.out.write(self._message('warning', message))
elif level >= log.DOCSTRING_WARNING:
- self.out.write(self.MESSAGE % ('warning', 'Warning', message))
- self.is_empty = False
+ self.out.write(self._message('docstring warning', message))
+ def _message(self, level, message):
+ self.is_empty = False
+ message = plaintext_to_html(message)
+ if '\n' in message:
+ message = '<pre class="log">%s</pre>' % message
+ hdr = ' '.join([w.capitalize() for w in level.split()])
+ return self.MESSAGE % (level.split()[-1], hdr, message)
+
def close(self):
if self.is_empty:
self.out.write('<div class="log-info">'
Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 01:33:29 UTC (rev 1490)
+++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 02:16:36 UTC (rev 1491)
@@ -318,25 +318,25 @@
.nomargin { margin-top: 0; margin-bottom: 0; }
/* HTML Log */
-div.log-block { padding: 0; margin: .5em;
+div.log-block { padding: 0; margin: .5em 0 .5em 0;
background: $log_bg; color: $log_fg;
border: $log_border; }
-div.log-error { padding: .5em; margin: .5em;
+div.log-error { padding: .1em .3em .1em .3em; margin: 4px;
background: $log_error_bg; color: $log_error_fg;
border: $log_error_border; }
-div.log-warning { padding: .5em; margin: .5em;
+div.log-warning { padding: .1em .3em .1em .3em; margin: 4px;
background: $log_warn_bg; color: $log_warn_fg;
border: $log_warn_border; }
-div.log-info { padding: .5em; margin: .5em;
+div.log-info { padding: .1em .3em .1em .3em; margin: 4px;
background: $log_info_bg; color: $log_info_fg;
border: $log_info_border; }
h2.log-hdr { background: $log_hdr_bg; color: $log_hdr_fg;
- margin: 0; padding: 0.1em 0.5em 0.1em 0.5em;
- border-bottom: $log_border; }
-p.log { font-weight: bold; }
+ margin: 0; padding: 0em 0.5em 0em 0.5em;
+ border-bottom: $log_border; font-size: 110%; }
+p.log { font-weight: bold; margin: .5em 0 .5em 0; }
tr.opt-changed { color: $opt_changed_fg; font-weight: bold; }
tr.opt-default { color: $opt_default_fg; }
-pre.log { margin: 0; padding: 0; }
+pre.log { margin: 0; padding: 0; padding-left: 1em; }
"""
############################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 01:33:31
|
Revision: 1490
http://svn.sourceforge.net/epydoc/?rev=1490&view=rev
Author: edloper
Date: 2007-02-13 17:33:29 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Extendedd support for extracting metadata fields from __variables__.
List & tuple values for multival fields are now supported, as are
int, float, bool, and None values (for introspection only -- parsing
still requires string values). Also added several more __varaibles__.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docstringparser.py
Modified: trunk/epydoc/src/epydoc/docstringparser.py
===================================================================
--- trunk/epydoc/src/epydoc/docstringparser.py 2007-02-14 01:20:09 UTC (rev 1489)
+++ trunk/epydoc/src/epydoc/docstringparser.py 2007-02-14 01:33:29 UTC (rev 1490)
@@ -105,7 +105,7 @@
# If it's deprecated, put that first.
DocstringField(['deprecated', 'depreciated'],
- 'Deprecated', multivalue=0),
+ 'Deprecated', multivalue=0, varnames=['__deprecated__']),
# Status info
DocstringField(['version'], 'Version', multivalue=0,
@@ -117,10 +117,12 @@
# Bibliographic Info
DocstringField(['author', 'authors'], 'Author', 'Authors', short=1,
varnames=['__author__', '__authors__']),
- DocstringField(['contact'], 'Contact', 'Contacts', short=1),
+ DocstringField(['contact'], 'Contact', 'Contacts', short=1,
+ varnames=['__contact__']),
DocstringField(['organization', 'org'],
'Organization', 'Organizations'),
- DocstringField(['copyright', '(c)'], 'Copyright', multivalue=0),
+ DocstringField(['copyright', '(c)'], 'Copyright', multivalue=0,
+ varnames=['__copyright__']),
DocstringField(['license'], 'License', multivalue=0,
varnames=['__license__']),
@@ -274,22 +276,39 @@
if varname not in api_doc.variables: continue
if api_doc.variables[varname].value is UNKNOWN: continue
val_doc = api_doc.variables[varname].value
- # Extract the value from the variable.
- value = None
+ value = []
+
+ # Try extracting the value from the pyval.
+ ok_types = (basestring, int, float, bool, type(None))
if val_doc.pyval is not UNKNOWN:
- if isinstance(val_doc.pyval, basestring):
- value = val_doc.pyval
+ if isinstance(val_doc.pyval, ok_types):
+ value = [val_doc.pyval]
+ elif field.multivalue:
+ if isinstance(val_doc.pyval, (tuple, list)):
+ for elt in val_doc.pyval:
+ if not isinstance(elt, ok_types): break
+ else:
+ value = list(val_doc.pyval)
+
+ # Try extracting the value from the parse tree.
elif val_doc.toktree is not UNKNOWN:
- try: value = epydoc.docparser.parse_string(val_doc.toktree)
+ try: value = [epydoc.docparser.parse_string(val_doc.toktree)]
except KeyboardInterrupt: raise
except: pass
- # If we found a value, then add it.
- if value is not None:
- if isinstance(value, str):
- value = decode_with_backslashreplace(value)
- value = epytext.ParsedEpytextDocstring(
- epytext.parse_as_para(value))
- api_doc.metadata.append( (field, varname, value) )
+ if field.multivalue and not value:
+ try: value = epydoc.docparser.parse_string_list(val_doc.toktree)
+ except KeyboardInterrupt: raise
+ except: raise
+
+ # Add any values that we found.
+ for elt in value:
+ if isinstance(elt, str):
+ elt = decode_with_backslashreplace(elt)
+ else:
+ elt = unicode(elt)
+ elt = epytext.ParsedEpytextDocstring(
+ epytext.parse_as_para(elt))
+ api_doc.metadata.append( (field, varname, elt) )
def initialize_api_doc(api_doc):
"""A helper function for L{parse_docstring()} that initializes
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 01:20:13
|
Revision: 1489
http://svn.sourceforge.net/epydoc/?rev=1489&view=rev
Author: edloper
Date: 2007-02-13 17:20:09 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Added support for extracting metadata fields from __variables__. To
add a new __varaible__->field mapping, set the 'varnames'
variable of the field. Currently supported __variables__ are
__version__, __date__, __author__, __authors__, __license__.
Feel free to add more. Currently, __variables__ are required to have
string values to be considered for addition to metadata.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docstringparser.py
Modified: trunk/epydoc/src/epydoc/docstringparser.py
===================================================================
--- trunk/epydoc/src/epydoc/docstringparser.py 2007-02-14 00:34:27 UTC (rev 1488)
+++ trunk/epydoc/src/epydoc/docstringparser.py 2007-02-14 01:20:09 UTC (rev 1489)
@@ -31,10 +31,12 @@
import re, sys
from epydoc import markup
+from epydoc.markup import epytext
from epydoc.apidoc import *
from epydoc.docintrospecter import introspect_docstring_lineno
from epydoc.util import py_src_filename
from epydoc import log
+import epydoc.docparser
import __builtin__, exceptions
######################################################################
@@ -69,7 +71,8 @@
added.
"""
def __init__(self, tags, label, plural=None,
- short=0, multivalue=1, takes_arg=0):
+ short=0, multivalue=1, takes_arg=0,
+ varnames=[]):
if type(tags) in (list, tuple):
self.tags = tuple(tags)
elif type(tags) is str:
@@ -81,6 +84,7 @@
self.multivalue = multivalue
self.short = short
self.takes_arg = takes_arg
+ self.varnames = varnames
def __cmp__(self, other):
if not isinstance(other, DocstringField): return -1
@@ -104,17 +108,21 @@
'Deprecated', multivalue=0),
# Status info
- DocstringField(['version'], 'Version', multivalue=0),
- DocstringField(['date'], 'Date', multivalue=0),
+ DocstringField(['version'], 'Version', multivalue=0,
+ varnames=['__version__']),
+ DocstringField(['date'], 'Date', multivalue=0,
+ varnames=['__date__']),
DocstringField(['status'], 'Status', multivalue=0),
# Bibliographic Info
- DocstringField(['author', 'authors'], 'Author', 'Authors', short=1),
+ DocstringField(['author', 'authors'], 'Author', 'Authors', short=1,
+ varnames=['__author__', '__authors__']),
DocstringField(['contact'], 'Contact', 'Contacts', short=1),
DocstringField(['organization', 'org'],
'Organization', 'Organizations'),
DocstringField(['copyright', '(c)'], 'Copyright', multivalue=0),
- DocstringField(['license'], 'License', multivalue=0),
+ DocstringField(['license'], 'License', multivalue=0,
+ varnames=['__license__']),
# Various warnings etc.
DocstringField(['bug'], 'Bug', 'Bugs'),
@@ -233,6 +241,11 @@
# some documented parameter.
check_type_fields(api_doc, field_warnings)
+ # Check for special variables (e.g., __version__)
+ if isinstance(api_doc, NamespaceDoc):
+ for field in STANDARD_FIELDS + user_docfields(api_doc, docindex):
+ add_metadata_from_var(api_doc, field)
+
# Extract a summary
if api_doc.summary is None and api_doc.descr is not None:
api_doc.summary, api_doc.other_docs = api_doc.descr.summary()
@@ -251,6 +264,33 @@
# Report any errors that occured
report_errors(api_doc, docindex, parse_errors, field_warnings)
+def add_metadata_from_var(api_doc, field):
+ if not field.multivalue:
+ for (f,a,d) in api_doc.metadata:
+ if field == f:
+ return # We already have a value for this metadata.
+ for varname in field.varnames:
+ # Check if api_doc has a variable w/ the given name.
+ if varname not in api_doc.variables: continue
+ if api_doc.variables[varname].value is UNKNOWN: continue
+ val_doc = api_doc.variables[varname].value
+ # Extract the value from the variable.
+ value = None
+ if val_doc.pyval is not UNKNOWN:
+ if isinstance(val_doc.pyval, basestring):
+ value = val_doc.pyval
+ elif val_doc.toktree is not UNKNOWN:
+ try: value = epydoc.docparser.parse_string(val_doc.toktree)
+ except KeyboardInterrupt: raise
+ except: pass
+ # If we found a value, then add it.
+ if value is not None:
+ if isinstance(value, str):
+ value = decode_with_backslashreplace(value)
+ value = epytext.ParsedEpytextDocstring(
+ epytext.parse_as_para(value))
+ api_doc.metadata.append( (field, varname, value) )
+
def initialize_api_doc(api_doc):
"""A helper function for L{parse_docstring()} that initializes
the attributes that C{parse_docstring()} will write to."""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2007-02-14 00:34:29
|
Revision: 1488
http://svn.sourceforge.net/epydoc/?rev=1488&view=rev
Author: edloper
Date: 2007-02-13 16:34:27 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
- Added --include-log option (feature request #1639425). Currently,
it's only useful with --html. The log page is named
"epydoc-log.html", and is linked from the footer.
- Put option defaults in a global dictionary at the top of the
'argument & config file parsing' section
- Added log.close() hook to close logs.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
trunk/epydoc/src/epydoc/docwriter/html.py
trunk/epydoc/src/epydoc/docwriter/html_css.py
trunk/epydoc/src/epydoc/log.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2007-02-14 00:34:00 UTC (rev 1487)
+++ trunk/epydoc/src/epydoc/cli.py 2007-02-14 00:34:27 UTC (rev 1488)
@@ -63,12 +63,14 @@
"""
__docformat__ = 'epytext en'
-import sys, os, time, re, pickle
+import sys, os, time, re, pickle, textwrap
from glob import glob
from optparse import OptionParser, OptionGroup, SUPPRESS_HELP
+import optparse
import epydoc
from epydoc import log
from epydoc.util import wordwrap, run_subprocess, RunSubprocessError
+from epydoc.util import plaintext_to_html
from epydoc.apidoc import UNKNOWN
from epydoc.compat import *
import ConfigParser
@@ -83,6 +85,15 @@
#{ Argument & Config File Parsing
######################################################################
+OPTION_DEFAULTS = dict(
+ action="html", show_frames=True, docformat=DEFAULT_DOCFORMAT,
+ show_private=True, show_imports=False, inheritance="listed",
+ verbose=0, quiet=0, load_pickle=False, parse=True, introspect=True,
+ debug=epydoc.DEBUG, profile=False, graphs=[],
+ list_classes_separately=False, graph_font=None, graph_font_size=None,
+ include_source_code=True, pstat_files=[], simple_term=False, fail_on=None,
+ exclude=[], exclude_parse=[], exclude_introspect=[])
+
def parse_arguments():
# Construct the option parser.
usage = '%prog ACTION [options] NAMES...'
@@ -180,6 +191,9 @@
generation_group.add_option( # --no-imports
"--no-imports", action="store_false", dest="show_imports",
help="Do not list each module's imports. (default)")
+ generation_group.add_option( # --include-log
+ '--include-log', action='store_true', dest='include_log',
+ help=("Include a page with the process log (epydoc-log.html)"))
generation_group.add_option( # --show-sourcecode
'--show-sourcecode', action='store_true', dest='include_source_code',
help=("Include source code with syntax highlighting in the "
@@ -285,19 +299,7 @@
optparser.add_option_group(return_group)
# Set the option parser's defaults.
- optparser.set_defaults(action="html", show_frames=True,
- docformat=DEFAULT_DOCFORMAT,
- show_private=True, show_imports=False,
- inheritance="listed",
- verbose=0, quiet=0, load_pickle=False,
- parse=True, introspect=True,
- debug=epydoc.DEBUG, profile=False,
- graphs=[], list_classes_separately=False,
- graph_font=None, graph_font_size=None,
- include_source_code=True, pstat_files=[],
- simple_term=False, fail_on=None,
- exclude=[], exclude_parse=[],
- exclude_introspect=[])
+ optparser.set_defaults(**OPTION_DEFAULTS)
# Parse the arguments.
options, names = optparser.parse_args()
@@ -367,6 +369,7 @@
options.target = options.action
# Return parsed args.
+ options.names = names
return options, names
def parse_configfiles(configfiles, options, names):
@@ -524,6 +527,12 @@
log.error("%s is not a directory" % options.target)
sys.exit(1)
+ if options.include_log:
+ if options.action == 'html':
+ log.register_logger(HTMLLogger(options.target, options))
+ else:
+ log.warning("--include-log requires --html")
+
# Set the default docformat
from epydoc import docstringparser
docstringparser.DEFAULT_DOCFORMAT = options.docformat
@@ -770,10 +779,13 @@
options, names = parse_arguments()
try:
- if options.profile:
- _profile()
- else:
- main(options, names)
+ try:
+ if options.profile:
+ _profile()
+ else:
+ main(options, names)
+ finally:
+ log.close()
except SystemExit:
raise
except KeyboardInterrupt:
@@ -1169,14 +1181,95 @@
def print_times(self):
pass
+class HTMLLogger(log.Logger):
+ """
+ A logger used to generate a log of all warnings and messages to an
+ HTML file.
+ """
+
+ FILENAME = "epydoc-log.html"
+ HEADER = textwrap.dedent('''\
+ <?xml version="1.0" encoding="ascii"?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>$title$</title>
+ <link rel="stylesheet" href="epydoc.css" type="text/css" />
+ </head>
+
+ <body bgcolor="white" text="black" link="blue" vlink="#204080"
+ alink="#204080">
+ <h1 class="epydoc">Epydoc Log</h1>
+ <p class="log">Epydoc started at %s</p>''')
+ START_BLOCK = '<div class="log-block"><h2 class="log-hdr">%s</h2>'
+ MESSAGE = '<div class="log-%s"><pre class="log"><b>%s</b>: %s</pre></div>\n'
+ END_BLOCK = '</div>'
+ FOOTER = "</body>\n</html>\n"
+
+ def __init__(self, directory, options):
+ self.start_time = time.time()
+ self.out = open(os.path.join(directory, self.FILENAME), 'w')
+ self.out.write(self.HEADER % time.ctime(self.start_time))
+ self.is_empty = True
+ self.options = options
+
+ def write_options(self, options):
+ self.out.write(self.START_BLOCK % 'Epydoc Options')
+ msg = '<table border="0" cellpadding="0" cellspacing="0">\n'
+ opts = [(key, getattr(options, key)) for key in dir(options)
+ if key not in dir(optparse.Values)]
+ opts = [(val==OPTION_DEFAULTS.get(key), key, val)
+ for (key, val) in opts]
+ for is_default, key, val in sorted(opts):
+ css = is_default and 'opt-default' or 'opt-changed'
+ msg += ('<tr class="%s"><td>%s</td><td><tt> = '
+ '</tt></td><td><tt>%s</tt></td></tr>' %
+ (css, key, plaintext_to_html(repr(val))))
+ msg += '</table>\n'
+ self.out.write('<div class="log-info">\n%s</div>\n' % msg)
+ self.out.write(self.END_BLOCK)
+
+ def start_block(self, header):
+ self.out.write(self.START_BLOCK % header)
+
+ def end_block(self):
+ self.out.write(self.END_BLOCK)
+
+ def log(self, level, message):
+ if message.endswith("(-v) to display markup errors."): return
+ if level >= log.ERROR:
+ self.out.write(self.MESSAGE % ('error', 'Error', message))
+ self.is_empty = False
+ elif level >= log.DOCSTRING_WARNING:
+ self.out.write(self.MESSAGE % ('warning', 'Warning', message))
+ self.is_empty = False
+
+ def close(self):
+ if self.is_empty:
+ self.out.write('<div class="log-info">'
+ 'No warnings or errors!</div>')
+ self.write_options(self.options)
+ self.out.write('<p class="log">Epydoc finished at %s</p>\n'
+ '<p class="log">(Elapsed time: %s)</p>' %
+ (time.ctime(), self._elapsed_time()))
+ self.out.write(self.FOOTER)
+ self.out.close()
+
+ def _elapsed_time(self):
+ secs = int(time.time()-self.start_time)
+ if secs < 60:
+ return '%d seconds' % secs
+ if secs < 3600:
+ return '%d minutes, %d seconds' % (secs/60, secs%60)
+ else:
+ return '%d hours, %d minutes' % (secs/3600, secs%3600)
+
+
######################################################################
## main
######################################################################
if __name__ == '__main__':
- try:
- cli()
- except:
- print '\n\n'
- raise
+ cli()
Modified: trunk/epydoc/src/epydoc/docwriter/html.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-14 00:34:00 UTC (rev 1487)
+++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-14 00:34:27 UTC (rev 1488)
@@ -288,6 +288,9 @@
@type include_source_code: C{boolean}
@keyword include_source_code: If true, then generate colorized
source code files for each python module.
+ @type include_log: C{boolean}
+ @keyword include_log: If true, the the footer will include an
+ href to the page 'epydoc-log.html'.
"""
self.docindex = docindex
@@ -349,6 +352,9 @@
self._graph_types = kwargs.get('graphs', ()) or ()
"""Graphs that we should include in our output."""
+ self._include_log = kwargs.get('include_log', False)
+ """Are we generating an HTML log page?"""
+
self._callgraph_cache = {}
"""Map the callgraph L{uid<DotGraph.uid>} to their HTML
representation."""
@@ -1653,8 +1659,14 @@
>>> if not short:
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
- <td align="left" class="footer">Generated by Epydoc
- $epydoc.__version__$ on $time.asctime()$</td>
+ <td align="left" class="footer">
+ >>> if self._include_log:
+ <a href="epydoc-log.html">Generated by Epydoc
+ $epydoc.__version__$ on $time.asctime()$</a>
+ >>> else:
+ Generated by Epydoc $epydoc.__version__$ on $time.asctime()$
+ >>> #endif
+ </td>
<td align="right" class="footer">
<a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
</td>
Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 00:34:00 UTC (rev 1487)
+++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-14 00:34:27 UTC (rev 1488)
@@ -316,8 +316,29 @@
margin: 0; }
.nomargin-top { margin-top: 0; }
.nomargin { margin-top: 0; margin-bottom: 0; }
-"""
+/* HTML Log */
+div.log-block { padding: 0; margin: .5em;
+ background: $log_bg; color: $log_fg;
+ border: $log_border; }
+div.log-error { padding: .5em; margin: .5em;
+ background: $log_error_bg; color: $log_error_fg;
+ border: $log_error_border; }
+div.log-warning { padding: .5em; margin: .5em;
+ background: $log_warn_bg; color: $log_warn_fg;
+ border: $log_warn_border; }
+div.log-info { padding: .5em; margin: .5em;
+ background: $log_info_bg; color: $log_info_fg;
+ border: $log_info_border; }
+h2.log-hdr { background: $log_hdr_bg; color: $log_hdr_fg;
+ margin: 0; padding: 0.1em 0.5em 0.1em 0.5em;
+ border-bottom: $log_border; }
+p.log { font-weight: bold; }
+tr.opt-changed { color: $opt_changed_fg; font-weight: bold; }
+tr.opt-default { color: $opt_default_fg; }
+pre.log { margin: 0; padding: 0; }
+"""
+
############################################################
## Derived stylesheets
############################################################
@@ -425,6 +446,23 @@
py_decorator = '#804020',
# Graphs
graph_border = '1px solid #000000',
+ # Log block
+ log_bg = '#e8f0f8',
+ log_fg = '#000000',
+ log_border = '1px solid #000000',
+ log_hdr_bg = '#70b0ff',
+ log_hdr_fg = '#000000',
+ log_error_bg = '#ffb0b0',
+ log_error_fg = '#000000',
+ log_error_border = '1px solid #000000',
+ log_warn_bg = '#ffffb0',
+ log_warn_fg = '#000000',
+ log_warn_border = '1px solid #000000',
+ log_info_bg = '#b0ffb0',
+ log_info_fg = '#000000',
+ log_info_border = '1px solid #000000',
+ opt_changed_fg = '#000000',
+ opt_default_fg = '#606060',
)
_BLUE_COLORS = _WHITE_COLORS.copy()
Modified: trunk/epydoc/src/epydoc/log.py
===================================================================
--- trunk/epydoc/src/epydoc/log.py 2007-02-14 00:34:00 UTC (rev 1487)
+++ trunk/epydoc/src/epydoc/log.py 2007-02-14 00:34:27 UTC (rev 1488)
@@ -64,6 +64,11 @@
message.
"""
+ def close(self):
+ """
+ Perform any tasks needed to close this logger.
+ """
+
#////////////////////////////////////////////////////////////
# Message blocks
#////////////////////////////////////////////////////////////
@@ -195,4 +200,5 @@
for logger in _loggers: logger.progress(percent, '%s' % message)
progress.__doc__ = Logger.progress.__doc__
-
+def close():
+ for logger in _loggers: logger.close()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|