Commit 0ce39357 authored by Michal Čihař's avatar Michal Čihař

Add rst renderer for credits

Issue #798
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent c2603381
......@@ -73,3 +73,14 @@ class ReportsTest(ViewTestCase):
credits,
[{'Czech': [['noreply@weblate.org', 'Weblate Test']]}]
)
def test_credits_view_rst(self):
self.add_change()
response = self.client.post(
reverse('credits', kwargs=self.kw_subproject),
{'style': 'rst', 'start_date': '2000-01-01'},
)
self.assertEqual(
response.content,
'* Czech\n\n * Weblate Test <noreply@weblate.org>\n'
)
......@@ -61,3 +61,19 @@ def get_credits(request, project, subproject):
json.dumps(credits),
content_type='application/json'
)
result = []
for language in credits:
name, translators = language.items()[0]
result.append(u'* {0}\n'.format(name))
result.append('\n'.join(
[' * {1} <{0}>'.format(*t) for t in translators]
))
result.append('')
return HttpResponse(
'\n'.join(result),
content_type='text/plain',
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment