aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-02-01 15:52:55 +0100
committerThomas White <taw@physics.org>2024-02-01 15:54:54 +0100
commit2757cae1c9b2b7753d121668c93da65cdc75cfef (patch)
tree487f970777bc24a36cf6044f3b11dd9659d32466
parent7212fb1e28e95a0d38456376dfc5b48fe2f3d004 (diff)
Meson: Fallback for older Pandoc versions
Pandoc >=2.0.0 needs "-f markdown-smart", which requests (amongst some other things) not to convert "--" to an en-dash. We have a lot of double hyphens in the documentation, and I would prefer not to have to escape every single one of them. Older Pandoc versions don't recognise "-smart", but also don't do the en-dash thing by default. Here, we can simply use "-f markdown". Note that older Pandoc versions don't quite render the manual pages correctly, but it's near enough. Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/90
-rw-r--r--meson.build13
1 files changed, 10 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index d0cb0081..1d6a0130 100644
--- a/meson.build
+++ b/meson.build
@@ -279,7 +279,14 @@ subdir('tests')
# ************************ Manual pages ************************
-pandoc = find_program('pandoc', required: false)
+pandoc = find_program('pandoc', version: '>=2.0.0', required: false)
+if pandoc.found()
+ mdfmt = 'markdown-smart'
+else
+ pandoc = find_program('pandoc', required: false)
+ mdfmt = 'markdown'
+endif
+
pandoc_pages = ['indexamajig.1.md',
'adjust_detector.1.md',
@@ -291,7 +298,7 @@ if pandoc.found()
input: join_paths('doc/man', page),
output: '@BASENAME@',
command: [pandoc, '@INPUT@','-o', '@OUTPUT@',
- '-s', '-f', 'markdown-smart', '-t', 'man'],
+ '-s', '-f', mdfmt, '-t', 'man'],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'))
endforeach
@@ -300,7 +307,7 @@ if pandoc.found()
input: 'doc/man/crystfel_geometry.5.md',
output: 'crystfel_geometry.5',
command: [pandoc, '@INPUT@','-o', '@OUTPUT@',
- '-s', '-f', 'markdown-smart', '-t', 'man'],
+ '-s', '-f', mdfmt, '-t', 'man'],
install: true,
install_dir: join_paths(get_option('mandir'), 'man5'))