#!/usr/bin/env python3
"""Use the selected real Pandoc; add only preregistration layout wrapping."""
import os,shutil,subprocess,sys
from pathlib import Path
args=sys.argv[1:]
# The maintained math_pandoc semantic probe is passed unchanged.
program=os.environ.get('PD_PANDOC') or shutil.which('pandoc')
if not program:raise SystemExit('Pandoc must be installed')
if any(Path(a).name=='prereg.md' for a in args):
    args+=['--lua-filter',str(Path(__file__).with_name('report-layout.lua'))]
raise SystemExit(subprocess.call([program,*args]))
