Issue
Create a page on a new site that contains a tag with two {static} instructions. For instance an image with lazyloading:
Title: Test Article
Date: 2024-11-02 21:30
Author: me
Category: Uncategorized
Tags:
Slug: test-article
Status: draft
<img
src="{static}/images/placeholder.png"
data-src="{static}/images/my_image.png"
loading="lazy"/>
Bye
Expected output:
<p><img
src="/images/placeholder.png"
data-src="/images/my_image.png"
loading="lazy"/></p>
<p>Bye</p>
Found output:
<p><img
src="{static}/images/placeholder.png"
data-src="/images/my_image.png"
loading="lazy"/></p>
<p>Bye</p>
The issue comes from the regex
(?P<markup><[^\>]+ # match tag with all url-value attributes
(?:href|src|poster|data|cite|formaction|action|content)\s*=\s*)
(?P<quote>["\']) # require value to be quoted
(?P<path>[{|](?P<what>.*?)[|}](?P<value>.*?)) # the url value
(?P=quote)"""
that will match only the last attribute (greedy). Changing it to (?P<markup><[^\>]+? makes it lazy and matches the first one only so doesn’t really solves the issue either.
Still trying to find a way to solve this without using 2 regex call but I am no expert in regex.
(edit: #3420 maybe?)
I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
I can reproduce this problem with stock/default settings file, theme, and sample content (as described in above “How to Get Help” sections of the documentation).
I have searched the issues (including closed ones) and believe that this is not a duplicate.
OS version and name: Archlinux
Python version:Python 3.11
Pelican version: 4.10
Issue
Create a page on a new site that contains a tag with two
{static}instructions. For instance an image with lazyloading:Expected output:
Found output:
The issue comes from the regex
that will match only the last attribute (greedy). Changing it to
(?P<markup><[^\>]+?makes it lazy and matches the first one only so doesn’t really solves the issue either.Still trying to find a way to solve this without using 2 regex call but I am no expert in regex.
(edit: #3420 maybe?)