We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee4f800 commit 42a8750Copy full SHA for 42a8750
align.py
@@ -0,0 +1,10 @@
1
+import re
2
+
3
+def align(str, pad=0):
4
+ props = re.findall(r'^\s*[\S]+:', str, re.MULTILINE)
5
+ longest = max([len(i) for i in props]) + pad
6
+ return ''.join([i+'\n' for i in map(lambda str:
7
+ re.sub(r'^(\s*.+?[^:#]: )\s*(.*)', lambda m:
8
+ m.group(1) + ''.ljust(longest - len(m.group(1)) + 1) + m.group(2),
9
+ str, re.MULTILINE)
10
+ , str.split('\n'))])
0 commit comments