another distcheck fix
[debian/gnuradio] / grc / src / grc_gnuradio / utils / extract_docs.py
index 13fe77a56caef66e2625350b4345a5f3ef720f42..55c7b7834d328dee2dc0c0e7280dbeb57cb2800a 100644 (file)
@@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 ##@package grc_gnuradio.utils.extract_docs
 #Extract documentation from the gnuradio doxygen files.
 
-from grc_gnuradio.Constants import *
+from grc_gnuradio.Constants import DOCS_DIR
 from lxml import etree
 import os
 
@@ -29,15 +29,18 @@ DOXYGEN_DETAILDESC_GR_XPATH = '/doxygen/compounddef/detaileddescription'
 DOXYGEN_BRIEFDESC_BLKS2_XPATH = '/doxygen/compounddef/sectiondef[@kind="public-func"]/memberdef/briefdescription'
 DOXYGEN_DETAILDESC_BLKS2_XPATH = '/doxygen/compounddef/sectiondef[@kind="public-func"]/memberdef/detaileddescription'
 
-def extract_txt(xml):
+def extract_txt(xml, parent_text=None):
        """!
        Recursivly pull the text out of an xml tree.
        @param xml the xml tree
+       @param parent_text the text of the parent element
        @return a string
        """
        text = xml.text or ''
-       if not len(xml): return text
-       return ''.join([text] + map(extract_txt, xml))
+       tail = parent_text and xml.tail or ''
+       return text + ''.join(
+               map(lambda x: extract_txt(x, text), xml)
+       ) + tail
 
 def is_match(key, file):
        """!