Skip to content

Commit b9294da

Browse files
kmillKha
authored andcommitted
bold first line of commits with PR tag, too
1 parent 5d535ea commit b9294da

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

zulip/integrations/rss/rss-bot

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,22 @@ def send_zulip(entry: Any, feed_name: str) -> Dict[str, Any]:
175175
m = re.match(r"Recent Commits to (\w+):", feed_name)
176176
if m:
177177
repo = m.group(1) # type: str
178-
body = re.sub(r"^(.*?) \((#\d+)\)", lambda m:
179-
"**[{}]({})** ({}{})".format(m.group(1), entry.link, repo, m.group(2)),
180-
body, 1)
178+
lines = body.splitlines()
179+
if lines:
180+
m = re.match(r"^(.*?) \((#\d+)\)(.*)$", lines[0])
181+
if m:
182+
body = "**[{}]({})** ({}{}){}\n".format(
183+
m.group(1),
184+
entry.link,
185+
repo,
186+
m.group(2),
187+
m.group(3)
188+
) + "\n".join(lines[1:])
189+
elif lines:
190+
body = "**[{}]({})**\n".format(
191+
lines[0],
192+
entry.link
193+
) + "\n".join(lines[1:])
181194

182195
author_detail = entry.author # type: str
183196
if 'author_detail' in entry and 'href' in entry.author_detail:

0 commit comments

Comments
 (0)