Skip to content

Commit 0a9ee76

Browse files
committed
docs/manual, Meson config: Check if xmllint can be used
1 parent 12d6c14 commit 0a9ee76

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ EXTRA_DIST = \
4545
meson_options.txt \
4646
sigc++config.h.meson \
4747
MSVC_NMake/meson.build \
48+
docs/manual/can_use_xmllint.xml \
4849
docs/manual/meson.build \
4950
docs/reference/meson.build \
5051
examples/meson.build \

docs/manual/can_use_xmllint.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<book xmlns="http://docbook.org/ns/docbook"
3+
version="5.0" xml:id="index" xml:lang="en">
4+
5+
<title>xmllint test</title>
6+
7+
<chapter xml:id="chapter-introduction">
8+
<title>Introduction</title>
9+
<para>
10+
This is a short DocBook V5.0 document. It can be used for testing if the installed
11+
version of xmllint or a similar program can validate a DocBook V5.0 document.
12+
</para>
13+
</chapter>
14+
15+
</book>

docs/manual/meson.build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ if not build_documentation
2424
subdir_done()
2525
endif
2626

27+
# Check if xmllint can be used.
28+
if xmllint.found()
29+
can_parse_and_validate = run_command(
30+
python3, tutorial_custom_cmd, 'xmllint',
31+
validate,
32+
meson.current_source_dir() / 'can_use_xmllint.xml',
33+
meson.current_build_dir() / 'can_use_xmllint.stamp',
34+
).returncode() == 0
35+
if not can_parse_and_validate
36+
# The DocBook V5.0 package is called docbook5-xml in Ubuntu,
37+
# docbook5-schemas in Fedora. It may have other names in other distros.
38+
warning('Can\'t validate XML file.\n' +
39+
'xmllint does not support Relax NG schemas and DocBook V5.0.\n' +
40+
'DocBook V5.0 support may require docbook5-xml, docbook5-schemas or a similar package.'
41+
)
42+
endif
43+
endif
44+
2745
install_data('..' / 'index.html', install_dir: install_docdir)
2846
install_data('..' / 'images' / 'libsigc_logo.gif',
2947
'..' / 'images' / 'top.gif',

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ endif
291291
validate = get_option('validation') and can_parse_and_validate
292292
explain_val = ''
293293
if get_option('validation') and not validate
294-
explain_val = ' (requires xmllint)'
294+
explain_val = ' (requires xmllint with Relax NG and DocBook V5.0 support)'
295295
endif
296296

297297
build_pdf = build_pdf_by_default and can_build_pdf

tools/tutorial-custom-cmd.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ def xmllint():
6565
stamp_file_path = sys.argv[4]
6666

6767
relax_ng_schema = 'http://docbook.org/xml/5.0/rng/docbook.rng'
68+
# schematron_schema = 'http://docbook.org/xml/5.0/sch/docbook.sch'
69+
70+
# Validation against the Schematron schema does not work on Ubuntu 21.04:
71+
# file:///usr/share/xml/docbook/schema/schematron/5.0/docbook.sch:6: element rule:
72+
# Schemas parser error : Failed to compile context expression db:firstterm[@linkend]
73+
# .....
74+
# Schematron schema http://docbook.org/xml/5.0/sch/docbook.sch failed to compile
6875

6976
cmd = [
7077
'xmllint',
@@ -73,7 +80,10 @@ def xmllint():
7380
'--xinclude',
7481
]
7582
if validate == 'true':
76-
cmd += ['--relaxng', relax_ng_schema]
83+
cmd += [
84+
'--relaxng', relax_ng_schema,
85+
#'--schematron', schematron_schema,
86+
]
7787
cmd += [input_xml_file]
7888
result = subprocess.run(cmd)
7989
if result.returncode:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy