You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
(?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?)
The text was updated successfully, but these errors were encountered:
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
Fixesgetpelican#3419
mart-e
added a commit
to mart-e/pelican
that referenced
this issue
Nov 3, 2024
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
Fixesgetpelican#3419
justinmayer
changed the title
Only one occurrence of {static} is replaced inside a tag
Only one occurrence of {static} is replaced inside a tag
Nov 3, 2024
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?)
The text was updated successfully, but these errors were encountered: