epydoc-commits Mailing List for Python API documentation generation tool (Page 24)
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...> - 2006-06-22 14:53:57
|
Revision: 1234 Author: dvarrazzo Date: 2006-06-22 07:53:52 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1234&view=rev Log Message: ----------- - Verbosity values from config file and command line are summed together (the latter used to overwrite the former). Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-06-22 14:47:48 UTC (rev 1233) +++ trunk/epydoc/src/epydoc/cli.py 2006-06-22 14:53:52 UTC (rev 1234) @@ -286,7 +286,8 @@ optparser.error("Invalid graph type %s." % graph_type) # Calculate verbosity. - options.verbosity = options.verbose - options.quiet + verbosity = getattr(options, 'verbosity', 0) + options.verbosity = verbosity + options.verbose - options.quiet # The target default depends on the action. if options.target is None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2006-06-22 14:47:53
|
Revision: 1233 Author: dvarrazzo Date: 2006-06-22 07:47:48 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1233&view=rev Log Message: ----------- - The option "graphs: all" works in config file too. Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-06-22 14:32:06 UTC (rev 1232) +++ trunk/epydoc/src/epydoc/cli.py 2006-06-22 14:47:48 UTC (rev 1233) @@ -355,8 +355,8 @@ elif optname == 'graph': graphtypes = val.replace(',', '').split() for graphtype in graphtypes: - if graphtype not in GRAPH_TYPES: - raise ValueError('"%s" expected one of: %s.' % + if graphtype not in GRAPH_TYPES + ('all',): + raise ValueError('"%s" expected one of: all, %s.' % (optname, ', '.join(GRAPH_TYPES))) options.graphs.extend(graphtypes) elif optname in ('separate-classes', 'separate_classes'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2006-06-22 14:32:11
|
Revision: 1232 Author: dvarrazzo Date: 2006-06-22 07:32:06 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1232&view=rev Log Message: ----------- - The dotgraph module is looked for in the right package. Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-04-19 00:30:37 UTC (rev 1231) +++ trunk/epydoc/src/epydoc/cli.py 2006-06-22 14:32:06 UTC (rev 1232) @@ -428,7 +428,7 @@ # Set the dot path if options.dotpath: - from epydoc import dotgraph + from epydoc.docwriter import dotgraph dotgraph.DOT_PATH = options.dotpath # Build docs for the named values. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-19 00:30:46
|
Revision: 1231 Author: edloper Date: 2006-04-18 17:30:37 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1231&view=rev Log Message: ----------- - Doctest colorization moved to epydoc.markup.doctest - Do doctest colorization for rst - Fixed the overridden starttag method for rendering rst as html Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/epytext.py trunk/epydoc/src/epydoc/markup/restructuredtext.py Added Paths: ----------- trunk/epydoc/src/epydoc/markup/doctest.py Added: trunk/epydoc/src/epydoc/markup/doctest.py =================================================================== --- trunk/epydoc/src/epydoc/markup/doctest.py (rev 0) +++ trunk/epydoc/src/epydoc/markup/doctest.py 2006-04-19 00:30:37 UTC (rev 1231) @@ -0,0 +1,151 @@ +# +# doctest.py: Syntax Highlighting for doctest blocks +# Edward Loper +# +# Created [06/28/03 02:52 AM] +# $Id: restructuredtext.py 1210 2006-04-10 13:25:50Z edloper $ +# + +""" +Syntax highlighting for doctest blocks. This module defines two +functions, L{doctest_to_html()} and L{doctest_to_latex()}, which can +be used to perform syntax highlighting on doctest blocks. It also +defines the more general L{colorize_doctest()}, which could be used to +do syntac highlighting on doctest blocks with other output formats. +(Both C{doctest_to_html()} and C{doctest_to_latex()} are defined using +C{colorize_doctest()}.) +""" + +import re +from epydoc.util import plaintext_to_html, plaintext_to_latex + +def doctest_to_html(s): + """ + Perform syntax highlighting on the given doctest string, and + return the resulting HTML code. This code consists of a C{<pre>} + block with class=py-doctest. Syntax highlighting is performed + using the following css classes: 'py-prompt', 'py-keyword', + 'py-string', 'py-comment', and 'py-output'. + """ + return ('<pre class="py-doctest">\n%s\n</pre>\n' % + colorize_doctest(s, _tag_span_html).strip()) + +def doctest_to_latex(s): + """ + Perform syntax highlighting on the given doctest string, and + return the resulting LaTeX code. This code consists of an + C{alltt} environment. Syntax highlighting is performed using five + new latex commands, which must be defined externally: + '\pysrcprompt', '\pysrckeyword', '\pysrcstring', '\pysrccomment', + and '\pysrcoutput'. + """ + return ('\\begin{alltt}\n%s\n\\end{alltt}\n' % + colorize_doctest(s, _tag_span_latex).strip()) + +def _tag_span_html(s, tag): + return '<span class="py-%s">%s</span>' % (tag, plaintext_to_html(s)) + +def _tag_span_latex(s, tag): + return '\\pysrc%s{%s}' % (tag, plaintext_to_latex(s)) + +# Regular expressions for colorize_doctestblock +_KEYWORDS = ["del", "from", "lambda", "return", "and", "or", "is", + "global", "not", "try", "break", "else", "if", "elif", + "while", "class", "except", "import", "pass", "raise", + "continue", "finally", "in", "print", "def", "for"] +_KEYWORD = '|'.join([r'(\b%s\b)' % _KW for _KW in _KEYWORDS]) +_STRING = (r""" +[uU]?[rR]? + (?: # Single-quote (') strings + '''(?: # Tripple-quoted can contain... + [^'] | # a non-quote + \\' | # a backslashed quote + '{1,2}(?!') # one or two quotes + )*''' | + '(?: # Non-tripple quoted can contain... + [^'] | # a non-quote + \\' # a backslashded quote + )*'(?!') | """+ +r''' # Double-quote (") strings + """(?: # Tripple-quoted can contain... + [^"] | # a non-quote + \\" | # a backslashed single + "{1,2}(?!") # one or two quotes + )*""" | + "(?: # Non-tripple quoted can contain... + [^"] | # a non-quote + \\" # a backslashded quote + )*"(?!") +)''') +_COMMENT = '(#.*?$)' +_PROMPT = r'^\s*(?:>>>|\.\.\.)(?:\s|$)' + +PROMPT_RE = re.compile('(%s)' % _PROMPT, re.MULTILINE | re.DOTALL) +'''The regular expression used to find Python prompts (">>>" and +"...") in doctest blocks.''' + +DOCTEST_RE = re.compile( + '(?P<STRING>%s)|(?P<COMMENT>%s)|(?P<KEYWORD>%s)|(?P<PROMPT>%s)|.+?' % + (_STRING, _COMMENT, _KEYWORD, _PROMPT), re.MULTILINE | re.DOTALL) +'''The regular expression used by L{_doctest_sub} to colorize doctest +blocks.''' + +def colorize_doctest(s, markup_func): + """ + Colorize the given doctest string C{s} using C{markup_func()}. + C{markup_func()} should be a function that takes a substring and a + tag, and returns a colorized version of the substring. E.g.: + + >>> def html_markup_func(s, tag): + ... return '<span class="%s">%s</span>' % (tag, s) + + The tags that will be passed to the markup function are: + - C{prompt} -- a Python prompt (>>> or ...) + - C{keyword} -- a Python keyword (for, if, etc.) + - C{string} -- a string literal + - C{comment} -- a comment + - C{output} -- the output from a doctest block. + - C{other} -- anything else (does *not* include output.) + """ + pysrc = [] # the source code part of a docstest block (lines) + pyout = [] # the output part of a doctest block (lines) + result = [] + out = result.append + + def subfunc(match): + if match.group('PROMPT'): + return markup_func(match.group(), 'prompt') + if match.group('KEYWORD'): + return markup_func(match.group(), 'keyword') + if match.group('COMMENT'): + return markup_func(match.group(), 'comment') + if match.group('STRING') and '\n' not in match.group(): + return markup_func(match.group(), 'string') + elif match.group('STRING'): + # It's a multiline string; colorize the string & prompt + # portion of each line. + pieces = [markup_func(s, ['string','prompt'][i%2]) + for i, s in enumerate(PROMPT_RE.split(match.group()))] + return ''.join(pieces) + else: + return markup_func(match.group(), 'other') + + for line in s.split('\n')+['\n']: + if PROMPT_RE.match(line): + pysrc.append(line) + if pyout: + result.append(markup_func('\n'.join(pyout).strip(), 'output')) + pyout = [] + else: + pyout.append(line) + if pysrc: + pysrc = DOCTEST_RE.sub(subfunc, '\n'.join(pysrc)) + result.append(pysrc.strip()) + #result.append(markup_func(pysrc.strip(), 'python')) + pysrc = [] + + remainder = '\n'.join(pyout).strip() + if remainder: + result.append(markup_func(remainder, 'output')) + + return '\n'.join(result) Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2006-04-13 07:24:22 UTC (rev 1230) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2006-04-19 00:30:37 UTC (rev 1231) @@ -109,7 +109,7 @@ import xml.dom.minidom from epydoc.markup import * from epydoc.util import wordwrap, plaintext_to_html, plaintext_to_latex -from epydoc.docwriter.html_colorize import colorize_doctestblock +from epydoc.markup.doctest import doctest_to_html, doctest_to_latex ################################################## ## Constants @@ -1817,8 +1817,7 @@ elif tree.tagName == 'literalblock': return '<pre class="literalblock">\n%s\n</pre>\n' % childstr elif tree.tagName == 'doctestblock': - dtb = colorize_doctestblock(childstr.strip()) - return '<pre class="doctestblock">\n%s</pre>\n' % dtb + return doctest_to_html(tree.childNodes[0].data.strip()) elif tree.tagName == 'fieldlist': raise AssertionError("There should not be any field lists left") elif tree.tagName in ('epytext', 'section', 'tag', 'arg', @@ -1935,7 +1934,7 @@ elif tree.tagName == 'heading': return ' '*(indent-2) + '(section) %s\n\n' % childstr elif tree.tagName == 'doctestblock': - return '\\begin{alltt}\n%s\\end{alltt}\n\n' % childstr + return doctest_to_latex(tree.childNodes[0].data.strip()) elif tree.tagName == 'literalblock': return '\\begin{alltt}\n%s\\end{alltt}\n\n' % childstr elif tree.tagName == 'fieldlist': Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2006-04-13 07:24:22 UTC (rev 1230) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2006-04-19 00:30:37 UTC (rev 1231) @@ -84,6 +84,7 @@ from epydoc.markup import * from epydoc.apidoc import ModuleDoc, ClassDoc from epydoc.docwriter.dotgraph import * +from epydoc.markup.doctest import doctest_to_html, doctest_to_latex #: A dictionary whose keys are the "consolidated fields" that are #: recognized by epydoc; and whose values are the corresponding epydoc @@ -455,15 +456,21 @@ target = self.encode(node.astext()) xref = self._linker.translate_identifier_xref(target, target) self.body.append(xref) - raise SkipNode + raise SkipNode() def visit_document(self, node): pass def depart_document(self, node): pass # For now, just ignore dotgraphs. [XXX] - def visit_dotgraph(self, node): pass - def depart_dotgraph(self, node): pass + def visit_dotgraph(self, node): + log.warning("Ignoring dotgraph in latex output (dotgraph " + "rendering for latex not implemented yet).") + raise SkipNode() + def visit_doctest_block(self, node): + self.body.append(doctest_to_latex(str(node[0]))) + raise SkipNode() + class _EpydocHTMLTranslator(HTMLTranslator): def __init__(self, document, docstring_linker, directory, docindex, context): @@ -484,7 +491,7 @@ target = self.encode(node.astext()) xref = self._linker.translate_identifier_xref(target, target) self.body.append(xref) - raise SkipNode + raise SkipNode() def should_be_compact_paragraph(self, node): if self.document.children == [node]: @@ -505,24 +512,35 @@ - hrefs not starting with C{'#'} are given target='_top' - all headings (C{<hM{n}>}) are given the css class C{'heading'} """ - # Prefix all CSS classes with "rst-" - if attributes.has_key('class'): - attributes['class'] = 'rst-%s' % attributes['class'] + # Get the list of all attribute dictionaries we need to munge. + attr_dicts = [attributes] + if isinstance(node, docutils.nodes.Node): + attr_dicts.append(node.attributes) + if isinstance(node, dict): + attr_dicts.append(node) + # Munge each attribute dictionary. Unfortunately, we need to + # iterate through attributes one at a time because some + # versions of docutils don't case-normalize attributes. + for attr_dict in attr_dicts: + for (key, val) in attr_dict.items(): + # Prefix all CSS classes with "rst-"; and prefix all + # names with "rst-" to avoid conflicts. + if key.lower() in ('class', 'id', 'name'): + attr_dict[key] = 'rst-%s' % val + elif key.lower() in ('classes', 'ids', 'names'): + attr_dict[key] = ['rst-%s' % cls for cls in val] + elif key.lower() == 'href': + if attr_dict[key][:1]=='#': + attr_dict[key] = '#rst-%s' % attr_dict[key][1:] + else: + # If it's an external link, open it in a new + # page. + attr_dict['target'] = '_top' - # Prefix all names with "rst-", to avoid conflicts - if attributes.has_key('id'): - attributes['id'] = 'rst-%s' % attributes['id'] - if attributes.has_key('name'): - attributes['name'] = 'rst-%s' % attributes['name'] - if attributes.has_key('href'): - if attributes['href'][:1]=='#': - attributes['href'] = '#rst-%s' % attributes['href'][1:] - else: - attributes['target'] = '_top' - # For headings, use class="heading" if re.match(r'^h\d+$', tagname): - attributes['class'] = 'heading' + attributes['class'] = ' '.join([attributes.get('class',''), + 'heading']).strip() return HTMLTranslator.starttag(self, node, tagname, suffix, **attributes) @@ -538,9 +556,11 @@ image_url = '%s.gif' % graph.uid image_file = os.path.join(self._directory, image_url) self.body.append(graph.to_html(image_file, image_url)) + raise SkipNode() - def depart_dotgraph(self, node): - pass # Nothing to do. + def visit_doctest_block(self, node): + self.body.append(doctest_to_html(str(node[0]))) + raise SkipNode() ###################################################################### #{ Graph Generation Directives This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-13 07:24:24
|
Revision: 1230 Author: edloper Date: 2006-04-13 00:24:22 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1230&view=rev Log Message: ----------- - Fixed bad links Modified Paths: -------------- trunk/epydoc/doc/faq.html Modified: trunk/epydoc/doc/faq.html =================================================================== --- trunk/epydoc/doc/faq.html 2006-04-13 07:17:41 UTC (rev 1229) +++ trunk/epydoc/doc/faq.html 2006-04-13 07:24:22 UTC (rev 1230) @@ -91,7 +91,7 @@ add support for my favorite markup language <i>xyz</i>?</p> <dd> <p>No, but you can! See the documentation for the function <a - href="http://syse.local/epydoc/api/epydoc.markup-module.html#register_markup_language" + href="epydoc.markup-module.html#register_markup_language" ><code>register_markup_language()</code></a>, which can be used to register new markup languages. If you add support for a new markup language, and believe that others might like to use it, please @@ -102,7 +102,7 @@ <dd><p>You can add new fields that describe simple metadata using the <code>@newfield</code> field. See the documentation for <a - href="http://syse.local/~edloper/epydoc/fields.html#newfield">fields</a> + href="fields.html#newfield">fields</a> for more information. </p></dd> </p></dd> </dl> @@ -250,7 +250,7 @@ generated documentation? </p></dt> <dd><p>Use the <code>@undocumented</code> field. See the documentation for <a - href="http://syse.local/~edloper/epydoc/fields.html">fields</a> for + href="fields.html">fields</a> for more information. </p></dd> </dl> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-13 07:17:46
|
Revision: 1229 Author: edloper Date: 2006-04-13 00:17:41 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1229&view=rev Log Message: ----------- - s/Index/Indices/ on the navbar Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-13 07:14:46 UTC (rev 1228) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-13 07:17:41 UTC (rev 1229) @@ -1520,10 +1520,10 @@ <!-- Index link --> >>> if context == "indices": <th bgcolor="#70b0f0" class="navselect" - > Index </th> + > Indices </th> >>> else: <th class="navbar"> <a class="navbar" - href="identifier-index.html">Index</a> </th> + href="identifier-index.html">Indices</a> </th> >>> #endif <!-- Help link --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-13 07:14:53
|
Revision: 1228 Author: edloper Date: 2006-04-13 00:14:46 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1228&view=rev Log Message: ----------- - Revamped index page - Added bug index - Added todo index - split into 4 pages - improved formatting - Cleaned up css a little (more left to do) 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 2006-04-12 21:01:16 UTC (rev 1227) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-13 07:14:46 UTC (rev 1228) @@ -390,8 +390,11 @@ if not isinstance(d, GenericValueDoc)] for doc in valdocs: if isinstance(doc, NamespaceDoc): - self.indexed_docs += [doc for doc in doc.variables.values() if - isinstance(doc.value, GenericValueDoc)] + # add any vars with generic vlaues; but don't include + # inherited vars. + self.indexed_docs += [d for d in doc.variables.values() if + isinstance(d.value, GenericValueDoc) + and d.container == doc] self.indexed_docs.sort() # Figure out the url for the top page. @@ -403,7 +406,7 @@ for doc in self.module_list: 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) + 9 + self._num_files = len(self.class_list) + 2*len(self.module_list) + 12 if self._incl_sourcecode: self._num_files += len(self.modules_with_sourcecode) @@ -499,7 +502,27 @@ self.write_javascript(directory) # Write the term & identifier indices - self._write(self.write_indices, directory, 'indices.html') + indices = {'ident': self.build_identifier_index(), + 'term': self.build_term_index(), + 'bug': self.build_metadata_index('bug'), + 'todo': self.build_metadata_index('todo')} + self._write(self.write_identifier_index, directory, + 'identifier-index.html', indices) + if indices['term']: + self._write(self.write_term_index, directory, + 'term-index.html', indices) + else: + self._files_written += 1 # (skipped) + if indices['bug']: + self._write(self.write_metadata_index, directory, + 'bug-index.html', indices, 'bug', 'Bug List') + else: + self._files_written += 1 # (skipped) + if indices['todo']: + self._write(self.write_metadata_index, directory, + 'todo-index.html', indices, 'todo', 'To Do List') + else: + self._files_written += 1 # (skipped) # Write the trees file (package & class hierarchies) self._write(self.write_trees, directory, 'trees.html') @@ -549,6 +572,9 @@ estr += ' (from %s)\n' % name log.docstring_warning(estr) + # [xx] testing: + assert self._num_files == self._files_written + def _write(self, write_func, directory, filename, *args): # Display our progress. self._files_written += 1 @@ -772,8 +798,6 @@ """ Write an HTML page containing the module and class hierarchies to the given streams. - @param public: The output stream for the public version of the page. - @param private: The output stream for the private version of the page. """ # Header material. self.write_header(out, 'Trees') @@ -801,135 +825,159 @@ self.write_footer(out) #//////////////////////////////////////////////////////////// - #{ 2.4. Indices page + #{ 2.4. Index pages #//////////////////////////////////////////////////////////// - def write_indices(self, out): + def write_identifier_index(self, out, indices): """ - Write an HTML page containing the term and identifier indices - to the given streams. - @bug: If there are private indexed terms, but no public - indexed terms, then this function will still write a - header for the Term Index to the public stream. - @param public: The output stream for the public version of the page. - @param private: The output stream for the private version of the page. + Write an HTML page containing the identifier index. """ # Header material. - self.write_header(out, 'Index') + self.write_header(out, 'Identifier Index') self.write_navbar(out, 'indices') - self.write_breadcrumbs(out, 'indices', 'indices.html') - out('<br />\n') + self.write_breadcrumbs(out, 'indices', 'identifier-index.html') + self.write_index_pointers(out, indices) - terms = self._extract_term_index() - if terms: - self.write_term_index(out, terms) + # Write a header with the page name and links to all available + # letters. + out('<table border="0" width="100%">\n' + '<tr valign="bottom"><td width="100%">\n' + '<a name="identifiers"><h2 class="index">' + 'Identifier Index</h2></a>\n' + '</td><td>\n') + out('[') + for letter in 'ABCDEFGHIJKLMNOPQRSTUVWZYZ_': + if letter in indices['ident']: + out(' <a href="#identifiers-%s">%s</a>' % + (letter, letter)) + else: + out(' %s' % letter) + out(' ]\n') - # [xx] this will only find variables if they have values. - # (e.g., it won't list any instance variables.) - identifiers = [] - for doc in self.indexed_docs: - name = doc.canonical_name - if self.url(doc) is None: continue - key = name[-1].lower() - key = (key[:1] in 'abcdefghijklmnopqrstuvwxyz', key) - identifiers.append( (key, name, doc) ) - - identifiers.sort() - if identifiers: - self.write_identifier_index(out, identifiers) + # Write the identifier index itself. + out('</td></table>\n') + out('<table border="0" width="100%"><tr valign="top">\n') + for letter in sorted(indices['ident'].iterkeys()): + out('<td valign="top" width="1%">') + out('<a name="identifiers-%s"><h2>%s</h2></a></td>\n' % + (letter, letter)) + out('<td valign="top">\n') + section = sorted(indices['ident'][letter]) + self.write_index_section(out, section, True) + out('</td></tr>\n') + out('</table>\n</br />') # Footer material. + out('<br />') self.write_navbar(out, 'indices') self.write_footer(out) - write_identifier_index_header = compile_template( + def write_term_index(self, out, indices): """ - write_identifier_index_header(self, out) - """, - # /------------------------- Template -------------------------\ - ''' - <!-- ==================== IDENTIFIER INDEX ==================== --> - <table class="index" border="1" cellpadding="3" - cellspacing="0" width="100%" bgcolor="white"> - <tr bgcolor="#70b0f0" class="index"><th colspan="2"> - <table border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr><th class="index">Identifier Index</th> - <td width="100%" align="right"> [ - <a href="#_">_</a> - >>> for c in "abcdefghijklmnopqrstuvwxyz": - <a href="#$c$">$c$</a> - >>> #endfor - ] </td> - </tr></table> - </th></tr> - ''') - # \------------------------------------------------------------/ - - write_identifier_index = compile_template( + Write an HTML page containing the term index. """ - write_identifier_index(self, out, index) - """, - # /------------------------- Template -------------------------\ - ''' - >>> #self.write_table_header(out, "index", "Identifier Index") - >>> self.write_identifier_index_header(out) - >>> letters = "abcdefghijklmnopqrstuvwxyz" - <a name="_"></a> - >>> for sortkey, name, doc in index: - >>> if self._doc_or_ancestor_is_private(doc): - >>> if not self._show_private: continue - <tr class="private"><td width="15%"> - >>> else: - <tr><td width="15%"> - >>> #endif - >>> while letters and letters[0] <= name[-1][:1].lower(): - <a name="$letters[0]$"></a> - >>> letters = letters[1:] - >>> #endif - $self.href(doc, name[-1])$ - </td> - <td>$self.doc_kind(doc)$ - >>> container_name = name.container() - >>> if container_name is not None: - >>> container = self.docindex.get_valdoc(container_name) - >>> if container is not None: - in $self.doc_kind(container)$ $self.href(container)$ - >>> #endif - >>> #endif - </td> - </tr> - >>> #endfor - </table> - >>> for letter in letters: - <a name="$letter$"></a> - >>> #endfor - <br /> - ''') - # \------------------------------------------------------------/ + # Header material. + self.write_header(out, 'Term Index') + self.write_navbar(out, 'indices') + self.write_breadcrumbs(out, 'indices', 'term-index.html') + self.write_index_pointers(out, indices) - write_term_index = compile_template( + out('<a name="term"><h2 class="index">Term Definition Index</h2></a>') + self.write_index_section(out, sorted(indices['term'], + key=lambda v:v[0].lower())) + + # Footer material. + out('<br />') + self.write_navbar(out, 'indices') + self.write_footer(out) + + def write_metadata_index(self, out, indices, field, title): """ - write_term_index(self, out, index) - """, - # /------------------------- Template -------------------------\ - ''' - >>> if not index: return - >>> self.write_table_header(out, "index", "Term Index") - >>> for (key, term, links) in index: - <tr><td width="15%">$term.to_plaintext(None)$</td> - <td> - >>> for link in links[:-1]: - <em>$self.href(link)$</em>, - >>> #endfor - <em>$self.href(links[-1])$</em> - </td> - </tr> - >>> #endfor - </table> - <br /> - ''') - # \------------------------------------------------------------/ + Write an HTML page containing a metadata index. + """ + # Header material. + self.write_header(out, title) + self.write_navbar(out, 'indices') + self.write_breadcrumbs(out, 'indices', '%s-index.html' % field) + self.write_index_pointers(out, indices) + index = indices[field] + # [XX} FIXME + out('<a name="%s"><h2 class="index">%s</h2></a>' % + (field, title)) + + for arg in sorted(index): + # Write a section title. + if arg is not None: + if len([1 for (doc, descrs) in index[arg] if + not self._doc_or_ancestor_is_private(doc)]) == 0: + out('<div class="private">') + else: + out('<div>') + self.write_table_header(out, 'index', arg) + out('</table>') + # List every descr for this arg. + for (doc, descrs) in index[arg]: + if self._doc_or_ancestor_is_private(doc): + out('<div class="private">\n') + else: + out('<div>\n') + out('<table width="100%" class="details" ' + 'bgcolor="#e0e0e0"><tr><td>') + out('<b>In %s</b>' % self.href(doc)) + out(' <ul>\n') + for descr in descrs: + out(' <li>%s</li>\n' % + self.docstring_to_html(descr,doc,4)) + out(' </ul>\n') + out('</table></div>\n') + out('</dl>\n') + + # Footer material. + out('<br />') + self.write_navbar(out, 'indices') + self.write_footer(out) + + def write_index_pointers(self, out, indices): + """ + A helper for the index page generation functions, which + generates a header that can be used to navigate between the + different indices. + """ + if len(indices) > 1: + out('<center><b>[\n') + out(' <a href="identifier-index.html">Identifier Index</a>\n') + if indices['term']: + out('| <a href="term-index.html">Term Definition Index</a>\n') + if indices['bug']: + out('| <a href="bug-index.html">Bug List</a>\n') + if indices['todo']: + out('| <a href="todo-index.html">To Do List</a>\n') + out(']</b></center>\n') + + def write_index_section(self, out, items, add_blankline=False): + out('<table class="index" width="100%" border="1">\n') + num_rows = (len(items)+2)/3 + for row in range(num_rows): + out(' <tr>\n') + for col in range(3): + out(' <td width="33%" class="index">') + i = col*num_rows+row + if i < len(items): + name, url, container = items[col*num_rows+row] + out('<a href="%s">%s</a>' % (url, name)) + if container is not None: + out('<br />\n ') + out('<font size="-2">(in %s)</font>' % + self.href(container)) + else: + out(' ') + out('</td>\n') + out(' </tr>\n') + if add_blankline and num_rows == 1: + out(' <tr>'+3*'<td class="index"> </td>'+'</tr>\n') + out('</table>\n') + #//////////////////////////////////////////////////////////// #{ 2.5. Help Page #//////////////////////////////////////////////////////////// @@ -940,9 +988,6 @@ C{self._helpfile} contains a help file, then use it; otherwise, use the default helpfile from L{epydoc.docwriter.html_help}. - - @param public: The output stream for the public version of the page. - @param private: The output stream for the private version of the page. """ # todo: optionally parse .rst etc help files? @@ -1085,8 +1130,6 @@ the given module to the given streams. This page lists the modules, classes, exceptions, functions, and variables defined by the module. - @param public: The output stream for the public version of the page. - @param private: The output stream for the private version of the page. """ name = doc.canonical_name[-1] self.write_header(out, name) @@ -1454,7 +1497,7 @@ <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> - >>> if self._top_page_url not in ("trees.html", "indices.html", "help.html"): + >>> if self._top_page_url not in ("trees.html", "identifier-index.html", "help.html"): <!-- Home link --> >>> if (isinstance(context, ValueDoc) and >>> self._top_page_url == self.url(context.canonical_name)): @@ -1480,7 +1523,7 @@ > Index </th> >>> else: <th class="navbar"> <a class="navbar" - href="indices.html">Index</a> </th> + href="identifier-index.html">Index</a> </th> >>> #endif <!-- Help link --> @@ -1686,7 +1729,7 @@ self.write_inheritance_list(out, doc, listed_inh_vars) def write_inheritance_list(self, out, doc, listed_inh_vars): - out(' <tr>\n <td colspan="2">\n') + out(' <tr>\n <td colspan="2" class="summary">\n') for base in doc.mro(): if base not in listed_inh_vars: continue public_vars = [v for v in listed_inh_vars[base] @@ -1761,10 +1804,12 @@ # /------------------------- Template -------------------------\ ''' <tr$tr_class$> - <td width="15%" align="right" valign="top" class="rtype"> - $self.rtype(var_doc, indent=6) or " "$ + <td width="15%" align="right" valign="top" class="summary"> + <span class="rtype"> + $self.rtype(var_doc, indent=6) or " "$ + </span> </td> - <td> + <td class="summary"> $self.function_signature(var_doc, link_name=True)$ $summary$ </td> @@ -1779,9 +1824,9 @@ # /------------------------- Template -------------------------\ ''' <tr$tr_class$> - <td width="15%"> + <td width="15%" class="summary"> <strong>$self.href(var_doc)$</strong></td> - <td>$summary or " "$</td> + <td class="summary">$summary or " "$</td> </tr> ''') # \------------------------------------------------------------/ @@ -1911,7 +1956,7 @@ >>> func_doc = var_doc.value <a name="$var_doc.name$"></a> <div$div_class$> - <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <table width="100%" class="details" bgcolor="#e0e0e0"><tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3>$self.function_signature(var_doc)$ @@ -2017,7 +2062,7 @@ >>> prop_doc = var_doc.value <a name="$var_doc.name$"></a> <div$div_class$> - <table width="100%" class="prop-details" bgcolor="#e0e0e0"><tr><td> + <table width="100%" class="details" bgcolor="#e0e0e0"><tr><td> <h3>$var_doc.name$</h3> $descr$ <dl><dt></dt><dd> @@ -2047,7 +2092,7 @@ ''' <a name="$var_doc.name$"></a> <div$div_class$> - <table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td> + <table width="100%" class="details" bgcolor="#e0e0e0"><tr><td> <h3>$var_doc.name$</h3> $descr$ <dl><dt></dt><dd> @@ -2069,9 +2114,9 @@ ''') # \------------------------------------------------------------/ - _variable_linelen = 70 + _variable_linelen = 80 _variable_maxlines = 3 - _variable_tooltip_linelen = 70 + _variable_tooltip_linelen = 80 def variable_tooltip(self, var_doc): if var_doc.value in (None, UNKNOWN): return '' @@ -2094,10 +2139,10 @@ summary_linelen) elif val_doc.parse_repr is not UNKNOWN: s = plaintext_to_html(val_doc.parse_repr) - return self._linewrap_html(s, self._variable_linelen, - self._variable_maxlines) else: - return self.href(val_doc) + s = self.href(val_doc) + return self._linewrap_html(s, self._variable_linelen, + self._variable_maxlines) def pprint_pyval(self, pyval, multiline=True, summary_linelen=0): # Handle the most common cases first. The following types @@ -2257,7 +2302,7 @@ @rtype: C{string} """ if context is None: - context = doc + context = doc.defining_module if width == None: width = self.find_tree_width(doc, context) if isinstance(doc, ClassDoc) and doc.bases != UNKNOWN: bases = doc.bases @@ -2278,9 +2323,9 @@ ' |'+postfix+'\n' + s) if i != 0: - s = (self.base_tree(base, width-4, ' |'+postfix)+s) + s = (self.base_tree(base, width-4, ' |'+postfix, context)+s) else: - s = (self.base_tree(base, width-4, ' '+postfix)+s) + s = (self.base_tree(base, width-4, ' '+postfix, context)+s) return s def find_tree_width(self, doc, context): @@ -2303,11 +2348,14 @@ """ Return the label for L{doc} to be shown in C{context}. """ - context = context.canonical_name - if context is not UNKNOWN: - context = context.container() - - return str(doc.canonical_name.contextualize(context)) + if doc.canonical_name is None: + if doc.parse_repr is not None: + return doc.parse_repr + else: + return '??' + else: + context_name = context.canonical_name + return str(doc.canonical_name.contextualize(context_name)) #//////////////////////////////////////////////////////////// #{ Function Signatures @@ -2598,9 +2646,71 @@ # \------------------------------------------------------------/ #//////////////////////////////////////////////////////////// - #{ Term index generation + #{ Index generation #//////////////////////////////////////////////////////////// + def build_identifier_index(self): + items = [] + for doc in self.indexed_docs: + name = doc.canonical_name[-1] + url = self.url(doc) + if not url: continue + container = self.docindex.container(doc) + items.append( (name, url, container) ) + return self._group_by_letter(items) + + def _group_by_letter(self, items): + index = {} + for item in items: + first_letter = item[0][0].upper() + if not ("A" <= first_letter <= "Z"): + first_letter = '_' + index.setdefault(first_letter, []).append(item) + return index + + def build_term_index(self): + items = [] + for doc in self.indexed_docs: + url = self.url(doc) + items += self._terms_from_docstring(url, doc, doc.descr) + for (field, arg, descr) in doc.metadata: + items += self._terms_from_docstring(url, doc, descr) + if hasattr(doc, 'type_descr'): + items += self._terms_from_docstring(url, doc, + doc.type_descr) + if hasattr(doc, 'return_descr'): + items += self._terms_from_docstring(url, doc, + doc.return_descr) + if hasattr(doc, 'return_type'): + items += self._terms_from_docstring(url, doc, + doc.return_type) + return items + + def _terms_from_docstring(self, base_url, container, parsed_docstring): + if parsed_docstring in (None, UNKNOWN): return [] + terms = [] + for term in parsed_docstring.index_terms(): + anchor = self._term_index_to_anchor(term) + url = '%s#%s' % (base_url, anchor) + terms.append( (term.to_plaintext(None), url, container) ) + return terms + + def build_metadata_index(self, field_name): + # Build the index. + index = {} + for doc in self.indexed_docs: + if (not self._show_private and + self._doc_or_ancestor_is_private(doc)): + continue + descrs = {} + if doc.metadata is not UNKNOWN: + for (field, arg, descr) in doc.metadata: + if field.tags[0] == field_name: + descrs.setdefault(arg, []).append(descr) + for (arg, descr_list) in descrs.iteritems(): + index.setdefault(arg, []).append( (doc, descr_list) ) + return index + def _get_index_terms(self, parsed_docstring, link, terms, links): """ A helper function for L{_extract_term_index}. @@ -2629,48 +2739,6 @@ s = re.sub(r'\s\s+', '-', term.to_plaintext(None)) return "index-"+re.sub("[^a-zA-Z0-9]", "_", s) - def _extract_term_index(self): - """ - Extract the set of terms that should be indexed from all - documented docstrings. Return the extracted set as a - list of tuples of the form C{(key, term, [links])}. - This list is used by L{write_indices()} to construct the - term index. - @rtype: C{list} of C{(string, ParsedDocstring, list of ValueDoc)} - """ - terms = {} - links = {} - for doc in self.valdocs: - self._get_index_terms(doc.descr, doc, terms, links) - if doc.metadata not in (None, UNKNOWN): - for (field, arg, descr) in doc.metadata: - self._get_index_terms(descr, doc, terms, links) - # [xx] summary? type_descr? others? - if isinstance(doc, NamespaceDoc): - for var in doc.variables.values(): - self._get_index_terms(var.descr, var, terms, links) - for (field, arg, descr) in var.metadata: - self._get_index_terms(descr, var, terms, links) - elif isinstance(doc, RoutineDoc): - self._get_index_terms(doc.return_descr, doc, terms, links) - self._get_index_terms(doc.return_type, doc, terms, links) - if doc.arg_descrs not in (None, UNKNOWN): - for arg, descr in doc.arg_descrs: - self._get_index_terms(descr, doc, terms, links) - if doc.arg_types not in (None, UNKNOWN): - for arg, descr in doc.arg_types.items(): - self._get_index_terms(descr, doc, terms, links) - if doc.exception_descrs not in (None, UNKNOWN): - for excname, descr in doc.exception_descrs: - self._get_index_terms(descr, doc, terms, links) - elif isinstance(doc, PropertyDoc): - self._get_index_terms(doc.type_descr, doc, terms, links) - - # Combine terms & links into one list - keys = terms.keys() - keys.sort() - return [(k, terms[k], links[k]) for k in keys] - #//////////////////////////////////////////////////////////// #{ Helper functions #//////////////////////////////////////////////////////////// @@ -2681,7 +2749,7 @@ write_table_header = compile_template( ''' write_table_header(self, out, css_class, heading=None, \ - private_link=True) + private_link=True, colspan=2) ''', # /------------------------- Template -------------------------\ ''' @@ -2695,10 +2763,10 @@ >>> if heading is not None: <tr bgcolor="#70b0f0" class="$css_class$"> >>> if private_link: - <td colspan="2"> + <td colspan="$colspan$" class="$css_class$"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> - <th align="left" class="$css_class$">$heading$</th> + <td align="left"><h3 class="$css_class$">$heading$</h3></th> <td align="right" valign="top" ><span class="options">[<a href="#$anchor$" class="privatelink" onclick="toggle_private();" @@ -2780,7 +2848,7 @@ return self.url(val_doc) # Special pages: elif obj == 'indices': - return 'indices.html' + return 'identifier-index.html' elif obj == 'help': return 'help.html' elif obj == 'trees': Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_css.py 2006-04-12 21:01:16 UTC (rev 1227) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2006-04-13 07:14:46 UTC (rev 1228) @@ -41,21 +41,30 @@ # Should all epydoc css classes start with epydoc-? # -# Base stylesheet -- just the layout details +# Base stylesheet -- just the layout details (no color) _LAYOUT = """ /* Tables */ table.help { margin-left: auto; margin-right: auto; } -th.summary, th.details, th.index - { text-align: left; font-size: 120%; } -th.group { text-align: left; font-size: 120%; - font-style: italic; } +table.summary { border-collapse: collapse; + border-width: 1px; border-style: solid; } +table.details { border-collapse: collapse; + border-width: 1px; border-style: solid; + margin: .2em 0 0 0; } +table.index { border-collapse: collapse; + border-width: 1px; border-style: solid; } +td.summary { border-width: 1px; border-style: solid; } +td.details { border-width: 1px; border-style: solid; } +td.index { border-width: 0px; } +th.group { text-align: left; font-size: 115%; font-style: italic; + border-width: 1px; border-style: solid; } /* Documentation page titles */ h2.module { margin-top: 0.2em; } h2.class { margin-top: 0.2em; } h2.type { margin-top: 0.2em; } h2.py-src { margin-top: 0.2em; } +h2.index { margin-top: 0.2em; margin-bottom: 0; } /* Headings */ h1.help { text-align: center; } @@ -69,6 +78,8 @@ font-weight: bold; padding: 0; } h2.tocheading { font-size: 100%; margin: 0.5em 0 0 -0.3em; font-weight: bold; } +h3.summary, h3.details, h3.index /* used in table headers */ + { font-size: 120%; margin: 0; } /* Table of contents */ p.toc { margin: 0; padding: 0; } @@ -83,17 +94,6 @@ p.imports { padding: 0 0 0 7em; text-indent: -7em; } .imports-header { font-weight: bold; } -/* Details Sections */ -table.func-details { border-width: 2px; border-style: groove; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.func-detail { margin: 0 0 1em 0; } -table.var-details { border-width: 2px; border-style: groove; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.var-details { margin: 0 0 1em 0; } -table.prop-details { border-width: 2px; border-style: groove; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.prop-details { margin: 0 0 1em 0; } - /* Function signatures */ .sig { font-weight: bold; } @@ -133,7 +133,7 @@ padding-left: .5em; } /*a.py-name { text-decoration: none; }*/ -/* For Graphs */ +/* Graphs */ .graph-without-title { border: none; } .graph-with-title { border: 1px solid black; } .graph-title { font-weight: bold; } @@ -159,26 +159,22 @@ # javadoc looks. _WHITE = _LAYOUT + """ /* Body color */ -body { background: #ffffff; color: #000000; } +body { background: #ffffff; color: #000000; } /* Tables */ -table.summary, table.details, table.index - { background: #e8f0f8; color: #000000; } -tr.summary, tr.details, tr.index - { background: #70b0ff; color: #000000; } +table.summary { background: #e8f0f8; color: #000000; + border-color: #608090; } +table.details { background: #e8f0f8; color: #000000; + border-color: #608090; } +table.index { background: #e8f0f8; color: #000000; + border-color: #608090; } +tr.summary { background: #70b0ff; color: #000000; + border-color: #608090; } +tr.details { background: #70b0ff; color: #000000; + border-color: #608090; } +tr.index { background: #70b0ff; color: #000000; } th.group { background: #c0e0f8; color: #000000; } -/* Details Sections */ -table.func-details { background: #e8f0f8; color: #000000; - border-color: #c0d0d0; } -h3.func-detail { background: transparent; color: #000000; } -table.var-details { background: #e8f0f8; color: #000000; - border-color: #c0d0d0; } -h3.var-details { background: transparent; color: #000000; } -table.prop-details { background: #e8f0f8; color: #000000; - border-color: #c0d0d0; } -h3.prop-details { background: transparent; color: #000000; } - /* Function signatures */ .sig { background: transparent; color: #000000; } .sig-name { background: transparent; color: #006080; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 21:01:24
|
Revision: 1227 Author: edloper Date: 2006-04-12 14:01:16 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1227&view=rev Log Message: ----------- - Fixed traceback from sf bug #1469467 (caused when the defining_module is UNKNOWN); but this doesn't fix the underlying problem from that bug. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2006-04-12 19:53:44 UTC (rev 1226) +++ trunk/epydoc/src/epydoc/docstringparser.py 2006-04-12 21:01:16 UTC (rev 1227) @@ -260,7 +260,7 @@ # [xx] Don't report markup errors for standard builtins. if (isinstance(api_doc, ValueDoc) and api_doc != module and (api_doc.pyval in __builtin__.__dict__.values() or - (module is not None and + (module not in (None, UNKNOWN) and module.pyval in (__builtin__, exceptions)))): return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:53:47
|
Revision: 1226 Author: edloper Date: 2006-04-12 12:53:44 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1226&view=rev Log Message: ----------- - enable pdf api generation - added code to use profiling info (but currently not used -- it crashes with python 2.4 for some reason) - replaced man-to-html generating code - add all builtin modules to stdlib-html Modified Paths: -------------- trunk/epydoc/Makefile Modified: trunk/epydoc/Makefile =================================================================== --- trunk/epydoc/Makefile 2006-04-12 19:51:25 UTC (rev 1225) +++ trunk/epydoc/Makefile 2006-04-12 19:53:44 UTC (rev 1226) @@ -102,8 +102,7 @@ cp -r $(DOCS) $(WEBDIR) cp -r $(HTML_API) $(WEBDIR)/api cp -r $(HTML_EXAMPLES) $(WEBDIR)/examples - @echo "Skipping pdf generation (not implemented yet)" -# cp $(LATEX_API)/api.pdf $(WEBDIR)/epydoc.pdf + cp $(LATEX_API)/api.pdf $(WEBDIR)/epydoc.pdf touch .webpage.up2date # Use plaintext docformat by default. But this is overridden by the @@ -111,18 +110,17 @@ # xml.dom.minidom and a few Docutils modules get plaintext # docstrings). api-html: .api-html.up2date -.api-html.up2date: $(PY_SRCFILES) +.api-html.up2date: $(PY_SRCFILES) #profile.out rm -rf $(HTML_API) mkdir -p $(HTML_API) $(EPYDOC) -o $(HTML_API) --name epydoc --css white \ - --url http://epydoc.sourceforge.net \ + --url http://epydoc.sourceforge.net --pstat profile.out \ --inheritance=listed --navlink "epydoc $(VERSION)"\ - --docformat plaintext -v --graph classtree $(PY_SRC) + --docformat plaintext -v --graph all $(PY_SRC) touch .api-html.up2date api-pdf: .api-pdf.up2date .api-pdf.up2date: $(PY_SRCFILES) - @echo "Skipping pdf generation (not implemented yet)" rm -rf $(LATEX_API) mkdir -p $(LATEX_API) $(EPYDOC) --pdf -o $(LATEX_API) --docformat plaintext \ @@ -135,33 +133,36 @@ mkdir -p $(HTML_EXAMPLES) $(EPYDOC) -o $(HTML_EXAMPLES) --name epydoc \ --url http://epydoc.sourceforge.net \ - --css blue --top example --docformat=plaintext \ + --css white --top epytext_example --docformat=plaintext \ --navlink 'epydoc examples' doc/epytext_example.py sre $(EPYDOC) -o $(HTML_EXAMPLES)/grouped \ --inheritance=grouped \ --name epydoc --url http://epydoc.sourceforge.net \ - --css blue --debug \ + --css white --debug \ --navlink 'epydoc examples' doc/inh_example.py $(EPYDOC) -o $(HTML_EXAMPLES)/listed \ --inheritance=listed \ --name epydoc --url http://epydoc.sourceforge.net \ - --css blue --debug \ + --css white --debug \ --navlink 'epydoc examples' doc/inh_example.py $(EPYDOC) -o $(HTML_EXAMPLES)/included \ --inheritance=included \ --name epydoc --url http://epydoc.sourceforge.net \ - --css blue --debug \ + --css white --debug \ --navlink 'epydoc examples' doc/inh_example.py touch .examples.up2date # Generate the HTML version of the man page. Note: The # post-processing clean-up that I do is probably *not* very portable. doc/epydoc-man.html: man/epydoc.1 - wget http://localhost/cgi-bin/man2html?epydoc -O - \ - 2>/dev/null \ - | sed 's/<\/HEAD><BODY>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD><BODY>/'\ + man2html man/epydoc.1 \ + | sed 's/<\/HEAD>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD>/' \ + | sed 's/<H1>EPYDOC<\/H1>/<H1>epydoc (1)<\/H1>/' \ + | sed 's/<BODY>/<BODY><DIV CLASS="BODY">/'\ + | sed 's/Content-type:.*//' \ + | sed '/Section: User Commands/,/<HR>/{s/.*//;}'\ + | sed 's/<\/BODY>/<\/DIV><\/BODY>/'\ | sed '/<DD>/{s/<DD>//; :loop; n; b loop;}'\ - | sed '/<H1>/,/<HR>/{s/.*//;}'\ | sed 's/\(<A NAME=".*">\) <\/A>/\1/'\ | sed 's/<\/H2>/<\/H2><\/A>/'\ | sed 's/"\/cgi-bin\/man2html?epydocgui+1"/"epydocgui-man.html"/'\ @@ -169,16 +170,28 @@ > doc/epydoc-man.html doc/epydocgui-man.html: man/epydocgui.1 - wget http://localhost/cgi-bin/man2html?epydocgui -O - \ - 2>/dev/null \ - | sed 's/<\/HEAD><BODY>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD><BODY>/'\ - | sed '/<H1>/,/<HR>/{s/.*//;}'\ + man2html man/epydocgui.1 \ + | sed 's/<\/HEAD>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD>/' \ + | sed 's/<H1>EPYDOCGUI<\/H1>/<H1>epydocgui (1)<\/H1>/'\ + | sed 's/<BODY>/<BODY><DIV CLASS="BODY">/'\ + | sed 's/Content-type:.*//' \ + | sed '/Section: User Commands/,/<HR>/{s/.*//;}'\ + | sed 's/<\/BODY>/<\/DIV><\/BODY>/'\ + | sed '/<DD>/{s/<DD>//; :loop; n; b loop;}'\ | sed 's/\(<A NAME=".*">\) <\/A>/\1/'\ | sed 's/<\/H2>/<\/H2><\/A>/'\ - | sed 's/"\/cgi-bin\/man2html?epydoc+1"/"epydoc-man.html"/'\ + | sed 's/"\/cgi-bin\/man2html?epydocgui+1"/"epydocgui-man.html"/'\ | sed 's/<A HREF="\/cgi-bin\/man2html">man2html<\/A>/man2html/'\ > doc/epydocgui-man.html +# [XX] A bug in the profiler for py 2.4 prevents this from working!! +profile.out: $(PY_SRCFILES) + $(EPYDOC) -o profile.tmp --name epydoc --css white \ + --url http://epydoc.sourceforge.net --profile-epydoc \ + --inheritance=listed --navlink "epydoc $(VERSION)"\ + --docformat plaintext -v --graph all $(PY_SRC) + rm -rf profile.tmp + ##////////////////////////////////////////////////////////////////////// ## Standard Library docs ##////////////////////////////////////////////////////////////////////// @@ -190,15 +203,18 @@ |grep -v "/$(PYTHON)/lib-old/" \ |grep -v "/$(PYTHON)/site-packages/" \ |grep -v "/$(PYTHON)/__phello__\.foo\.py" ) +PY_PRINT_BUILTINS = "import sys; print ' '.join(sys.builtin_module_names)" +SLBUILTINS = $(shell $(PYTHON) -c $(PY_PRINT_BUILTINS)) + export TZ='XXX00XXX;000/00,000/00' # So tzparse won't die. stdlib-html: .stdlib-html.up2date .stdlib-html.up2date: $(PY_SRCFILES) rm -rf $(HTML_STDLIB) mkdir -p $(HTML_STDLIB) @echo "Building stdlib html docs..." - @$(EPYDOC) -o $(HTML_STDLIB) --css white \ - --name $(SLNAME) --url $(SLURL) --debug \ - --show-imports __builtin__ $(SLFILES) + @$(EPYDOC) -o $(HTML_STDLIB) --css white --name $(SLNAME) \ + --url $(SLURL) --debug --graph classtree \ + --show-imports $(SLBUILTINS) $(SLFILES) touch .stdlib-html.up2date # (this will typically cause latex to run out of resources) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:51:30
|
Revision: 1225 Author: edloper Date: 2006-04-12 12:51:25 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1225&view=rev Log Message: ----------- - Report 2nd alpha Modified Paths: -------------- trunk/epydoc/doc/index.html Modified: trunk/epydoc/doc/index.html =================================================================== --- trunk/epydoc/doc/index.html 2006-04-12 19:51:07 UTC (rev 1224) +++ trunk/epydoc/doc/index.html 2006-04-12 19:51:25 UTC (rev 1225) @@ -32,8 +32,8 @@ <div class="box"> <h2 class="box-title">News</h2> -<p><b>Epydoc 3.0 alpha released [March 2006]</b><br /> An alpha -release of epydoc 3.0 is now available on the <a +<p><b>Epydoc 3.0 alpha 2 released [April 2006]</b><br /> The second +alpha release of epydoc 3.0 is now available on the <a href="http://sourceforge.net/project/showfiles.php?group_id=32455">SourceForge download page</a>. See the <a href="whatsnew.html">What's New</a> page for details. Epydoc is under active development; if you wish to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:51:25
|
Revision: 1224 Author: edloper Date: 2006-04-12 12:51:07 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1224&view=rev Log Message: ----------- - Added a couple notes about bugs Modified Paths: -------------- trunk/epydoc/src/epydoc/__init__.py Modified: trunk/epydoc/src/epydoc/__init__.py =================================================================== --- trunk/epydoc/src/epydoc/__init__.py 2006-04-12 19:50:43 UTC (rev 1223) +++ trunk/epydoc/src/epydoc/__init__.py 2006-04-12 19:51:07 UTC (rev 1224) @@ -182,6 +182,10 @@ don't construct docs for imported modules' vars if it's not necessary) +:bug: UserDict.* is interpreted as imported .. why?? +:bug: Nested functions break source colorizer (and *why* is the source + colorizer being so slow on the stdlib???) + :license: IBM Open Source License :copyright: |copy| 2006 Edward Loper This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:50:52
|
Revision: 1223 Author: edloper Date: 2006-04-12 12:50:43 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1223&view=rev Log Message: ----------- - Fixed bug in _get_docs_from_items Modified Paths: -------------- trunk/epydoc/src/epydoc/docbuilder.py Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2006-04-12 19:50:15 UTC (rev 1222) +++ trunk/epydoc/src/epydoc/docbuilder.py 2006-04-12 19:50:43 UTC (rev 1223) @@ -254,11 +254,14 @@ item, introspect, parse, progress_estimator)) elif os.path.isdir(item): log.error("Directory %r is not a package" % item) + continue elif os.path.isfile(item): log.error("File %s is not a Python module" % item) + continue else: log.error("Could not find a file or object named %s" % item) + continue else: doc_pairs.append(_get_docs_from_pyobject( item, introspect, parse, progress_estimator)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:50:18
|
Revision: 1222 Author: edloper Date: 2006-04-12 12:50:15 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1222&view=rev Log Message: ----------- - Fixed base tree list in the case where a base is not a ClassDoc Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/dotgraph.py Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-12 19:49:51 UTC (rev 1221) +++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-12 19:50:15 UTC (rev 1222) @@ -1002,14 +1002,16 @@ classes = set(bases) queue = list(bases) for cls in queue: - if cls.subclasses not in (None, UNKNOWN): - queue.extend(cls.subclasses) - classes.update(cls.subclasses) + if isinstance(cls, ClassDoc): + if cls.subclasses not in (None, UNKNOWN): + queue.extend(cls.subclasses) + classes.update(cls.subclasses) queue = list(bases) for cls in queue: - if cls.bases not in (None, UNKNOWN): - queue.extend(cls.bases) - classes.update(cls.bases) + if isinstance(cls, ClassDoc): + if cls.bases not in (None, UNKNOWN): + queue.extend(cls.bases) + classes.update(cls.bases) # Add a node for each cls. classes = [d for d in classes if isinstance(d, ClassDoc) @@ -1052,7 +1054,8 @@ # Create nodes for all class_doc's subclasses. queue = [class_doc] for cls in queue: - if cls.subclasses not in (None, UNKNOWN): + if (isinstance(cls, ClassDoc) and + cls.subclasses not in (None, UNKNOWN)): queue.extend(cls.subclasses) for cls in cls.subclasses: if cls not in nodes: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:49:57
|
Revision: 1221 Author: edloper Date: 2006-04-12 12:49:51 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1221&view=rev Log Message: ----------- - Fixed base tree list in the case where a base's canonical_name is None. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/plaintext.py Modified: trunk/epydoc/src/epydoc/docwriter/plaintext.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/plaintext.py 2006-04-12 19:49:32 UTC (rev 1220) +++ trunk/epydoc/src/epydoc/docwriter/plaintext.py 2006-04-12 19:49:51 UTC (rev 1221) @@ -63,7 +63,12 @@ s = '(' class_parent = class_doc.canonical_name.container() for i, base in enumerate(class_doc.bases): - if base.canonical_name.container() == class_parent: + if base.canonical_name is None: + if base.parse_repr is not UNKNOWN: + s += base.parse_repr + else: + s += '??' + elif base.canonical_name.container() == class_parent: s += str(base.canonical_name[-1]) else: s += str(base.canonical_name) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:49:47
|
Revision: 1220 Author: edloper Date: 2006-04-12 12:49:32 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1220&view=rev Log Message: ----------- - Fixed the case where a base's canonical_name is None. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2006-04-12 19:46:21 UTC (rev 1219) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2006-04-12 19:49:32 UTC (rev 1220) @@ -420,7 +420,7 @@ width = self._find_tree_width(doc)+2 linespec = [] s = ('&'*(width-4)+'\\multicolumn{2}{l}{\\textbf{%s}}\n' % - plaintext_to_latex('%s'%doc.canonical_name)) + plaintext_to_latex('%s'%self._base_name(doc))) s += '\\end{tabular}\n\n' top = 1 else: @@ -438,6 +438,15 @@ return s + def _base_name(self, doc): + if doc.canonical_name is None: + if doc.parse_repr is not None: + return doc.parse_repr + else: + return '??' + else: + return '%s' % doc.canonical_name + def _find_tree_width(self, doc): if not isinstance(doc, ClassDoc): return 2 width = 2 @@ -446,16 +455,17 @@ return width def _base_tree_line(self, doc, width, linespec): + base_name = plaintext_to_latex(self._base_name(doc)) + # linespec is a list of booleans. - s = '%% Line for %s, linespec=%s\n' % (doc.canonical_name, linespec) + s = '%% Line for %s, linespec=%s\n' % (base_name, linespec) labelwidth = width-2*len(linespec)-2 # The base class name. - shortname = plaintext_to_latex('%s'%doc.canonical_name) s += ('\\multicolumn{%s}{r}{' % labelwidth) - s += '\\settowidth{\\BCL}{%s}' % shortname - s += '\\multirow{2}{\\BCL}{%s}}\n' % shortname + s += '\\settowidth{\\BCL}{%s}' % base_name + s += '\\multirow{2}{\\BCL}{%s}}\n' % base_name # The vertical bars for other base classes (top half) for vbar in linespec: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 19:46:31
|
Revision: 1219 Author: edloper Date: 2006-04-12 12:46:21 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1219&view=rev Log Message: ----------- - Set BASE_HANDLING to 'parse' (and fixed the code this uses) - Fixed bug in _find (not using path correctly) - Removed debug printf - Changed find_base to always return a proxy base, even if it can't figure out where it came from Modified Paths: -------------- trunk/epydoc/src/epydoc/docparser.py Modified: trunk/epydoc/src/epydoc/docparser.py =================================================================== --- trunk/epydoc/src/epydoc/docparser.py 2006-04-12 18:35:03 UTC (rev 1218) +++ trunk/epydoc/src/epydoc/docparser.py 2006-04-12 19:46:21 UTC (rev 1219) @@ -29,7 +29,7 @@ # Finding modules: import imp # File services: -import os, os.path +import os, os.path, sys # Unicode: import codecs # API documentation encoding: @@ -162,7 +162,7 @@ knowledge about what value the decorator returns. """ -BASE_HANDLING = 'link' +BASE_HANDLING = 'parse'#'link' """What should C{docparser} do when it encounters a base class that was imported from another module? - C{'link'}: Create a valuedoc with a C{proxy_for} pointer to the @@ -381,13 +381,10 @@ # If we're inside a package, then find the package's path. if package_doc is None: path = None + elif package_doc.path is not UNKNOWN: + path = package_doc.path else: - try: - # [XXX] - path_ast = module_doc.variables['__path__'].value.ast - path = extract_string_list(path_ast) - except: - path = [os.path.split(package_doc.filename)[0]] + path = [os.path.split(package_doc.filename)[0]] # The leftmost identifier in `name` should be a module or # package on the given path; find it and parse it. @@ -552,8 +549,6 @@ tok_iter = tokenize.generate_tokens(module_file.readline) for toktype, toktext, (srow,scol), (erow,ecol), line_str in tok_iter: # BOM encoding marker: ignore. - if toktype == token.ERRORTOKEN: - log.debug(type(toktext), `toktext`) if (toktype == token.ERRORTOKEN and (toktext == u'\ufeff' or toktext.encode(encoding) == '\xef\xbb\xbf')): @@ -650,7 +645,7 @@ raise ParseError('Error during parsing: invalid ' 'syntax (%s, line %d) -- %s' % (module_doc.filename, lineno, e)) - except KeyboardError, e: raise + except KeyboardInterrupt, e: raise except Exception, e: log.error('Internal error during parsing (%s, line ' '%s):\n%s' % (module_doc.filename, lineno, e)) @@ -1521,21 +1516,32 @@ return class_doc +def _proxy_base(**attribs): + return ClassDoc(variables={}, sort_spec=[], bases=[], subclasses=[], + docs_extracted_by='parser', **attribs) + def find_base(name, parent_docs): assert isinstance(name, DottedName) # Find the variable containing the base. base_var = lookup_variable(name, parent_docs) if base_var is None: - # If it looks like it's in an external module, then try - # "importing" it. - if (lookup_name(name[0], parent_docs).imported_from not in - (None, UNKNOWN)): - _import_var(name, parent_docs) - base_var = lookup_variable(name, parent_docs) - # If we still don't have a var containing the base, give up. + # If we didn't find it, then it must have been imported. + # First, check if it looks like it's contained in any + # known imported variable: + if len(name) > 1: + src = lookup_name(name[0], parent_docs) + if (src is not None and + src.imported_from not in (None, UNKNOWN)): + _import_var(name, parent_docs) + base_var = lookup_variable(name, parent_docs) + # Otherwise, it must have come from an "import *" statement + # (or from magic, such as direct manipulation of the module's + # dictionary), so we don't know where it came from. So + # there's nothing left but to use an empty proxy. if base_var is None: - raise ParseError("Could not find %s" % name) + return _proxy_base(parse_repr=str(name)) + #raise ParseError("Could not find %s" % name) # If the variable has a value, return that value. if base_var.value != UNKNOWN: @@ -1546,20 +1552,24 @@ # just make a proxy object. if base_var.imported_from not in (None, UNKNOWN): if BASE_HANDLING == 'parse': + old_sys_path = sys.path try: - return parse_docs(name=base_var.imported_from) - except ParseError: - pass + dirname = os.path.split(parent_docs[0].filename)[0] + sys.path = [dirname] + sys.path + try: + return parse_docs(name=str(base_var.imported_from)) + except ParseError: + log.info('Unable to parse base', base_var.imported_from) + except ImportError: + log.info('Unable to find base', base_var.imported_from) + finally: + sys.path = old_sys_path + # Either BASE_HANDLING='link' or parsing the base class failed; # return a proxy value for the base class. - return ClassDoc(variables={}, sort_spec=[], bases=[], - subclasses=[], proxy_for=base_var.imported_from, - docs_extracted_by='parser') + return _proxy_base(proxy_for=base_var.imported_from) else: - raise ParseError() # no value available for var. - - - + return _proxy_base(parse_repr=str(name)) #///////////////////////////////////////////////////////////////// #{ Parsing This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 18:35:16
|
Revision: 1218 Author: edloper Date: 2006-04-12 11:35:03 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1218&view=rev Log Message: ----------- - If there's an internal error during parsing, report what line number generated it. Modified Paths: -------------- trunk/epydoc/src/epydoc/docparser.py Modified: trunk/epydoc/src/epydoc/docparser.py =================================================================== --- trunk/epydoc/src/epydoc/docparser.py 2006-04-12 18:02:59 UTC (rev 1217) +++ trunk/epydoc/src/epydoc/docparser.py 2006-04-12 18:35:03 UTC (rev 1218) @@ -650,6 +650,11 @@ raise ParseError('Error during parsing: invalid ' 'syntax (%s, line %d) -- %s' % (module_doc.filename, lineno, e)) + except KeyboardError, e: raise + except Exception, e: + log.error('Internal error during parsing (%s, line ' + '%s):\n%s' % (module_doc.filename, lineno, e)) + raise # grouping... if groups[-1] and prev_line_doc not in (None, 'skip_block'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 18:03:12
|
Revision: 1217 Author: edloper Date: 2006-04-12 11:02:59 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1217&view=rev Log Message: ----------- - Use environment variable interpolations when reading config files (sf feature request #1464911) Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-04-12 17:58:21 UTC (rev 1216) +++ trunk/epydoc/src/epydoc/cli.py 2006-04-12 18:02:59 UTC (rev 1217) @@ -38,11 +38,15 @@ A simple example of a config file is:: [epydoc] - modules: sys, os, os.path, re + modules: sys, os, os.path, re, %(MYSANDBOXPATH)/utilities.py name: Example graph: classtree introspect: no +All ConfigParser interpolations are done using local values and the +environment variables. + + Verbosity Levels ================ The C{-v} and C{-q} options increase and decrease verbosity, @@ -300,7 +304,7 @@ configparser.readfp(fp, configfile) fp.close() for optname in configparser.options('epydoc'): - val = configparser.get('epydoc', optname).strip() + val = configparser.get('epydoc', optname, vars=os.environ).strip() optname = optname.lower().strip() if optname in ('modules', 'objects', 'values', 'module', 'object', 'value'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 17:58:29
|
Revision: 1216 Author: edloper Date: 2006-04-12 10:58:21 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1216&view=rev Log Message: ----------- - fixed typo in previous checkin Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-04-12 17:57:36 UTC (rev 1215) +++ trunk/epydoc/src/epydoc/cli.py 2006-04-12 17:58:21 UTC (rev 1216) @@ -242,7 +242,7 @@ if len(options.configfiles) == 1: cf_name = 'config file %s' % options.configfiles[0] else: - cf_name = 'config files %s' % ', '.join(options.configfiles + cf_name = 'config files %s' % ', '.join(options.configfiles) optparser.error('Error reading %s:\n %s' % (cf_name, e)) # Check to make sure all options are valid. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-12 17:57:42
|
Revision: 1215 Author: edloper Date: 2006-04-12 10:57:36 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1215&view=rev Log Message: ----------- - Report name(s) of config files when reading them fails (sf bug #1464975) Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2006-04-11 17:26:56 UTC (rev 1214) +++ trunk/epydoc/src/epydoc/cli.py 2006-04-12 17:57:36 UTC (rev 1215) @@ -239,7 +239,11 @@ parse_configfiles(options.configfiles, options, names) except (KeyboardInterrupt,SystemExit): raise except Exception, e: - optparser.error('Error reading config file:\n %s' % e) + if len(options.configfiles) == 1: + cf_name = 'config file %s' % options.configfiles[0] + else: + cf_name = 'config files %s' % ', '.join(options.configfiles + optparser.error('Error reading %s:\n %s' % (cf_name, e)) # Check to make sure all options are valid. if len(names) == 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-11 17:27:00
|
Revision: 1214 Author: edloper Date: 2006-04-11 10:26:56 -0700 (Tue, 11 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1214&view=rev Log Message: ----------- - Bumped version number to 3.0alpha2 Modified Paths: -------------- trunk/epydoc/src/epydoc/__init__.py Modified: trunk/epydoc/src/epydoc/__init__.py =================================================================== --- trunk/epydoc/src/epydoc/__init__.py 2006-04-10 20:05:45 UTC (rev 1213) +++ trunk/epydoc/src/epydoc/__init__.py 2006-04-11 17:26:56 UTC (rev 1214) @@ -167,7 +167,7 @@ :author: `Edward Loper <ed...@gr...>`__ :requires: Python 2.3+ -:version: 3.0 alpha +:version: 3.0 alpha 2 :see: `The epydoc webpage <http://epydoc.sourceforge.net>`__ :see: `The epytext markup language manual <http://epydoc.sourceforge.net/epytext.html>`__ @@ -198,7 +198,7 @@ """ __docformat__ = 'restructuredtext en' -__version__ = '3.0alpha' +__version__ = '3.0alpha2' """The version of epydoc""" __author__ = 'Edward Loper <ed...@gr...>' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-10 20:05:49
|
Revision: 1213 Author: edloper Date: 2006-04-10 13:05:45 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1213&view=rev Log Message: ----------- removed old epydoc3 code from the sandbox Removed Paths: ------------- trunk/epydoc/sandbox/epydoc3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-10 19:46:27
|
Revision: 1212 Author: edloper Date: 2006-04-10 12:45:10 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1212&view=rev Log Message: ----------- - Major update to the webpage Modified Paths: -------------- trunk/epydoc/doc/epydoc_gui.png trunk/epydoc/doc/epydoc_guiconfig.png trunk/epydoc/doc/sflogo.png Property Changed: ---------------- trunk/epydoc/doc/epydoc_gui.png trunk/epydoc/doc/epydoc_guiconfig.png trunk/epydoc/doc/sflogo.png Modified: trunk/epydoc/doc/epydoc_gui.png =================================================================== (Binary files differ) Property changes on: trunk/epydoc/doc/epydoc_gui.png ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + image/png Modified: trunk/epydoc/doc/epydoc_guiconfig.png =================================================================== (Binary files differ) Property changes on: trunk/epydoc/doc/epydoc_guiconfig.png ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + image/png Modified: trunk/epydoc/doc/sflogo.png =================================================================== (Binary files differ) Property changes on: trunk/epydoc/doc/sflogo.png ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + image/png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-10 13:25:55
|
Revision: 1210 Author: edloper Date: 2006-04-10 06:25:50 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1210&view=rev Log Message: ----------- - DotGraph.to_html() now takes an extra argument, the image filename, and is responsible for writing the image file. This lets me use a single call to dot generate both the image and the client image map when dotversion>1.8.10 Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/dotgraph.py trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/markup/epytext.py trunk/epydoc/src/epydoc/markup/restructuredtext.py Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-10 13:23:24 UTC (rev 1209) +++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-10 13:25:50 UTC (rev 1210) @@ -128,7 +128,7 @@ self.uid = '%s_%s' % (self.uid, n) self._uids.add(self.uid) - def to_html(self, image_url, center=True): + def to_html(self, image_file, image_url, center=True): """ Return the HTML code that should be uesd to display this graph (including a client-side image map). @@ -136,7 +136,17 @@ :param image_url: The URL of the image file for this graph; this should be generated separately with the `write()` method. """ - cmapx = self.render('cmapx') or '' + # If dotversion >1.8.10, then we can generate the image and + # the cmapx with a single call to dot. Otherwise, we need to + # run dot twice. + if get_dot_version() > [1,8,10]: + cmapx = self._run_dot('-Tgif', '-o%s' % image_file, '-Tcmapx') + if cmapx is None: return '' # failed to render + else: + if not self.write(image_file): + return '' # failed to render + cmapx = self.render('cmapx') or '' + title = plaintext_to_html(self.title or '') caption = plaintext_to_html(self.caption or '') if title or caption: @@ -209,14 +219,12 @@ :return: True if rendering was successful. """ - s = self.render(language) - if s is not None: - out = open(filename, 'wb') - out.write(s) - out.close() - return True - else: - return False + result = self._run_dot('-T%s' % language, + '-o%s' % filename) + # Decode into unicode, if necessary. + if language == 'cmapx' and result is not None: + result = result.decode('utf-8') + return (result is not None) def render(self, language='gif'): """ @@ -224,14 +232,13 @@ format `language`. Return the result as a string, or `None` if the rendering failed. """ + return self._run_dot('-T%s' % language) + + def _run_dot(self, *options): try: - result, err = run_subprocess([DOT_COMMAND, '-T%s' % language], + result, err = run_subprocess((DOT_COMMAND,)+options, self.to_dotfile()) - # Decode into unicode, if necessary. - if language == 'cmapx' and result is not None: - result = result.decode('utf-8') - if err: - log.warning("Graphviz dot warning(s):\n%s" % err) + if err: log.warning("Graphviz dot warning(s):\n%s" % err) except OSError, e: log.warning("Unable to render Graphviz dot graph:\n%s" % e) #log.debug(self.to_dotfile()) Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-10 13:23:24 UTC (rev 1209) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-10 13:25:50 UTC (rev 1210) @@ -1334,18 +1334,13 @@ #{ 2.10. Graphs #//////////////////////////////////////////////////////////// + # [xx] use DotGraph.to_html?? def render_graph(self, graph, css='graph-without-title'): if graph is None: return '' - # Write the graph's image to a file - path = os.path.join(self._directory, graph.uid) - if not graph.write('%s.gif' % path, 'gif'): - return '' - # Generate the image map. - cmapx = graph.render('cmapx') or '' - # Display the graph. - uid = graph.uid - return ('%s\n<img src="%s.gif" alt="%s" usemap="#%s" ismap="ismap" ' - 'class="%s"/>\n' % (cmapx, uid, uid, uid, css)) + graph.caption = graph.title = None + image_url = '%s.gif' % graph.uid + image_file = os.path.join(self._directory, image_url) + return graph.to_html(image_file, image_url) def render_callgraph(self, callgraph): graph_html = self.render_graph(callgraph, css='graph-with-title') Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2006-04-10 13:23:24 UTC (rev 1209) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2006-04-10 13:25:50 UTC (rev 1210) @@ -1831,14 +1831,14 @@ else: return '[??]' elif tree.tagName == 'graph': + # Generate the graph. graph = self._build_graph(variables[0], variables[1:], linker, docindex, context) if not graph: return '' - # Write the graph's image to a file - path = os.path.join(directory, graph.uid) - if not graph.write('%s.gif' % path, 'gif'): - return '' - return graph.to_html('%s.gif' % graph.uid) + # Write the graph. + image_url = '%s.gif' % graph.uid + image_file = os.path.join(directory, image_url) + return graph.to_html(image_file, image_url) else: raise ValueError('Unknown epytext DOM element %r' % tree.tagName) Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2006-04-10 13:23:24 UTC (rev 1209) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2006-04-10 13:25:50 UTC (rev 1210) @@ -533,11 +533,11 @@ # Generate the graph. graph = node.graph(self._docindex, self._context, self._linker) if graph is None: return - # Write the graph's image to a file - path = os.path.join(self._directory, graph.uid) - if not graph.write('%s.gif' % path, 'gif'): - return - self.body.append(graph.to_html('%s.gif' % graph.uid)) + + # Write the graph. + image_url = '%s.gif' % graph.uid + image_file = os.path.join(self._directory, image_url) + self.body.append(graph.to_html(image_file, image_url)) def depart_dotgraph(self, node): pass # Nothing to do. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2006-04-10 13:23:29
|
Revision: 1209 Author: edloper Date: 2006-04-10 06:23:24 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1209&view=rev Log Message: ----------- - Added a markup language registry, which can be used by users to register support for new markup languages. Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/__init__.py Modified: trunk/epydoc/src/epydoc/markup/__init__.py =================================================================== --- trunk/epydoc/src/epydoc/markup/__init__.py 2006-04-10 13:22:49 UTC (rev 1208) +++ trunk/epydoc/src/epydoc/markup/__init__.py 2006-04-10 13:23:24 UTC (rev 1209) @@ -77,6 +77,38 @@ ## Dispatcher ################################################## +_markup_language_registry = { + 'restructuredtext': 'epydoc.markup.restructuredtext', + 'epytext': 'epydoc.markup.epytext', + 'plaintext': 'epydoc.markup.plaintext', + 'javadoc': 'epydoc.markup.javadoc', + } + +def register_markup_language(name, parse_function): + """ + Register a new markup language named C{name}, which can be parsed + by the function C{parse_function}. + + @param name: The name of the markup language. C{name} should be a + simple identifier, such as C{'epytext'} or C{'restructuredtext'}. + Markup language names are case insensitive. + + @param parse_function: A function which can be used to parse the + markup language, and returns a L{ParsedDocstring}. It should + have the following signature: + + >>> def parse(s, errors): + ... 'returns a ParsedDocstring' + + Where: + - C{s} is the string to parse. (C{s} will be a unicode + string.) + - C{errors} is a list; any errors that are generated + during docstring parsing should be appended to this + list (as L{ParseError} objects). + """ + _markup_language_registry[name.lower()] = parse_function + MARKUP_LANGUAGES_USED = set() def parse(docstring, markup='plaintext', errors=None, **options): @@ -115,15 +147,29 @@ if not re.match(r'\w+', markup): _parse_warn('Bad markup language name %r. Treating ' 'docstrings as plaintext.' % markup) + import epydoc.markup.plaintext as plaintext return plaintext.parse_docstring(docstring, errors, **options) # Is the markup language supported? - try: exec('from epydoc.markup.%s import parse_docstring' % markup) - except ImportError: + if markup not in _markup_language_registry: _parse_warn('Unsupported markup language %r. Treating ' 'docstrings as plaintext.' % markup) + import epydoc.markup.plaintext as plaintext return plaintext.parse_docstring(docstring, errors, **options) + # Get the parse function. + parse_docstring = _markup_language_registry[markup] + + # If it's a string, then it names a function to import. + if isinstance(parse_docstring, basestring): + try: exec('from %s import parse_docstring' % parse_docstring) + except ImportError, e: + _parse_warn('Error importing %s for markup language %s: %s' % + (parse_docstring, markup, e)) + import epydoc.markup.plaintext as plaintext + return plaintext.parse_docstring(docstring, errors, **options) + _markup_language_registry[markup] = parse_docstring + # Keep track of which markup languages have been used so far. MARKUP_LANGUAGES_USED.add(markup) @@ -134,12 +180,14 @@ if epydoc.DEBUG: raise log.error('Internal error while parsing a docstring: %s; ' 'treating docstring as plaintext' % e) + import epydoc.markup.plaintext as plaintext return plaintext.parse_docstring(docstring, errors, **options) # Check for fatal errors. fatal_errors = [e for e in errors if e.is_fatal()] if fatal_errors and raise_on_error: raise fatal_errors[0] if fatal_errors: + import epydoc.markup.plaintext as plaintext return plaintext.parse_docstring(docstring, errors, **options) return parsed_docstring @@ -569,11 +617,3 @@ code.appendChild(doc.createTextNode(type(obj).__name__)) return ParsedEpytextDocstring(doc) -################################################## -## Sub-module Imports -################################################## -# By default, just import plaintext. That way we don't have to wait -# for other modules (esp restructuredtext) to load if we're not going -# to use them. - -import plaintext This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |