def assert_html2textile(self, textile_string, html_string, strip_lines=False, debug=False, parser_kwargs={}, emitter_kwargs={}): """ Check html2textile """ self.assertNotEqual(textile_string, html_string) textile_string = self._prepare_text(textile_string) html_string = self._prepare_text(html_string) if strip_lines: html_string = strip_html_lines(html_string, strip_lines) # compare html -> textile textile_string2 = html2textile(html_string, debug, parser_kwargs, emitter_kwargs) if debug: print("-" * 79) print(textile_string2) print("-" * 79) self.assertEqual(textile_string2, textile_string, msg="html2textile") return textile_string, html_string
def assert_html2textile(self, textile_string, html_string, \ strip_lines=False, debug=False, parser_kwargs={}, emitter_kwargs={}): """ Check html2textile """ self.assertNotEqual(textile_string, html_string) textile_string = self._prepare_text(textile_string) html_string = self._prepare_text(html_string) if strip_lines: html_string = strip_html_lines(html_string, strip_lines) # compare html -> textile textile_string2 = html2textile(html_string, debug, parser_kwargs, emitter_kwargs) if debug: print("-" * 79) print(textile_string2) print("-" * 79) self.assertEqual(textile_string2, textile_string, msg="html2textile") return textile_string, html_string
def assert_html2textile(self, textile_string, html_string, \ strip_lines=False, debug=False, parser_kwargs={}, emitter_kwargs={}): self.assertNotEqual(textile_string, html_string) textile_string = self._prepare_text(textile_string) html_string = self._prepare_text(html_string) if strip_lines: html_string = strip_html_lines(html_string, strip_lines) # compare html -> textile textile_string2 = html2textile(html_string, debug, parser_kwargs, emitter_kwargs) if debug: print "-" * 79 print textile_string2 print "-" * 79 try: self.assertEqual(textile_string2, textile_string) except: print " *** Error in html2textile:" raise return textile_string, html_string
=== a table: |=headline 1 |= headline 2 | | 1.1. cell | 1.2. cell | | 2.1. cell | 2.2. cell | ---- More info on our [[http://code.google.com/p/python-creole/|Homepage]].""" if __name__ == "__main__": print("_" * 79 + "\n*** Convert creole into html: ***\n\n") html = creole2html(source_creole) print(html) print("\n\n" + "_" * 79 + "\n*** Convert html back into creole: ***\n\n") creole = html2creole(html) print(creole) print("\n\n" + "_" * 79 + "\n*** Convert html into ReStructuredText: ***\n\n") rest = html2rest(html) print(rest) print("\n\n" + "_" * 79 + "\n*** Convert html into textile: ***\n\n") textile = html2textile(html) print(textile)