X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e977f7187b10b1bc0a30794cd585c6b840568996..049c5959e33d29e4c0044c235d291144d49d3c45:/src/documents/xml_tools.py?ds=inline diff --git a/src/documents/xml_tools.py b/src/documents/xml_tools.py index f2c885d9..ac145db4 100644 --- a/src/documents/xml_tools.py +++ b/src/documents/xml_tools.py @@ -21,7 +21,11 @@ def _trim(text, trim_begin=True, trim_end=True): that eg. one big XML file can be compiled from many small XML files. """ if trim_begin: - text = RE_TRIM_BEGIN.split(text, maxsplit=1)[-1] + parts = RE_TRIM_BEGIN.split(text, maxsplit=1) + text = parts[-1] + if len(parts) > 1: + lines = parts[0].count('\n') + text = f'' + text if trim_end: text = RE_TRIM_END.split(text, maxsplit=1)[0] return text