mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
TXT Input: Speed up removal of leading whitespace. Fixes #1965443 ["Remove indents at beginning of lines" sometimes greatly slow down conversion](https://bugs.launchpad.net/calibre/+bug/1965443)
This commit is contained in:
parent
3627a442be
commit
4225ab51a5
@ -220,7 +220,7 @@ def remove_indents(txt):
|
|||||||
'''
|
'''
|
||||||
Remove whitespace at the beginning of each line.
|
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):
|
def opf_writer(path, opf_name, manifest, spine, mi):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user