[Happydoc-checkins] CVS: HappyDoc3/happydoclib/docset base.py,1.17,1.18
Brought to you by:
doughellmann,
krlosaqp
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 |