- Timestamp:
- Jun 12, 2011, 2:41:35 AM (12 years ago)
- Location:
- trunk/genshi
- Files:
-
- 2 edited
-
output.py (modified) (4 diffs)
-
tests/output.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/genshi/output.py
r1163 r1164 240 240 stream = filter_(stream) 241 241 for kind, data, pos in stream: 242 if kind is TEXT and isinstance(data, Markup): 243 yield data 244 continue 242 245 cached = _get((kind, data)) 243 246 if cached is not None: … … 346 349 stream = filter_(stream) 347 350 for kind, data, pos in stream: 351 if kind is TEXT and isinstance(data, Markup): 352 yield data 353 continue 348 354 cached = _get((kind, data)) 349 355 if cached is not None: … … 468 474 stream = filter_(stream) 469 475 for kind, data, _ in stream: 476 if kind is TEXT and isinstance(data, Markup): 477 yield data 478 continue 470 479 output = _get((kind, data)) 471 480 if output is not None: … … 659 668 660 669 for kind, data, pos in stream: 670 if kind is TEXT and isinstance(data, Markup): 671 yield kind, data, pos 672 continue 661 673 output = _get((kind, data)) 662 674 if output is not None: -
trunk/genshi/tests/output.py
r1157 r1164 16 16 import sys 17 17 18 from genshi.core import Attrs, Stream, QName18 from genshi.core import Attrs, Markup, QName, Stream 19 19 from genshi.input import HTML, XML 20 20 from genshi.output import DocType, XMLSerializer, XHTMLSerializer, \ … … 362 362 self.assertEqual('<!DOCTYPE html>\n<html></html>', output) 363 363 364 def test_ignorable_space(self): 365 text = '<foo> Mess \n\n\n with me! </foo>' 366 output = XML(text).render(XMLSerializer, encoding=None) 367 self.assertEqual('<foo> Mess\n with me! </foo>', output) 368 369 def test_cache_markup(self): 370 loc = (None, -1, -1) 371 stream = Stream([(Stream.START, (QName('foo'), Attrs()), loc), 372 (Stream.TEXT, u'…', loc), 373 (Stream.END, QName('foo'), loc), 374 (Stream.START, (QName('bar'), Attrs()), loc), 375 (Stream.TEXT, Markup('…'), loc), 376 (Stream.END, QName('bar'), loc)]) 377 output = stream.render(XMLSerializer, encoding=None, 378 strip_whitespace=False) 379 self.assertEqual('<foo>&hellip;</foo><bar>…</bar>', output) 380 364 381 365 382 class HTMLSerializerTestCase(unittest.TestCase):
Note: See TracChangeset
for help on using the changeset viewer.
