epydoc-commits Mailing List for Python API documentation generation tool (Page 10)
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-03-20 00:58:55
|
Revision: 1587 http://svn.sourceforge.net/epydoc/?rev=1587&view=rev Author: dvarrazzo Date: 2007-03-19 17:58:51 -0700 (Mon, 19 Mar 2007) Log Message: ----------- - Allow the LaTeX representation of an encoding to be different from the one used by Python. - Comments delimiting sections converted into API groups. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-14 01:53:42 UTC (rev 1586) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-20 00:58:51 UTC (rev 1587) @@ -118,7 +118,12 @@ self._top_section = 2 self._index_functions = 1 self._hyperref = 1 + + #: The Python representation of the encoding. + #: Update L{latex_encodings} in case of mismatch between it and + #: the C{inputenc} LaTeX package. self._encoding = kwargs.get('encoding', 'utf-8') + self.valdocs = sorted(docindex.reachable_valdocs( imports=False, packages=False, bases=False, submodules=False, subclasses=False, private=self._show_private)) @@ -226,7 +231,7 @@ os.mkdir(directory) #//////////////////////////////////////////////////////////// - # Main Doc File + #{ Main Doc File #//////////////////////////////////////////////////////////// def write_topfile(self, out): @@ -274,7 +279,7 @@ out('\n') # Set the encoding. - out('\\usepackage[%s]{inputenc}' % self._encoding) + out('\\usepackage[%s]{inputenc}' % self.get_latex_encoding()) # If we're generating hyperrefs, add the appropriate packages. if self._hyperref: @@ -309,7 +314,7 @@ #//////////////////////////////////////////////////////////// - # Chapters + #{ Chapters #//////////////////////////////////////////////////////////// def write_module(self, out, doc): @@ -405,7 +410,7 @@ out(' ' + self.indexterm(doc, 'end')) #//////////////////////////////////////////////////////////// - # Module hierarchy trees + #{ Module hierarchy trees #//////////////////////////////////////////////////////////// def write_module_tree(self, out): @@ -463,7 +468,7 @@ out(' '*depth + ' \\end{itemize}\n') #//////////////////////////////////////////////////////////// - # Base class trees + #{ Base class trees #//////////////////////////////////////////////////////////// def base_tree(self, doc, width=None, linespec=None): @@ -539,7 +544,7 @@ return s #//////////////////////////////////////////////////////////// - # Class List + #{ Class List #//////////////////////////////////////////////////////////// def write_class_list(self, out, doc): @@ -583,7 +588,7 @@ out((', p.~\\pageref{%s})}\n\n' % self.label(doc))) #//////////////////////////////////////////////////////////// - # Function List + #{ Function List #//////////////////////////////////////////////////////////// def write_func_list(self, out, heading, doc, value_type, seclevel=1): @@ -752,7 +757,7 @@ return '(%s)' % (', '.join([self._arg_name(a) for a in arg])) #//////////////////////////////////////////////////////////// - # Variable List + #{ Variable List #//////////////////////////////////////////////////////////// # Also used for the property list. @@ -848,7 +853,7 @@ out('\\cline{1-2}\n') #//////////////////////////////////////////////////////////// - # Standard Fields + #{ Standard Fields #//////////////////////////////////////////////////////////// # Copied from HTMLWriter: @@ -903,7 +908,7 @@ #//////////////////////////////////////////////////////////// - # Docstring -> LaTeX Conversion + #{ Docstring -> LaTeX Conversion #//////////////////////////////////////////////////////////// # We only need one linker, since we don't use context: @@ -922,7 +927,7 @@ hyperref=self._hyperref) #//////////////////////////////////////////////////////////// - # Helpers + #{ Helpers #//////////////////////////////////////////////////////////// def write_header(self, out, where): @@ -1002,6 +1007,15 @@ def label(self, doc): return ':'.join(doc.canonical_name) + #: Map the Python encoding representation into mismatching LaTeX ones. + latex_encodings = { + 'utf-8': 'utf8', + } - - + def get_latex_encoding(self): + """ + @return: The LaTeX representation of the selected encoding. + @rtype: C{str} + """ + enc = self._encoding.lower() + return self.latex_encodings.get(enc, enc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-14 01:53:43
|
Revision: 1586 http://svn.sourceforge.net/epydoc/?rev=1586&view=rev Author: dvarrazzo Date: 2007-03-13 18:53:42 -0700 (Tue, 13 Mar 2007) Log Message: ----------- - Some docstring fixed. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/xlink.py Modified: trunk/epydoc/src/epydoc/docwriter/xlink.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/xlink.py 2007-03-14 01:53:14 UTC (rev 1585) +++ trunk/epydoc/src/epydoc/docwriter/xlink.py 2007-03-14 01:53:42 UTC (rev 1586) @@ -298,12 +298,14 @@ api_register = {} """ Mapping from the API name to the `UrlGenerator` to be used. + +Use `register_api()` to add new generators to the register. """ def register_api(name, generator=None): """Register the API `name` into the `api_register`. - A registered API is available to the markup as the interpreted text + A registered API will be available to the markup as the interpreted text role ``name``. If a `generator` is not provided, register a `VoidUrlGenerator` instance: @@ -366,8 +368,16 @@ """ Create and register a new role to create links for an API documentation. - Create a role called `name`, which will use the ``name`` registered - URL resolver to create a link for an object. + Create a role called `name`, which will use the URL resolver registered as + ``name`` in `api_register` to create a link for an object. + + :Parameters: + `name` : `str` + name of the role to create. + `problematic` : `bool` + if True, the registered role will create problematic nodes in + case of failed references. If False, a warning will be raised + anyway, but the output will appear as an ordinary literal. """ def resolve_api_name(n, rawtext, text, lineno, inliner, options={}, content=[]): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-14 01:53:15
|
Revision: 1585 http://svn.sourceforge.net/epydoc/?rev=1585&view=rev Author: dvarrazzo Date: 2007-03-13 18:53:14 -0700 (Tue, 13 Mar 2007) Log Message: ----------- - Fixed external API root and file: more than one can be specified now. Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2007-03-13 21:57:48 UTC (rev 1584) +++ trunk/epydoc/src/epydoc/cli.py 2007-03-14 01:53:14 UTC (rev 1585) @@ -506,7 +506,7 @@ if optname in ('modules', 'objects', 'values', 'module', 'object', 'value'): - names.extend(val.replace(',', ' ').split()) + names.extend(_str_to_list(val)) elif optname == 'target': options.target = val elif optname == 'output': @@ -529,11 +529,11 @@ elif optname == 'introspect': options.introspect = _str_to_bool(val, optname) elif optname == 'exclude': - options.exclude.append(val) + options.exclude.extend(_str_to_list(val)) elif optname in ('exclude-parse', 'exclude_parse'): - options.exclude_parse.append(val) + options.exclude_parse.extend(_str_to_list(val)) elif optname in ('exclude-introspect', 'exclude_introspect'): - options.exclude_introspect.append(val) + options.exclude_introspect.extend(_str_to_list(val)) elif optname == 'inheritance': if val.lower() not in INHERITANCE_STYLES: raise ValueError('"%s" expected one of: %s.' % @@ -568,15 +568,15 @@ # External API elif optname in ('external-api', 'external_api'): - options.external_api.extend(val.replace(',', ' ').split()) + options.external_api.extend(_str_to_list(val)) elif optname in ('external-api-file', 'external_api_file'): - options.external_api_file.append(val) + options.external_api_file.extend(_str_to_list(val)) elif optname in ('external-api-root', 'external_api_root'): - options.external_api_root.append(val) + options.external_api_root.extend(_str_to_list(val)) # Graph options elif optname == 'graph': - graphtypes = val.replace(',', '').split() + graphtypes = _str_to_list(val) for graphtype in graphtypes: if graphtype not in GRAPH_TYPES + ('all',): raise ValueError('"%s" expected one of: all, %s.' % @@ -589,7 +589,7 @@ elif optname in ('graph-font-size', 'graph_font_size'): options.graph_font_size = _str_to_int(val, optname) elif optname == 'pstat': - options.pstat_files.extend(val.replace(',', ' ').split()) + options.pstat_files.extend(_str_to_list(val)) # Return value options elif optname in ('failon', 'fail-on', 'fail_on'): @@ -620,6 +620,9 @@ except ValueError: raise ValueError('"%s" option expected an int' % optname) +def _str_to_list(val): + return val.replace(',', ' ').split() + ###################################################################### #{ Interface ###################################################################### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-13 21:57:51
|
Revision: 1584 http://svn.sourceforge.net/epydoc/?rev=1584&view=rev Author: dvarrazzo Date: 2007-03-13 14:57:48 -0700 (Tue, 13 Mar 2007) Log Message: ----------- - Fixed encoding in LaTeX generator. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-11 17:28:59 UTC (rev 1583) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-13 21:57:48 UTC (rev 1584) @@ -118,7 +118,7 @@ self._top_section = 2 self._index_functions = 1 self._hyperref = 1 - self._encoding = kwargs.get('encoding', 'latin1') + self._encoding = kwargs.get('encoding', 'utf-8') self.valdocs = sorted(docindex.reachable_valdocs( imports=False, packages=False, bases=False, submodules=False, subclasses=False, private=self._show_private)) @@ -180,7 +180,7 @@ log.progress(self._files_written/self._num_files, filename) path = os.path.join(directory, filename) - if self._encoding == 'utf8': + if self._encoding == 'utf-8': f = codecs.open(path, 'w', 'utf-8') write_func(f.write, *args) f.close() @@ -194,8 +194,9 @@ log.error("Output could not be represented with the " "given encoding (%r). Unencodable characters " "will be displayed as '?'. It is recommended " - "that you use a different output encoding (utf8, " - "if it's supported by latex on your system).") + "that you use a different output encoding (utf-8, " + "if it's supported by latex on your system)." + % self._encoding) s = s.encode(self._encoding, 'replace') f = open(path, 'w') f.write(s) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-11 17:29:05
|
Revision: 1583 http://svn.sourceforge.net/epydoc/?rev=1583&view=rev Author: dvarrazzo Date: 2007-03-11 10:28:59 -0700 (Sun, 11 Mar 2007) Log Message: ----------- - Guard against `RoutineDoc` whose ``override`` is not a `RoutineDoc`: sometimes (probably when a parsed valued is not recognized as a function) a `GenericValueDoc` ends up there, making `href()` barf. 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-03-10 21:13:24 UTC (rev 1582) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-11 17:28:59 UTC (rev 1583) @@ -2322,7 +2322,13 @@ >>> # === overrides === >>> if var_doc.overrides not in (None, UNKNOWN): <dt>Overrides: - $self.href(var_doc.overrides.value, context=var_doc)$ + >>> # Avoid passing GenericValueDoc to href() + >>> if isinstance(var_doc.overrides.value, RoutineDoc): + $self.href(var_doc.overrides.value, context=var_doc)$ + >>> else: + >>> # In this case, a less interesting label is generated. + $self.href(var_doc.overrides, context=var_doc)$ + >>> #endif >>> 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> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-10 21:13:25
|
Revision: 1582 http://svn.sourceforge.net/epydoc/?rev=1582&view=rev Author: dvarrazzo Date: 2007-03-10 13:13:24 -0800 (Sat, 10 Mar 2007) Log Message: ----------- - Added test case for the SF bug #1678046. The test currently fails. Modified Paths: -------------- trunk/epydoc/src/epydoc/test/docbuilder.doctest Modified: trunk/epydoc/src/epydoc/test/docbuilder.doctest =================================================================== --- trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-03-10 17:56:29 UTC (rev 1581) +++ trunk/epydoc/src/epydoc/test/docbuilder.doctest 2007-03-10 21:13:24 UTC (rev 1582) @@ -360,3 +360,23 @@ | +- is_imported = True +- z => VariableDoc for epydoc_test.z [4] +- is_imported = False + +Merging the right value +======================= +Test for the SF bug #1678046. Check that, in case of mismatch between parsed +and introspected versions of a value, other values don't get damaged. + + >>> runbuilder(s=''' + ... foo = None + ... bar = None + ... + ... def mangle(): + ... global foo + ... foo = 'foo' + ... + ... mangle() + ... ''', + ... build="bar", + ... attribs="pyval") + GenericValueDoc [0] + +- pyval = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-10 17:56:32
|
Revision: 1581 http://svn.sourceforge.net/epydoc/?rev=1581&view=rev Author: dvarrazzo Date: 2007-03-10 09:56:29 -0800 (Sat, 10 Mar 2007) Log Message: ----------- - Ordering of classes in classes tree stabilized. The base classes used to be sorted by canonical name, but no order was set for subclasses. Now sorting both base classes and subclasses by class name (which is probably more meaningful than canonical name for people looking for a class regardless from the module it is exposed from) 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-03-10 16:01:52 UTC (rev 1580) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-10 17:56:29 UTC (rev 1581) @@ -959,7 +959,7 @@ #class_set.add(base) out('<ul class="nomargin-top">\n') - for doc in sorted(class_set): + for doc in sorted(class_set, key=lambda c:c.canonical_name[-1]): if doc.bases != UNKNOWN and len(doc.bases)==0: self.write_class_tree_item(out, doc, class_set) out('</ul>\n') @@ -2714,7 +2714,7 @@ >>> # endif >>> if doc.subclasses: <ul> - >>> for subclass in set(doc.subclasses): + >>> for subclass in sorted(set(doc.subclasses), key=lambda c:c.canonical_name[-1]): >>> if subclass in class_set: >>> self.write_class_tree_item(out, subclass, class_set) >>> #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-10 16:01:54
|
Revision: 1580 http://svn.sourceforge.net/epydoc/?rev=1580&view=rev Author: dvarrazzo Date: 2007-03-10 08:01:52 -0800 (Sat, 10 Mar 2007) Log Message: ----------- - Added parsing of relative import according to rules defined in :PEP:`328`. Allowed relative import forms are:: from .foo import bar from ..foo import bar ... from . import foo from .. import foo ... Other relative forms are not allowed by the PEP:: import . # nope import .. # never from .. import * # not a chance... Modified Paths: -------------- trunk/epydoc/src/epydoc/docparser.py Modified: trunk/epydoc/src/epydoc/docparser.py =================================================================== --- trunk/epydoc/src/epydoc/docparser.py 2007-03-10 02:32:35 UTC (rev 1579) +++ trunk/epydoc/src/epydoc/docparser.py 2007-03-10 16:01:52 UTC (rev 1580) @@ -865,7 +865,9 @@ # >>> from os.path import join, split else: - src_name = parse_dotted_name(lhs) + # Allow relative imports in this case, as per PEP 328 + src_name = parse_dotted_name(lhs, + parent_name=parent_docs[-1].canonical_name) parts = split_on(rhs, (token.OP, ',')) for part in parts: # from m import x @@ -1668,8 +1670,11 @@ raise ParseError("Bad name") return elt[1] -def parse_dotted_name(elt_list, strip_parens=True): +def parse_dotted_name(elt_list, strip_parens=True, parent_name=None): """ + @param parent_name: canonical name of referring module, to resolve + relative imports. + @type parent_name: L{DottedName} @bug: does not handle 'x.(y).z' """ if len(elt_list) == 0: raise ParseError("Bad dotted name") @@ -1683,8 +1688,25 @@ elt_list[0][-1] == (token.OP, ')')): elt_list[:1] = elt_list[0][1:-1] + # Convert a relative import into an absolute name. + prefix_name = None + if parent_name is not None and elt_list[0][-1] == '.': + items = 1 + while len(elt_list) > items and elt_list[items][-1] == '.': + items += 1 + + elt_list = elt_list[items:] + prefix_name = parent_name[:-items] + + # >>> from . import foo + if not elt_list: + return prefix_name + if len(elt_list) % 2 != 1: raise ParseError("Bad dotted name") name = DottedName(parse_name(elt_list[0], True)) + if prefix_name is not None: + name = prefix_name + name + for i in range(2, len(elt_list), 2): dot, identifier = elt_list[i-1], elt_list[i] if dot != (token.OP, '.'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-10 02:32:37
|
Revision: 1579 http://svn.sourceforge.net/epydoc/?rev=1579&view=rev Author: dvarrazzo Date: 2007-03-09 18:32:35 -0800 (Fri, 09 Mar 2007) Log Message: ----------- - Property accessor names contextualized. 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-03-10 00:10:33 UTC (rev 1578) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-10 02:32:35 UTC (rev 1579) @@ -2178,10 +2178,12 @@ # Properties elif isinstance(var_doc.value, PropertyDoc): prop_doc = var_doc.value - accessors = [(name, self.property_accessor_to_html(val_doc), - self.summary(val_doc)) for (name, val_doc) in - [('Get', prop_doc.fget), ('Set', prop_doc.fset), - ('Delete', prop_doc.fdel)] + accessors = [ (name, + self.property_accessor_to_html(val_doc, prop_doc), + self.summary(val_doc)) + for (name, val_doc) in + [('Get', prop_doc.fget), ('Set', prop_doc.fset), + ('Delete', prop_doc.fdel)] if val_doc not in (None, UNKNOWN) and val_doc.pyval is not None ] @@ -2203,15 +2205,15 @@ return '<li>%s - %s</li>' % (lhs, rhs) - def property_accessor_to_html(self, val_doc): + def property_accessor_to_html(self, val_doc, context=None): if val_doc not in (None, UNKNOWN): if isinstance(val_doc, RoutineDoc): return self.function_signature(val_doc, is_summary=True, - link_name=True) + link_name=True, context=context) elif isinstance(val_doc, GenericValueDoc): return self.pprint_value(val_doc) else: - return self.href(val_doc) + return self.href(val_doc, context=context) else: return '??' @@ -2524,7 +2526,7 @@ #//////////////////////////////////////////////////////////// def function_signature(self, api_doc, is_summary=False, - link_name=False, anchor=False): + link_name=False, anchor=False, context=None): """Render a function signature in HTML. @param api_doc: The object whose name is to be rendered. If a @@ -2536,6 +2538,9 @@ @type link_name: C{bool} @param anchor: If True, the name is the object anchor. @type anchor: C{bool} + @param context: If set, represent the function name from this context. + Only useful when C{api_doc} is a L{RoutineDoc}. + @type context: L{DottedName} @return: The HTML code for the object. @rtype: C{str} @@ -2556,7 +2561,8 @@ link_name=link_name, anchor=anchor) else: func_doc = api_doc - name = self.href(api_doc, css_class=css_class+'-name') + name = self.href(api_doc, css_class=css_class+'-name', + context=context) if func_doc.posargs == UNKNOWN: args = ['...'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-10 00:10:35
|
Revision: 1578 http://svn.sourceforge.net/epydoc/?rev=1578&view=rev Author: dvarrazzo Date: 2007-03-09 16:10:33 -0800 (Fri, 09 Mar 2007) Log Message: ----------- - Variables don't add metadata to multivalue fields, if a value is already present. - Somewhat optimized check to test if a variable is to be used as metadata. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-03-09 23:26:21 UTC (rev 1577) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-03-10 00:10:33 UTC (rev 1578) @@ -267,13 +267,18 @@ 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 + + # Check moved here from before the for loop because we expect to + # reach rarely this point. The loop below is to be performed more than + # once only for fields with more than one varname, which currently is + # only 'author'. + for md in api_doc.metadata: + if field == md[0]: + return # We already have a value for this metadata. + var_doc = api_doc.variables[varname] if var_doc.value is UNKNOWN: continue val_doc = var_doc.value This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-09 23:26:24
|
Revision: 1577 http://svn.sourceforge.net/epydoc/?rev=1577&view=rev Author: dvarrazzo Date: 2007-03-09 15:26:21 -0800 (Fri, 09 Mar 2007) Log Message: ----------- - Small optimization trick: ``in`` is way faster than ``has_key()``. The former is a single opcode while the latter involves a lookup and the call to a bound method. Modified Paths: -------------- trunk/epydoc/src/epydoc/docparser.py trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/markup/__init__.py trunk/epydoc/src/epydoc/markup/epytext.py trunk/epydoc/src/epydoc/markup/restructuredtext.py Modified: trunk/epydoc/src/epydoc/docparser.py =================================================================== --- trunk/epydoc/src/epydoc/docparser.py 2007-03-09 23:08:24 UTC (rev 1576) +++ trunk/epydoc/src/epydoc/docparser.py 2007-03-09 23:26:21 UTC (rev 1577) @@ -230,7 +230,7 @@ except ValueError, e: raise ImportError('%s' % e) # Check the cache, first. - if _moduledoc_cache.has_key(filename): + if filename in _moduledoc_cache: return _moduledoc_cache[filename] log.info("Parsing %s" % filename) @@ -1871,18 +1871,18 @@ # Locals if isinstance(parent_docs[-1], NamespaceDoc): - if parent_docs[-1].variables.has_key(identifier): + if identifier in parent_docs[-1].variables: return parent_docs[-1].variables[identifier] # Globals (aka the containing module) if isinstance(parent_docs[0], NamespaceDoc): - if parent_docs[0].variables.has_key(identifier): + if identifier in parent_docs[0].variables: return parent_docs[0].variables[identifier] # Builtins builtins = epydoc.docintrospecter.introspect_docs(__builtin__) if isinstance(builtins, NamespaceDoc): - if builtins.variables.has_key(identifier): + if identifier in builtins.variables: return builtins.variables[identifier] # We didn't find it; return None. Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-09 23:08:24 UTC (rev 1576) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-09 23:26:21 UTC (rev 1577) @@ -1389,7 +1389,7 @@ if os.path.exists(cssname): try: css = open(cssname).read() except: raise IOError("Can't open CSS file: %r" % cssname) - elif STYLESHEETS.has_key(cssname): + elif cssname in STYLESHEETS: css = STYLESHEETS[cssname][0] else: raise IOError("Can't find CSS file: %r" % cssname) Modified: trunk/epydoc/src/epydoc/markup/__init__.py =================================================================== --- trunk/epydoc/src/epydoc/markup/__init__.py 2007-03-09 23:08:24 UTC (rev 1576) +++ trunk/epydoc/src/epydoc/markup/__init__.py 2007-03-09 23:26:21 UTC (rev 1577) @@ -200,7 +200,7 @@ printed, then do nothing. """ global _parse_warnings - if _parse_warnings.has_key(estr): return + if estr in _parse_warnings: return _parse_warnings[estr] = 1 log.warning(estr) Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-09 23:08:24 UTC (rev 1576) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-09 23:26:21 UTC (rev 1577) @@ -1021,7 +1021,7 @@ if (end>0) and 'A' <= str[end-1] <= 'Z': if (end-1) > start: stack[-1].children.append(str[start:end-1]) - if not _COLORIZING_TAGS.has_key(str[end-1]): + if str[end-1] not in _COLORIZING_TAGS: estr = "Unknown inline markup tag." errors.append(ColorizingError(estr, token, end-1)) stack.append(Element('unknown')) @@ -1056,7 +1056,7 @@ errors.append(ColorizingError(estr, token, end)) else: symb = stack[-1].children[0] - if _SYMBOLS.has_key(symb): + if symb in _SYMBOLS: # It's a symbol stack[-2].children[-1] = Element('symbol', symb) else: @@ -1071,7 +1071,7 @@ errors.append(ColorizingError(estr, token, end)) else: escp = stack[-1].children[0] - if _ESCAPES.has_key(escp): + if escp in _ESCAPES: # It's an escape from _ESCPAES stack[-2].children[-1] = _ESCAPES[escp] elif len(escp) == 1: Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-03-09 23:08:24 UTC (rev 1576) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-03-09 23:26:21 UTC (rev 1577) @@ -413,7 +413,7 @@ is_fatal=0)) # Use a @newfield to let it be displayed as-is. - if not self._newfields.has_key(tagname.lower()): + if tagname.lower() not in self._newfields: newfield = Field('newfield', tagname.lower(), parse(tagname, 'plaintext')) self.fields.append(newfield) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-09 23:08:25
|
Revision: 1576 http://svn.sourceforge.net/epydoc/?rev=1576&view=rev Author: dvarrazzo Date: 2007-03-09 15:08:24 -0800 (Fri, 09 Mar 2007) Log Message: ----------- - Test strengthened to avoid passing a `GenericValueDoc` to `parse_function_signature()` in case of incomplete state (which usually doesn't happen... but unusual is our business) Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-03-08 21:28:07 UTC (rev 1575) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-03-09 23:08:24 UTC (rev 1576) @@ -218,7 +218,7 @@ # Parse ahead the __init__ docstring for this class initvar = api_doc.variables.get('__init__') - if initvar and initvar.value not in (None, UNKNOWN): + if initvar and isinstance(initvar.value, RoutineDoc): init_api_doc = initvar.value parse_docstring(init_api_doc, docindex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-03-08 21:28:09
|
Revision: 1575 http://svn.sourceforge.net/epydoc/?rev=1575&view=rev Author: edloper Date: 2007-03-08 13:28:07 -0800 (Thu, 08 Mar 2007) Log Message: ----------- fixed typos Modified Paths: -------------- trunk/epydoc/doc/fields.html trunk/epydoc/doc/manual-docstring.txt trunk/epydoc/doc/manual-othermarkup.txt Modified: trunk/epydoc/doc/fields.html =================================================================== --- trunk/epydoc/doc/fields.html 2007-03-07 02:55:14 UTC (rev 1574) +++ trunk/epydoc/doc/fields.html 2007-03-08 21:28:07 UTC (rev 1575) @@ -364,7 +364,7 @@ <h2> 3. Where to Write Fields</h2> <p> Normally the fields are written in the docstring of the documented -objects: this allows to add fields to modules, classes, function, properties. +objects: this allows you to add fields to modules, classes, function, properties. Where a docstring is not allowed, usually alternative options do exist. </p> Modified: trunk/epydoc/doc/manual-docstring.txt =================================================================== --- trunk/epydoc/doc/manual-docstring.txt 2007-03-07 02:55:14 UTC (rev 1574) +++ trunk/epydoc/doc/manual-docstring.txt 2007-03-08 21:28:07 UTC (rev 1575) @@ -104,7 +104,7 @@ as ``__add__``) are public. For each module and class, Epydoc generates pages with both public and private -methods. A Javascript snippet allows to toggle the visibility of private +methods. A Javascript snippet allows you to toggle the visibility of private objects. If a module wants to hide some of the objects it contains (either defined in Modified: trunk/epydoc/doc/manual-othermarkup.txt =================================================================== --- trunk/epydoc/doc/manual-othermarkup.txt 2007-03-07 02:55:14 UTC (rev 1574) +++ trunk/epydoc/doc/manual-othermarkup.txt 2007-03-08 21:28:07 UTC (rev 1575) @@ -381,7 +381,7 @@ Linking from standalone documents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Epydoc provides the script ``apirst2html.py`` which allows to use the +Epydoc provides the script ``apirst2html.py`` which allows you to use the previously described interpreted text roles from any reST document. The script exposes the same interface of the standard Docutils script ``rst2html.py`` but provides the extra command line options described in `External API links`_. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-07 02:55:15
|
Revision: 1574 http://svn.sourceforge.net/epydoc/?rev=1574&view=rev Author: dvarrazzo Date: 2007-03-06 18:55:14 -0800 (Tue, 06 Mar 2007) Log Message: ----------- - Fixed summarization for plaintext markup. If a docstring had one (or more) line not ending with a full stop, but separated from the rest of the docstring by a blank line, and there was a full stop somewhere in the following paragraphs, the docstring was summarized up to the full stop instead of the blank line. Such docstrings appear in many places in the stdlib. - Test case added. - Pre-compiling the regular expression to recognize the summary. Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/epytext.py trunk/epydoc/src/epydoc/markup/javadoc.py trunk/epydoc/src/epydoc/markup/plaintext.py trunk/epydoc/src/epydoc/markup/restructuredtext.py trunk/epydoc/src/epydoc/test/plaintext.doctest Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-07 01:26:50 UTC (rev 1573) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-07 02:55:14 UTC (rev 1574) @@ -1969,6 +1969,8 @@ # Assume that anything else can be passed through. return childstr + _SUMMARY_RE = re.compile(r'(\s*[\w\W]*?\.)(\s|$)') + def summary(self): if self._tree is None: return self, False tree = self._tree @@ -2008,7 +2010,7 @@ doc.children.append(para) for parachild in parachildren: if isinstance(parachild, basestring): - m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', parachild) + m = self._SUMMARY_RE.match(parachild) if m: para.children.append(m.group(1)) long_docs |= parachild is not parachildren[-1] Modified: trunk/epydoc/src/epydoc/markup/javadoc.py =================================================================== --- trunk/epydoc/src/epydoc/markup/javadoc.py 2007-03-07 01:26:50 UTC (rev 1573) +++ trunk/epydoc/src/epydoc/markup/javadoc.py 2007-03-07 02:55:14 UTC (rev 1574) @@ -219,13 +219,15 @@ def to_plaintext(self, docstring_linker, **options): return self._docstring + _SUMMARY_RE = re.compile(r'(\s*[\w\W]*?\.)(\s|$)') + # Jeff's hack to get summary working def summary(self): # Drop tags doc = "\n".join([ row for row in self._docstring.split('\n') if not row.lstrip().startswith('@') ]) - m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', doc) + m = self._SUMMARY_RE.match(doc) if m: other = doc[m.end():] return (ParsedJavadocDocstring(m.group(1)), Modified: trunk/epydoc/src/epydoc/markup/plaintext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/plaintext.py 2007-03-07 01:26:50 UTC (rev 1573) +++ trunk/epydoc/src/epydoc/markup/plaintext.py 2007-03-07 02:55:14 UTC (rev 1574) @@ -50,8 +50,10 @@ return '\n'.join([' '*indent+l for l in lines])+'\n' return self._text+'\n' + _SUMMARY_RE = re.compile(r'(\s*[\w\W]*?(?:\.(\s|$)|[\n][\t ]*[\n]))') + def summary(self): - m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', self._text) + m = self._SUMMARY_RE.match(self._text) if m: other = self._text[m.end():] return (ParsedPlaintextDocstring(m.group(1), verbatim=0), Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-03-07 01:26:50 UTC (rev 1573) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-03-07 02:55:14 UTC (rev 1574) @@ -291,6 +291,7 @@ def visit_document(self, node): self.summary = None + _SUMMARY_RE = re.compile(r'(\s*[\w\W]*?\.)(\s|$)') def visit_paragraph(self, node): if self.summary is not None: # found a paragraph after the first one @@ -302,7 +303,7 @@ # Extract the first sentence. for child in node: if isinstance(child, docutils.nodes.Text): - m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', child.data) + m = self._SUMMARY_RE.match(child.data) if m: summary_pieces.append(docutils.nodes.Text(m.group(1))) other = child.data[m.end():] Modified: trunk/epydoc/src/epydoc/test/plaintext.doctest =================================================================== --- trunk/epydoc/src/epydoc/test/plaintext.doctest 2007-03-07 01:26:50 UTC (rev 1573) +++ trunk/epydoc/src/epydoc/test/plaintext.doctest 2007-03-07 02:55:14 UTC (rev 1574) @@ -52,3 +52,19 @@ ... This is detached ... """) ('Other lines without period...', True) + +In 3.0beta1 docstrings such this were not correctly summarized. + +>>> getsummary("""A user-defined wrapper around string objects +... +... Note: string objects have grown methods in Python 1.6 +... This module requires Python 1.6 or later. +... """) +('A user-defined wrapper around string objects', True) + +>>> getsummary("""This is more tricky +... than the test before +... +... but i am looking for the same bug. +... """) +('This is more tricky\nthan the test before', True) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-07 01:26:51
|
Revision: 1573 http://svn.sourceforge.net/epydoc/?rev=1573&view=rev Author: dvarrazzo Date: 2007-03-06 17:26:50 -0800 (Tue, 06 Mar 2007) Log Message: ----------- - Branch merged into the trunk. Removed Paths: ------------- branches/exp-text_node/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-07 01:23:20
|
Revision: 1572 http://svn.sourceforge.net/epydoc/?rev=1572&view=rev Author: dvarrazzo Date: 2007-03-06 17:23:18 -0800 (Tue, 06 Mar 2007) Log Message: ----------- - All "free" Epydoc paragraphs are rendered in HTML into ``<p>``\ 's: removed the "HTML postprocessing" required to fix excessive spacing. - Added an ``inline`` attribute to `Ticket` and `Element`. Inline elements are similar tho HTMl ``<span>``; they are rendered in HTML without ``<p>``. Inline elements are, for instance: - list items (fields too); - docstring summaries; - HTML code simplified: no more ``<br><br>`` to accomodate for the lack of ``<p>``. This layout is more CSS-friendly. - Paragraphs vertical margins tweaked. - H3 top margin value set for cross browser consistency (IE and FF have different defaults). Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/docwriter/html_css.py trunk/epydoc/src/epydoc/markup/epytext.py trunk/epydoc/src/epydoc/test/encoding.doctest trunk/epydoc/src/epydoc/test/epytext.doctest Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-03-07 01:23:18 UTC (rev 1572) @@ -507,6 +507,7 @@ """A ParsedDocstring containing the text 'Returns'. This is used to construct summary descriptions for routines that have empty C{descr}, but non-empty C{return_descr}.""" +RETURN_PDS._tree.children[0].attribs['inline'] = True ###################################################################### #{ Field Processing Error Messages Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-07 01:23:18 UTC (rev 1572) @@ -739,11 +739,11 @@ out('<!-- ==================== %s ' % typ.upper() + 'DESCRIPTION ==================== -->\n') out('<h1 class="epydoc">%s %s</h1>' % (typ, shortname)) - out(self.pysrc_link(doc) + '<br /><br />\n') + out('<p class="nomargin-top">%s</p>\n' % self.pysrc_link(doc)) # If the module has a description, then list it. if doc.descr not in (None, UNKNOWN): - out(self.descr(doc, 2)+'<br /><br />\n\n') + out(self.descr(doc, 2)+'\n\n') # Write any standarad metadata (todo, author, etc.) if doc.metadata is not UNKNOWN and doc.metadata: @@ -830,7 +830,7 @@ out('<!-- ==================== %s ' % typ.upper() + 'DESCRIPTION ==================== -->\n') out('<h1 class="epydoc">%s %s</h1>' % (typ, shortname)) - out(self.pysrc_link(doc) + '<br /><br />\n') + out('<p class="nomargin-top">%s</p>\n' % self.pysrc_link(doc)) if ((doc.bases not in (UNKNOWN, None) and len(doc.bases) > 0) or (doc.subclasses not in (UNKNOWN,None) and len(doc.subclasses)>0)): @@ -864,7 +864,7 @@ # If the class has a description, then list it. if doc.descr not in (None, UNKNOWN): - out(self.descr(doc, 2)+'<br /><br />\n\n') + out(self.descr(doc, 2)+'\n\n') # Write any standarad metadata (todo, author, etc.) if doc.metadata is not UNKNOWN and doc.metadata: Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-03-07 01:23:18 UTC (rev 1572) @@ -60,6 +60,7 @@ * defined below). */ body { background: $body_bg; color: $body_fg; } +p { margin-top: 0.5em; margin-bottom: 0.5em; } a:link { color: $body_link; } a:visited { color: $body_visited_link; } dt { font-weight: bold; } @@ -84,7 +85,8 @@ */ h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } h2.epydoc { font-size: +130%; font-weight: bold; } -h3.epydoc { font-size: +115%; font-weight: bold; } +h3.epydoc { font-size: +115%; font-weight: bold; + margin-top: 0.2em; } td h3.epydoc { font-size: +115%; font-weight: bold; margin-bottom: 0; } table.navbar { background: $navbar_bg; color: $navbar_fg; Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2007-03-07 01:23:18 UTC (rev 1572) @@ -367,6 +367,8 @@ if para_token.indent == indent_stack[-1]: # Colorize the paragraph and add it. para = _colorize(doc, para_token, errors) + if para_token.inline: + para.attribs['inline'] = True stack[-1].children.append(para) else: estr = "Improper paragraph indentation." @@ -554,6 +556,11 @@ heading; C{None}, otherwise. Valid heading levels are 0, 1, and 2. + @type inline: C{bool} + @ivar inline: If True, the element is an inline level element, comparable + to an HTML C{<span>} tag. Else, it is a block level element, comparable + to an HTML C{<div>}. + @type PARA: C{string} @cvar PARA: The C{tag} value for paragraph C{Token}s. @type LBLOCK: C{string} @@ -574,7 +581,8 @@ HEADING = "heading" BULLET = "bullet" - def __init__(self, tag, startline, contents, indent, level=None): + def __init__(self, tag, startline, contents, indent, level=None, + inline=False): """ Create a new C{Token}. @@ -591,12 +599,15 @@ @param level: The heading-level of this C{Token} if it is a heading; C{None}, otherwise. @type level: C{int} or C{None} + @param inline: Is this C{Token} inline as a C{<span>}?. + @type inline: C{bool} """ self.tag = tag self.startline = startline self.contents = contents self.indent = indent self.level = level + self.inline = inline def __repr__(self): """ @@ -794,14 +805,16 @@ linenum += 1 # Add the bullet token. - tokens.append(Token(Token.BULLET, start, bcontents, bullet_indent)) + tokens.append(Token(Token.BULLET, start, bcontents, bullet_indent, + inline=True)) # Add the paragraph token. pcontents = ([lines[start][para_start:].strip()] + [line.strip() for line in lines[start+1:linenum]]) pcontents = ' '.join(pcontents).strip() if pcontents: - tokens.append(Token(Token.PARA, start, pcontents, para_indent)) + tokens.append(Token(Token.PARA, start, pcontents, para_indent, + inline=True)) # Return the linenum after the paragraph token ends. return linenum @@ -1768,25 +1781,14 @@ indent+2, seclevel) for c in tree.children] - # Get rid of unnecessary <P>...</P> tags; they introduce extra - # space on most browsers that we don't want. - for i in range(len(variables)-1): - if (not isinstance(tree.children[i], basestring) and - tree.children[i].tag == 'para' and - (isinstance(tree.children[i+1], basestring) or - tree.children[i+1].tag != 'para')): - variables[i] = ' '*(indent+2)+variables[i][5+indent:-5]+'\n' - if (tree.children and - not isinstance(tree.children[-1], basestring) and - tree.children[-1].tag == 'para'): - variables[-1] = ' '*(indent+2)+variables[-1][5+indent:-5]+'\n' - # Construct the HTML string for the variables. childstr = ''.join(variables) # Perform the approriate action for the DOM tree type. if tree.tag == 'para': - return wordwrap('<p>%s</p>' % childstr, indent) + return wordwrap( + (tree.attribs.get('inline') and '%s' or '<p>%s</p>') % childstr, + indent) elif tree.tag == 'code': style = tree.attribs.get('style') if style: @@ -2002,7 +2004,7 @@ # Extract the first sentence. parachildren = variables[0].children - para = Element('para') + para = Element('para', inline=True) doc.children.append(para) for parachild in parachildren: if isinstance(parachild, basestring): Modified: trunk/epydoc/src/epydoc/test/encoding.doctest =================================================================== --- trunk/epydoc/src/epydoc/test/encoding.doctest 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/test/encoding.doctest 2007-03-07 01:23:18 UTC (rev 1572) @@ -27,27 +27,27 @@ >>> testencoding('''# -*- coding: cp874 -*- ... """abc ABC 123 \x80 \x85""" ... ''') - abc ABC 123 € … + <p>abc ABC 123 € …</p> >>> testencoding('''# -*- coding: cp1250 -*- ... """abc ABC 123 \x80 \x82 \x84 \x85 \xff""" ... ''') - abc ABC 123 € ‚ „ … ˙ + <p>abc ABC 123 € ‚ „ … ˙</p> >>> testencoding('''# -*- coding: cp1251 -*- ... """abc ABC 123 \x80 \x81 \x82 \xff""" ... ''') - abc ABC 123 Ђ Ѓ ‚ я + <p>abc ABC 123 Ђ Ѓ ‚ я</p> >>> testencoding('''# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding('''# -*- coding: cp1253 -*- ... """abc ABC 123 \x80 \x82 \x83 \xfe""" ... ''') - abc ABC 123 € ‚ ƒ ώ + <p>abc ABC 123 € ‚ ƒ ώ</p> Unicode tests: @@ -71,52 +71,52 @@ <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> # UTF-8 with a BOM & a coding directive: >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> # UTF-8 with a BOM & no coding directive: >>> testencoding(utf8_bom+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Tests for KOI8-R: >>> testencoding('''# -*- coding: koi8-r -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 ─ ┌ ┐ Ъ + <p>abc ABC 123 ─ ┌ ┐ Ъ</p> Tests for 'coding' directive on the second line: >>> testencoding('''\n# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding('''# comment on the first line.\n# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding("\n# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding("# comment\n# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Tests for shift-jis @@ -132,12 +132,12 @@ >>> testencoding('''# -*- coding: utf-8 -*- ... """abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80""" ... ''') - abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> >>> testencoding('''# -*- coding: utf-8 -*- ... u"""abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80""" ... ''') - abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> Under special circumstances, we may not be able to tell what the proper encoding for a docstring is. This happens if: @@ -166,33 +166,33 @@ <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test, introspect=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+utf8_test, introspect=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding("# -*- coding: utf-8 -*-\n"+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Context checks ============== @@ -219,12 +219,12 @@ ... ''') abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ - abc ABC 123 € ߿ ࠀ >>> testencoding('''# -*- coding: utf-8 -*- ... class A: @@ -238,11 +238,11 @@ ... z = property(doc=u"abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80") ... ''') abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ - abc ABC 123 € ߿ ࠀ Modified: trunk/epydoc/src/epydoc/test/epytext.doctest =================================================================== --- trunk/epydoc/src/epydoc/test/epytext.doctest 2007-03-06 19:24:12 UTC (rev 1571) +++ trunk/epydoc/src/epydoc/test/epytext.doctest 2007-03-07 01:23:18 UTC (rev 1572) @@ -45,14 +45,14 @@ ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field.</para></field></fieldlist> + <para inline=True>This is a field.</para></field></fieldlist> >>> print testparse(""" ... This is a paragraph. ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field.</para></field></fieldlist> + <para inline=True>This is a field.</para></field></fieldlist> >>> print testparse(""" ... This is a paragraph. @@ -60,23 +60,23 @@ ... Hello.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field. Hello.</para></field></fieldlist> - + <para inline=True>This is a field. Hello.</para></field> + </fieldlist> >>> print testparse("""Paragraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <para inline=True>field</para></field></fieldlist> >>> print testparse("""Paragraph\n\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <para inline=True>field</para></field></fieldlist> >>> print testparse("""\nParagraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <para inline=True>field</para></field></fieldlist> Make sure thta unindented lists are not allowed: @@ -122,20 +122,22 @@ >>> print testparse("""Paragraph\n- list item""") <para>Paragraph</para> - <ulist><li><para>list item</para></li></ulist> + <ulist><li><para inline=True>list item</para></li></ulist> Make sure that indented lists are allowed: >>> print testparse('This is a paragraph.\n - This is a list item.\n'+ ... 'This is a paragraph') <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse('This is a paragraph.\n\n - This is a list item.'+ ... '\n\nThis is a paragraph') <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -145,7 +147,8 @@ ... ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -154,18 +157,22 @@ ... - This is a list item. ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" ... - This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> >>> print testparse("""- This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> >>> print testparse("""\n- This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> Basic list tests: @@ -176,10 +183,10 @@ >>> LI3 = " - This is a list\n item." >>> LI4 = "\n - This is a list\n item." >>> PARA = ('<para>This is a paragraph.</para>') - >>> ONELIST = ('<ulist><li><para>This is a '+ + >>> ONELIST = ('<ulist><li><para inline=True>This is a '+ ... 'list item.</para></li></ulist>') - >>> TWOLIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li><li><para>This is a '+ + >>> TWOLIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li><li><para inline=True>This is a '+ ... 'list item.</para></li></ulist>') >>> for p in (P1, P2): @@ -198,7 +205,7 @@ ... PARA+TWOLIST+PARA) >>> LI5 = " - This is a list item.\n\n It contains two paragraphs." - >>> LI5LIST = ('<ulist><li><para>This is a list item.</para>'+ + >>> LI5LIST = ('<ulist><li><para inline=True>This is a list item.</para>'+ ... '<para>It contains two paragraphs.</para></li></ulist>') >>> checkparse(LI5, LI5LIST) >>> checkparse('%s\n%s' % (P1, LI5), PARA+LI5LIST) @@ -206,7 +213,7 @@ >>> LI6 = (" - This is a list item with a literal block::\n" + ... " hello\n there") - >>> LI6LIST = ('<ulist><li><para>This is a list item with a literal '+ + >>> LI6LIST = ('<ulist><li><para inline=True>This is a list item with a literal '+ ... 'block:</para><literalblock> hello\n there'+ ... '</literalblock></li></ulist>') >>> checkparse(LI6, LI6LIST) @@ -216,10 +223,10 @@ Item wrap tests: >>> LI = "- This is a list\n item." - >>> ONELIST = ('<ulist><li><para>This is a '+ + >>> ONELIST = ('<ulist><li><para inline=True>This is a '+ ... 'list item.</para></li></ulist>') - >>> TWOLIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li><li><para>This is a '+ + >>> TWOLIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li><li><para inline=True>This is a '+ ... 'list item.</para></li></ulist>') >>> for indent in ('', ' '): ... for nl1 in ('', '\n'): @@ -229,7 +236,7 @@ Summary ======= -The implementation of the summaization function works as expected. +The implementation of the summarization function works as expected. >>> from epydoc.markup import epytext >>> def getsummary(s): @@ -298,14 +305,14 @@ ... return (v or '').rstrip() >>> print epytext2html("{1:{2:3}}") -{1:{2:3}} +<p>{1:{2:3}}</p> >>> print epytext2html("C{{1:{2:3}}}") -<code>{1:{2:3}}</code> +<p><code>{1:{2:3}}</code></p> >>> print epytext2html("{1:C{{2:3}}}") -{1:<code>{2:3}</code>} +<p>{1:<code>{2:3}</code>}</p> >>> print epytext2html("{{{}{}}{}}") -{{{}{}}{}} +<p>{{{}{}}{}}</p> >>> print epytext2html("{{E{lb}E{lb}E{lb}}}") -{{{{{}} +<p>{{{{{}}</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-06 19:24:15
|
Revision: 1571 http://svn.sourceforge.net/epydoc/?rev=1571&view=rev Author: dvarrazzo Date: 2007-03-06 11:24:12 -0800 (Tue, 06 Mar 2007) Log Message: ----------- - Actually, it is not really required to add a new token: PARA and TEXT are almost always treated the same way. Using an attribute is enough. Modified Paths: -------------- branches/exp-text_node/epydoc/src/epydoc/docstringparser.py branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest Modified: branches/exp-text_node/epydoc/src/epydoc/docstringparser.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/docstringparser.py 2007-03-05 02:18:17 UTC (rev 1570) +++ branches/exp-text_node/epydoc/src/epydoc/docstringparser.py 2007-03-06 19:24:12 UTC (rev 1571) @@ -507,7 +507,7 @@ """A ParsedDocstring containing the text 'Returns'. This is used to construct summary descriptions for routines that have empty C{descr}, but non-empty C{return_descr}.""" -RETURN_PDS._tree.children[0].tag = "text" +RETURN_PDS._tree.children[0].attribs['inline'] = True ###################################################################### #{ Field Processing Error Messages Modified: branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-05 02:18:17 UTC (rev 1570) +++ branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-06 19:24:12 UTC (rev 1571) @@ -286,7 +286,7 @@ _pop_completed_blocks(token, stack, indent_stack) # If Token has type PARA, colorize and add the new paragraph - if token.tag in (Token.PARA, Token.TEXT): + if token.tag == Token.PARA: _add_para(doc, token, stack, indent_stack, errors) # If Token has type HEADING, add the new section @@ -366,7 +366,9 @@ indent_stack[-1] = para_token.indent if para_token.indent == indent_stack[-1]: # Colorize the paragraph and add it. - para = _colorize(doc, para_token, errors, tagName=para_token.tag) + para = _colorize(doc, para_token, errors) + if para_token.inline: + para.attribs['inline'] = True stack[-1].children.append(para) else: estr = "Improper paragraph indentation." @@ -511,10 +513,9 @@ """ C{Token}s are an intermediate data structure used while constructing the structuring DOM tree for a formatted docstring. - There are six types of C{Token}: + There are five types of C{Token}: - Paragraphs - - Text - Literal blocks - Doctest blocks - Headings @@ -534,9 +535,8 @@ @type tag: C{string} @ivar tag: This C{Token}'s type. Possible values are C{Token.PARA} - (paragraph), C{Token.TEXT} (text node), C{Token.LBLOCK} - (literal block), C{Token.DTBLOCK} (doctest block), C{Token.HEADINGC}, - and C{Token.BULLETC}. + (paragraph), C{Token.LBLOCK} (literal block), C{Token.DTBLOCK} + (doctest block), C{Token.HEADINGC}, and C{Token.BULLETC}. @type startline: C{int} @ivar startline: The line on which this C{Token} begins. This @@ -556,10 +556,13 @@ heading; C{None}, otherwise. Valid heading levels are 0, 1, and 2. + @type inline: C{bool} + @ivar inline: If True, the element is an inline level element, comparable + to an HTML C{<span>} tag. Else, it is a block level element, comparable + to an HTML C{<div>}. + @type PARA: C{string} @cvar PARA: The C{tag} value for paragraph C{Token}s. - @type TEXT: C{string} - @cvar TEXT: The C{tag} value for text parts inside other items. @type LBLOCK: C{string} @cvar LBLOCK: The C{tag} value for literal C{Token}s. @type DTBLOCK: C{string} @@ -577,9 +580,9 @@ DTBLOCK = "doctestblock" HEADING = "heading" BULLET = "bullet" - TEXT = "text" - def __init__(self, tag, startline, contents, indent, level=None): + def __init__(self, tag, startline, contents, indent, level=None, + inline=False): """ Create a new C{Token}. @@ -596,12 +599,15 @@ @param level: The heading-level of this C{Token} if it is a heading; C{None}, otherwise. @type level: C{int} or C{None} + @param inline: Is this C{Token} inline as a C{<span>}?. + @type inline: C{bool} """ self.tag = tag self.startline = startline self.contents = contents self.indent = indent self.level = level + self.inline = inline def __repr__(self): """ @@ -799,14 +805,16 @@ linenum += 1 # Add the bullet token. - tokens.append(Token(Token.BULLET, start, bcontents, bullet_indent)) + tokens.append(Token(Token.BULLET, start, bcontents, bullet_indent, + inline=True)) # Add the paragraph token. pcontents = ([lines[start][para_start:].strip()] + [line.strip() for line in lines[start+1:linenum]]) pcontents = ' '.join(pcontents).strip() if pcontents: - tokens.append(Token(Token.TEXT, start, pcontents, para_indent)) + tokens.append(Token(Token.PARA, start, pcontents, para_indent, + inline=True)) # Return the linenum after the paragraph token ends. return linenum @@ -945,7 +953,7 @@ linenum = _tokenize_para(lines, linenum, indent, tokens, errors) # Paragraph tokens ending in '::' initiate literal blocks. - if (tokens[-1].tag in (Token.PARA, Token.TEXT) and + if (tokens[-1].tag == Token.PARA and tokens[-1].contents[-2:] == '::'): tokens[-1].contents = tokens[-1].contents[:-1] linenum = _tokenize_literal(lines, linenum, indent, tokens, errors) @@ -1230,7 +1238,7 @@ # Clean up for literal blocks (add the double "::" back) childstr = re.sub(':(\s*)\2', '::\\1', childstr) - if tree.tag in ('para', 'text'): + if tree.tag == 'para': str = wordwrap(childstr, indent)+'\n' str = re.sub(r'((^|\n)\s*\d+)\.', r'\1E{.}', str) str = re.sub(r'((^|\n)\s*)-', r'\1E{-}', str) @@ -1317,7 +1325,7 @@ variables = [to_plaintext(c, cindent, seclevel) for c in tree.children] childstr = ''.join(variables) - if tree.tag in ('para', 'text'): + if tree.tag == 'para': return wordwrap(childstr, indent)+'\n' elif tree.tag == 'li': # We should be able to use getAttribute here; but there's no @@ -1397,7 +1405,7 @@ # Clean up for literal blocks (add the double "::" back) childstr = re.sub(':( *\n \|\n)\2', '::\\1', childstr) - if tree.tag in ('para', 'text'): + if tree.tag == 'para': str = wordwrap(childstr, indent-6, 69)+'\n' str = re.sub(r'((^|\n)\s*\d+)\.', r'\1E{.}', str) str = re.sub(r'((^|\n)\s*)-', r'\1E{-}', str) @@ -1778,9 +1786,9 @@ # Perform the approriate action for the DOM tree type. if tree.tag == 'para': - return wordwrap('<p>%s</p>' % childstr, indent) - if tree.tag == 'text': - return wordwrap('%s' % childstr, indent) + return wordwrap( + (tree.attribs.get('inline') and '%s' or '<p>%s</p>') % childstr, + indent) elif tree.tag == 'code': style = tree.attribs.get('style') if style: @@ -1898,7 +1906,7 @@ for c in tree.children] childstr = ''.join(variables) - if tree.tag in ('para', 'text'): + if tree.tag == 'para': return wordwrap(childstr, indent)+'\n' elif tree.tag == 'code': return '\\texttt{%s}' % childstr @@ -1968,7 +1976,7 @@ # Find the first paragraph. variables = tree.children - while (len(variables) > 0) and (variables[0].tag not in ('para', 'text')): + while (len(variables) > 0) and (variables[0].tag != 'para'): if variables[0].tag in ('section', 'ulist', 'olist', 'li'): variables = variables[0].children else: @@ -1996,7 +2004,7 @@ # Extract the first sentence. parachildren = variables[0].children - para = Element('text') + para = Element('para', inline=True) doc.children.append(para) for parachild in parachildren: if isinstance(parachild, basestring): Modified: branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-05 02:18:17 UTC (rev 1570) +++ branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-06 19:24:12 UTC (rev 1571) @@ -45,14 +45,14 @@ ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <text>This is a field.</text></field></fieldlist> + <para inline=True>This is a field.</para></field></fieldlist> >>> print testparse(""" ... This is a paragraph. ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <text>This is a field.</text></field></fieldlist> + <para inline=True>This is a field.</para></field></fieldlist> >>> print testparse(""" ... This is a paragraph. @@ -60,23 +60,23 @@ ... Hello.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <text>This is a field. Hello.</text></field></fieldlist> - + <para inline=True>This is a field. Hello.</para></field> + </fieldlist> >>> print testparse("""Paragraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <text>field</text></field></fieldlist> + <para inline=True>field</para></field></fieldlist> >>> print testparse("""Paragraph\n\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <text>field</text></field></fieldlist> + <para inline=True>field</para></field></fieldlist> >>> print testparse("""\nParagraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <text>field</text></field></fieldlist> + <para inline=True>field</para></field></fieldlist> Make sure thta unindented lists are not allowed: @@ -122,20 +122,22 @@ >>> print testparse("""Paragraph\n- list item""") <para>Paragraph</para> - <ulist><li><text>list item</text></li></ulist> + <ulist><li><para inline=True>list item</para></li></ulist> Make sure that indented lists are allowed: >>> print testparse('This is a paragraph.\n - This is a list item.\n'+ ... 'This is a paragraph') <para>This is a paragraph.</para> - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse('This is a paragraph.\n\n - This is a list item.'+ ... '\n\nThis is a paragraph') <para>This is a paragraph.</para> - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -145,7 +147,8 @@ ... ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -154,18 +157,22 @@ ... - This is a list item. ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> <para>This is a paragraph</para> >>> print testparse(""" ... - This is a list item.""") - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> >>> print testparse("""- This is a list item.""") - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> >>> print testparse("""\n- This is a list item.""") - <ulist><li><text>This is a list item.</text></li></ulist> + <ulist><li><para inline=True>This is a list item.</para></li> + </ulist> Basic list tests: @@ -176,11 +183,11 @@ >>> LI3 = " - This is a list\n item." >>> LI4 = "\n - This is a list\n item." >>> PARA = ('<para>This is a paragraph.</para>') - >>> ONELIST = ('<ulist><li><text>This is a '+ - ... 'list item.</text></li></ulist>') - >>> TWOLIST = ('<ulist><li><text>This is a '+ - ... 'list item.</text></li><li><text>This is a '+ - ... 'list item.</text></li></ulist>') + >>> ONELIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li></ulist>') + >>> TWOLIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li><li><para inline=True>This is a '+ + ... 'list item.</para></li></ulist>') >>> for p in (P1, P2): ... for li1 in (LI1, LI2, LI3, LI4): @@ -198,7 +205,7 @@ ... PARA+TWOLIST+PARA) >>> LI5 = " - This is a list item.\n\n It contains two paragraphs." - >>> LI5LIST = ('<ulist><li><text>This is a list item.</text>'+ + >>> LI5LIST = ('<ulist><li><para inline=True>This is a list item.</para>'+ ... '<para>It contains two paragraphs.</para></li></ulist>') >>> checkparse(LI5, LI5LIST) >>> checkparse('%s\n%s' % (P1, LI5), PARA+LI5LIST) @@ -206,8 +213,8 @@ >>> LI6 = (" - This is a list item with a literal block::\n" + ... " hello\n there") - >>> LI6LIST = ('<ulist><li><text>This is a list item with a literal '+ - ... 'block:</text><literalblock> hello\n there'+ + >>> LI6LIST = ('<ulist><li><para inline=True>This is a list item with a literal '+ + ... 'block:</para><literalblock> hello\n there'+ ... '</literalblock></li></ulist>') >>> checkparse(LI6, LI6LIST) >>> checkparse('%s\n%s' % (P1, LI6), PARA+LI6LIST) @@ -216,11 +223,11 @@ Item wrap tests: >>> LI = "- This is a list\n item." - >>> ONELIST = ('<ulist><li><text>This is a '+ - ... 'list item.</text></li></ulist>') - >>> TWOLIST = ('<ulist><li><text>This is a '+ - ... 'list item.</text></li><li><text>This is a '+ - ... 'list item.</text></li></ulist>') + >>> ONELIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li></ulist>') + >>> TWOLIST = ('<ulist><li><para inline=True>This is a '+ + ... 'list item.</para></li><li><para inline=True>This is a '+ + ... 'list item.</para></li></ulist>') >>> for indent in ('', ' '): ... for nl1 in ('', '\n'): ... checkparse(nl1+indent+LI, ONELIST) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-05 02:18:19
|
Revision: 1570 http://svn.sourceforge.net/epydoc/?rev=1570&view=rev Author: dvarrazzo Date: 2007-03-04 18:18:17 -0800 (Sun, 04 Mar 2007) Log Message: ----------- - Fixed unrequired encoding. - Tests updated with the newly generated HTML (there are always <p> tags). Modified Paths: -------------- branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py branches/exp-text_node/epydoc/src/epydoc/test/encoding.doctest branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest Modified: branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-05 01:52:05 UTC (rev 1569) +++ branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-05 02:18:17 UTC (rev 1570) @@ -1780,7 +1780,7 @@ if tree.tag == 'para': return wordwrap('<p>%s</p>' % childstr, indent) if tree.tag == 'text': - return wordwrap(str(childstr), indent) + return wordwrap('%s' % childstr, indent) elif tree.tag == 'code': style = tree.attribs.get('style') if style: Modified: branches/exp-text_node/epydoc/src/epydoc/test/encoding.doctest =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/test/encoding.doctest 2007-03-05 01:52:05 UTC (rev 1569) +++ branches/exp-text_node/epydoc/src/epydoc/test/encoding.doctest 2007-03-05 02:18:17 UTC (rev 1570) @@ -27,27 +27,27 @@ >>> testencoding('''# -*- coding: cp874 -*- ... """abc ABC 123 \x80 \x85""" ... ''') - abc ABC 123 € … + <p>abc ABC 123 € …</p> >>> testencoding('''# -*- coding: cp1250 -*- ... """abc ABC 123 \x80 \x82 \x84 \x85 \xff""" ... ''') - abc ABC 123 € ‚ „ … ˙ + <p>abc ABC 123 € ‚ „ … ˙</p> >>> testencoding('''# -*- coding: cp1251 -*- ... """abc ABC 123 \x80 \x81 \x82 \xff""" ... ''') - abc ABC 123 Ђ Ѓ ‚ я + <p>abc ABC 123 Ђ Ѓ ‚ я</p> >>> testencoding('''# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding('''# -*- coding: cp1253 -*- ... """abc ABC 123 \x80 \x82 \x83 \xfe""" ... ''') - abc ABC 123 € ‚ ƒ ώ + <p>abc ABC 123 € ‚ ƒ ώ</p> Unicode tests: @@ -71,52 +71,52 @@ <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> # UTF-8 with a BOM & a coding directive: >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> # UTF-8 with a BOM & no coding directive: >>> testencoding(utf8_bom+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Tests for KOI8-R: >>> testencoding('''# -*- coding: koi8-r -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 ─ ┌ ┐ Ъ + <p>abc ABC 123 ─ ┌ ┐ Ъ</p> Tests for 'coding' directive on the second line: >>> testencoding('''\n# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding('''# comment on the first line.\n# -*- coding: cp1252 -*- ... """abc ABC 123 \x80 \x82 \x83 \xff""" ... ''') - abc ABC 123 € ‚ ƒ ÿ + <p>abc ABC 123 € ‚ ƒ ÿ</p> >>> testencoding("\n# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding("# comment\n# -*- coding: utf-8 -*-\n"+utf8_test) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Tests for shift-jis @@ -132,12 +132,12 @@ >>> testencoding('''# -*- coding: utf-8 -*- ... """abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80""" ... ''') - abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> >>> testencoding('''# -*- coding: utf-8 -*- ... u"""abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80""" ... ''') - abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> Under special circumstances, we may not be able to tell what the proper encoding for a docstring is. This happens if: @@ -166,33 +166,33 @@ <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test, introspect=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+utf8_test, introspect=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding("# -*- coding: utf-8 -*-\n"+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+"# -*- coding: utf-8 -*-\n"+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> >>> testencoding(utf8_bom+utf8_test, parse=False) <p>abc ABC 123</p> <p>0x80-0x7ff range: €  ߾ ߿</p> <p>0x800-0xffff range: ࠀ ࠁ  </p> - 0x10000-0x10ffff range: 𐀀 𐀁   + <p>0x10000-0x10ffff range: 𐀀 𐀁  </p> Context checks ============== @@ -219,12 +219,12 @@ ... ''') abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ - abc ABC 123 € ߿ ࠀ >>> testencoding('''# -*- coding: utf-8 -*- ... class A: @@ -238,11 +238,11 @@ ... z = property(doc=u"abc ABC 123 \xc2\x80 \xdf\xbf \xe0\xa0\x80") ... ''') abc ABC 123 € ߿ ࠀ + <p>abc ABC 123 € ߿ ࠀ</p> abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ abc ABC 123 € ߿ ࠀ - abc ABC 123 € ߿ ࠀ Modified: branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-05 01:52:05 UTC (rev 1569) +++ branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-05 02:18:17 UTC (rev 1570) @@ -298,14 +298,14 @@ ... return (v or '').rstrip() >>> print epytext2html("{1:{2:3}}") -{1:{2:3}} +<p>{1:{2:3}}</p> >>> print epytext2html("C{{1:{2:3}}}") -<code>{1:{2:3}}</code> +<p><code>{1:{2:3}}</code></p> >>> print epytext2html("{1:C{{2:3}}}") -{1:<code>{2:3}</code>} +<p>{1:<code>{2:3}</code>}</p> >>> print epytext2html("{{{}{}}{}}") -{{{}{}}{}} +<p>{{{}{}}{}}</p> >>> print epytext2html("{{E{lb}E{lb}E{lb}}}") -{{{{{}} +<p>{{{{{}}</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-05 01:52:09
|
Revision: 1569 http://svn.sourceforge.net/epydoc/?rev=1569&view=rev Author: dvarrazzo Date: 2007-03-04 17:52:05 -0800 (Sun, 04 Mar 2007) Log Message: ----------- - Added Token.TEXT to represent an inline chunk of text. - Some tests updated. Not all tests pass yet anyway. - Removed double <br/>'s from HTML output. Modified Paths: -------------- branches/exp-text_node/epydoc/src/epydoc/docstringparser.py branches/exp-text_node/epydoc/src/epydoc/docwriter/html.py branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest Modified: branches/exp-text_node/epydoc/src/epydoc/docstringparser.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/docstringparser.py 2007-03-05 01:39:41 UTC (rev 1568) +++ branches/exp-text_node/epydoc/src/epydoc/docstringparser.py 2007-03-05 01:52:05 UTC (rev 1569) @@ -507,6 +507,7 @@ """A ParsedDocstring containing the text 'Returns'. This is used to construct summary descriptions for routines that have empty C{descr}, but non-empty C{return_descr}.""" +RETURN_PDS._tree.children[0].tag = "text" ###################################################################### #{ Field Processing Error Messages Modified: branches/exp-text_node/epydoc/src/epydoc/docwriter/html.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/docwriter/html.py 2007-03-05 01:39:41 UTC (rev 1568) +++ branches/exp-text_node/epydoc/src/epydoc/docwriter/html.py 2007-03-05 01:52:05 UTC (rev 1569) @@ -739,11 +739,11 @@ out('<!-- ==================== %s ' % typ.upper() + 'DESCRIPTION ==================== -->\n') out('<h1 class="epydoc">%s %s</h1>' % (typ, shortname)) - out(self.pysrc_link(doc) + '<br /><br />\n') + out('<p class="nomargin-top">%s</p>\n' % self.pysrc_link(doc)) # If the module has a description, then list it. if doc.descr not in (None, UNKNOWN): - out(self.descr(doc, 2)+'<br /><br />\n\n') + out(self.descr(doc, 2)+'\n\n') # Write any standarad metadata (todo, author, etc.) if doc.metadata is not UNKNOWN and doc.metadata: @@ -830,7 +830,7 @@ out('<!-- ==================== %s ' % typ.upper() + 'DESCRIPTION ==================== -->\n') out('<h1 class="epydoc">%s %s</h1>' % (typ, shortname)) - out(self.pysrc_link(doc) + '<br /><br />\n') + out('<p class="nomargin-top">%s</p>\n' % self.pysrc_link(doc)) if ((doc.bases not in (UNKNOWN, None) and len(doc.bases) > 0) or (doc.subclasses not in (UNKNOWN,None) and len(doc.subclasses)>0)): @@ -864,7 +864,7 @@ # If the class has a description, then list it. if doc.descr not in (None, UNKNOWN): - out(self.descr(doc, 2)+'<br /><br />\n\n') + out(self.descr(doc, 2)+'\n\n') # Write any standarad metadata (todo, author, etc.) if doc.metadata is not UNKNOWN and doc.metadata: Modified: branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-05 01:39:41 UTC (rev 1568) +++ branches/exp-text_node/epydoc/src/epydoc/markup/epytext.py 2007-03-05 01:52:05 UTC (rev 1569) @@ -286,7 +286,7 @@ _pop_completed_blocks(token, stack, indent_stack) # If Token has type PARA, colorize and add the new paragraph - if token.tag == Token.PARA: + if token.tag in (Token.PARA, Token.TEXT): _add_para(doc, token, stack, indent_stack, errors) # If Token has type HEADING, add the new section @@ -366,7 +366,7 @@ indent_stack[-1] = para_token.indent if para_token.indent == indent_stack[-1]: # Colorize the paragraph and add it. - para = _colorize(doc, para_token, errors) + para = _colorize(doc, para_token, errors, tagName=para_token.tag) stack[-1].children.append(para) else: estr = "Improper paragraph indentation." @@ -511,9 +511,10 @@ """ C{Token}s are an intermediate data structure used while constructing the structuring DOM tree for a formatted docstring. - There are five types of C{Token}: + There are six types of C{Token}: - Paragraphs + - Text - Literal blocks - Doctest blocks - Headings @@ -533,8 +534,9 @@ @type tag: C{string} @ivar tag: This C{Token}'s type. Possible values are C{Token.PARA} - (paragraph), C{Token.LBLOCK} (literal block), C{Token.DTBLOCK} - (doctest block), C{Token.HEADINGC}, and C{Token.BULLETC}. + (paragraph), C{Token.TEXT} (text node), C{Token.LBLOCK} + (literal block), C{Token.DTBLOCK} (doctest block), C{Token.HEADINGC}, + and C{Token.BULLETC}. @type startline: C{int} @ivar startline: The line on which this C{Token} begins. This @@ -556,6 +558,8 @@ @type PARA: C{string} @cvar PARA: The C{tag} value for paragraph C{Token}s. + @type TEXT: C{string} + @cvar TEXT: The C{tag} value for text parts inside other items. @type LBLOCK: C{string} @cvar LBLOCK: The C{tag} value for literal C{Token}s. @type DTBLOCK: C{string} @@ -573,6 +577,7 @@ DTBLOCK = "doctestblock" HEADING = "heading" BULLET = "bullet" + TEXT = "text" def __init__(self, tag, startline, contents, indent, level=None): """ @@ -801,7 +806,7 @@ [line.strip() for line in lines[start+1:linenum]]) pcontents = ' '.join(pcontents).strip() if pcontents: - tokens.append(Token(Token.PARA, start, pcontents, para_indent)) + tokens.append(Token(Token.TEXT, start, pcontents, para_indent)) # Return the linenum after the paragraph token ends. return linenum @@ -940,7 +945,7 @@ linenum = _tokenize_para(lines, linenum, indent, tokens, errors) # Paragraph tokens ending in '::' initiate literal blocks. - if (tokens[-1].tag == Token.PARA and + if (tokens[-1].tag in (Token.PARA, Token.TEXT) and tokens[-1].contents[-2:] == '::'): tokens[-1].contents = tokens[-1].contents[:-1] linenum = _tokenize_literal(lines, linenum, indent, tokens, errors) @@ -1225,7 +1230,7 @@ # Clean up for literal blocks (add the double "::" back) childstr = re.sub(':(\s*)\2', '::\\1', childstr) - if tree.tag == 'para': + if tree.tag in ('para', 'text'): str = wordwrap(childstr, indent)+'\n' str = re.sub(r'((^|\n)\s*\d+)\.', r'\1E{.}', str) str = re.sub(r'((^|\n)\s*)-', r'\1E{-}', str) @@ -1312,7 +1317,7 @@ variables = [to_plaintext(c, cindent, seclevel) for c in tree.children] childstr = ''.join(variables) - if tree.tag == 'para': + if tree.tag in ('para', 'text'): return wordwrap(childstr, indent)+'\n' elif tree.tag == 'li': # We should be able to use getAttribute here; but there's no @@ -1392,7 +1397,7 @@ # Clean up for literal blocks (add the double "::" back) childstr = re.sub(':( *\n \|\n)\2', '::\\1', childstr) - if tree.tag == 'para': + if tree.tag in ('para', 'text'): str = wordwrap(childstr, indent-6, 69)+'\n' str = re.sub(r'((^|\n)\s*\d+)\.', r'\1E{.}', str) str = re.sub(r'((^|\n)\s*)-', r'\1E{-}', str) @@ -1768,25 +1773,14 @@ indent+2, seclevel) for c in tree.children] - # Get rid of unnecessary <P>...</P> tags; they introduce extra - # space on most browsers that we don't want. - for i in range(len(variables)-1): - if (not isinstance(tree.children[i], basestring) and - tree.children[i].tag == 'para' and - (isinstance(tree.children[i+1], basestring) or - tree.children[i+1].tag != 'para')): - variables[i] = ' '*(indent+2)+variables[i][5+indent:-5]+'\n' - if (tree.children and - not isinstance(tree.children[-1], basestring) and - tree.children[-1].tag == 'para'): - variables[-1] = ' '*(indent+2)+variables[-1][5+indent:-5]+'\n' - # Construct the HTML string for the variables. childstr = ''.join(variables) # Perform the approriate action for the DOM tree type. if tree.tag == 'para': return wordwrap('<p>%s</p>' % childstr, indent) + if tree.tag == 'text': + return wordwrap(str(childstr), indent) elif tree.tag == 'code': style = tree.attribs.get('style') if style: @@ -1904,7 +1898,7 @@ for c in tree.children] childstr = ''.join(variables) - if tree.tag == 'para': + if tree.tag in ('para', 'text'): return wordwrap(childstr, indent)+'\n' elif tree.tag == 'code': return '\\texttt{%s}' % childstr @@ -1974,7 +1968,7 @@ # Find the first paragraph. variables = tree.children - while (len(variables) > 0) and (variables[0].tag != 'para'): + while (len(variables) > 0) and (variables[0].tag not in ('para', 'text')): if variables[0].tag in ('section', 'ulist', 'olist', 'li'): variables = variables[0].children else: @@ -2002,7 +1996,7 @@ # Extract the first sentence. parachildren = variables[0].children - para = Element('para') + para = Element('text') doc.children.append(para) for parachild in parachildren: if isinstance(parachild, basestring): Modified: branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest =================================================================== --- branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-05 01:39:41 UTC (rev 1568) +++ branches/exp-text_node/epydoc/src/epydoc/test/epytext.doctest 2007-03-05 01:52:05 UTC (rev 1569) @@ -45,14 +45,14 @@ ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field.</para></field></fieldlist> + <text>This is a field.</text></field></fieldlist> >>> print testparse(""" ... This is a paragraph. ... @foo: This is a field.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field.</para></field></fieldlist> + <text>This is a field.</text></field></fieldlist> >>> print testparse(""" ... This is a paragraph. @@ -60,23 +60,23 @@ ... Hello.""") <para>This is a paragraph.</para> <fieldlist><field><tag>foo</tag> - <para>This is a field. Hello.</para></field></fieldlist> + <text>This is a field. Hello.</text></field></fieldlist> >>> print testparse("""Paragraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <text>field</text></field></fieldlist> >>> print testparse("""Paragraph\n\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <text>field</text></field></fieldlist> >>> print testparse("""\nParagraph\n@foo: field""") <para>Paragraph</para> <fieldlist><field><tag>foo</tag> - <para>field</para></field></fieldlist> + <text>field</text></field></fieldlist> Make sure thta unindented lists are not allowed: @@ -122,20 +122,20 @@ >>> print testparse("""Paragraph\n- list item""") <para>Paragraph</para> - <ulist><li><para>list item</para></li></ulist> + <ulist><li><text>list item</text></li></ulist> Make sure that indented lists are allowed: >>> print testparse('This is a paragraph.\n - This is a list item.\n'+ ... 'This is a paragraph') <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> <para>This is a paragraph</para> >>> print testparse('This is a paragraph.\n\n - This is a list item.'+ ... '\n\nThis is a paragraph') <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -145,7 +145,7 @@ ... ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> <para>This is a paragraph</para> >>> print testparse(""" @@ -154,18 +154,18 @@ ... - This is a list item. ... This is a paragraph""") <para>This is a paragraph.</para> - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> <para>This is a paragraph</para> >>> print testparse(""" ... - This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> >>> print testparse("""- This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> >>> print testparse("""\n- This is a list item.""") - <ulist><li><para>This is a list item.</para></li></ulist> + <ulist><li><text>This is a list item.</text></li></ulist> Basic list tests: @@ -176,11 +176,11 @@ >>> LI3 = " - This is a list\n item." >>> LI4 = "\n - This is a list\n item." >>> PARA = ('<para>This is a paragraph.</para>') - >>> ONELIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li></ulist>') - >>> TWOLIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li><li><para>This is a '+ - ... 'list item.</para></li></ulist>') + >>> ONELIST = ('<ulist><li><text>This is a '+ + ... 'list item.</text></li></ulist>') + >>> TWOLIST = ('<ulist><li><text>This is a '+ + ... 'list item.</text></li><li><text>This is a '+ + ... 'list item.</text></li></ulist>') >>> for p in (P1, P2): ... for li1 in (LI1, LI2, LI3, LI4): @@ -198,7 +198,7 @@ ... PARA+TWOLIST+PARA) >>> LI5 = " - This is a list item.\n\n It contains two paragraphs." - >>> LI5LIST = ('<ulist><li><para>This is a list item.</para>'+ + >>> LI5LIST = ('<ulist><li><text>This is a list item.</text>'+ ... '<para>It contains two paragraphs.</para></li></ulist>') >>> checkparse(LI5, LI5LIST) >>> checkparse('%s\n%s' % (P1, LI5), PARA+LI5LIST) @@ -206,8 +206,8 @@ >>> LI6 = (" - This is a list item with a literal block::\n" + ... " hello\n there") - >>> LI6LIST = ('<ulist><li><para>This is a list item with a literal '+ - ... 'block:</para><literalblock> hello\n there'+ + >>> LI6LIST = ('<ulist><li><text>This is a list item with a literal '+ + ... 'block:</text><literalblock> hello\n there'+ ... '</literalblock></li></ulist>') >>> checkparse(LI6, LI6LIST) >>> checkparse('%s\n%s' % (P1, LI6), PARA+LI6LIST) @@ -216,11 +216,11 @@ Item wrap tests: >>> LI = "- This is a list\n item." - >>> ONELIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li></ulist>') - >>> TWOLIST = ('<ulist><li><para>This is a '+ - ... 'list item.</para></li><li><para>This is a '+ - ... 'list item.</para></li></ulist>') + >>> ONELIST = ('<ulist><li><text>This is a '+ + ... 'list item.</text></li></ulist>') + >>> TWOLIST = ('<ulist><li><text>This is a '+ + ... 'list item.</text></li><li><text>This is a '+ + ... 'list item.</text></li></ulist>') >>> for indent in ('', ' '): ... for nl1 in ('', '\n'): ... checkparse(nl1+indent+LI, ONELIST) @@ -229,7 +229,7 @@ Summary ======= -The implementation of the summaization function works as expected. +The implementation of the summarization function works as expected. >>> from epydoc.markup import epytext >>> def getsummary(s): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-05 01:39:43
|
Revision: 1568 http://svn.sourceforge.net/epydoc/?rev=1568&view=rev Author: dvarrazzo Date: 2007-03-04 17:39:41 -0800 (Sun, 04 Mar 2007) Log Message: ----------- - This branch aims to solve the html problem raised in SF bug #1671711. Currently epytext html output creates excessive <p> tags (e.g. in lists and fields). There is an hack that postprocesses the first html rendering removing some of those tags, but it probably exagerates and some paragraph is rendered without <p> at all. This leads to the need to add many <br/>'s in the HTML output, different spacing w.r.t. other markups, surprising behaviour of the page when the CSS is to be customized. The proposed solution is to add a new type of epytext node: 'text' representing inline text inside other elements, such list items. Added Paths: ----------- branches/exp-text_node/ Copied: branches/exp-text_node (from rev 1567, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-05 00:53:11
|
Revision: 1567 http://svn.sourceforge.net/epydoc/?rev=1567&view=rev Author: dvarrazzo Date: 2007-03-04 16:53:10 -0800 (Sun, 04 Mar 2007) Log Message: ----------- - Fixed docstring (it appeared a definition list). 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-03-05 00:40:54 UTC (rev 1566) +++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2007-03-05 00:53:10 UTC (rev 1567) @@ -864,7 +864,7 @@ - ``label`` is the HTML label - ``depth`` is the depth of the package tree (for coloring) - ``width`` is the max width of the HTML label, roughly in - units of characters. + units of characters. """ MAX_ROW_WIDTH = 80 # unit is roughly characters. pkg_name = package.canonical_name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-05 00:40:56
|
Revision: 1566 http://svn.sourceforge.net/epydoc/?rev=1566&view=rev Author: dvarrazzo Date: 2007-03-04 16:40:54 -0800 (Sun, 04 Mar 2007) Log Message: ----------- - Fixed margin for nested lists in fields. 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-03-01 23:40:03 UTC (rev 1565) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-03-05 00:40:54 UTC (rev 1566) @@ -155,6 +155,7 @@ dl.fields { margin-left: 2em; margin-top: 1em; margin-bottom: 1em; } dl.fields dd ul { margin-left: 0em; padding-left: 0em; } +dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } div.fields { margin-left: 2em; } div.fields p { margin-bottom: 0.5em; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-03-01 23:40:07
|
Revision: 1565 http://svn.sourceforge.net/epydoc/?rev=1565&view=rev Author: dvarrazzo Date: 2007-03-01 15:40:03 -0800 (Thu, 01 Mar 2007) Log Message: ----------- - Some HTML cleanup. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/dotgraph.py trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/docwriter/html_colorize.py Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2007-03-01 04:03:01 UTC (rev 1564) +++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2007-03-01 23:40:03 UTC (rev 1565) @@ -184,7 +184,7 @@ s += ' -- ' if caption: s += '<span class="graph-caption">%s</span>' % caption - s += '\n </td></tr>\n</table><br/>' + s += '\n </td></tr>\n</table><br />' if center: s += '</center>' return s @@ -1004,8 +1004,8 @@ ###################################################################### def class_tree_graph(bases, linker, context=None, **options): """ - Return a `DotGraph` that graphically displays the package - hierarchies for the given packages. + Return a `DotGraph` that graphically displays the class + hierarchy for the given classes. """ graph = DotGraph('Class Hierarchy for %s' % name_list(bases, context), body='ranksep=0.3\n', @@ -1263,7 +1263,7 @@ specialize_valdoc_node(node, val_doc, context, linker.url_for(val_doc)) return nodes -NOOP_URL = 'javascript: void(0);' +NOOP_URL = 'javascript:void(0);' MODULE_NODE_HTML = ''' <TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0" PORT="table" ALIGN="LEFT"> Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-01 04:03:01 UTC (rev 1564) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-03-01 23:40:03 UTC (rev 1565) @@ -1013,15 +1013,15 @@ # Alphabetical sections. sections = [s for s in sections if s in index_by_section] if sections: - out('<table border="0" width="100%"><tr valign="top">\n') + out('<table border="0" width="100%">\n') for section in sorted(sections): - out('<td valign="top" width="1%">') - out('<a name="%s"><h2 class="epydoc">%s</h2></a></td>\n' % + out('<tr valign="top"><td valign="top" width="1%">') + out('<h2 class="epydoc"><a name="%s">%s</a></h2></td>\n' % (section, section)) out('<td valign="top">\n') self.write_index_section(out, index_by_section[section], True) out('</td></tr>\n') - out('</table>\n</br />') + out('</table>\n<br />') # Footer material. out('<br />') @@ -1040,7 +1040,7 @@ '%s-index.html' % field) # Page title. - out('<a name="%s"><h1 class="epydoc">%s</h1></a>\n<br />\n' % + out('<h1 class="epydoc"><a name="%s">%s</a></h1>\n<br />\n' % (field, title)) # Index (one section per arg) @@ -1070,7 +1070,6 @@ self.docstring_to_html(descr,doc,4)) out(' </ul>\n') out('</table></div>\n') - out('</dl>\n') # Footer material. out('<br />') @@ -1117,7 +1116,7 @@ else: label = container.canonical_name[-1] out('<span class="index-where">(in %s)' - '</font>' % self.href(container, label)) + '</span>' % self.href(container, label)) else: out(' ') out('</td>\n') Modified: trunk/epydoc/src/epydoc/docwriter/html_colorize.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2007-03-01 04:03:01 UTC (rev 1564) +++ trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2007-03-01 23:40:03 UTC (rev 1565) @@ -52,7 +52,7 @@ var elt = document.getElementById(id+"-expanded-linenums"); if (elt) elt.style.display = "none"; var elt = document.getElementById(id+"-collapsed-linenums"); - if (elt) { elt.innerHTML = "<br/>"; elt.style.display="block"; } + if (elt) { elt.innerHTML = "<br />"; elt.style.display="block"; } var elt = document.getElementById(id+"-toggle"); if (elt) { elt.innerHTML = "+"; } var elt = document.getElementById(id+"-collapsed"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-03-01 04:03:10
|
Revision: 1564 http://svn.sourceforge.net/epydoc/?rev=1564&view=rev Author: edloper Date: 2007-02-28 20:03:01 -0800 (Wed, 28 Feb 2007) Log Message: ----------- - Fixed svn properties Property Changed: ---------------- trunk/epydoc/doc/epydoc-slides.ppt trunk/epydoc/doc/epydoc_gui.png trunk/epydoc/doc/epydoc_guiconfig.png trunk/epydoc/doc/pycon-epydoc.pdf trunk/epydoc/doc/pycon-epydoc.ps Property changes on: trunk/epydoc/doc/epydoc-slides.ppt ___________________________________________________________________ Name: svn:keywords - Author Date Id Revision Name: svn:eol-style - native Name: svn:mime-type + application/vnd.ms-powerpoint Property changes on: trunk/epydoc/doc/epydoc_gui.png ___________________________________________________________________ Name: svn:keywords - Author Date Id Revision Property changes on: trunk/epydoc/doc/epydoc_guiconfig.png ___________________________________________________________________ Name: svn:keywords - Author Date Id Revision Property changes on: trunk/epydoc/doc/pycon-epydoc.pdf ___________________________________________________________________ Name: svn:keywords - Author Date Id Revision Name: svn:eol-style - native Name: svn:mime-type + application/pdf Property changes on: trunk/epydoc/doc/pycon-epydoc.ps ___________________________________________________________________ Name: svn:mime-type + application/postscript This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-02-28 21:03:11
|
Revision: 1563 http://svn.sourceforge.net/epydoc/?rev=1563&view=rev Author: edloper Date: 2007-02-28 13:03:10 -0800 (Wed, 28 Feb 2007) Log Message: ----------- Fixed sf bug 1669572 -- <foo at 0x123> values were not getting penalized if they were too long. Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/pyval_repr.py Modified: trunk/epydoc/src/epydoc/markup/pyval_repr.py =================================================================== --- trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-02-27 09:57:25 UTC (rev 1562) +++ trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-02-28 21:03:10 UTC (rev 1563) @@ -213,9 +213,9 @@ state.score -= 100 if pyval_repr_ok: - self._output(pyval_repr, None, state) if self.GENERIC_OBJECT_RE.match(pyval_repr): state.score -= 5 + self._output(pyval_repr, None, state) else: state.result.append(self.UNKNOWN_REPR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |