comparison piecrust/page.py @ 727:71309814e88f

bug: Also look for format changes when determining if a page needs parsing.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 30 May 2016 20:44:36 -0700
parents dab26ab3d533
children e7481bbbb29f
comparison
equal deleted inserted replaced
703:dab26ab3d533 727:71309814e88f
305 305
306 def _string_needs_parsing(txt, offset): 306 def _string_needs_parsing(txt, offset):
307 txtlen = len(txt) 307 txtlen = len(txt)
308 index = txt.find('-', offset) 308 index = txt.find('-', offset)
309 while index >= 0 and index < txtlen - 8: 309 while index >= 0 and index < txtlen - 8:
310 # Look for a potential `<--format-->`
311 if index > 0 and txt[index - 1] == '<' and txt[index + 1] == '-':
312 return True
313 # Look for a potential `---segment---`
310 if txt[index + 1] == '-' and txt[index + 2] == '-': 314 if txt[index + 1] == '-' and txt[index + 2] == '-':
311 return True 315 return True
312 index = txt.find('-', index + 1) 316 index = txt.find('-', index + 1)
313 return False 317 return False
314 318