appstream-glib
appstream-glib copied to clipboard
Validation of `<em>` and `<code>` inside `<li>` elements fails
According to the spec both <em> and <code> elements can be used in <li> elements in descriptions:
Within paragraphs and list items, emphasis (em) and inline code (code) text styles are supported.
Unfortunately, validation fails with appstream-util 0.7.18 (Fedora 34):
appstream-util validate-relax --nonet res/linux/org.mixxx.Mixxx.metainfo.xml
res/linux/org.mixxx.Mixxx.metainfo.xml: failed to parse res/linux/org.mixxx.Mixxx.metainfo.xml: Error on line 236 char 5: <li> already set 'It is no longer necessary to manually copy the udev rule file in packaging scripts. Now pkg-config is used to determine the udevdir used to install the rules file in the CMake install step when CMAKE_INSTALL_PREFIX is' and tried to replace with '
or
'
Example: org.mixxx.Mixxx.metainfo.xml
Validation with appstreamcli succeeds:
appstreamcli validate --no-net res/linux/org.mixxx.Mixxx.metainfo.xml
I: org.mixxx.Mixxx:~: content-rating-missing
Validation was successful: infos: 1, pedantic: 1
I think using appstreamcli validate is probably the right thing to use these days.
Thanks for the confirmation. We already switched to appstreamcli as a workaround and we could stick with it if recommended.
I am running into this bug using flatpak-builder:
Rewriting contents of org.mixxx.Mixxx.desktop
Running appstream-compose
Processing application org.mixxx.Mixxx
Error loading AppData file: failed to parse /app/share/appdata/org.mixxx.Mixxx.appdata.xml: Error on line 265 char 5: <li> already set 'It is no longer necessary to manually copy the udev rule file in packaging scripts. Now pkg-config is used to determine the udevdir used to install the rules file in the CMake install step when CMAKE_INSTALL_PREFIX is' and tried to replace with '
or
'
Error: ERROR: appstream-compose failed: Child process exited with code 1
Ugly hack around this in the Flatpak manifest:
post-install:
- sed -i 's/<code>//g' ${FLATPAK_DEST}/share/metainfo/org.mixxx.Mixxx.metainfo.xml
- sed -i 's/<\/code>//g' ${FLATPAK_DEST}/share/metainfo/org.mixxx.Mixxx.metainfo.xml
In the long run https://github.com/flatpak/flatpak/pull/4426 will add support for that in some form, unless appstream-glib implements dedicated support. The only immediate fix I can see though is your sed hack :-/
I have the same problem with <em> and <code> in <description>. This fails to parse:
<description>
<p>foo <em>bar</em> <code>baz</code> qux</p>
</description>
$ appstream-util validate-relax fail.appdata.xml
failed to parse fail.appdata.xml: Error on line 7 char 46: <p> already set 'foo' and tried to replace with ' qux'
This is with libappstream-glib-0.7.18-3.fc35.x86_64.
Because of this, I can't have markup in package description on Flathub.