mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
minor: Clean up lstrip() for help article titles.
Saying `foo.lstrip('# ')` does more than just remove
a '# ' prefix. It removes any combination of '#' and
spaces.
We now make the intention slightly more clear.
We would strip these as you'd expect:
# foo
## foo
### foo
but for this we now only strip the first "#":
# # # # # foo
This commit is contained in:
@@ -107,7 +107,7 @@ class MarkdownDirectoryView(ApiURLView):
|
|||||||
with open(article_path) as article_file:
|
with open(article_path) as article_file:
|
||||||
first_line = article_file.readlines()[0]
|
first_line = article_file.readlines()[0]
|
||||||
# Strip the header and then use the first line to get the article title
|
# Strip the header and then use the first line to get the article title
|
||||||
article_title = first_line.strip().lstrip("# ")
|
article_title = first_line.lstrip("#").strip()
|
||||||
if context["not_index_page"]:
|
if context["not_index_page"]:
|
||||||
context["OPEN_GRAPH_TITLE"] = "%s (%s)" % (article_title, title_base)
|
context["OPEN_GRAPH_TITLE"] = "%s (%s)" % (article_title, title_base)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user