[Epydoc-commits] SF.net SVN: epydoc: [1188] trunk/epydoc/src/epydoc/docwriter
Brought to you by:
edloper
From: <ed...@us...> - 2006-04-07 23:34:48
|
Revision: 1188 Author: edloper Date: 2006-04-07 16:34:41 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1188&view=rev Log Message: ----------- - Include the javascripts from html_colorize in epydoc.js - In PythonSourceColorizer: - Fixed bug in spacing of collapsed divs - Made some changes that decrease the size of the generated html file (without changing functionality) Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/docwriter/html_colorize.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-07 23:32:37 UTC (rev 1187) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-07 23:34:41 UTC (rev 1188) @@ -19,7 +19,7 @@ import time, epydoc, epydoc.markup from epydoc.docwriter.html_colorize import colorize_re from epydoc.docwriter.html_colorize import PythonSourceColorizer -from epydoc.docwriter.html_colorize import colorize_re +from epydoc.docwriter import html_colorize from epydoc.docwriter.html_css import STYLESHEETS from epydoc.docwriter.html_help import HTML_HELP from epydoc.docwriter.dotgraph import * @@ -1216,6 +1216,7 @@ print >> jsfile, self.SET_FRAME_JS print >> jsfile, self.HIDE_PRIVATE_JS print >> jsfile, self.TOGGLE_CALLGRAPH_JS + print >> jsfile, html_colorize.PYSRC_JAVASCRIPTS jsfile.close() #: A javascript that is used to show or hide the API documentation @@ -1338,7 +1339,7 @@ 'class="%s"/>\n' % (cmapx, uid, uid, uid, css)) def render_callgraph(self, callgraph): - graph_html = self.render_graph(callgraph, css='callgraph') + graph_html = self.render_graph(callgraph, css='graph-with-title') if graph_html == '': return '' return ('<div style="display:none" id="%s-div"><center>\n' '<table border="0" cellpadding="0" cellspacing="0">\n' Modified: trunk/epydoc/src/epydoc/docwriter/html_colorize.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2006-04-07 23:32:37 UTC (rev 1187) +++ trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2006-04-07 23:34:41 UTC (rev 1188) @@ -401,8 +401,6 @@ #: Javascript code for the PythonSourceColorizer PYSRC_JAVASCRIPTS = '''\ -<script type="text/javascript"> -<!-- function expand(id) { var elt = document.getElementById(id+"-expanded"); if (elt) elt.style.display = "block"; @@ -430,13 +428,14 @@ elt.style.display = "block"; var indent = elt.indent; - var linenumpadding = elt.linenumpadding; - var s = ""; - if (linenumpadding != "") - s = "<span class=\'lineno\'>" + linenumpadding + "</span>" - s = s + " <span class=\'py-line\'>" + indent + - "<a href=\'#\' onclick=\'expand(\\"" + id + - "\\");return false\'>...</a></span><br />"; + var pad = elt.pad; + var s = "<span class=\'lineno\'>"; + for (var i=0; i<pad.length; i++) { s += " " } + s += "</span>"; + s += " <span class=\'py-line\'>"; + for (var i=0; i<indent.length; i++) { s += " " } + s += "<a href=\'#\' onclick=\'expand(\\"" + id; + s += "\\");return false\'>...</a></span><br />"; elt.innerHTML = s; } } @@ -560,7 +559,11 @@ links + "</ul>"; } } +''' +PYSRC_EXPANDTO_JAVASCRIPT = '''\ +<script type="text/javascript"> +<!-- expandto(location.href); // --> </script> @@ -651,7 +654,7 @@ #: ellipsis marker in the collapsed version. START_DEF_BLOCK = ( '<div id="%s-collapsed" style="display:none;" ' - 'linenumpadding="%s" indent="%s"></div>' + 'pad="%s" indent="%s"></div>' '<div id="%s-expanded">') #: HTML code for the end of a collapsable function or class @@ -814,8 +817,8 @@ coding = 'iso-8859-1' html = html.decode(coding).encode('ascii', 'xmlcharrefreplace') - # Add on the javascripts. - html += PYSRC_JAVASCRIPTS + # Call expandto. + html += PYSRC_EXPANDTO_JAVASCRIPT return html @@ -1038,6 +1041,9 @@ for i in range(ended_def_blocks): self.out(self.END_DEF_BLOCK) + # Strip any empty <span>s. + s = re.sub(r'<span class="[\w+]"></span>', '', s) + # Write the line. self.out(s) @@ -1047,8 +1053,8 @@ # Add div's if we're starting a def block. if (self.ADD_DEF_BLOCKS and def_name and (line[-2][1] == ':') and None not in self.context): - indentation = (''.join(self.indents)+' ').replace(' ', ' ') - linenum_padding = ' '*self.linenum_size + indentation = (''.join(self.indents)+' ').replace(' ', '+') + linenum_padding = '+'*self.linenum_size name='.'.join(self.context+[def_name]) self.out(self.START_DEF_BLOCK % (name, linenum_padding, indentation, name)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |