[Epydoc-commits] SF.net SVN: epydoc: [1587] trunk/epydoc/src/epydoc/docwriter/latex.py
Brought to you by:
edloper
From: <dva...@us...> - 2007-03-20 00:58:55
|
Revision: 1587 http://svn.sourceforge.net/epydoc/?rev=1587&view=rev Author: dvarrazzo Date: 2007-03-19 17:58:51 -0700 (Mon, 19 Mar 2007) Log Message: ----------- - Allow the LaTeX representation of an encoding to be different from the one used by Python. - Comments delimiting sections converted into API groups. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-14 01:53:42 UTC (rev 1586) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-03-20 00:58:51 UTC (rev 1587) @@ -118,7 +118,12 @@ self._top_section = 2 self._index_functions = 1 self._hyperref = 1 + + #: The Python representation of the encoding. + #: Update L{latex_encodings} in case of mismatch between it and + #: the C{inputenc} LaTeX package. self._encoding = kwargs.get('encoding', 'utf-8') + self.valdocs = sorted(docindex.reachable_valdocs( imports=False, packages=False, bases=False, submodules=False, subclasses=False, private=self._show_private)) @@ -226,7 +231,7 @@ os.mkdir(directory) #//////////////////////////////////////////////////////////// - # Main Doc File + #{ Main Doc File #//////////////////////////////////////////////////////////// def write_topfile(self, out): @@ -274,7 +279,7 @@ out('\n') # Set the encoding. - out('\\usepackage[%s]{inputenc}' % self._encoding) + out('\\usepackage[%s]{inputenc}' % self.get_latex_encoding()) # If we're generating hyperrefs, add the appropriate packages. if self._hyperref: @@ -309,7 +314,7 @@ #//////////////////////////////////////////////////////////// - # Chapters + #{ Chapters #//////////////////////////////////////////////////////////// def write_module(self, out, doc): @@ -405,7 +410,7 @@ out(' ' + self.indexterm(doc, 'end')) #//////////////////////////////////////////////////////////// - # Module hierarchy trees + #{ Module hierarchy trees #//////////////////////////////////////////////////////////// def write_module_tree(self, out): @@ -463,7 +468,7 @@ out(' '*depth + ' \\end{itemize}\n') #//////////////////////////////////////////////////////////// - # Base class trees + #{ Base class trees #//////////////////////////////////////////////////////////// def base_tree(self, doc, width=None, linespec=None): @@ -539,7 +544,7 @@ return s #//////////////////////////////////////////////////////////// - # Class List + #{ Class List #//////////////////////////////////////////////////////////// def write_class_list(self, out, doc): @@ -583,7 +588,7 @@ out((', p.~\\pageref{%s})}\n\n' % self.label(doc))) #//////////////////////////////////////////////////////////// - # Function List + #{ Function List #//////////////////////////////////////////////////////////// def write_func_list(self, out, heading, doc, value_type, seclevel=1): @@ -752,7 +757,7 @@ return '(%s)' % (', '.join([self._arg_name(a) for a in arg])) #//////////////////////////////////////////////////////////// - # Variable List + #{ Variable List #//////////////////////////////////////////////////////////// # Also used for the property list. @@ -848,7 +853,7 @@ out('\\cline{1-2}\n') #//////////////////////////////////////////////////////////// - # Standard Fields + #{ Standard Fields #//////////////////////////////////////////////////////////// # Copied from HTMLWriter: @@ -903,7 +908,7 @@ #//////////////////////////////////////////////////////////// - # Docstring -> LaTeX Conversion + #{ Docstring -> LaTeX Conversion #//////////////////////////////////////////////////////////// # We only need one linker, since we don't use context: @@ -922,7 +927,7 @@ hyperref=self._hyperref) #//////////////////////////////////////////////////////////// - # Helpers + #{ Helpers #//////////////////////////////////////////////////////////// def write_header(self, out, where): @@ -1002,6 +1007,15 @@ def label(self, doc): return ':'.join(doc.canonical_name) + #: Map the Python encoding representation into mismatching LaTeX ones. + latex_encodings = { + 'utf-8': 'utf8', + } - - + def get_latex_encoding(self): + """ + @return: The LaTeX representation of the selected encoding. + @rtype: C{str} + """ + enc = self._encoding.lower() + return self.latex_encodings.get(enc, enc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |