mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge 0177773b65 into b7408cbfe9
This commit is contained in:
commit
6800ead99d
2 changed files with 14 additions and 3 deletions
|
|
@ -371,9 +371,7 @@ class 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)"""
|
||||
|
|
|
|||
|
|
@ -532,6 +532,9 @@ class TestPage(TestBase):
|
|||
"images/poster.jpg": Static(
|
||||
"", settings=args["settings"], source_path="images/poster.jpg"
|
||||
),
|
||||
"images/placeholder.jpg": Static(
|
||||
"", settings=args["settings"], source_path="images/placeholder.jpg"
|
||||
),
|
||||
}
|
||||
args["context"]["generated_content"] = {
|
||||
"article.rst": Article(
|
||||
|
|
@ -560,6 +563,16 @@ class TestPage(TestBase):
|
|||
content, '<img src="http://static.cool.site/images/poster.jpg"/>'
|
||||
)
|
||||
|
||||
# Image with two links
|
||||
args["content"] = (
|
||||
'<img src="{static}/images/placeholder.jpg" data-src="{static}/images/poster.jpg"/>'
|
||||
)
|
||||
content = Page(**args).get_content("http://cool.site")
|
||||
self.assertEqual(
|
||||
content,
|
||||
'<img src="http://static.cool.site/images/placeholder.jpg" data-src="http://static.cool.site/images/poster.jpg"/>',
|
||||
)
|
||||
|
||||
# Image link will go to static
|
||||
args["content"] = '<meta content="{static}/images/poster.jpg"/>'
|
||||
content = Page(**args).get_content("http://cool.site")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue