mirror of
https://github.com/getpelican/pelican.git
synced 2026-10-15 12:56:54 +02:00
Merge 0177773b65 into f5535a3ac6
This commit is contained in:
commit
8ecd8142fe
2 changed files with 14 additions and 3 deletions
|
|
@ -399,9 +399,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)"""
|
||||
|
|
|
|||
|
|
@ -612,6 +612,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(
|
||||
|
|
@ -640,6 +643,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