"""Icons: 16x16 line icons in the ADS style, used through one inline sprite per page.""" import re ICONS = { 'page': '', 'doc': '', 'whiteboard': '', 'folder': '', 'task': '', 'epic': '', 'project': '', 'goal': '', 'video': '', 'pull-request': '', 'repo': '', 'comment': '', 'hashtag': '', 'calendar': '', 'person': '', 'teams': '', 'people-group': '', 'globe': '', 'search': '', 'book': '', 'decision': '', 'location': '', 'check': '', 'copy': '', 'sparkle': '', 'changes': '', 'info': '', 'flag': '', 'clock': '', 'note': '', 'list-numbered': '', 'tree': '', 'link': '', 'priority-blocker': '', 'arrow-right': '', 'angle-brackets': '', 'warning': '', 'settings': '', 'list-checklist': '', 'lightbulb': '', } def icon(name, cls=''): """An icon from the set, drawn from the page's sprite. An unknown name draws `globe`. icon('flag', 'ic-subtle') """ name = name if name in ICONS else 'globe' return f'' def sprite(body): """The inline icon sprite, holding only the icons the body uses. page() adds it. sprite('') """ used = set(re.findall(r'href="#i-([\w-]+)"', body)) return ''