summaryrefslogtreecommitdiff
path: root/docs/plugintable.py
blob: e982647dccf449245e8ca1a1022e2f597ab749c2 (plain)
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
32
33
"""
Crappy utility for generating Sphinx tables 
for rdflib plugins
"""

import sys

from rdflib.plugin import _plugins

cls = sys.argv[1]

p = {}

for (name, kind), plugin in _plugins.items(): 
    if "/" in name: continue # skip duplicate entries for mimetypes
    if cls == kind.__name__: 
        p[name]="%s.%s"%(plugin.module_path, plugin.class_name)

l1=max(len(x) for x in p)
l2=max(10+len(x) for x in p.values())

def hr():
    print "="*l1,"="*l2

hr()
print "%-*s"%(l1,"Name"), "%-*s"%(l2, "Class")
hr()

for n in sorted(p): 
    print "%-*s"%(l1,n), ":class:`~%s`"%p[n]
hr()
print