diff --git a/pyth/plugins/plaintext/writer.py b/pyth/plugins/plaintext/writer.py index 9dd8bfd..e766981 100644 --- a/pyth/plugins/plaintext/writer.py +++ b/pyth/plugins/plaintext/writer.py @@ -46,6 +46,8 @@ def go(self): def paragraph(self, paragraph, prefix=""): content = [] for text in paragraph.content: + if text.__class__ is document.Image: + continue content.append(u"".join(text.content)) content = u"".join(content).encode("utf-8") diff --git a/pyth/plugins/rtf15/reader.py b/pyth/plugins/rtf15/reader.py index 7a74162..72b41d7 100644 --- a/pyth/plugins/rtf15/reader.py +++ b/pyth/plugins/rtf15/reader.py @@ -170,9 +170,19 @@ def getControl(self): first = False if next == "'": - # ANSI escape, takes two hex digits - chars.extend("ansi_escape") - digits.extend(self.source.read(2)) + possible_digits = self.source.read(2) + try: + # Test for ANSI escape + true_digits = [ + int(possible_digits[0], 16), + int(possible_digits[1], 16) + ] + # ANSI escape, takes two hex digits + chars.extend("ansi_escape") + digits.extend(true_digits) + except ValueError: + # It's just an escaped quote mark, so reset the file header + self.source.seek(-2, 1) break if next == ' ':