diff options
author | Martin Vilcans <martin@librador.com> | 2011-11-15 23:05:09 +0100 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2011-11-15 23:06:05 +0100 |
commit | bce1a38322327256ad2b718269d43371236d0bb7 (patch) | |
tree | 6e1929780c7b4b49fff6469ad60b46e86514ec5c | |
parent | dcf91bd828ba66e3682ed08bee38e85a5a5ae7ba (diff) | |
download | screenplain-bce1a38322327256ad2b718269d43371236d0bb7.tar.gz |
Fixed bold/underline etc. in FDX. (Capitalization mistake.)
-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 ) |