Skip to content

Commit 3669756

Browse files
committed
Switch to docutils make_id()
1 parent 8568d8c commit 3669756

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

snooty/types.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import hashlib
33
import logging
44
import re
5+
from docutils.nodes import make_id
56
from collections import defaultdict
67
from dataclasses import dataclass, field
78
from pathlib import Path, PurePath, PurePosixPath
@@ -57,11 +58,6 @@ def normalize_target(target: str) -> str:
5758
return re.sub(r"\s+", " ", target).lower()
5859

5960

60-
def get_html_id(target: str) -> str:
61-
"""Return an HTML ID from a target name."""
62-
return target.replace(" ", "_")
63-
64-
6561
class SnootyError(Exception):
6662
pass
6763

@@ -233,7 +229,7 @@ def generate_inventory(self, base_url: str) -> intersphinx.Inventory:
233229
base_uri = uri
234230
if (domain, role_name) != ("std", "doc"):
235231
base_uri += "#$"
236-
uri = uri + "#" + get_html_id(name)
232+
uri = uri + "#" + make_id(name)
237233

238234
targets[key] = intersphinx.TargetDefinition(
239235
definition.canonical_name,

0 commit comments

Comments
 (0)