Skip to content

Commit e7be328

Browse files
committed
fix: extract overlay with relative path
1 parent 0d53cc4 commit e7be328

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lectern/extract.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
FragmentLoader = Callable[[Fragment, Mapping[str, Directive]], Optional[Fragment]]
4040

4141

42-
RELATIVE_PATH_REGEX = re.compile(r"^(?:assets|data)(?:/[a-zA-Z0-9_.]+)+$")
42+
RELATIVE_PATH_REGEX = re.compile(
43+
r"^(?:[a-zA-Z0-9_.]+/)?(assets|data)(?:/[a-zA-Z0-9_.]+)+$"
44+
)
4345

4446

4547
class Extractor:
@@ -332,10 +334,10 @@ def parse_fragments(
332334
and (
333335
match := regex.match(inline := inline.children[0].content)
334336
or (
335-
RELATIVE_PATH_REGEX.match(inline)
337+
(directory := RELATIVE_PATH_REGEX.match(inline))
336338
and (
337339
directive := "@resource_pack"
338-
if inline.startswith("assets")
340+
if directory[0] == "assets"
339341
else "@data_pack"
340342
)
341343
and regex.match(f"{directive} {inline}")

0 commit comments

Comments
 (0)