comparison genshi/output.py @ 854:0d9e87c6cf6e

More work on reducing the size of the diff produced by 2to3.
author cmlenz
date Tue, 10 Nov 2009 22:53:21 +0000
parents 4376010bb97e
children 72d56a8441e8
comparison
equal deleted inserted replaced
853:4376010bb97e 854:0d9e87c6cf6e
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (C) 2006-2008 Edgewall Software 3 # Copyright (C) 2006-2009 Edgewall Software
4 # All rights reserved. 4 # All rights reserved.
5 # 5 #
6 # This software is licensed as described in the file COPYING, which 6 # This software is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution. The terms 7 # you should have received as part of this distribution. The terms
8 # are also available at http://genshi.edgewall.org/wiki/License. 8 # are also available at http://genshi.edgewall.org/wiki/License.
263 elif sysid: 263 elif sysid:
264 buf.append(' SYSTEM') 264 buf.append(' SYSTEM')
265 if sysid: 265 if sysid:
266 buf.append(' "%s"') 266 buf.append(' "%s"')
267 buf.append('>\n') 267 buf.append('>\n')
268 yield Markup(''.join(buf)) % filter(None, data) 268 yield Markup(''.join(buf)) % tuple([p for p in data if p])
269 have_doctype = True 269 have_doctype = True
270 270
271 elif kind is START_CDATA: 271 elif kind is START_CDATA:
272 yield Markup('<![CDATA[') 272 yield Markup('<![CDATA[')
273 in_cdata = True 273 in_cdata = True
379 elif sysid: 379 elif sysid:
380 buf.append(' SYSTEM') 380 buf.append(' SYSTEM')
381 if sysid: 381 if sysid:
382 buf.append(' "%s"') 382 buf.append(' "%s"')
383 buf.append('>\n') 383 buf.append('>\n')
384 yield Markup(''.join(buf)) % filter(None, data) 384 yield Markup(''.join(buf)) % tuple([p for p in data if p])
385 have_doctype = True 385 have_doctype = True
386 386
387 elif kind is XML_DECL and not have_decl and not drop_xml_decl: 387 elif kind is XML_DECL and not have_decl and not drop_xml_decl:
388 version, encoding, standalone = data 388 version, encoding, standalone = data
389 buf = ['<?xml version="%s"' % version] 389 buf = ['<?xml version="%s"' % version]
516 elif sysid: 516 elif sysid:
517 buf.append(' SYSTEM') 517 buf.append(' SYSTEM')
518 if sysid: 518 if sysid:
519 buf.append(' "%s"') 519 buf.append(' "%s"')
520 buf.append('>\n') 520 buf.append('>\n')
521 yield Markup(''.join(buf)) % filter(None, data) 521 yield Markup(''.join(buf)) % tuple([p for p in data if p])
522 have_doctype = True 522 have_doctype = True
523 523
524 elif kind is PI: 524 elif kind is PI:
525 yield _emit(kind, data, Markup('<?%s %s?>' % data)) 525 yield _emit(kind, data, Markup('<?%s %s?>' % data))
526 526
Copyright (C) 2012-2017 Edgewall Software