+def mark_czytelnia(content):
+ db = -1
+ de = -1
+ i = 0
+ czy_czytelnia = re.compile(r"[\s]*czytelnia[\s]*", re.I)
+ czytelnia = content[0].spawn(List)
+ czytelnia.type = 'czytelnia'
+ while i < len(content):
+ e = content[i]
+ if isinstance(e, Section):
+ if czy_czytelnia.match(e.title):
+ db = i + 1
+ elif db >= 1:
+ de = i
+ content[db:de] = [czytelnia]
+ break
+ elif db >= 0:
+ if isinstance(e, Paragraph):
+ if e.line:
+ czytelnia.append(e.line)
+ i += 1
+
+ return content
+
+
+
+def move_evaluation(content):
+ evaluation = []
+
+ content = remove_block(content, r"ewaluacja[+ PA\[\].]*", evaluation)
+ if evaluation:
+ # print "found evaluation %s" % (evaluation,)
+ evaluation[0].is_podrozdzial = True
+ # evaluation place
+ opcje_dodatkowe = find_block(content, r"opcje dodatkowe\s*")
+ if opcje_dodatkowe:
+ # print "putting evaluation just before opcje dodatkowe @ %s" % (opcje_dodatkowe, )
+ content[opcje_dodatkowe[0]:opcje_dodatkowe[0]] = evaluation
+ else:
+ materialy = find_block(content, r"materia.y[+ AP\[\].]*")
+ if materialy:
+ # print "putting evaluation just before materialy @ %s" % (materialy, )
+ content[materialy[0]:materialy[0]] = evaluation
+ else:
+ print "er.. no idea where to place evaluation"
+ return content
+
+
+def toxml(content, pretty_print=False):
+ # some transformations