From 2e141a617573a99228ea6d949093864734bf8d75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 10:03:43 +0530 Subject: [PATCH] TXT Input: Fix option to remove indents at the start of lines breaking conversion of markdown documents. Fixes #1814989 ["Remove indents at the beginning of lines" setting removes paragraph breaks in conversion](https://bugs.launchpad.net/calibre/+bug/1814989) --- src/calibre/ebooks/txt/processor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 0845e6c944..22ace69037 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -200,8 +200,7 @@ def remove_indents(txt): ''' Remove whitespace at the beginning of each line. ''' - txt = re.sub('(?miu)^\s+', '', txt) - return txt + return '\n'.join([l.lstrip() for l in txt.splitlines()]) def opf_writer(path, opf_name, manifest, spine, mi):