def convertOffice(self, actableFile):
     """Simple conversion script that runs WordDown
     Get WordDown from http://code.google.com/p/jischtml5/
     You need to have an OpenOffice variant installed, and 
     http://code.google.com/p/jischtml5/tools/commandline in your path
    
     """
     
     
     #For now this is calling python as process
     #TODO Need to turn WordDown into a module and fix this
     self.logger.info( "Running  WordDown on " + actableFile.path)
     self.logger.info(WordDownOO.convert(actableFile.path, actableFile.indexHTML,
                        True, self.preferDataURIs, False))
示例#2
0
    def test_indentsClose(self):
        odt = self.getZip(self.testIndentsClose)
        b = WordDownOO.Bookmarker(odt)
        margins = []

        for p in b.contentRoot.iter(b.pTag):

            for bm in p.iter(b.bookmarkTag):
                bmText = bm.get(b.bookmarkNameAttribute)
                if re.search("left-margin:", bmText):
                    margin = re.sub("left-margin:", "", bmText)
                    margin = re.sub("\s+:::.*", "", margin)
                    margins.append(margin)
        expectedMargins = [
            '0', '0', '0', '0', '0', '0', '1.27', '1.27', '1.27', '1.27', '0'
        ]

        self.assertEqual(expectedMargins, margins)
示例#3
0
 def test_readme(self):
     targetSting = ""
     self.assertEqual(WordDownOO.makeReadme("./worddoc.docx","My title!"),targetString)
示例#4
0
 def test_readme(self):
     targetSting = ""
     self.assertEqual(WordDownOO.makeReadme("./worddoc.docx", "My title!"),
                      targetString)
示例#5
0
 def test_styles_names(self):
     odt = self.getZip(self.testPathStyle)
     s = WordDownOO.Styles(odt)
     self.assertEqual(s.getDisplayName("Text_20_body"), "Text body")
     self.assertEqual(s.getDisplayName("P2"), "li1b")