1
# -*- coding: utf-8 -*-
6
Pygments setuptools plugin interface. The methods defined
7
here also work if setuptools isn't installed but they just
13
yourlexer = yourmodule:YourLexer
18
yourformatter = yourformatter:YourFormatter
19
/.ext = yourformatter:YourFormatter
21
As you can see, you can define extensions for the formatter
27
yourstyle = yourstyle:YourStyle
32
yourfilter = yourfilter:YourFilter
35
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
36
:license: BSD, see LICENSE for details.
43
LEXER_ENTRY_POINT = 'pygments.lexers'
44
FORMATTER_ENTRY_POINT = 'pygments.formatters'
45
STYLE_ENTRY_POINT = 'pygments.styles'
46
FILTER_ENTRY_POINT = 'pygments.filters'
49
def find_plugin_lexers():
50
if pkg_resources is None:
52
for entrypoint in pkg_resources.iter_entry_points(LEXER_ENTRY_POINT):
53
yield entrypoint.load()
56
def find_plugin_formatters():
57
if pkg_resources is None:
59
for entrypoint in pkg_resources.iter_entry_points(FORMATTER_ENTRY_POINT):
60
yield entrypoint.name, entrypoint.load()
63
def find_plugin_styles():
64
if pkg_resources is None:
66
for entrypoint in pkg_resources.iter_entry_points(STYLE_ENTRY_POINT):
67
yield entrypoint.name, entrypoint.load()
70
def find_plugin_filters():
71
if pkg_resources is None:
73
for entrypoint in pkg_resources.iter_entry_points(FILTER_ENTRY_POINT):
74
yield entrypoint.name, entrypoint.load()