sysreptor icon indicating copy to clipboard operation
sysreptor copied to clipboard

Fix space after figure references

Open laura-rs-c53 opened this issue 2 weeks ago • 2 comments

When referencing figures, the figure ref title is intentionally hidden. However, due to the ref title being hidden, there is no implicit space added to the ::before pseudo-element under certain circumstances:

<ref to="fig1" />abc
<figure id="fig1">...</figure>
<ref to="fig1" />def

Here, the first reference would render as Figure 1abc, whereas the second reference renders as Figure 1 abc. This PR simply forces the space to be present for figure references, resolving this inconsistency. (Note that due to an explicit space being present, there isn't any implicit space being added during rendering -> there aren't any double spaces introduced with this fix)

laura-rs-c53 avatar Nov 12 '25 15:11 laura-rs-c53

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 12 '25 15:11 CLAassistant

Hi, the root cause is an upstream bug in weasyprint and not something we can easily fix via CSS. See #248 for details.

Always adding a space via CSS fixes the cases when there should be a space (e.g. regular text, followed by another word), but it also adds spaces when there shouldn't be one (e.g. at the end of a sentences before the dot or in parentheses).

... as described in <ref to="fig1" />.
(see <ref to="fig1" />)

I guess we have to wait until the bug is fixed in weasyprint.

MWedl avatar Nov 13 '25 09:11 MWedl

This one has been a problem, so I've just had to go through a whole report looking for this issue.

vysecurity avatar Nov 22 '25 19:11 vysecurity