Example #1
0
 def test_removeLeadingTrailingBlankLines(self):
     """
     L{tree._removeLeadingTrailingBlankLines} removes leading and trailing
     blank lines from a string and returns a string with all lines joined.
     """
     result = tree._removeLeadingTrailingBlankLines(self.inputString)
     self.assertEqual(result, 'foo\nbar\n')
Example #2
0
 def test_removeLeadingTrailingBlankLines(self):
     """
     L{tree._removeLeadingTrailingBlankLines} removes leading and trailing
     blank lines from a string and returns a string with all lines joined.
     """
     result = tree._removeLeadingTrailingBlankLines(self.inputString)
     self.assertEqual(result, 'foo\nbar\n')
Example #3
0
    def visitNode_pre(self, node):
        """
        Writes Latex block using the 'typewriter' font when it encounters a
        I{pre} element.

        @param node: The element to process.
        @type node: L{xml.dom.minidom.Element}
        """
        # TODO: Syntax highlighting
        buf = StringIO()
        getLatexText(node, buf.write, entities=entities)
        data = buf.getvalue()
        data = _removeLeadingTrailingBlankLines(data)
        lines = data.split('\n')
        self.fontStack.append(('typewriter', 4))
        self.writer('%' + self.fontName() + '\n')
        for line in lines:
            self.writer(' ' + line + '\n')
        del self.fontStack[-1]
        self.writer('%' + self.fontName() + '\n')
Example #4
0
File: slides.py Project: 0004c/VTK
    def visitNode_pre(self, node):
        """
        Writes Latex block using the 'typewriter' font when it encounters a
        I{pre} element.

        @param node: The element to process.
        @type node: L{xml.dom.minidom.Element}
        """
        # TODO: Syntax highlighting
        buf = StringIO()
        getLatexText(node, buf.write, entities=entities)
        data = buf.getvalue()
        data = _removeLeadingTrailingBlankLines(data)
        lines = data.split('\n')
        self.fontStack.append(('typewriter', 4))
        self.writer('%' + self.fontName() + '\n')
        for line in lines:
            self.writer(' ' + line + '\n')
        del self.fontStack[-1]
        self.writer('%' + self.fontName() + '\n')