Add GitHub and GitLab icons to contacts

This commit is contained in:
Petr Kraus 2018-08-18 16:24:13 +02:00
parent dd9919749a
commit 09902e3490

View File

@ -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()