[Happydoc-checkins] CVS: HappyDoc3/happydoclib/docset base.py,1.5,1.6
Brought to you by:
doughellmann,
krlosaqp
From: Doug H. <dou...@us...> - 2002-12-07 17:02:51
|
Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset In directory sc8-pr-cvs1:/tmp/cvs-serv23408/happydoclib/docset Modified Files: base.py Log Message: Move writeTOCFile. Add writeText and unquoteString. Index: base.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/base.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** base.py 7 Dec 2002 15:34:32 -0000 1.5 --- base.py 7 Dec 2002 17:02:48 -0000 1.6 *************** *** 326,341 **** def writeTOCFile(self, packageTreeNode): ! trace.into('MultiFileDocSet', 'writeDirectory', ! packageTreeNode=packageTreeNode, ! ) ! ! output_filename = self.getOutputFilenameForPackageTreeNode(packageTreeNode) ! ! file = self.openOutput(output_filename) ! file.write('TOC goes here') ! self.closeOutput(file) ! ! trace.outof() ! return def writeFileHeader(self, output, title=None, subtitle=None): --- 326,330 ---- def writeTOCFile(self, packageTreeNode): ! raise NotImplemented('writeTOCFile') def writeFileHeader(self, output, title=None, subtitle=None): *************** *** 354,357 **** --- 343,396 ---- output.close() return + + def _unquoteString(self, str): + "Remove surrounding quotes from a string." + str = str.strip() + while ( str + and + (str[0] == str[-1]) + and + str[0] in ('"', "'") + ): + str = str[1:-1] + return str + + def writeText(self, output, text, textFormat): + """Format and write the 'text' to the 'output'. + + Arguments: + + 'output' -- Stream to which 'text' should be written. + + 'text' -- String to be written. + + 'textFormat' -- String identifying the format of 'text' so + the formatter can use a docstring converter to convert the + body of 'text' to the appropriate output format. + + 'quote=1' -- Boolean option to control whether the text + should be quoted to escape special characters. + + """ + if not text: + return + text = self._unquoteString(text) + # + # Get a text converter + # + converter_factory = getConverterFactory(textFormat) + converter = converter_factory() + # + # Do we need to quote the text? + # + #if self._html_quote_text and quote: + # text = converter.quote(text, 'html') + # + # Convert and write the text. + # + html = converter.convert(text, 'html', level=3) + output.write(html) + return + def writePlainTextFile(self, packageTreeNode): *************** *** 379,383 **** output_file = self.openOutput(output_filename) - output_file.write(cooked_body) --- 418,421 ---- |