From 2757cae1c9b2b7753d121668c93da65cdc75cfef Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 1 Feb 2024 15:52:55 +0100 Subject: 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 --- meson.build | 13 ++++++++++--- 1 file 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')) -- cgit v1.2.3