diff options
-rw-r--r-- | screenplain/export/fdx.py | 4 | ||||
-rw-r--r-- | tests/fdx_test.py | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/screenplain/export/fdx.py b/screenplain/export/fdx.py index 3644714..b2d2d87 100644 --- a/screenplain/export/fdx.py +++ b/screenplain/export/fdx.py @@ -17,13 +17,13 @@ def _write_text_element(out, styles, text): if style_value == '': out.write(' <Text>%s</Text>\n' % (escape(text))) else: - out.write(' <Text style="%s">%s</Text>\n' % + out.write(' <Text Style="%s">%s</Text>\n' % (style_value, escape(text)) ) def write_text(out, rich, trailing_linebreak): - """Writes <Text style="..."> elements.""" + """Writes <Text Style="..."> elements.""" for seg_no, segment in enumerate(rich.segments): fdx_styles = set(style_names[n] for n in segment.styles) if trailing_linebreak and seg_no == len(rich.segments) - 1: diff --git a/tests/fdx_test.py b/tests/fdx_test.py index d97782f..1e2c743 100644 --- a/tests/fdx_test.py +++ b/tests/fdx_test.py @@ -21,7 +21,7 @@ class OutputTests(unittest2.TestCase): write_text(self.out, bold('hello'), False) self.assertEqual( self.out.getvalue(), - ' <Text style="Bold">hello</Text>\n' + ' <Text Style="Bold">hello</Text>\n' ) def test_sequential_styles(self): @@ -30,8 +30,8 @@ class OutputTests(unittest2.TestCase): self.assertEqual( self.out.getvalue(), ' <Text>plain</Text>\n' - ' <Text style="Bold">b</Text>\n' - ' <Text style="Italic">i</Text>\n' + ' <Text Style="Bold">b</Text>\n' + ' <Text Style="Italic">i</Text>\n' ) def test_several_styles(self): @@ -39,9 +39,9 @@ class OutputTests(unittest2.TestCase): write_text(self.out, rich, False) self.assertEqual( self.out.getvalue(), - ' <Text style="Bold">outer</Text>\n' - ' <Text style="Bold+Italic">inner</Text>\n' - ' <Text style="Bold">outer</Text>\n' + ' <Text Style="Bold">outer</Text>\n' + ' <Text Style="Bold+Italic">inner</Text>\n' + ' <Text Style="Bold">outer</Text>\n' ) def test_write_text_adds_line_break_if_requested(self): @@ -49,7 +49,7 @@ class OutputTests(unittest2.TestCase): write_text(self.out, rich, True) self.assertEqual( self.out.getvalue(), - ' <Text style="Bold">outer</Text>\n' - ' <Text style="Bold+Italic">inner</Text>\n' - ' <Text style="Bold">outer\n</Text>\n' # note newline + ' <Text Style="Bold">outer</Text>\n' + ' <Text Style="Bold+Italic">inner</Text>\n' + ' <Text Style="Bold">outer\n</Text>\n' # note newline ) |