Build chokes on & in tag name #2331

Closed
opened 2021-11-29 09:47:07 +00:00 by max.mehl · 4 comments
Owner

I tried to have the tag name contain an & in this commit.

In normal text, that works. In our build system, that leads to an error – not on the news item itself but when building the tag page as it seems.

Here an extract from Phase 2 of the build:

[09:20:24] * Building tags/tagged-childrensbook.zh.html
[09:20:24] * Building tags/tags.ar.html
[09:20:24] * Building tags/tags.bg.html
[09:20:24] * Building tags/tags.bs.html
[09:20:24] -:329: parser error : xmlParseEntityRef: no name
[09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za
[09:20:24] ^
[09:20:24] unable to parse -
[09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:44: /srv/www/fsfe.org_stage/tags/tags.ar.html] Error 6
[09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.ar.html'
[09:20:24] make: *** Waiting for unfinished jobs....
[09:20:24] -:336: parser error : xmlParseEntityRef: no name
[09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za
[09:20:24] ^
[09:20:24] unable to parse -
[09:20:24] -:369: parser error : xmlParseEntityRef: no name
[09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za
[09:20:24] ^
[09:20:24] unable to parse -
[09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:47: /srv/www/fsfe.org_stage/tags/tags.bg.html] Error 6
[09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.bg.html'
[09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:50: /srv/www/fsfe.org_stage/tags/tags.bs.html] Error 6
[09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.bs.html'
[09:20:24] 1638177624

Interestingly, the actual tag's page builds fine: [09:20:23] * Building tags/tagged-adaandzangemann.en.html

It's not high priority, but an unexpected behaviour.

I tried to have the tag name contain an `&amp;` in [this commit](https://git.fsfe.org/FSFE/fsfe-website/commit/4243c4fdb027127867ea8c01790778c244856404). In normal text, that works. In our build system, that leads to an error – not on the news item itself but when building the tag page as it seems. Here an extract from Phase 2 of the build: ``` [09:20:24] * Building tags/tagged-childrensbook.zh.html [09:20:24] * Building tags/tags.ar.html [09:20:24] * Building tags/tags.bg.html [09:20:24] * Building tags/tags.bs.html [09:20:24] -:329: parser error : xmlParseEntityRef: no name [09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za [09:20:24] ^ [09:20:24] unable to parse - [09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:44: /srv/www/fsfe.org_stage/tags/tags.ar.html] Error 6 [09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.ar.html' [09:20:24] make: *** Waiting for unfinished jobs.... [09:20:24] -:336: parser error : xmlParseEntityRef: no name [09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za [09:20:24] ^ [09:20:24] unable to parse - [09:20:24] -:369: parser error : xmlParseEntityRef: no name [09:20:24] <tag section="news" key="adaandzangemann" count="1" filename="tags">Ada & Za [09:20:24] ^ [09:20:24] unable to parse - [09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:47: /srv/www/fsfe.org_stage/tags/tags.bg.html] Error 6 [09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.bg.html' [09:20:24] make: *** [/srv/www/status.fsfe.org/fsfe.org/Makefile:50: /srv/www/fsfe.org_stage/tags/tags.bs.html] Error 6 [09:20:24] make: *** Deleting file '/srv/www/fsfe.org_stage/tags/tags.bs.html' [09:20:24] 1638177624 ``` Interestingly, the actual tag's page builds fine: `[09:20:23] * Building tags/tagged-adaandzangemann.en.html` It's not high priority, but an unexpected behaviour.
max.mehl added the bugtaggingxslbuild labels 2021-11-29 09:47:07 +00:00
Owner

In xml files the build system chokes as well on an & in the text.

In xml files the build system chokes as well on an `&` in the text.
Member

So, with the new build system a tag name with an ampersand in it is fine, ie

<tag key="test">test&amp;</tag>

builds just fine, and renders properly on the actual list of tags for the page.

But in the tag overview the &amp is not parsed into an ampersand due to us escaping the xml text:

escape(tag.text.strip()) if tag.text and tag.text.strip() else None

I think this is because of some other issues we had, but I do not think that matters too much?

Using & in the key of a tag does not work, IE

<tag key="test&amp;">test&amp;</tag>

Results in a build error.

We still do not support an & in xml text with the new build process, but it works in xhtml it seems?

Perhaps we can close this issue?

So, with the new build system a tag name with an ampersand in it is fine, ie ```xml <tag key="test">test&amp;</tag> ``` builds just fine, and renders properly on the actual list of tags for the page. But in the tag overview the &amp is not parsed into an ampersand due to us escaping the xml text: https://git.fsfe.org/FSFE/fsfe-website/src/commit/0f8805e037cd435d189a1ce8b506c631feb37389/fsfe.org/tags/subdir.py#L118 I think this is because of some other issues we had, but I do not think that matters too much? Using &amp; in the key of a tag does not work, IE ```xml <tag key="test&amp;">test&amp;</tag> ``` Results in a build error. We still do not support an & in xml text with the new build process, but it works in xhtml it seems? Perhaps we can close this issue?
Member

It seems the escaping tag names was not in fact necessary, and I have pr to remove it here: #5279

This means that after that pr is merged using an &amp; in a tag text works perfectly, which I think satisfies this issue. @tobiasd

It seems the escaping tag names was not in fact necessary, and I have pr to remove it here: https://git.fsfe.org/FSFE/fsfe-website/pulls/5279 This means that after that pr is merged using an `&amp;` in a tag text works perfectly, which I think satisfies this issue. @tobiasd
Owner

thanks!

thanks!
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FSFE/fsfe-website#2331