Skip to content

Commit

Permalink
[FIX] match all occurrences of static/attach
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mart-e committed Nov 3, 2024
1 parent 0da2530 commit db84f84
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pelican/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ def _find_path(path: str) -> Optional[Content]:
def _get_intrasite_link_regex(self) -> re.Pattern:
intrasite_link_regex = self.settings["INTRASITE_LINK_REGEX"]
regex = rf"""
(?P<markup><[^\>]+ # match tag with all url-value attributes
(?:href|src|poster|data|cite|formaction|action|content)\s*=\s*)
(?P<markup>(?:href|src|poster|data|cite|formaction|action|content)\s*=\s*)
(?P<quote>["\']) # require value to be quoted
(?P<path>{intrasite_link_regex}(?P<value>.*?)) # the url value
(?P=quote)"""
Expand Down

0 comments on commit db84f84

Please sign in to comment.