Skip to content

Commit 2eb1fe6

Browse files
authored
👌 IMPROVE: Replace _Entities with AttrDict (#85)
1 parent 5ef2bd7 commit 2eb1fe6

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

markdown_it/common/entities.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
"""HTML5 entities map: { name -> characters }."""
22
import html.entities
33

4+
from markdown_it.utils import AttrDict
45

5-
class _Entities:
6-
def __getattr__(self, name):
7-
try:
8-
return DATA[name]
9-
except KeyError:
10-
raise AttributeError(name)
11-
12-
def __getitem__(self, name):
13-
return DATA[name]
14-
15-
def __contains__(self, name):
16-
return name in DATA
17-
18-
19-
entities = _Entities()
206

217
DATA = {name.rstrip(";"): chars for name, chars in html.entities.html5.items()}
8+
9+
entities = AttrDict(DATA)

0 commit comments

Comments
 (0)