Thanks and credit to mattn and ferreus on GitHub.
Also check out Developing on WSL and/or wslpath
(Windows 10 Build 17046 or later) if you're using the Windows Subsystem for Linux.
Thanks and credit to mattn and ferreus on GitHub.
Also check out Developing on WSL and/or wslpath
(Windows 10 Build 17046 or later) if you're using the Windows Subsystem for Linux.
import re | |
def strip_margin(text): | |
return re.sub('\n[ \t]*\|', '\n', text) | |
def strip_heredoc(text): | |
indent = len(min(re.findall('\n[ \t]*(?=\S)', text) or [''])) | |
pattern = r'\n[ \t]{%d}' % (indent - 1) | |
return re.sub(pattern, '\n', text) |