-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathdomain.py
More file actions
48 lines (38 loc) · 1.16 KB
/
domain.py
File metadata and controls
48 lines (38 loc) · 1.16 KB
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
"""A domain to register in sphinx.
This is required for any directive/role names using `:`.
"""
from sphinx.domains import Domain
from .directives import (
PasteAnyDirective,
PasteFigureDirective,
PasteMarkdownDirective,
PasteMathDirective,
)
from .roles import PasteMarkdownRole, PasteRoleAny, PasteTextRole
class NbGlueDomain(Domain):
"""A sphinx domain for defining glue roles and directives.
Note, the only reason we use this,
is that sphinx will not allow for `:` in a directive/role name,
if it is part of a domain.
"""
name = "glue"
label = "NotebookGlue"
# data version, bump this when the format of self.data changes
data_version = 1
roles = {
"": PasteRoleAny(),
"any": PasteRoleAny(),
"text": PasteTextRole(),
"md": PasteMarkdownRole(),
}
directives = {
"": PasteAnyDirective,
"any": PasteAnyDirective,
"figure": PasteFigureDirective,
"math": PasteMathDirective,
"md": PasteMarkdownDirective,
}
def merge_domaindata(self, *args, **kwargs):
pass
def resolve_any_xref(self, *args, **kwargs):
return []