File: contributors.py

package info (click to toggle)
quodlibet 4.6.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,016 kB
  • sloc: python: 85,817; sh: 385; xml: 110; makefile: 91
file content (31 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from docutils.parsers.rst import Directive
from docutils.nodes import paragraph


class ContributorsDirective(Directive):

    required_arguments = 1
    has_content = True

    def run(self):
        role = self.arguments[0]

        roles = ['authors', 'translators', 'artists']
        if role not in roles:
            raise Exception('Argument must be in {}'.format(roles))

        const = self.state.document.settings.env.config.const
        if role == 'authors':
            people = const.AUTHORS
        elif role == 'translators':
            people = const.TRANSLATORS
        else:
            people = const.ARTISTS

        output = ', '.join(people)
        return [paragraph(text=output)]


def setup(app):
    app.add_directive('contributors', ContributorsDirective)
    return {"parallel_read_safe": True, "parallel_write_safe": True}