-
Notifications
You must be signed in to change notification settings - Fork 4
/
pyproject.toml
76 lines (59 loc) · 2.17 KB
/
pyproject.toml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "pygments-plugin-scaffolding" # change this to a package name for your plugin
version = "0.0.1"
dependencies = ["pygments"]
readme = "README.md"
# Declare plugin lexers in this table. The key (like `example_lexer` below) are
# not significant. The value has the form `module_name:ClassName`. The lexer
# class will be imported using `from module_name import ClassName`.
# See the attributes declared in example_lexer.py for how to configure the
# language names and file patterns.
[project.entry-points."pygments.lexers"]
example_lexer = "example_lexer:ExampleLexer"
# Declare plugin formatters in this table. The key is not significant and the
# value has the same format as for lexers. See example_formatter.py for
# configuration options.
[project.entry-points."pygments.formatters"]
example_formatter = "example_formatter:ExampleFormatter"
# Declare plugin styles in this table. The key *is* significant: it is the name
# the style will be recognized as. In this example, we can use
#
# pygmentize -Ostyle=example-style"
#
# on the command line. Also,
#
# pygments.styles.get_style_by_name("example-style")
#
# will return the style class.
[project.entry-points."pygments.styles"]
example-style = "example_style:ExampleStyle"
# Declare plugin filters in this table. The key *is* significant: it is the name
# the filter will be recognized as. In this example, we can use
#
# pygmentize -F example-filter
#
# on the command line. Also,
#
# pygments.filters.find_filter_class("example-filter")
#
# will return the filter class.
[project.entry-points."pygments.filters"]
example-filter = "example_filter:ExampleFilter"
# This is a test command. Running it should print:
#
# [ff0000]foo
# [black]<tab><tab>bar # tabs here
#
# - Our custom lexer highlights "foo" as keyword,
# - Our custom style uses red (ff0000) for keywords,
# - Our custom formatter prints colors in brackets,
# - Our custom filter replaces tabs with "<tab>".
#
# Run with
#
# hatch run test
[tool.hatch.envs.default.scripts]
test = "pygmentize -l example-lang -f example-format -F example-filter -O style=example-style test.exmpl"