Commit 02efa0fd authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[Python][Doc] Convert TeX formulas.

parent df704769
......@@ -380,8 +380,8 @@ class ClassCompound (CompoundBase):
output.out (template_class_doc.format (
tplargs = self._templateDecl(),
classname = self._className(),
docstring = docstring.encode('utf-8'),
attributes = attribute_docstrings.encode('utf-8'),
docstring = docstring,
attributes = attribute_docstrings,
))
def write (self, output):
......
......@@ -10,11 +10,20 @@ class XmlDocString (object):
"parameterdescription": self.otherTags,
"emphasis": self.emphasis,
"simplesect": self.simplesect,
"formula": self.formula,
"itemizedlist": self.itemizedlist,
"listitem": self.listitem,
}
self.unkwownTags = set()
self.unkwownReferences = dict()
self._linesep = "\\n\"\n\""
try:
from pylatexenc.latex2text import LatexNodes2Text
self.latex = LatexNodes2Text()
except ImportError:
self.latex = None
def clear (self):
self.lines = []
self.unkwownTags.clear()
......@@ -86,7 +95,7 @@ class XmlDocString (object):
def emphasis (self, node):
self._write ("*")
self.otherTags(node)
self.otherTags (node)
self._write ("*")
def simplesect (self, node):
......@@ -129,3 +138,18 @@ class XmlDocString (object):
sep = ", "
self._write (" ")
self.visit (desc)
def itemizedlist(self, node):
self._newline()
self.otherTags (node)
def listitem (self, node):
self._write ("- ")
self.otherTags (node)
def formula (self, node):
if node.text:
if self.latex is None:
self._write (node.text.strip())
else:
self._write (self.latex.latex_to_text(node.text))
......@@ -48,7 +48,7 @@ namespace fcl
/// @brief Front list acceleration for collision
/// Front list is a set of internal and leaf nodes in the BVTT hierarchy, where
/// the traversal terminates while performing a query during a given time instance. The front list reects the subset of a
/// the traversal terminates while performing a query during a given time instance. The front list reflects the subset of a
/// BVTT that is traversed for that particular proximity query.
struct BVHFrontNode
{
......
......@@ -53,16 +53,26 @@ ELSE()
SET(ENABLE_DOXYGEN_AUTODOC TRUE)
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import lxml"
RESULT_VARIABLE _lxml_found
RESULT_VARIABLE _pypkg_found
OUTPUT_QUIET
ERROR_QUIET)
IF(_lxml_found EQUAL 0)
IF(_pypkg_found EQUAL 0)
MESSAGE(STATUS "Found Python package lxml.")
ELSE()
SET(ENABLE_DOXYGEN_AUTODOC FALSE)
MESSAGE(STATUS "Python package lxml not found. Python bindings will not be documented.")
ENDIF()
UNSET(_lxml_found)
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import pylatexenc"
RESULT_VARIABLE _pypkg_found
OUTPUT_QUIET
ERROR_QUIET)
IF(NOT _pypkg_found EQUAL 0)
MESSAGE(STATUS "Python package pylatexenc not found.")
MESSAGE(STATUS " Formulas in the Python bindings documentation may look ugly.")
MESSAGE(STATUS " You can install it with: pip install pylatexenc")
ENDIF()
UNSET(_pypkg_found)
ENDIF()
IF(ENABLE_DOXYGEN_AUTODOC)
ADD_CUSTOM_TARGET(generate_doxygen_cpp_doc
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment