XHTML: behaviour of cleanID

Thibaut Cuvelier tcuvelier at lyx.org
Mon Jul 20 00:30:42 UTC 2020


Dear Riki,

As you indicated being the culprit behind the XHTML code ;), I've got a
question for you: why is there a point at the end of the cleaned ID if it
ends with a digit? I'm referring to this part of the code:

if (isDigitASCII(content[content.size() - 1]))
content += ".";

I don't see a compelling reason to do so. I think this was a hack to ensure
that IDs don't clash with those generated by LyX (i.e. if cleanID had to
change the ID somehow), but I'm not sure about that.

I'm interested in that issue because of bibliographies: usually, IDs used
in a bibliography end with a year (at least, that's something very very
common), aka digits. With this part in the code, "Bringhurst2005" is output
as "Bringhurst2005.", which is very strange (and potentially highly
confusing if the user works on the XML/XHTML document later on).

If that's the only reason to do it, why not generate IDs that should really
not be used by users? For now, it's just appending "-" and some number(s),
which the user might do by themself. What about appending "-lyx" then the
number(s)? If the user tries that, they are asking for troubles, that's for
sure.

I'm attaching a patch that just removes adding the point. I prefer not to
commit it directly, because I'm afraid it might be really breaking if I
didn't get it right.

Thanks for reading this long message :)!
Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200720/addcbd7b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Stop-adding-points-at-the-end-of-xml-id-without-reas.patch
Type: application/octet-stream
Size: 724 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200720/addcbd7b/attachment.obj>


More information about the lyx-devel mailing list