Issue #7685: g-ir-doc-tool produces broken XML.

To work around the issue, I just wrote a stupid sed script. Of course,
it means that if we encounter again the issue on some other docs, we'll
have to update it. In other words, it's neither robust nor a proper
long-term fix. Just a temporary hack.
See: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/425

Also fixing this issue, I encountered another bug, this time in meson,
which changes backslashes in slashes on 'command' arguments, in a
completely uninvited manner! The only workaround to this is apparently
to call an external script, which is ridiculous for such a basic stuff.
But well… here is why I implement this with a script, instead of
directly calling sed in the meson 'command'.
See: https://github.com/mesonbuild/meson/issues/1564
This commit is contained in:
Jehan 2022-03-26 17:49:45 +01:00
parent c799d5235e
commit 7123b6c466
2 changed files with 25 additions and 2 deletions

View file

@ -0,0 +1,3 @@
#!/bin/sh
sed -i 's/<\(Prefix\|Image\)/\&lt;\1/g' "$1"

View file

@ -17,6 +17,8 @@ foreach lang : [ 'python', 'gjs' ]
], ],
build_by_default: true) build_by_default: true)
## Gimp Module ##
# XXX `output` is bogus. g-ir-doc-tool produces a lot of output, # XXX `output` is bogus. g-ir-doc-tool produces a lot of output,
# basically one page per public symbol, which is more than 1000 so # basically one page per public symbol, which is more than 1000 so
# it's not usable. Since custom_target() requires an 'output', I could # it's not usable. Since custom_target() requires an 'output', I could
@ -41,10 +43,28 @@ foreach lang : [ 'python', 'gjs' ]
], ],
build_by_default: true) build_by_default: true)
## Gimp Module ## # This step is completely an ugly workaround for 2 tool issues. The
# first issue is that g-ir-doc-tool generates invalid XML by not
# transforming less-than signs into entities. So I am special-casing
# the one API documentation where we need to write a less-than (it will
# need to be updated if this happens again).
# See GIMP issue #7685.
# The second issue is in meson itself which transforms backslash into
# slashes preventing to write most basic regexp in a 'command'. For
# this reason, I need to add the sed command as an external script.
# See meson issue #1564.
docs_pages_fix_sh = find_program('docs_pages_fix.sh')
gir_docs_pages_fix = custom_target('g-ir-Gimp-' + lang + '-pages-fix',
input: [ gir_docs_pages ],
output: [ 'Gimp-' + lang + '-pages-fix' ],
command: [
docs_pages_fix_sh,
'@OUTDIR@' + '/pages/' + lang + '/Gimp-' + gimp_api_version + '/Gimp.Procedure.add_menu_path.page',
],
build_by_default: true)
gir_docs_cache = custom_target('g-ir-Gimp-' + lang + '-cache', gir_docs_cache = custom_target('g-ir-Gimp-' + lang + '-cache',
input: [ gir_docs_pages ], input: [ gir_docs_pages_fix ],
output: [ 'Gimp-' + lang + '-cache' ], output: [ 'Gimp-' + lang + '-cache' ],
command: [ command: [
yelp_build, 'cache', yelp_build, 'cache',