diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index be017b3f4f..65a97dba4d 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -220,7 +220,7 @@ def remove_indents(txt): ''' Remove whitespace at the beginning of each line. ''' - return '\n'.join(l.lstrip() for l in txt.splitlines()) + return re.sub(r'^\s+', '', txt, flags=re.MULTILINE) def opf_writer(path, opf_name, manifest, spine, mi):