I bumped into this while using the Pelican static site generator; see the issue report there).
It seems if i have an @ character in a filename, it will be converted to @ even if email cloaking is disabled.
As a minimal example, i use this configuration:
[html writers]
cloak_email_addresses=yes
and this example .rst file:
My `public PGP key <./gergely@polonkai>`_
The result is (irrelevant lines omitted):
<p>My <a class="reference external" href="./gergely@polonkai">public PGP key</a></p>
In Pelican’s case this results in a warning, stating that my file is not available.
Is this a bug? If not, is there a way to circumvent it?
This behavior is as intended, not a bug. It was intended to help thwart email harvesters, separately from email cloaking. I don't if it's useful for that or not. The behavior could be removed for the "@" character specifically if it's really causing an issue (but see below). The code for it is here:
docutils.writers._html_base.HTMLTranslator.encode, using theHTMLTranslator.special_characterslookup table.Try your generated HTML and see: it should work fine. At least, it works fine with vanilla Docutils. Clicking the link should retrieve the file without issue. Your browser turns "
@" back into a "@" automatically.I guess that Pelican is not doing the entity-to-character conversion before checking for file availability before complaining. Try a file with a double-quote (") or a less-than (<) character in its name. Those characters absolutely have to be escaped in HTML. If Pelican complains with those, it's a deficiency in Pelican.
Last edit: David Goodger 2020-05-01