1 # -*- coding: utf-8 -*-
2 # This file is part of django-ssify, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
5 from __future__ import unicode_literals
10 splitter = re.compile(br'(?<=-->)\s*(?=<!--#)')
12 def split_ssi(ssi_text):
13 """re.split won't split on empty sequence, so we need that."""
14 ssi_text = ssi_text.strip()
16 for match in re.finditer(splitter, ssi_text):
17 yield ssi_text[start:match.start()]
19 yield ssi_text[start:]