示例#1
0
文件: text.py 项目: noraj/MDdot
    def _setImage(self, block):
        # If all is ok, image otken must be alone in paragraph token
        captionxml = """</w:p><w:p><w:pPr><w:pStyle w:val="%s"/></w:pPr>"""

        idImage = 'image_' + str(len(self.images))

        text = "{{ %s.image }}" % (idImage)
        self._addText(text, {})
        if block.title:
            rt = RichText()
            rt.xml = captionxml % (self.styles[self.CAPTION],
                                   escape(block.title))
            self._addText(rt, {})
        elif block.children:
            rt = RichText()
            rt.xml = captionxml % (self.styles[self.CAPTION])
            self._addText(rt, {})
            self._parseChild(block, {'style': self.styles[self.CAPTION]})

        src = os.path.join(self.ressourcePath, block.src)
        self.images[idImage] = {
            'src': src,
            'title': block.title,
            'id': self.id
        }
示例#2
0
文件: text.py 项目: Titanexx/MDdot
 def _addXML(self, xml, options):
     rt = RichText()
     rt.xml = xml
     self._addText(rt, options)