Commit 2b02c3c0 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'rhtenhove-main-patch-41858' into 'main'

fix: pandoc cleaner code, fix render, add test

See merge request just-ci/templates!63
parents ea8d430c 5afb0024
Loading
Loading
Loading
Loading
+24 −11
Original line number Diff line number Diff line
---
variables:
  PANDOC_EXTRA_ARGS: ""

docs:pandoc-from-template:
  image:
    name: registry.gitlab.com/just-ci/images/pandoc:latest
    entrypoint: [""]
  stage: build
  variables:
    FORMATS: pdf docx html
    DEFAULT_ARGS: >
    DEFAULT_ARGS:
      --standalone --table-of-contents --number-sections --citeproc --metadata
      link-citations=true

    PDF_ENGINE: xelatex
    SOURCE_DIR: .
    MEDIA_DIR: media
    BIBLIOGRAPHY: references.yaml
    TEMPLATE: https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/eisvogel.tex
    CSL: https://raw.githubusercontent.com/citation-style-language/styles/master/cell-numeric.csl
    CSS: https://gist.githubusercontent.com/killercup/5917178/raw/40840de5352083adb2693dc742e9f75dbb18650f/pandoc.css
    TOC_DEPTH: 2
    REPORT_NAME: "${CI_PROJECT_NAME}"
    TOC_DEPTH: "2"
    REPORT_NAME: ${CI_PROJECT_NAME}
    METADATA_LANG: en-US
    EXTRA_ARGS: "" # Add extra arguments to customize even further
  script:
    - mkdir output
    - cd ${SOURCE_DIR}
    - |
      for FORMAT in $FORMATS; do
        pandoc ${DEFAULT_ARGS} ${EXTRA_ARGS} --template="${TEMPLATE}" --pdf-engine=${PDF_ENGINE} --csl="${CSL}" --css="${CSS}" --toc-depth=${TOC_DEPTH} --bibliography="${BIBLIOGRAPHY}" --extract-media="${OUTPUT_DIR}/${MEDIA_DIR}" --metadata lang=${METADATA_LANG} --to ${FORMAT} --output output/"${REPORT_NAME}.${FORMAT}" --resource-path=.:"${SOURCE_DIR}" "${SOURCE_DIR}"/*.md
      for FORMAT in ${FORMATS}; do
        pandoc ${DEFAULT_ARGS} ${PANDOC_EXTRA_ARGS} \
        --template="${TEMPLATE}" \
        --pdf-engine=${PDF_ENGINE} \
        --csl="${CSL}" \
        --css="${CSS}" \
        --toc-depth=${TOC_DEPTH} \
        --bibliography="${BIBLIOGRAPHY}" \
        --extract-media="." \
        --metadata lang=${METADATA_LANG} \
        --to ${FORMAT} \
        --output "${REPORT_NAME}.${FORMAT}" \
        *.md
        echo "[+] ${SOURCE_DIR}/${REPORT_NAME}.${FORMAT} done."
      done
  artifacts:
    paths:
      - output/*
      - "**/*.*"
    when: always
+4 −2
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@ include:
  - local: docs/drawio.yml
  - local: docs/md-presentation.yml
  - local: pipelines/workflow.yml
  - local: docs/report-pandoc.yml

before_script:
  - cd tests/mockup_projects/docs
docs:pandoc-from-template:
  variables:
    SOURCE_DIR: tests/mockup_projects/docs/pandoc
+15 −0
Original line number Diff line number Diff line
---
title: Just CI
subtitle: Release v47.11.2
author:
  - R.H. ten Hove
  - F. Falconieri
date: 1 June 2030
titlepage: true
titlepage-color: "FFFFFF"
titlepage-text-color: "000000"
titlepage-rule-color: "000000"
titlepage-rule-height: 2
...

\newpage
+5 −0
Original line number Diff line number Diff line
# Conclusions and Recommendations

It's great[@indeed], keep it up!

![logo](media/logo.png)
+6.06 KiB
Loading image diff...
Loading