From 09902e34906a434f0cbe01abd79e4c86a865b9b0 Mon Sep 17 00:00:00 2001 From: Petr Kraus Date: Sat, 18 Aug 2018 16:24:13 +0200 Subject: [PATCH] Add GitHub and GitLab icons to contacts --- xml/extensionmetadocgenerator.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xml/extensionmetadocgenerator.py b/xml/extensionmetadocgenerator.py index ffdb5536..435e1829 100644 --- a/xml/extensionmetadocgenerator.py +++ b/xml/extensionmetadocgenerator.py @@ -247,8 +247,18 @@ class Extension: write('*Contact*::', file=fp) contacts = self.contact.split(',') - for c in contacts: - write(' * ' + c, file=fp) + for contact in contacts: + contactWords = contact.strip().split() + name = ' '.join(contactWords[:-1]) + handle = contactWords[-1] + if handle.startswith('gitlab:'): + prettyHandle = 'icon:gitlab[alt=GitLab, role="red"]' + handle.replace('gitlab:@', '') + elif handle.startswith('@'): + prettyHandle = 'icon:github[alt=GitHub]' + handle[1:] + else: + prettyHandle = handle + + write(' * ' + name + ' ' + prettyHandle, file=fp) fp.close()