Commit 025149e34e8487ae2951bd19358f903a607ca331
Always use only the first line in the post title
Including when the title is not a heading.Greg K Nicholson committed on 10/15/2017, 3:47:36 PM
Parent: a1d3ac16dfab4dabf37b36f6c2ffbae74f80753b
Files changed
scuttleblog.py | changed |
scuttleblog.py | |||
---|---|---|---|
@@ -49,11 +49,11 @@ | |||
49 | 49 … | return user_posts | |
50 | 50 … | ||
51 | 51 … | def define_post_text(text): | |
52 | 52 … | text = text.strip() | |
53 … | + title = text.splitlines()[0] | ||
53 | 54 … | if re.match('#', text): | |
54 | 55 … | # The first line is a heading. Use it as the title and strip it from the body. | |
55 | - title = text.splitlines()[0] | ||
56 | 56 … | body = ''.join(text.splitlines(keepends=True)[1:]).strip() \ | |
57 | 57 … | if len(text.splitlines()) > 1 \ | |
58 | 58 … | else '' | |
59 | 59 … | else: |
Built with git-ssb-web