X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/65f4793d71ca86c80a7f4f7974e8d65a3ebe6f25..e2d4fbf230c90dcf3e904351a70d399426478352:/apps/catalogue/management/edumed.py?ds=sidebyside diff --git a/apps/catalogue/management/edumed.py b/apps/catalogue/management/edumed.py index e5d5ee0a..ffad2ec1 100644 --- a/apps/catalogue/management/edumed.py +++ b/apps/catalogue/management/edumed.py @@ -15,14 +15,18 @@ class Tagger: def line(self, position): return self.lines[position] - empty_line = re.compile(r"\s+") + ignore = [ re.compile(r"^[\[][PA][\]] - [^ ]+$") ] + empty_line = re.compile(r"^\s+$") def skip_empty(self, position): while self.line(position) == "" or \ - self.empty_line.match(self.line(position)): + self.empty_line.match(self.line(position)) or \ + filter(lambda r: r.match(self.line(position)), + self.ignore[:]): position += 1 return position + def tag(self, position): """ Return None -- means that we can't tag it in any way @@ -105,7 +109,7 @@ class List(Tagger): class Paragraph(Tagger): remove_this = [ - re.compile(r"[\s]*opis zawartości[\s]*", re.I), + re.compile(r"[\s]*opis zawarto.ci[\s]*", re.I), re.compile(r"^[\s]*$") ] podrozdzial = [