From 54addabbc5f7895abadea3bbc2de08a99b5d1698 Mon Sep 17 00:00:00 2001 From: use-to <13922835+use-to@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:35:11 +0100 Subject: [PATCH] feat: add imprint --- .github/workflows/latex.yml | 17 +++++++++++++++++ imprint.tex | 20 ++++++++++++++++++++ src/nda.tex | 9 ++------- 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 imprint.tex diff --git a/.github/workflows/latex.yml b/.github/workflows/latex.yml index eed1047..505c031 100644 --- a/.github/workflows/latex.yml +++ b/.github/workflows/latex.yml @@ -5,9 +5,11 @@ on: [push, pull_request] env: OUTPUT_DIR: "output" MAIN_TEX_FOLDER: "src" + IMPRINT_URL: "https://cdn.helpwave.de/imprint.json" DEPENDENCIES: | head.tex version.tex + imprint.tex logo.svg jobs: @@ -117,6 +119,21 @@ jobs: run: | sed -i "s/ffffff/${{ steps.get_commit_hash.outputs.commit_hash }}/" version.tex + - name: Download JSON file + run: | + curl -o imprint.json ${{ env.IMPRINT_URL }} + + - name: Replace placeholders in LaTeX file + run: | + FILE_TO_UPDATE="imprint.tex" + + for key in $(jq -r 'keys[]' imprint.json); do + value=$(jq -r --arg key "$key" '.[$key]' imprint.json) + + placeholder=$(echo $key | tr '.' '_') + sed -i "s|$placeholder|$value|g" $FILE_TO_UPDATE + done + - name: Compile changed LaTeX documents if: env.changed_files != '' uses: xu-cheng/latex-action@v3 diff --git a/imprint.tex b/imprint.tex new file mode 100644 index 0000000..6434ede --- /dev/null +++ b/imprint.tex @@ -0,0 +1,20 @@ +\newcommand{\imprinturl}{imprint_url} + +\newcommand{\companyname}{company_name} +\newcommand{\careof}{address.care_of} +\newcommand{\street}{address.street} +\newcommand{\postalcode}{address.postal_code} +\newcommand{\city}{address.city} +\newcommand{\registrationnumber}{commercial_register.registration_number} + +\newcommand{\imprint}{ + \href{\imprinturl}{ + {\small\color{gray} + \companyname\\ + \careof + \street\\ + \postalcode\ \city\\ + \registrationnumber + } + } +} diff --git a/src/nda.tex b/src/nda.tex index 63d2214..7afde93 100644 --- a/src/nda.tex +++ b/src/nda.tex @@ -9,13 +9,8 @@ \includesvg[width=0.2\linewidth]{logo.svg}\\[4ex] {\Huge \sffamily Vertraulichkeitsvereinbarung}\\[2ex] \textcolor{gray}{{\large \sffamily zwischen}}\\[2ex] - {\small -helpwave GmbH \\ -mit Sitz in Aachen \\ -HRB 27480 \\ -(nachfolgend „Inhaber“) -}\\[2ex] - {\textcolor{gray}{{\large \sffamily und}}}\\[2ex] + {\imprint \\ (nachfolgend „Inhaber“)}\\[2ex] + {\textcolor{gray}{{\large \sffamily und}}}\\[2ex] {\small \begin{Form}