comparison roundup/cgi/TAL/HTMLParser.py @ 5377:12fe83f90f0d

Python 3 preparation: use repr() instead of ``. Tool-generated patch.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 21:36:02 +0000
parents 63868084b8bb
children d26921b851c3
comparison
equal deleted inserted replaced
5376:64b05e24dbd8 5377:12fe83f90f0d
283 offset = len(self.__starttag_text) \ 283 offset = len(self.__starttag_text) \
284 - self.__starttag_text.rfind("\n") 284 - self.__starttag_text.rfind("\n")
285 else: 285 else:
286 offset = offset + len(self.__starttag_text) 286 offset = offset + len(self.__starttag_text)
287 self.error("junk characters in start tag: %s" 287 self.error("junk characters in start tag: %s"
288 % `rawdata[k:endpos][:20]`) 288 % repr(rawdata[k:endpos][:20]))
289 if end[-2:] == '/>': 289 if end[-2:] == '/>':
290 # XHTML-style empty tag: <span attr="value" /> 290 # XHTML-style empty tag: <span attr="value" />
291 self.handle_startendtag(tag, attrs) 291 self.handle_startendtag(tag, attrs)
292 else: 292 else:
293 self.handle_starttag(tag, attrs) 293 self.handle_starttag(tag, attrs)
335 if not match: 335 if not match:
336 return -1 336 return -1
337 j = match.end() 337 j = match.end()
338 match = endtagfind.match(rawdata, i) # </ + tag + > 338 match = endtagfind.match(rawdata, i) # </ + tag + >
339 if not match: 339 if not match:
340 self.error("bad end tag: %s" % `rawdata[i:j]`) 340 self.error("bad end tag: %s" % repr(rawdata[i:j]))
341 tag = match.group(1).lower() 341 tag = match.group(1).lower()
342 if ( self.cdata_endtag is not None 342 if ( self.cdata_endtag is not None
343 and tag != self.cdata_endtag): 343 and tag != self.cdata_endtag):
344 # Should be a mismatched end tag, but we'll treat it 344 # Should be a mismatched end tag, but we'll treat it
345 # as text anyway, since most HTML authors aren't 345 # as text anyway, since most HTML authors aren't
386 # Overridable -- handle processing instruction 386 # Overridable -- handle processing instruction
387 def handle_pi(self, data): 387 def handle_pi(self, data):
388 pass 388 pass
389 389
390 def unknown_decl(self, data): 390 def unknown_decl(self, data):
391 self.error("unknown declaration: " + `data`) 391 self.error("unknown declaration: " + repr(data))
392 392
393 # Internal -- helper to remove special character quoting 393 # Internal -- helper to remove special character quoting
394 def unescape(self, s): 394 def unescape(self, s):
395 if '&' not in s: 395 if '&' not in s:
396 return s 396 return s

Roundup Issue Tracker: http://roundup-tracker.org/