Commit 91072869fd8d2662c89bd6f090600bfe0ee8f85f
Post titles: strip any initial '#' before limiting length
Greg K Nicholson committed on 10/15/2017, 11:58:04 PMParent: 0cc15bcd9a37b318d9087f8f0a7e09fee879a308
Files changed
scuttleblog.py | changed |
scuttleblog.py | |||
---|---|---|---|
@@ -63,8 +63,9 @@ | |||
63 | 63 … | ||
64 | 64 … | def define_post_text(text): | |
65 | 65 … | text = text.strip() | |
66 | 66 … | title = text.splitlines()[0] | |
67 … | + title = re.sub('^#+\s+', '', title) | ||
67 | 68 … | maxlength = 140 | |
68 | 69 … | ellipsis = '...' | |
69 | 70 … | if len(title) > maxlength: | |
70 | 71 … | title = title[:maxlength].rsplit(' ', 1)[0] + ellipsis | |
@@ -73,9 +74,8 @@ | |||
73 | 74 … | if len(text.splitlines()) > 1: | |
74 | 75 … | body = ''.join(text.splitlines(keepends=True)[1:]).strip() | |
75 | 76 … | else: | |
76 | 77 … | body = '' | |
77 | - title = re.sub('^#+\s+', '', title) | ||
78 | 78 … | return {'title': title, 'body': body} | |
79 | 79 … | ||
80 | 80 … | def build_post_structure(p): | |
81 | 81 … | post = {} |
Built with git-ssb-web