Revision: 1462
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1462&view=rev
Author: roman_yakovenko
Date: 2008-12-07 11:15:01 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
commit new version from Hern?\195?\161n Ordiales
Modified Paths:
--------------
pyplusplus_dev/contrib/doc_extractors/doxygen.py
Modified: pyplusplus_dev/contrib/doc_extractors/doxygen.py
===================================================================
--- pyplusplus_dev/contrib/doc_extractors/doxygen.py 2008-11-28 17:49:30 UTC (rev 1461)
+++ pyplusplus_dev/contrib/doc_extractors/doxygen.py 2008-12-07 11:15:01 UTC (rev 1462)
@@ -8,8 +8,7 @@
class doxygen_doc_extractor:
"""
- Extracts Doxigen styled documentation from source
- or generates from description.
+ Extracts Doxygen styled documentation from source or generates it from description.
"""
def __init__(self):
#for caching source
@@ -51,60 +50,180 @@
if doc_lines:
final_doc_lines = [ line.replace("\n","\\n") for line in doc_lines[:-1] ]
final_doc_lines.append(doc_lines[-1].replace("\n",""))
- #final_doc_lines.insert(0, self.get_generic_doc(declaration))
return '\"' + ''.join(final_doc_lines) + '\"'
else:
return '\"\"'
- #return '\"'+self.get_generic_doc(declaration)+'\"'
#__call__()
- #def get_generic_doc(self, declaration):
- #"""
- #Generate call information about function or method
- #"""
- #try:
- #return "Help on %s" % str(declaration)
- #except:
- #pass
- #return ''
- ##get_generic_doc()
-
def clear_str(self, tmp_str):
"""
- Replace */! by Space and \breaf, \fn, \param, ...
+ Replace */! by space and \brief, @fn, \param, etc
"""
- clean = lambda tmp_str, sym, change2 = '': tmp_str.replace(sym, change2)
-
- tmp_str = reduce(clean, [tmp_str, '/', '*', '!', "\\brief", "\\fn",\
- "@brief", "@fn", "@ref", "\\ref", "\"", "\'", "\\c"])
-
- tmp_str = clean(tmp_str, "@param", "Param:")
- tmp_str = clean(tmp_str, "@see", "See:")
- tmp_str = clean(tmp_str, "@pre", "Pre-condition:")
- tmp_str = clean(tmp_str, "@throws", "Throws:")
- tmp_str = clean(tmp_str, "@throw", "Throw:")
- tmp_str = clean(tmp_str, "@todo", "TODO:")
- tmp_str = clean(tmp_str, "\param", "Param:")
- tmp_str = clean(tmp_str, "@ingroup", "Group")
- tmp_str = clean(tmp_str, "\ingroup", "Group")
- tmp_str = clean(tmp_str, "@return", "It return")
- tmp_str = clean(tmp_str, "\\return", "It return")
- tmp_str = clean(tmp_str, "\\warning", "Warning:")
- tmp_str = clean(tmp_str, "\\WARNING", "Warning:")
- tmp_str = clean(tmp_str, "@dot", "[Dot]")
- tmp_str = clean(tmp_str, "@enddot", "[/Dot]")
- tmp_str = clean(tmp_str, "@code", "[Code]")
- tmp_str = clean(tmp_str, "@endcode", "[/Code]")
+ tmp_str = reduce(clean, [tmp_str, '/','*','!',"\\brief","@brief","\\fn","@fn","\\ref","@ref", "\"", "\'", "\\c"])
+
+ #commands list taken form : http://www.stack.nl/~dimitri/doxygen/commands.html
+ replacement_list = [
+# "a",
+ "addindex",
+ "addtogroup",
+ "anchor",
+ "arg",
+ "attention",
+ "author",
+# "b",
+# "brief",
+ "bug",
+# "c",
+ "callgraph",
+ "callergraph",
+ "category",
+ "class",
+ ("code","[Code]"),
+ "cond",
+ "copybrief",
+ "copydetails",
+ "copydoc",
+ "date",
+ "def",
+ "defgroup",
+ "deprecated",
+ "details",
+ "dir",
+ "dontinclude",
+ ("dot","[Dot]"),
+ "dotfile",
+ "e",
+ "else",
+ "elseif",
+ "em",
+ ("endcode","[/Code]"),
+ "endcond",
+ ("enddot","[/Dot]"),
+ "endhtmlonly",
+ "endif",
+ "endlatexonly",
+ "endlink",
+ "endmanonly",
+ "endmsc",
+ "endverbatim",
+ "endxmlonly",
+ "enum",
+ "example",
+ "exception",
+ "extends",
+ "f$",
+ "f[",
+ "f]",
+ "f{",
+ "f}",
+ "file",
+# "fn",
+ "headerfile",
+ "hideinitializer",
+ "htmlinclude",
+ "htmlonly",
+ "if",
+ "ifnot",
+ "image",
+ "implements",
+ "include",
+ "includelineno",
+ "ingroup",
+ "internal",
+ "invariant",
+ "interface",
+ "latexonly",
+ "li",
+ "line",
+ "link",
+ "mainpage",
+ "manonly",
+ "memberof",
+ "msc",
+# "n",
+ "name",
+ "namespace",
+ "nosubgrouping",
+ "note",
+ "overload",
+# "p",
+ "package",
+ "page",
+ "par",
+ "paragraph",
+ "param",
+ "post",
+ "pre",
+# "private (PHP only)",
+# "privatesection (PHP only)",
+ "property",
+# "protected (PHP only)",
+# "protectedsection (PHP only)",
+ "protocol",
+# "public (PHP only)",
+# "publicsection (PHP only)",
+# "ref",
+ "relates",
+ "relatesalso",
+ "remarks",
+ "return",
+ "retval",
+ "sa",
+ "section",
+ "see",
+ "showinitializer",
+ "since",
+ "skip",
+ "skipline",
+ "struct",
+ "subpage",
+ "subsection",
+ "subsubsection",
+ "test",
+ "throw",
+ ("todo","TODO"),
+ "tparam",
+ "typedef",
+ "union",
+ "until",
+ "var",
+ "verbatim",
+ "verbinclude",
+ "version",
+ "warning",
+ "weakgroup",
+ "xmlonly",
+ "xrefitem",
+# "$",
+# "@",
+# "\",
+# "&",
+# "~",
+# "<",
+# ">",
+# "#",
+# "%",
+ ]
+
+ for command in replacement_list:
+ try:
+ old,new = command
+ except ValueError:
+ old = command
+ new = command.capitalize()+":"
+ tmp_str = clean(tmp_str, "@"+old, new)
+ tmp_str = clean(tmp_str, "\\"+old, new)
+
return tmp_str.lstrip()
#clean_str()
-
+
def is_code(self, tmp_str):
"""
- Detect if tmp_str is code
+ Detects if tmp_str is code or not
"""
try:
beg = tmp_str.lstrip()[:2]
- return beg != "//" and beg != "/*"
+ return beg != "//" and beg != "/*"
except:
pass
return False
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|