happydoc-checkins Mailing List for HappyDoc (Page 2)
Brought to you by:
doughellmann,
krlosaqp
You can subscribe to this list here.
2002 |
Jan
(3) |
Feb
(40) |
Mar
(1) |
Apr
|
May
(12) |
Jun
(4) |
Jul
|
Aug
(39) |
Sep
|
Oct
(4) |
Nov
(49) |
Dec
(78) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(54) |
Feb
|
Mar
(41) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
From: Doug H. <dou...@us...> - 2003-03-16 23:43:54
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv15405/happydoclib/docset/docset_TAL/templates/default Added Files: python_macros.pt Log Message: Macros related to documenting python modules. --- NEW FILE: python_macros.pt --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <!-- $Id: python_macros.pt,v 1.1 2003/03/16 23:43:50 doughellmann Exp $ --> <head> </head> <body> <tal:block metal:define-macro="python_module" xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal"> <tal:block tal:define="import_data python: docset.getImportData(current_module)" tal:condition="import_data|nothing"> <h2>Imports</h2> <tal:block tal:repeat="one_import import_data"> <tal:block tal:define="import_name python: one_import[0]; import_symbols python: one_import[1];"> <div tal:condition="import_symbols"> <code>from <span tal:content="structure import_name">Module</span> import <span tal:content="structure python: ', '.join(import_symbols)">Symbols</span> </code> </div> <div tal:condition="not: import_symbols"> <code>import <span tal:content="structure import_name">Module</span></code> </div> </tal:block> </tal:block> </tal:block> </tal:block> <p>This template contains the macros for formatting information about python modules. </p> </body> </html> |
From: Doug H. <dou...@us...> - 2003-03-16 23:43:26
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv15255/happydoclib/docset/docset_TAL Modified Files: __init__.py Log Message: Add a getImportData() wrapper that returns links instead of just names, when we can compute a link. This is much more useful to the template. Index: __init__.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 16 Mar 2003 20:28:10 -0000 1.3 --- __init__.py 16 Mar 2003 23:43:23 -0000 1.4 *************** *** 62,68 **** # import happydoclib - from happydoclib.docset import base - from happydoclib.trace import trace from happydoclib.docset.docset_TAL.templateset import TemplateSet --- 62,67 ---- # import happydoclib + from happydoclib.docset import base from happydoclib.docset.docset_TAL.templateset import TemplateSet *************** *** 70,73 **** --- 69,76 ---- getConverterFactory + from happydoclib.sysmodules import getPythonSystemModuleURL + + from happydoclib.trace import trace + # # Module *************** *** 245,249 **** """ self.statusMessage('processPythonFile needs work') ! raise NotImplementedError('processPythonFile') return --- 248,252 ---- """ self.statusMessage('processPythonFile needs work') ! #raise NotImplementedError('processPythonFile') return *************** *** 315,319 **** """ self.statusMessage('processPythonClass needs work') ! raise NotImplementedError('processPythonClass') return --- 318,322 ---- """ self.statusMessage('processPythonClass needs work') ! #raise NotImplementedError('processPythonClass') return *************** *** 337,340 **** --- 340,424 ---- ) return subnodes + + def getImportData(self, packageTreeNode): + """Retrieves the import data for the node, and converts + the data structure to something that is easier to work + with in the template. + """ + trace.into('TALDocset', 'getImportData', + packageTreeNode=packageTreeNode, + outputLevel=TRACE_LEVEL) + + import_data = packageTreeNode.getImportData() + sortable_import_data = [ (m.lower(), m, s) + for (m, s) in import_data ] + sortable_import_data.sort() + import_data = [ (m, s) + for (ignore, m, s) in sortable_import_data ] + + response = [] + + for module_name, symbol_names in import_data: + trace.writeVar(module_name=module_name, + symbol_names=symbol_names, + outputLevel=TRACE_LEVEL) + + url = getPythonSystemModuleURL(module_name) + if url: + trace.write('Python module', outputLevel=TRACE_LEVEL) + link = '<a href="%s">%s</a>' % (url, module_name) + response.append( (link, symbol_names) ) + continue + + referenced_module = packageTreeNode.findNodeFromDottedName(module_name) + if referenced_module is not None: + trace.write('Reference to another scanned module', + outputLevel=TRACE_LEVEL) + # + # Get the link to the module + # + module_url = self.getHREFToNode(packageTreeNode, + referenced_module, + ) + module_link = '<a href="%s">%s</a>' % (module_url, + module_name) + + if not symbol_names: + trace.write('No symbol names', + outputLevel=TRACE_LEVEL) + response.append( (module_link, symbol_names) ) + continue + + # + # Get links to the symbols, if we can. + # + name_urls = [] + for symbol_name in symbol_names: + symbol_node = referenced_module.findNodeFromDottedName(symbol_name) + if symbol_node is None: + name_urls.append(symbol_name) + continue + + symbol_url = self.getHREFToNode(packageTreeNode, + symbol_node, + ) + symbol_link = '<a href="%s">%s</a>' % (symbol_url, + symbol_name, + ) + name_urls.append(symbol_link) + + response.append( (module_link, name_urls) ) + + else: + trace.write('Unknown module', + outputLevel=TRACE_LEVEL) + # + # We do not know the module, so just take + # the names as they were given. + # + response.append( (module_name, symbol_names) ) + + trace.outof(outputLevel=TRACE_LEVEL) + return response |
From: Doug H. <dou...@us...> - 2003-03-16 23:42:32
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib In directory sc8-pr-cvs1:/tmp/cvs-serv14921/happydoclib Modified Files: packagetree.py Log Message: Add getImportData() as part of the default API. Index: packagetree.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/packagetree.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** packagetree.py 16 Mar 2003 20:16:27 -0000 1.8 --- packagetree.py 16 Mar 2003 23:42:27 -0000 1.9 *************** *** 198,202 **** def getOneLiner(self): return self.getSummaryAndFormat()[0] ! # --- 198,206 ---- def getOneLiner(self): return self.getSummaryAndFormat()[0] ! ! def getImportData(self): ! "Returns a list of the symbols which are imported." ! return [] ! # |
From: Doug H. <dou...@us...> - 2003-03-16 20:34:10
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv3769/happydoclib/docset/docset_TAL/templates/default Modified Files: toc.pt Log Message: Add other documentation, python files, and subdirectories to the TOC pages. Index: toc.pt =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default/toc.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** toc.pt 16 Mar 2003 16:30:48 -0000 1.1 --- toc.pt 16 Mar 2003 20:33:57 -0000 1.2 *************** *** 11,19 **** </head> ! <body> - Table of Contents body. - - </body> --- 11,86 ---- </head> ! <body ! tal:define="other_documentation python: node.getSubNodes(['text/plain', 'text/x-structured', 'text/html']); ! python_files python: docset.getPythonSubNodes(node); ! subdirectories python: node.getSubNodes(['application/x-directory']); ! "> ! ! <h1 tal:content="subtitle">Subtitle (really contains the local title)</h1> ! ! <div tal:replace="structure description">Description</div> ! ! <hr> ! ! <tal:block tal:condition="other_documentation|nothing"> ! <h2>Other Documentation</h2> ! ! <table class="descriptive_list"> ! ! <tr tal:repeat="subnode other_documentation"> ! <td><a href="" ! tal:attributes="href python: docset.getHREFToNode(node, subnode)" ! tal:content="subnode/getName"> ! Plain Text File Name ! </a> ! </td> ! <td tal:content="structure subnode/getOneLiner"> ! One line description ! </td> ! </tr> ! ! </table> ! </tal:block> ! ! <tal:block tal:condition="python_files|nothing"> ! <h2>Python Files</h2> ! ! <table class="descriptive_list"> ! ! <tr tal:repeat="subnode python_files"> ! <td><a href="" ! tal:attributes="href python: docset.getHREFToNode(node, subnode)" ! tal:content="subnode/getName"> ! Python File Name ! </a> ! </td> ! <td tal:content="structure subnode/getOneLiner"> ! One line description ! </td> ! </tr> ! ! </table> ! </tal:block> ! ! <tal:block tal:condition="subdirectories|nothing"> ! <h2>Subdirectories</h2> ! ! <table class="descriptive_list"> ! ! <tr tal:repeat="subnode subdirectories"> ! <td><a href="" ! tal:attributes="href python: docset.getHREFToNode(node, subnode)" ! tal:content="subnode/getName"> ! Directory Name ! </a> ! </td> ! <td tal:content="structure subnode/getOneLiner"> ! One line description ! </td> ! </tr> ! ! </table> ! </tal:block> </body> |
From: Doug H. <dou...@us...> - 2003-03-16 20:33:25
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv3581/happydoclib/docset/docset_TAL/templates/default Added Files: plain_text.pt Log Message: Template for formatting plain text files. --- NEW FILE: plain_text.pt --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" > <!-- $Id: plain_text.pt,v 1.1 2003/03/16 20:33:21 doughellmann Exp $ --> <head metal:use-macro="templates/header.pt/macros/html_header"> </head> <body> <h1 tal:content="subtitle">Subtitle (really contains the local title)</h1> <div tal:replace="structure cooked_body">Cooked Body</div> </body> </html> |
From: Doug H. <dou...@us...> - 2003-03-16 20:28:14
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv1701/happydoclib/docset/docset_TAL Modified Files: __init__.py Log Message: Add renderTemplateToFile(). Implement writeTOCFile(). Implement processPlainTextFile(). Add a few utility methods for use by templates. Index: __init__.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 16 Mar 2003 16:27:44 -0000 1.2 --- __init__.py 16 Mar 2003 20:28:10 -0000 1.3 *************** *** 67,70 **** --- 67,73 ---- from happydoclib.docset.docset_TAL.templateset import TemplateSet + from happydoclib.docstring import getConverterFactoryForFile, \ + getConverterFactory + # # Module *************** *** 80,83 **** --- 83,88 ---- """ + CONVERTER_HEADER_START_LEVEL = 2 + DEFAULT_TEMPLATE_SET = 'default' DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), *************** *** 172,184 **** return ! def renderTemplateToFile(self, template, outputFilename, packageTreeNode, **extraContext): ! rendered_text = template.render(extraContext) output = self.openOutput(outputFilename, packageTreeNode) ! output.write(rendered_text) ! output.close() return --- 177,197 ---- return ! def renderTemplateToFile(self, template, ! outputFilename, packageTreeNode, **extraContext): + + context = {} + context.update(extraContext) + context['node'] = packageTreeNode + context['docset'] = self ! rendered_text = template.render(context) output = self.openOutput(outputFilename, packageTreeNode) ! try: ! output.write(rendered_text) ! finally: ! output.close() return *************** *** 202,205 **** --- 215,221 ---- template = self.template_set['toc.pt'] + readme_text, text_format = packageTreeNode.getDocStringAndFormat() + description = self.formatText(readme_text, text_format) + self.renderTemplateToFile( template, *************** *** 208,211 **** --- 224,228 ---- title=self.title, subtitle=packageTreeNode.getRelativeFilename(), + description=description, ) *************** *** 238,243 **** already exist. """ ! self.statusMessage('processPlainTextFile needs work') ! raise NotImplementedError('processPlainTextFile') return --- 255,312 ---- already exist. """ ! trace.into('TALDocset', 'processPlainTextFile', ! packageTreeNode=packageTreeNode, ! outputLevel=TRACE_LEVEL, ! ) ! ! canonical_path = packageTreeNode.getPath(1) ! canonical_filename = apply(os.path.join, canonical_path) ! output_filename = self.getOutputFilenameForPackageTreeNode( ! packageTreeNode) ! ! self.statusMessage('Translating: "%s"\n to: "%s"' % ( ! canonical_filename, ! output_filename, ! )) ! ! template = self.template_set['plain_text.pt'] ! ! converter_factory = getConverterFactoryForFile(canonical_filename) ! converter = converter_factory() ! ! input_file = converter.getExternalDocumentationFile(canonical_filename) ! ! raw_body = str(input_file) ! ! cooked_body = converter.convert(raw_body, 'html', level=2) ! ! from happydoclib.docset.docset_TAL.TAL.HTMLParser import HTMLParseError ! try: ! self.renderTemplateToFile( ! template, ! output_filename, ! packageTreeNode, ! title=self.title, ! subtitle=packageTreeNode.getRelativeFilename(), ! raw_body=raw_body, ! cooked_body=cooked_body, ! ) ! except HTMLParseError, msg: ! # ! # Could not handle cooked body. ! # ! self.warningMessage('Error converting %s' % canonical_filename) ! self.warningMessage('%s' % msg) ! self.renderTemplateToFile( ! template, ! output_filename, ! packageTreeNode, ! title=self.title, ! subtitle=packageTreeNode.getRelativeFilename(), ! raw_body=raw_body, ! cooked_body='<pre>\n%s\n</pre>\n' % raw_body, ! ) ! ! trace.outof(outputLevel=TRACE_LEVEL) return *************** *** 248,252 **** raise NotImplementedError('processPythonClass') return ! def entryPoint(): --- 317,341 ---- raise NotImplementedError('processPythonClass') return ! ! ## ! ## METHODS USED BY TEMPLATES ! ## ! ! def getHREFToNode(self, source, destination): ! """Returns the HREF pointing to destination from the current node. ! """ ! href = self._computeRelativeHREF(source, destination) ! return href ! ! def getPythonSubNodes(self, node): ! """Return a list of subnodes with mimetype text/x-python, ! filtering out __init__.py if it is present. ! """ ! subnodes = node.getSubNodes(['text/x-python']) ! subnodes = filter(lambda x: x.getName() != '__init__.py', ! subnodes, ! ) ! return subnodes ! def entryPoint(): |
From: Doug H. <dou...@us...> - 2003-03-16 20:18:30
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv30386/happydoclib/docset Modified Files: docset_MultiHTMLFile.py Log Message: Move function for building relative HREF between two nodes to base class where it can be shared. Update use of getSubNodes() now that it takes a list of mimetypes. Index: docset_MultiHTMLFile.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_MultiHTMLFile.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** docset_MultiHTMLFile.py 18 Jan 2003 22:14:24 -0000 1.16 --- docset_MultiHTMLFile.py 16 Mar 2003 20:18:24 -0000 1.17 *************** *** 316,386 **** return - def _computeRelativeHREF(self, source, destination): - """Compute the HREF to point from the output file of source to destination. - """ - trace.into('MultiHTMLFileDocSet', '_computeRelativeHREF', - source=source.getName(), - destination=destination.getName(), - outputLevel=TRACE_LEVEL, - ) - - relative_path = source.getPathToNode(destination) - trace.writeVar(relative_path=relative_path, - outputLevel=TRACE_LEVEL) - if not relative_path: - output_name = self.getOutputFilenameForPackageTreeNode( - destination, - includePath=0, - ) - trace.outof(output_name, outputLevel=TRACE_LEVEL) - return output_name - - destination_mimetype = destination.getMimeType()[0] - source_mimetype = source.getMimeType()[0] - - # - # Pointing to a class defined by source module. - # - if ( (len(relative_path) == 1) - and - (destination_mimetype == 'application/x-class') - and - (source_mimetype == 'text/x-python') - and - (source.get(destination.getName()) is not None) - ): - trace.write('adding source to relative path', - outputLevel=TRACE_LEVEL) - relative_path = (source.getName(), relative_path[0]) - - destination_name = destination.getName() - if relative_path[-1] == destination_name: - # - # Need to replace with output name. - # - output_name = self.getOutputFilenameForPackageTreeNode( - destination, - includePath=0, - ) - trace.write('Replacing %s with %s' % (relative_path[-1], - output_name, - ), - outputLevel=TRACE_LEVEL, - ) - relative_path = relative_path[:-1] + (output_name,) - - # - # If the destination is a directory, add 'index.html' to the end. - # - #print destination.getName(), destination.getMimeType() - #if destination.getMimeType() == ('application/x-directory', None): - # print 'adding index.html' - # relative_path += ('index.html',) - # print relative_path - - href = '/'.join(relative_path) - trace.outof(href, outputLevel=TRACE_LEVEL) - return href - def _getAnchorTagForPackageTreeNode(self, source, --- 316,319 ---- *************** *** 534,541 **** # converted. # ! plain_text_files = packageTreeNode.getSubNodes('text/plain') ! structured_text_files = packageTreeNode.getSubNodes('text/x-structured') ! html_files = packageTreeNode.getSubNodes('text/html') ! text_files = plain_text_files + structured_text_files + html_files self.writeTOCReferencesSection( output, --- 467,474 ---- # converted. # ! text_files = packageTreeNode.getSubNodes(['text/plain', ! 'text/x-structured', ! 'text/html', ! ]) self.writeTOCReferencesSection( output, *************** *** 552,556 **** packageTreeNode, 'Python files', ! [ node for node in packageTreeNode.getSubNodes('text/x-python') if node.getName() != '__init__.py' ], --- 485,489 ---- packageTreeNode, 'Python files', ! [ node for node in packageTreeNode.getSubNodes(['text/x-python']) if node.getName() != '__init__.py' ], *************** *** 560,564 **** # Write out references to subdirectories # ! directories = packageTreeNode.getSubNodes('application/x-directory') #directories = [ d for d in directories # if d[1].items() --- 493,497 ---- # Write out references to subdirectories # ! directories = packageTreeNode.getSubNodes(['application/x-directory']) #directories = [ d for d in directories # if d[1].items() *************** *** 1050,1054 **** """ #class_names = self._filterNames(packageTreeNode.module_info.getClassNames()) ! classes = packageTreeNode.getSubNodes('application/x-class') class_map = {} for c in classes: --- 983,987 ---- """ #class_names = self._filterNames(packageTreeNode.module_info.getClassNames()) ! classes = packageTreeNode.getSubNodes(['application/x-class']) class_map = {} for c in classes: |
From: Doug H. <dou...@us...> - 2003-03-16 20:17:33
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv30011/happydoclib/docset Modified Files: base.py Log Message: Move function for building relative HREF between two nodes here where it can be shared. Add warningMessage() method. Set up HTML converter to allow subclass to override the heading start level. Index: base.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/base.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** base.py 16 Mar 2003 16:25:39 -0000 1.17 --- base.py 16 Mar 2003 20:17:30 -0000 1.18 *************** *** 64,68 **** from happydoclib.utils import * from happydoclib.trace import trace ! from happydoclib.docstring import getConverterFactoryForFile, getConverterFactory # --- 64,69 ---- from happydoclib.utils import * from happydoclib.trace import trace ! from happydoclib.docstring import getConverterFactoryForFile, \ ! getConverterFactory # *************** *** 134,137 **** --- 135,142 ---- return + def warningMessage(self, message=''): + self.statusMessage('WARNING: %s' % message, 0) + return + def write(self): """Called by the application to cause the docset to be written. *************** *** 342,345 **** --- 347,352 ---- """ + CONVERTER_HEADER_START_LEVEL = 4 + mimetype_extension_mapping = { 'text/x-python' : { 'remove_existing':1,}, *************** *** 583,587 **** # Convert and write the text. # ! html = converter.convert(text, 'html', level=4) return html --- 590,595 ---- # Convert and write the text. # ! html = converter.convert(text, 'html', ! level=self.CONVERTER_HEADER_START_LEVEL) return html *************** *** 659,660 **** --- 667,735 ---- trace.outof(outputLevel=TRACE_LEVEL) return + + def _computeRelativeHREF(self, source, destination): + """Compute the HREF to point from the output file of source to destination. + """ + trace.into('MultiHTMLFileDocSet', '_computeRelativeHREF', + source=source.getName(), + destination=destination.getName(), + outputLevel=TRACE_LEVEL, + ) + + relative_path = source.getPathToNode(destination) + trace.writeVar(relative_path=relative_path, + outputLevel=TRACE_LEVEL) + if not relative_path: + output_name = self.getOutputFilenameForPackageTreeNode( + destination, + includePath=0, + ) + trace.outof(output_name, outputLevel=TRACE_LEVEL) + return output_name + + destination_mimetype = destination.getMimeType()[0] + source_mimetype = source.getMimeType()[0] + + # + # Pointing to a class defined by source module. + # + if ( (len(relative_path) == 1) + and + (destination_mimetype == 'application/x-class') + and + (source_mimetype == 'text/x-python') + and + (source.get(destination.getName()) is not None) + ): + trace.write('adding source to relative path', + outputLevel=TRACE_LEVEL) + relative_path = (source.getName(), relative_path[0]) + + destination_name = destination.getName() + if relative_path[-1] == destination_name: + # + # Need to replace with output name. + # + output_name = self.getOutputFilenameForPackageTreeNode( + destination, + includePath=0, + ) + trace.write('Replacing %s with %s' % (relative_path[-1], + output_name, + ), + outputLevel=TRACE_LEVEL, + ) + relative_path = relative_path[:-1] + (output_name,) + + # + # If the destination is a directory, add 'index.html' to the end. + # + #print destination.getName(), destination.getMimeType() + #if destination.getMimeType() == ('application/x-directory', None): + # print 'adding index.html' + # relative_path += ('index.html',) + # print relative_path + + href = '/'.join(relative_path) + trace.outof(href, outputLevel=TRACE_LEVEL) + return href |
From: Doug H. <dou...@us...> - 2003-03-16 20:16:33
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib In directory sc8-pr-cvs1:/tmp/cvs-serv29615/happydoclib Modified Files: packagetree.py Log Message: Change getSubNodes() to take a sequence of mimetypes instead of just a single value. Index: packagetree.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/packagetree.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** packagetree.py 18 Jan 2003 22:15:12 -0000 1.7 --- packagetree.py 16 Mar 2003 20:16:27 -0000 1.8 *************** *** 195,198 **** --- 195,201 ---- """ raise NotImplementedError('getSummaryAndFormat') + + def getOneLiner(self): + return self.getSummaryAndFormat()[0] *************** *** 402,406 **** return node ! def getSubNodes(self, mimetype=None): """Returns the children of this node. --- 405,409 ---- return node ! def getSubNodes(self, mimetypes=[]): """Returns the children of this node. *************** *** 408,412 **** mimetype. """ ! if mimetype is None: return self.values() else: --- 411,415 ---- mimetype. """ ! if not mimetypes: return self.values() else: *************** *** 417,421 **** group = self.grouped_children.setdefault(node_mimetype, []) group.append(node) ! return self.grouped_children.get(mimetype, []) def walk(self, callback): --- 420,436 ---- group = self.grouped_children.setdefault(node_mimetype, []) group.append(node) ! ! subnodes = [] ! for mimetype in mimetypes: ! subnodes += self.grouped_children.get(mimetype, []) ! ! subnodes.sort() ! return subnodes ! ! def __cmp__(self, other): ! """Comparison by name for sorting. ! The name check is case insensitive. ! """ ! return cmp(self.getName().lower(), other) def walk(self, callback): |
From: Doug H. <dou...@us...> - 2003-03-16 20:15:53
|
Update of /cvsroot/happydoc/HappyDoc3 In directory sc8-pr-cvs1:/tmp/cvs-serv29314 Modified Files: TODO Log Message: Note to self on API change. Index: TODO =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/TODO,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TODO 18 Jan 2003 20:02:18 -0000 1.4 --- TODO 16 Mar 2003 20:15:48 -0000 1.5 *************** *** 13,16 **** --- 13,18 ---- 8. CSS-based docset 9. PageTemplate-based docset (same as 8?) + 10. Change processPythonFile to processSourceCodeFile in docset, and + register it for python, C, etc. |
From: Doug H. <dou...@us...> - 2003-03-16 16:30:53
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv31960/happydoclib/docset/docset_TAL/templates/default Added Files: toc.pt Log Message: Table of contents template for default template set. --- NEW FILE: toc.pt --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" > <!-- $Id: toc.pt,v 1.1 2003/03/16 16:30:48 doughellmann Exp $ --> <head metal:use-macro="templates/header.pt/macros/html_header"> </head> <body> Table of Contents body. </body> </html> |
From: Doug H. <dou...@us...> - 2003-03-16 16:30:03
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv31572/happydoclib/docset/docset_TAL/templates/default Added Files: header.pt Log Message: Header macro for default template set. --- NEW FILE: header.pt --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <!-- $Id: header.pt,v 1.1 2003/03/16 16:30:00 doughellmann Exp $ --> <head metal:define-macro="html_header" xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal"> <title metal:define-slot="title"> <span tal:replace="title">Title from header.pt</span> <tal:block tal:condition="subtitle|nothing">(<span tal:replace="subtitle">Subtitle from header.pt</span>)</tal:block> </title> <metal:block metal:define-slot="head_slot"> </metal:block> </head> <body> <p>Contains the html_header macro.</p> </body> </html> |
From: Doug H. <dou...@us...> - 2003-03-16 16:29:23
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default In directory sc8-pr-cvs1:/tmp/cvs-serv31297/happydoclib/docset/docset_TAL/templates/default Log Message: Directory /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates/default added to the repository |
From: Doug H. <dou...@us...> - 2003-03-16 16:29:18
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv31258/happydoclib/docset/docset_TAL Modified Files: test_templatefile.py Log Message: Categorize tests. Index: test_templatefile.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/test_templatefile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_templatefile.py 26 Jan 2003 19:15:02 -0000 1.1 --- test_templatefile.py 16 Mar 2003 16:29:14 -0000 1.2 *************** *** 85,88 **** --- 85,92 ---- class TemplateFileTestCase(unittest.TestCase): + PROCTOR_TEST_CATEGORIES = ( 'docset', + 'TAL', + ) + def runOneTest(self, hereName, templateFileName, macroFileNames, expectedResults): template = TemplateFile(templateFileName) |
From: Doug H. <dou...@us...> - 2003-03-16 16:29:03
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv31110/happydoclib/docset/docset_TAL Added Files: templateset.py Log Message: Class to manage a set of templates. The constructor is given a directory name, and the directory is scanned for template files. --- NEW FILE: templateset.py --- #!/usr/bin/env python # # $Id: templateset.py,v 1.1 2003/03/16 16:29:00 doughellmann Exp $ # # Copyright 2003 Doug Hellmann. # # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Doug # Hellmann not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # """Load up a set of templates. """ __rcs_info__ = { # # Creation Information # 'module_name' : '$RCSfile: templateset.py,v $', 'rcs_id' : '$Id: templateset.py,v 1.1 2003/03/16 16:29:00 doughellmann Exp $', 'creator' : 'Doug Hellmann <do...@he...>', 'project' : 'UNSPECIFIED', 'created' : 'Sun, 16-Mar-2003 10:47:39 EST', # # Current Information # 'author' : '$Author: doughellmann $', 'version' : '$Revision: 1.1 $', 'date' : '$Date: 2003/03/16 16:29:00 $', } try: __version__ = __rcs_info__['version'].split(' ')[1] except: __version__ = '0.0' # # Import system modules # import glob import os import UserDict # # Import Local modules # import happydoclib from happydoclib.trace import trace from happydoclib.docset.docset_TAL.templatefile import TemplateFile # # Module # TRACE_LEVEL=0 class TemplateSet(UserDict.UserDict): """Manages a set of templates. """ def __init__(self, directoryName, patterns=['*.pt']): """Load the templates from directoryName. """ UserDict.UserDict.__init__(self) self.directory = directoryName for pattern in patterns: filenames = glob.glob(os.path.join(directoryName, pattern)) for filename in filenames: template_file = TemplateFile(filename, self) basename = os.path.basename(filename) self[basename] = template_file return def __getitem__(self, name): try: template = UserDict.UserDict.__getitem__(self, name) except KeyError: raise MissingTemplateError(name, self.directory) return template class MissingTemplateError(KeyError): def __init__(self, templateName, templatePathName): Exception.__init__(self) self.name = templateName self.path = templatePathName return def __str__(self): return 'Missing template %s in %s.' % (self.name, self.path, ) |
From: Doug H. <dou...@us...> - 2003-03-16 16:28:23
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates In directory sc8-pr-cvs1:/tmp/cvs-serv30834/happydoclib/docset/docset_TAL/templates Log Message: Directory /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templates added to the repository |
From: Doug H. <dou...@us...> - 2003-03-16 16:28:17
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv30675/happydoclib/docset/docset_TAL Modified Files: templatefile.py Log Message: Let the TemplateFile know about its TemplateSet. Index: templatefile.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/templatefile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** templatefile.py 26 Jan 2003 19:15:02 -0000 1.1 --- templatefile.py 16 Mar 2003 16:28:12 -0000 1.2 *************** *** 78,82 **** """ ! def __init__(self, fileName): """Constructor. """ --- 78,82 ---- """ ! def __init__(self, fileName, templateSet=None): """Constructor. """ *************** *** 86,89 **** --- 86,91 ---- ) self.filename = fileName + self.template_set = templateSet + self.engine = hdExpressions.getEngine() self.generator = TALGenerator(self.engine, xml=0) *************** *** 103,106 **** --- 105,110 ---- 'modules': hdExpressions.DocsetModuleImporter, } + if self.template_set is not None: + c['templates'] = self.template_set return c |
From: Doug H. <dou...@us...> - 2003-03-16 16:27:50
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL In directory sc8-pr-cvs1:/tmp/cvs-serv30486/happydoclib/docset/docset_TAL Modified Files: __init__.py Log Message: Fix output filename handling. Add ability to specify the tempalte set and path. Implement writeTOCFile(). Raise exceptions in the methods that still need to be implemented. Index: __init__.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/docset_TAL/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 26 Jan 2003 19:12:58 -0000 1.1 --- __init__.py 16 Mar 2003 16:27:44 -0000 1.2 *************** *** 55,58 **** --- 55,59 ---- # Import system modules # + import os import sys *************** *** 64,67 **** --- 65,70 ---- from happydoclib.trace import trace + from happydoclib.docset.docset_TAL.templateset import TemplateSet + # # Module *************** *** 77,80 **** --- 80,88 ---- """ + DEFAULT_TEMPLATE_SET = 'default' + DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), + 'templates', + ) + def __init__(self, scanner, title, *************** *** 105,111 **** --- 113,168 ---- extraParameters=extraParameters, ) + + self.template_name = extraParameters.get('template_name', + self.DEFAULT_TEMPLATE_SET) + + self.template_path = extraParameters.get('template_path', + self.DEFAULT_TEMPLATE_PATH) + + self.template_set = TemplateSet(os.path.join(self.template_path, + self.template_name) + ) + trace.outof(outputLevel=TRACE_LEVEL) return + + def getOutputFilenameForPackageTreeNode(self, packageTreeNode, includePath=1): + """Returns a filename where documentation for packageTreeNode should be written. + + The filename will be in the output directory, possibly in a + subdirectory based on the path from the input root to the + input file. + + For example:: + + input_directory : /foo/input + containing : /foo/input/bar.py + output_directory : /foo/output + + results in : /foo/output/input/bar.py + """ + trace.into('TALDocset', 'getOutputFilenameForPackageTreeNode', + outputLevel=TRACE_LEVEL) + filename = base.MultiFileDocSet.getOutputFilenameForPackageTreeNode( + self, + packageTreeNode, + includePath=includePath, + ) + + if packageTreeNode.getMimeType() == ('application/x-directory', None): + # + # This is a directory. + # + filename_with_extension = os.path.join(filename, 'index.html') + else: + # + # This is not a directory (file, module, class, etc.). + # + filename_with_extension = '%s.html' % filename + + trace.outof(filename_with_extension, outputLevel=TRACE_LEVEL) + return filename_with_extension + def _initializeWriters(self): """Hook to allow subclasses to register writers without having to *************** *** 115,118 **** --- 172,187 ---- return + def renderTemplateToFile(self, template, outputFilename, + packageTreeNode, + **extraContext): + + rendered_text = template.render(extraContext) + + output = self.openOutput(outputFilename, packageTreeNode) + output.write(rendered_text) + output.close() + + return + def writeTOCFile(self, packageTreeNode): """Write the table of contents for a directory. *************** *** 123,130 **** for that directory should be written as appropriate. """ ! self.statusMessage('writeTOCFile needs work') return ! def writeFileHeader(self, output, packageTreeNode, title='', subtitle=''): """Does nothing. """ --- 192,218 ---- for that directory should be written as appropriate. """ ! trace.into('TALDocset', 'writeTOCFile', ! packageTreeNode=packageTreeNode, ! outputLevel=TRACE_LEVEL, ! ) ! ! output_filename = self.getOutputFilenameForPackageTreeNode( ! packageTreeNode) ! ! template = self.template_set['toc.pt'] ! ! self.renderTemplateToFile( ! template, ! output_filename, ! packageTreeNode, ! title=self.title, ! subtitle=packageTreeNode.getRelativeFilename(), ! ) ! ! trace.outof(outputLevel=TRACE_LEVEL) return ! def writeFileHeader(self, output, packageTreeNode, ! title='', subtitle=''): """Does nothing. """ *************** *** 140,143 **** --- 228,232 ---- """ self.statusMessage('processPythonFile needs work') + raise NotImplementedError('processPythonFile') return *************** *** 150,153 **** --- 239,243 ---- """ self.statusMessage('processPlainTextFile needs work') + raise NotImplementedError('processPlainTextFile') return *************** *** 156,159 **** --- 246,250 ---- """ self.statusMessage('processPythonClass needs work') + raise NotImplementedError('processPythonClass') return |
From: Doug H. <dou...@us...> - 2003-03-16 16:26:35
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv29990/happydoclib/docset Modified Files: tests.py Log Message: Categorize tests. Index: tests.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/tests.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tests.py 1 Jan 2003 14:06:21 -0000 1.5 --- tests.py 16 Mar 2003 16:26:32 -0000 1.6 *************** *** 68,71 **** --- 68,74 ---- class TestDocSetBase(unittest.TestCase): + PROCTOR_TEST_CATEGORIES = ( 'docset', + ) + def testRequiresWrite(self): docset = base.DocSetBase( *************** *** 84,87 **** --- 87,93 ---- class TestDocSet(unittest.TestCase): + PROCTOR_TEST_CATEGORIES = ( 'docset', + ) + def testFilterNames(self): docset = base.DocSet( *************** *** 125,128 **** --- 131,138 ---- class TestMultiFileDocSet(unittest.TestCase): + + PROCTOR_TEST_CATEGORIES = ( 'docset', + 'MultiFile', + ) def testRequiresWriteTOCFile(self): |
From: Doug H. <dou...@us...> - 2003-03-16 16:26:19
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv29830/happydoclib/docset Added Files: test_docset_TAL.py Log Message: New tests for the TAL docset. --- NEW FILE: test_docset_TAL.py --- #!/usr/bin/env python # # $Id: test_docset_TAL.py,v 1.1 2003/03/16 16:26:12 doughellmann Exp $ # # Copyright 2003 Doug Hellmann. # # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Doug # Hellmann not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # """Tests for TAL docset. """ __rcs_info__ = { # # Creation Information # 'module_name' : '$RCSfile: test_docset_TAL.py,v $', 'rcs_id' : '$Id: test_docset_TAL.py,v 1.1 2003/03/16 16:26:12 doughellmann Exp $', 'creator' : 'Doug Hellmann <do...@he...>', 'project' : 'UNSPECIFIED', 'created' : 'Sun, 16-Mar-2003 08:57:53 EST', # # Current Information # 'author' : '$Author: doughellmann $', 'version' : '$Revision: 1.1 $', 'date' : '$Date: 2003/03/16 16:26:12 $', } try: __version__ = __rcs_info__['version'].split(' ')[1] except: __version__ = '0.0' # # Import system modules # import os import unittest # # Import Local modules # import happydoclib from happydoclib import tests # # Module # class TALDocSetRunTest(tests.HappyDocRunTest): PROCTOR_TEST_CATEGORIES = ( 'docset', 'TAL', ) TEST_OUTPUT_DIRECTORY_BASE = 'TestOutput' TEST_DOCSET = 'TAL' |
From: Doug H. <dou...@us...> - 2003-03-16 16:26:01
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv29688/happydoclib/docset Modified Files: test_docset_MultiHTMLFile.py Log Message: Move test logic to shared location. Index: test_docset_MultiHTMLFile.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/test_docset_MultiHTMLFile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_docset_MultiHTMLFile.py 26 Jan 2003 19:05:51 -0000 1.11 --- test_docset_MultiHTMLFile.py 16 Mar 2003 16:25:58 -0000 1.12 *************** *** 71,143 **** class MultiHTMLFileDocSetRunTest(tests.HappyDocRunTest): ! TEST_OUTPUT_DIRECTORY_BASE = 'TestOutput' ! ! def testAllExpectedFilesCreated(self): ! self.runHappyDoc( '-T', 'MultiHTMLFile', ! os.path.join('TestCases', 'testScanner') ) ! scanner = Scanner([self.getOutputDirectory()]) ! root = os.path.join( self.getOutputDirectory(), 'testScanner' ) ! expected_dirs = [ ('levelOne',), ! ('levelOne', 'levelTwo'), ! ] ! expected_dirs = [ apply(os.path.join, (root,) + ed) for ed in expected_dirs ] ! for dirname in expected_dirs: ! self.failUnless(os.path.isdir(dirname), ! '%s is not a directory' % dirname, ! ) ! ! expected_files = [ ('levelOne', 'index.html'), ! ('levelOne', 'Existing.html'), ! ('levelOne', 'README.html'), ! ('levelOne', 'one.html'), ! ('levelOne', 'levelTwo'), ! ] ! expected_files = [ apply(os.path.join, (root,) + ef) for ef in expected_files ] ! for filename in expected_files: ! self.failUnless(os.path.exists(filename), ! '%s does not exist' % filename, ! ) ! return ! ! def testSelfDoc(self): ! self.runHappyDoc( '-T', 'MultiHTMLFile', ! '-i', 'TestCases', ! '-i', 'TestOutput', ! '-i', '^tests.py$', ! '-i', '^test_.*.py$', ! os.getcwd(), ! ) ! ! scanner = Scanner([self.getOutputDirectory()]) ! root = self.getOutputDirectory() ! ! # ! # Directories to ignore ! # ! expected_dirs = [ ('HappyDoc3', 'levelOne',), ! ('HappyDoc3', 'levelOne', 'levelTwo'), ! ] ! expected_dirs = [ apply(os.path.join, (root,) + ed) ! for ed in expected_dirs ! ] ! for dirname in expected_dirs: ! if os.path.isdir(dirname): ! self.fail('%s should have been ignored' % dirname) ! # ! # Directories to document ! # ! expected_dirs = [ ('HappyDoc3', 'happydoclib',), ! ('HappyDoc3', 'happydoclib', 'docset'), ! ('HappyDoc3', 'happydoclib', 'docstring'), ! ('HappyDoc3', 'happydoclib', 'parseinfo'), ! ] ! expected_dirs = [ apply(os.path.join, (root,) + ed) ! for ed in expected_dirs ! ] ! for dirname in expected_dirs: ! if not os.path.isdir(dirname): ! self.fail('%s should not have been ignored' % dirname) ! return # def testImportStatements(self): --- 71,79 ---- class MultiHTMLFileDocSetRunTest(tests.HappyDocRunTest): ! PROCTOR_TEST_CATEGORIES = ( 'docset', ! 'MultiHTMLFile', ! ) ! TEST_DOCSET = 'MultiHTMLFile' # def testImportStatements(self): |
From: Doug H. <dou...@us...> - 2003-03-16 16:25:42
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv29565/happydoclib/docset Modified Files: base.py Log Message: Make sure the output directory exists before copying a file from input to output. Index: base.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/base.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** base.py 15 Mar 2003 14:24:07 -0000 1.16 --- base.py 16 Mar 2003 16:25:39 -0000 1.17 *************** *** 432,435 **** --- 432,445 ---- input_filename = packageTreeNode.getInputFilename() output_filename = self.getOutputFilenameForPackageTreeNode(packageTreeNode) + + # + # Make sure the directory exists. + # + output_dirname = os.path.dirname(output_filename) + self.rmkdir(output_dirname) + + # + # Copy the file + # self.statusMessage('Copying: %s\n To: %s' % ( input_filename, |
From: Doug H. <dou...@us...> - 2003-03-16 16:25:08
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib In directory sc8-pr-cvs1:/tmp/cvs-serv29191/happydoclib Modified Files: tests.py Log Message: Write test output to a directory based on the test id. Move some test logic into the HappyDocRunTest so it can be shared by different docset tests. Index: tests.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/tests.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tests.py 15 Dec 2002 17:01:11 -0000 1.1 --- tests.py 16 Mar 2003 16:25:05 -0000 1.2 *************** *** 63,70 **** --- 63,72 ---- # import happydoclib + from happydoclib.scanner import Scanner # # Module # + __proctor_ignore_module__ = 1 class HappyDocRunTest(unittest.TestCase): *************** *** 72,87 **** TEST_OUTPUT_DIRECTORY_BASE = 'TestOutput' - def getTestName(self): - return self._TestCase__testMethodName - def getOutputDirectory(self): ! return os.path.join(self.TEST_OUTPUT_DIRECTORY_BASE, ! self.getTestName(), ! ) def runHappyDoc(self, *args): default_args = ( '-q', '-d', self.getOutputDirectory(), ! '-t', self.getTestName(), ) #default_args = ( '-d', self.getOutputDirectory(), ) --- 74,90 ---- TEST_OUTPUT_DIRECTORY_BASE = 'TestOutput' def getOutputDirectory(self): ! id = self.id() ! id_parts = id.split('.') ! id = os.sep.join(id_parts) ! output_dir = os.path.join(self.TEST_OUTPUT_DIRECTORY_BASE, ! id, ! ) ! return output_dir def runHappyDoc(self, *args): default_args = ( '-q', '-d', self.getOutputDirectory(), ! '--title', self.id(), ) #default_args = ( '-d', self.getOutputDirectory(), ) *************** *** 89,91 **** --- 92,184 ---- happydoc = happydoclib.HappyDoc(all_args) happydoc.run() + return + + def testAllExpectedFilesCreated(self): + # + # Run HappyDoc to generate output using our docset. + # + self.runHappyDoc( '-T', self.TEST_DOCSET, + os.path.join('TestCases', 'testScanner') ) + # + # Scan the output directory to find what files are there. + # + scanner = Scanner([self.getOutputDirectory()]) + # + # Build up the list of expected directories, + # and make sure they are all present. + # + root = os.path.join( self.getOutputDirectory(), 'testScanner' ) + expected_dirs = [ ('levelOne',), + ('levelOne', 'levelTwo'), + ] + expected_dirs = [ apply(os.path.join, (root,) + ed) + for ed in expected_dirs + ] + for dirname in expected_dirs: + self.failUnless(os.path.isdir(dirname), + '%s is not a directory' % dirname, + ) + + # + # Build up the list of expected files, + # and make sure they are all present. + # + expected_files = [ ('levelOne', 'index.html'), + ('levelOne', 'Existing.html'), + ('levelOne', 'README.html'), + ('levelOne', 'one.html'), + ('levelOne', 'levelTwo'), + ] + expected_files = [ apply(os.path.join, (root,) + ef) for ef in expected_files ] + for filename in expected_files: + self.failUnless(os.path.exists(filename), + '%s does not exist' % filename, + ) + return + + def testSelfDoc(self): + # + # Run HappyDoc against itself. + # + self.runHappyDoc( '-T', self.TEST_DOCSET, + '-i', 'TestCases', + '-i', 'TestOutput', + '-i', '^tests.py$', + '-i', '^test_.*.py$', + os.getcwd(), + ) + + # + # Create a scanner to find the output files generated. + # + scanner = Scanner([self.getOutputDirectory()]) + root = self.getOutputDirectory() + + # + # Directories to ignore + # + expected_dirs = [ ('HappyDoc3', 'levelOne',), + ('HappyDoc3', 'levelOne', 'levelTwo'), + ] + expected_dirs = [ apply(os.path.join, (root,) + ed) + for ed in expected_dirs + ] + for dirname in expected_dirs: + if os.path.isdir(dirname): + self.fail('%s should have been ignored' % dirname) + + # + # Directories to document + # + expected_dirs = [ ('HappyDoc3', 'happydoclib',), + ('HappyDoc3', 'happydoclib', 'docset'), + ('HappyDoc3', 'happydoclib', 'docstring'), + ('HappyDoc3', 'happydoclib', 'parseinfo'), + ] + expected_dirs = [ apply(os.path.join, (root,) + ed) + for ed in expected_dirs + ] + for dirname in expected_dirs: + if not os.path.isdir(dirname): + self.fail('%s should not have been ignored' % dirname) return |
From: Doug H. <dou...@us...> - 2003-03-16 16:24:26
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib In directory sc8-pr-cvs1:/tmp/cvs-serv28957/happydoclib Modified Files: appclass.py Log Message: Let the user specify the --template-path where the template set should be found. Index: appclass.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/appclass.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** appclass.py 15 Mar 2003 14:23:20 -0000 1.14 --- appclass.py 16 Mar 2003 16:24:24 -0000 1.15 *************** *** 117,120 **** --- 117,125 ---- template_name = None + # + # Where should we look for templates? + # + template_path = None + ## ## Local methods *************** *** 338,341 **** --- 343,352 ---- return + def optionHandler_template_path(self, template_path_directory): + """Set the parent directory of the template directory. + """ + self.template_path = template_path_directory + return + ## ## Main *************** *** 381,384 **** --- 392,397 ---- if self.template_name: docset_params['template_name'] = self.template_name + if self.template_path: + docset_params['template_path'] = self.template_path self.parser_params = parser_params |
From: Doug H. <dou...@us...> - 2003-03-16 16:23:58
|
Update of /cvsroot/happydoc/HappyDoc3 In directory sc8-pr-cvs1:/tmp/cvs-serv28668 Modified Files: Makefile Log Message: Allow testing by proctor category. Ignore directories that look like python files whenm making tags file. Index: Makefile =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 15 Mar 2003 14:25:09 -0000 1.1 --- Makefile 16 Mar 2003 16:23:55 -0000 1.2 *************** *** 30,36 **** PROCTOR_VERBOSITY="-vvv" PROCTOR_ARGS="--interleaved" ! REGRESSION_TEST=$(PROCTOR) $(PROCTOR_VERBOSITY) $(PROCTOR_ARGS) . 2>&1 | tee test_output.txt tags: ! find . -name '*.py' | grep -v TestCase | etags -l auto --regex='/[ \t]*\def[ \t]+\([^ :(\t]+\)/\1/' - --- 30,37 ---- PROCTOR_VERBOSITY="-vvv" PROCTOR_ARGS="--interleaved" + TEST_CATEGORY="All" ! REGRESSION_TEST=$(PROCTOR) --category $(TEST_CATEGORY) $(PROCTOR_VERBOSITY) $(PROCTOR_ARGS) . 2>&1 | tee test_output.txt tags: ! find . -name '*.py' -type f | grep -v TestCase | etags -l auto --regex='/[ \t]*\def[ \t]+\([^ :(\t]+\)/\1/' - |