Skip to content

Commit

Permalink
fix: extract overlay with relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Oct 24, 2023
1 parent 0d53cc4 commit e7be328
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lectern/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
FragmentLoader = Callable[[Fragment, Mapping[str, Directive]], Optional[Fragment]]


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


class Extractor:
Expand Down Expand Up @@ -332,10 +334,10 @@ def parse_fragments(
and (
match := regex.match(inline := inline.children[0].content)
or (
RELATIVE_PATH_REGEX.match(inline)
(directory := RELATIVE_PATH_REGEX.match(inline))
and (
directive := "@resource_pack"
if inline.startswith("assets")
if directory[0] == "assets"
else "@data_pack"
)
and regex.match(f"{directive} {inline}")
Expand Down

0 comments on commit e7be328

Please sign in to comment.