2019-02-03 14:10:17 +01:00
|
|
|
import html
|
|
|
|
|
|
|
|
from generator.formatters import BaseFormatter
|
|
|
|
|
|
|
|
|
|
|
|
class MarkdownFormatter(BaseFormatter):
|
|
|
|
|
|
|
|
def __str__(self) -> str:
|
|
|
|
text = ""
|
2019-02-03 16:33:44 +01:00
|
|
|
for repo in self.repos:
|
|
|
|
if repo.issues:
|
2019-02-03 18:26:13 +01:00
|
|
|
if len(self.repos) > 1:
|
|
|
|
text += "### [{}]({})\n".format(repo.path, repo.absolute_url)
|
2019-02-03 16:33:44 +01:00
|
|
|
for issue in repo.issues:
|
|
|
|
text += " - [#{id}]({url}) {title}".format(
|
|
|
|
url=issue.url,
|
|
|
|
id=issue.number,
|
|
|
|
title=html.escape(issue.title)
|
2019-02-03 14:10:17 +01:00
|
|
|
)
|
2019-02-03 16:33:44 +01:00
|
|
|
if issue.authors:
|
|
|
|
text += " [by {}]".format(
|
|
|
|
", ".join(
|
|
|
|
"[@{name}]({url})".format(
|
|
|
|
url=author.profile_url,
|
|
|
|
name=html.escape(author.username)
|
|
|
|
) for author in issue.authors
|
|
|
|
)
|
|
|
|
)
|
|
|
|
text += "\n"
|
2019-02-03 14:10:17 +01:00
|
|
|
return text
|