Exemplo n.º 1
0
class WordPressLatexPost(WordPressPost):
    """Encapsulate a LaTeX Post to Wordpress
    """
    
    def __init__(self, latex):
        """
        
        Arguments:
        - `latex`:
        """
        WordPressPost.__init__(self)

        self._tex = TeX()
        self._renderer = WPRenderer()

        self._tex.input(latex)
        self._document = self._tex.parse()

        # Before rendering, let's pass through and extract the images
        self.images = findImageNodes(self._document)
        
    def render(self):
        """Render this post
        """
        # Have to encode the unicode string to print it correctly.
        self.description = self._renderer.render(self._document).encode('utf-8')
        self.title = self._document.userdata['title'].textContent.encode('utf-8')
        self.tags = self._document.userdata['tags'].textContent.encode('utf-8')
Exemplo n.º 2
0
    def __init__(self, latex):
        """
        
        Arguments:
        - `latex`:
        """
        WordPressPost.__init__(self)

        self._tex = TeX()
        self._renderer = WPRenderer()

        self._tex.input(latex)
        self._document = self._tex.parse()

        # Before rendering, let's pass through and extract the images
        self.images = findImageNodes(self._document)