pylatexenc/latex2text.py
def nodelist_to_text(self, nodelist):
        """
        Extracts text from a node list. `nodelist` is a list of nodes as returned by
        :py:meth:`pylatexenc.latexwalker.LatexWalker.get_latex_nodes()`.

        In addition to converting each node in the list to text using
        `node_to_text()`, we apply some global replacements and fine-tuning to
        the resulting text to account for `text_replacements` (e.g., to fix
        quotes, tab alignment ``&`` chars, etc.)
        """

        s = self._nodelistcontents_to_text(nodelist)

        # now, perform suitable replacements
        for pattern, replacement in self.text_replacements:
            if (hasattr(pattern, 'sub')):
                s = pattern.sub(replacement, s)
            else:
                s = s.replace(pattern, replacement)

        if not self.keep_inline_math:
            s = s.replace('$', ''); # removing math mode inline signs, just keep their Unicode counterparts..

        return s
def nodelist_to_text(self, nodelist):
        """
        Extracts text from a node list. `nodelist` is a list of nodes as returned by
        :py:meth:`pylatexenc.latexwalker.LatexWalker.get_latex_nodes()`.

        In addition to converting each node in the list to text using
        `node_to_text()`, we apply some global replacements and fine-tuning to
        the resulting text to account for `text_replacements` (e.g., to fix
        quotes, tab alignment ``&`` chars, etc.)
        """

        s = self._nodelistcontents_to_text(nodelist)

        # now, perform suitable replacements
        for pattern, replacement in self.text_replacements:
            if (hasattr(pattern, 'sub')):
                s = pattern.sub(replacement, s)
            else:
                s = s.replace(pattern, replacement)

        if not self.keep_inline_math:
            s = s.replace('$', ''); # removing math mode inline signs, just keep their Unicode counterparts..

        return s
Extracts text from a node list. `nodelist` is a list of nodes as returned by
        :py:meth:`pylatexenc.latexwalker.LatexWalker.get_latex_nodes()`.

        In addition to converting each node in the list to text using
        `node_to_text()`, we apply some global replacements and fine-tuning to
        the resulting text to account for `text_replacements` (e.g., to fix
        quotes, tab alignment ``&`` chars, etc.)