def run(self):
        """Create a type list."""
        config = self.state.document.settings.env.config

        # Group processes by category
        processes = get_processes(config.autoprocess_process_dir, config.autoprocess_source_base_url)
        processes.sort(key=itemgetter('type'))
        processes_by_types = {k: list(g) for k, g in groupby(processes, itemgetter('type'))}

        listnode = nodes.bullet_list()

        for typ in sorted(processes_by_types.keys()):
            par = nodes.paragraph()
            par += nodes.literal(typ, typ)
            par += nodes.Text(' - ')

            processes = sorted(processes_by_types[typ], key=itemgetter('name'))
            last_process = processes[-1]
            for process in processes:
                node = nodes.reference('', process['name'], internal=True)
                node['refuri'] = config.autoprocess_definitions_uri + '#process-' + process['slug']
                node['reftitle'] = process['name']
                par += node
                if process != last_process:
                    par += nodes.Text(', ')

            listnode += nodes.list_item('', par)

        return [listnode]
def run ( self ) : config = self . state . document . settings . env . config processes = get_processes ( config . autoprocess_process_dir , config . autoprocess_source_base_url ) processes . sort ( key = itemgetter ( 'type' ) ) processes_by_types = { k : list ( g ) for k , g in groupby ( processes , itemgetter ( 'type' ) ) } listnode = nodes . bullet_list ( ) for typ in sorted ( processes_by_types . keys ( ) ) : par = nodes . paragraph ( ) par += nodes . literal ( typ , typ ) par += nodes . Text ( ' - ' ) processes = sorted ( processes_by_types [ typ ] , key = itemgetter ( 'name' ) ) last_process = processes [ - 1 ] for process in processes : node = nodes . reference ( '' , process [ 'name' ] , internal = True ) node [ 'refuri' ] = config . autoprocess_definitions_uri + '#process-' + process [ 'slug' ] node [ 'reftitle' ] = process [ 'name' ] par += node if process != last_process : par += nodes . Text ( ', ' ) listnode += nodes . list_item ( '' , par ) return [ listnode ]
Create a type list.