[Epydoc-commits] SF.net SVN: epydoc: [1512] trunk/epydoc/src/epydoc/docwriter
Brought to you by:
edloper
From: <dva...@us...> - 2007-02-16 02:33:28
|
Revision: 1512 http://svn.sourceforge.net/epydoc/?rev=1512&view=rev Author: dvarrazzo Date: 2007-02-15 18:32:56 -0800 (Thu, 15 Feb 2007) Log Message: ----------- - HTML for fields cleaned up. It should be easier now to change the page look providing a different CSS. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/docwriter/html_css.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-16 02:08:51 UTC (rev 1511) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-02-16 02:32:56 UTC (rev 1512) @@ -1957,7 +1957,6 @@ # Write a footer for the table. out(self.TABLE_FOOTER) - out('\n<br />\n') def write_summary_group(self, out, doc, name, var_docs, grouped_inh_vars): # Split up the var_docs list, according to the way each var @@ -2136,7 +2135,7 @@ if not var_docs: return # Write a header - self.write_table_header(out, "summary", heading) + self.write_table_header(out, "details", heading) out(self.TABLE_FOOTER) for var_doc in var_docs: @@ -2145,9 +2144,7 @@ out('<br />\n') def write_details_entry(self, out, var_doc): - descr = self.descr(var_doc, indent=2) - if descr: descr = '<br />'+descr - else: descr = '' + descr = self.descr(var_doc, indent=2) or '' if var_doc.is_public: div_class = '' else: div_class = ' class="private"' @@ -2255,25 +2252,25 @@ </table> $self.render_callgraph(callgraph)$ $descr$ - <dl><dt></dt><dd> + <dl class="fields"> >>> # === parameters === >>> if arg_descrs: - <dl><dt>Parameters:</dt></dl> - <ul class="nomargin"> + <dt>Parameters:</dt> + <dd><ul class="nomargin-top"> >>> for lhs, rhs in arg_descrs: $self.labelled_list_item(lhs, rhs)$ >>> #endfor - </ul> + </ul></dd> >>> #endif >>> # === return type === >>> if rdescr and rtype: - <dl><dt>Returns: $rtype$</dt> - <dd>$rdescr$</dd></dl> + <dt>Returns: $rtype$</dt> + <dd>$rdescr$</dd> >>> elif rdescr: - <dl><dt>Returns:</dt> - <dd>$rdescr$</dd></dl> + <dt>Returns:</dt> + <dd>$rdescr$</dd> >>> elif rtype: - <dl><dt>Returns: $rtype$</dt></dl> + <dt>Returns: $rtype$</dt> >>> #endif >>> # === decorators === >>> if func_doc.decorators not in (None, UNKNOWN): @@ -2288,17 +2285,17 @@ >>> decos = None >>> #endif >>> if decos: - <dl><dt>Decorators:</dt></dl> - <ul class="nomargin"> + <dt>Decorators:</dt> + <dd><ul class="nomargin-top"> >>> for deco in decos: <li><code>@$deco$</code></li> >>> #endfor - </ul> + </ul></dd> >>> #endif >>> # === exceptions === >>> if func_doc.exception_descrs not in (None, UNKNOWN, (), []): - <dl><dt>Raises:</dt></dl> - <ul class="nomargin"> + <dt>Raises:</dt> + <dd><ul class="nomargin-top"> >>> for name, descr in func_doc.exception_descrs: >>> exc_name = self.docindex.find(name, func_doc) >>> if exc_name is not None: @@ -2309,21 +2306,21 @@ str(name) + "</strong></code>", self.docstring_to_html(descr, func_doc, 8))$ >>> #endfor - </ul> + </ul></dd> >>> #endif >>> # === overrides === >>> if var_doc.overrides not in (None, UNKNOWN): - <dl><dt>Overrides: + <dt>Overrides: $self.href(var_doc.overrides.value, context=var_doc)$ >>> if (func_doc.docstring in (None, UNKNOWN) and >>> var_doc.overrides.value.docstring not in (None, UNKNOWN)): <dd><em class="note">(inherited documentation)</em></dd> >>> #endif - </dt></dl> + </dt> >>> #endif + </dl> >>> # === metadata === >>> self.write_standard_fields(out, func_doc) - </dd></dl> </td></tr></table> </div> ''') @@ -2375,21 +2372,21 @@ <tr><td> <h3 class="epydoc">$var_doc.name$</h3> $descr$ - <dl><dt></dt><dd> + <dl class="fields"> >>> for (name, val, summary) in accessors: - <dl><dt>$name$ Method:</dt> - <dd>$val$ + <dt>$name$ Method:</dt> + <dd class="value">$val$ >>> if summary: - $summary$ >>> #endif - </dd></dl> + </dd> >>> #endfor >>> if prop_doc.type_descr not in (None, UNKNOWN): - <dl><dt>Type:</dt> - <dd>$self.type_descr(var_doc, indent=6)$</dd></dl> + <dt>Type:</dt> + <dd>$self.type_descr(var_doc, indent=6)$</dd> >>> #endif + </dl> >>> self.write_standard_fields(out, prop_doc) - </dd></dl> </td></tr></table> </div> ''') @@ -2407,18 +2404,19 @@ <tr><td> <h3 class="epydoc">$var_doc.name$</h3> $descr$ - <dl><dt></dt><dd> + <dl class="fields"> >>> if var_doc.type_descr not in (None, UNKNOWN): - <dl><dt>Type:</dt> - <dd>$self.type_descr(var_doc, indent=6)$</dd></dl> + <dt>Type:</dt> + <dd>$self.type_descr(var_doc, indent=6)$</dd> >>> #endif + </dl> >>> self.write_standard_fields(out, var_doc) >>> if var_doc.value is not UNKNOWN: - <dl><dt>Value:</dt> + <dl class="fields"> + <dt>Value:</dt> <dd>$self.pprint_value(var_doc.value)$</dd> - </dl> + </dl> >>> #endif - </dd></dl> </td></tr></table> </div> ''') @@ -2729,8 +2727,6 @@ fields = [] field_values = {} - #if _sort_fields: fields = STANDARD_FIELD_NAMES [XX] - for (field, arg, descr) in doc.metadata: if field not in field_values: fields.append(field) @@ -2740,6 +2736,9 @@ else: field_values.setdefault(field,[]).append(descr) + if not fields: return + + out('<div class="fields">') for field in fields: if field.takes_arg: for arg, descrs in field_values[field].items(): @@ -2748,6 +2747,8 @@ else: self.write_standard_field(out, doc, field, field_values[field]) + out('</div>') + write_standard_field = compile_template( """ write_standard_field(self, out, doc, field, descrs, arg='') @@ -2771,7 +2772,7 @@ </dd> </dl> >>> else: - <p><strong>$field.plural+arglabel$:</strong> + <strong>$field.plural+arglabel$:</strong> <ul class="nomargin-top"> >>> for descr in descrs: <li> @@ -3206,7 +3207,6 @@ s = '<span class="docstring">%s</span><!--end docstring-->' % s return s - # [XX] Just use docstring_to_html??? def description(self, parsed_docstring, where=None, indent=0): assert isinstance(where, (APIDoc, type(None))) if parsed_docstring in (None, UNKNOWN): return '' Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-16 02:08:51 UTC (rev 1511) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-02-16 02:32:56 UTC (rev 1512) @@ -129,7 +129,8 @@ */ table.summary { border-collapse: collapse; background: $table_bg; color: $table_fg; - border: $table_border; } + border: $table_border; + margin-bottom: 0.5em; } td.summary { border: $table_border; } code.summary-type { font-size: 85%; } table.summary a:link { color: $table_link; } @@ -137,7 +138,7 @@ /* Details Tables (functions, variables, etc) - * - Each object is described in its own single-celled table. + * - Each object is described in its own div. * - A single-row summary table w/ table-header is used as * a header for each details section (CSS style for table-header * is defined above, under 'Table Headers'). @@ -150,6 +151,13 @@ table.details a:link { color: $table_link; } table.details a:visited { color: $table_visited_link; } +/* Fields */ +dl.fields { margin-left: 2em; margin-top: 1em; + margin-bottom: 1em; } +dl.fields dd ul { margin-left: -2em; } +div.fields { margin-left: 2em; } +div.fields p { margin-bottom: 0.5em; } + /* Index tables (identifier index, term index, etc) * - link-index is used for indices containing lists of links * (namely, the identifier index & term index). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |