Skip to content

Commit db84f84

Browse files
committed
[FIX] match all occurrences of static/attach
If a markup element contains more than one {static} or {attach} value, only the last one was replaced. Simplify the regex to match every occurrence
1 parent 0da2530 commit db84f84

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pelican/contents.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ def _find_path(path: str) -> Optional[Content]:
372372
def _get_intrasite_link_regex(self) -> re.Pattern:
373373
intrasite_link_regex = self.settings["INTRASITE_LINK_REGEX"]
374374
regex = rf"""
375-
(?P<markup><[^\>]+ # match tag with all url-value attributes
376-
(?:href|src|poster|data|cite|formaction|action|content)\s*=\s*)
377-
375+
(?P<markup>(?:href|src|poster|data|cite|formaction|action|content)\s*=\s*)
378376
(?P<quote>["\']) # require value to be quoted
379377
(?P<path>{intrasite_link_regex}(?P<value>.*?)) # the url value
380378
(?P=quote)"""

0 commit comments

Comments
 (0)