From 1f813f5e70addb00b3207128728d0832691d4154 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 4 Mar 2024 21:34:40 +0100 Subject: taler-terms-generator: use pandoc --- contrib/taler-terms-generator | 45 ++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/contrib/taler-terms-generator b/contrib/taler-terms-generator index 2dd35cc18..d83a8801d 100755 --- a/contrib/taler-terms-generator +++ b/contrib/taler-terms-generator @@ -256,15 +256,7 @@ for d in en $(ls -d ${LOCALE_DIR}/?? | grep -v "en" 2>/dev/null || true); do LBUILD="sphinx-build -D language=${LANGUAGE} -d ${BUILDDIR}/.doctrees" - echo "$VERSION_BASENAME TXT ($LANGUAGE)..." 1>&2 - # shellcheck disable=SC2090 - $LBUILD \ - -b text \ - "${BUILDDIR}" \ - "${BUILDDIR}/txt" \ - &>"${BUILDDIR}/txt-sphinx.log" || - failcat "${BUILDDIR}/txt-sphinx.log" - mv "${BUILDDIR}/txt/${VERSION_BASENAME}.txt" "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.txt" + OUTBASE="${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}" echo "$VERSION_BASENAME MD ($LANGUAGE)..." 1>&2 $LBUILD \ @@ -273,28 +265,29 @@ for d in en $(ls -d ${LOCALE_DIR}/?? | grep -v "en" 2>/dev/null || true); do "${BUILDDIR}/md" \ &>"${BUILDDIR}/md-sphinx.log" || failcat "${BUILDDIR}/md-sphinx.log" - mv "${BUILDDIR}/md/${VERSION_BASENAME}.md" "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.md" + BUILDFILE_MARKDOWN="${BUILDDIR}/md/${VERSION_BASENAME}.md" + cp "$BUILDFILE_MARKDOWN" "${OUTBASE}.md" + + # Convert the generated Markdown (!) to other formats. echo "$VERSION_BASENAME PDF ($LANGUAGE)..." 1>&2 - mkdir -p "${BUILDDIR}/pdf/" - # Convert the generated Markdown (!) to PDF. pandoc \ - -i "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.md" \ - -o "${BUILDDIR}/pdf/${VERSION_BASENAME}.pdf" \ - --pdf-engine=pdfroff - mv "${BUILDDIR}/pdf/${VERSION_BASENAME}.pdf" "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.pdf" + -i "$BUILDFILE_MARKDOWN" \ + -o "${OUTBASE}.pdf" \ + --pdf-engine=pdfroff \ + --shift-heading-level-by=-1 echo "$VERSION_BASENAME HTML ($LANGUAGE)..." 1>&2 - # shellcheck disable=SC2090 - $LBUILD \ - -b html \ - "${BUILDDIR}" \ - "${BUILDDIR}/html" \ - &>"${BUILDDIR}/html-sphinx.log" || - failcat "${BUILDDIR}/html-sphinx.log" - htmlark \ - -o "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.html" \ - "${BUILDDIR}/html/${VERSION_BASENAME}.html" + pandoc \ + -i "$BUILDFILE_MARKDOWN" \ + -o "${OUTBASE}.html" \ + --embed-resources --standalone \ + --shift-heading-level-by=-1 + + echo "$VERSION_BASENAME TXT ($LANGUAGE)..." 1>&2 + pandoc \ + -i "$BUILDFILE_MARKDOWN" \ + -o "${OUTBASE}.txt" done if [[ $INCREMENTAL -eq 1 ]]; then -- cgit v1.2.3