From bb80497deccf164956d8b0b99a7546df75df439e Mon Sep 17 00:00:00 2001 From: KingOfDog Date: Wed, 10 Nov 2021 13:33:51 +0100 Subject: [PATCH] Improve automization and VSCode integration --- .gitignore | 5 +++ additionals/executive_summary.tex | 12 ++++++ build.sh | 6 +-- config.tex | 16 ++++++- main.tex | 2 +- templates/markdown/.drone.yml | 71 ++++++++++++++++++++----------- templates/markdown/tasks.json | 26 +++++++---- 7 files changed, 98 insertions(+), 40 deletions(-) create mode 100644 additionals/executive_summary.tex diff --git a/.gitignore b/.gitignore index 88ec3e7..2af65ff 100644 --- a/.gitignore +++ b/.gitignore @@ -240,3 +240,8 @@ TSWLatexianTemp* # expex forward references with \gathertags *-tags.tex main.ptc + +*temp.tex +.DS_Store + +words.txt diff --git a/additionals/executive_summary.tex b/additionals/executive_summary.tex new file mode 100644 index 0000000..d9351a9 --- /dev/null +++ b/additionals/executive_summary.tex @@ -0,0 +1,12 @@ + +\addchap{Executive Summary} + +% Problemstellung + +% Zielsetzung + +% Methodik + +% Ergebnisse + +% Ausblick diff --git a/build.sh b/build.sh index fe1eef0..bccfe66 100644 --- a/build.sh +++ b/build.sh @@ -67,9 +67,9 @@ function run_pandoc_appendix { filename=$(basename -- "$f") filename="${filename%.*}" pandoc --lua-filter templates/germanquotes.lua --citeproc --filter pandoc-crossref \ - -M cref=true --top-level-division=chapter \ - --bibliography library/library.bib --biblatex \ - -o appendix/generated/$filename.tex appendix/$filename.md + -M cref=true --top-level-division=chapter \ + --bibliography library/library.bib --biblatex \ + -o appendix/generated/$filename.tex appendix/$filename.md done } diff --git a/config.tex b/config.tex index e7ea424..c43db16 100644 --- a/config.tex +++ b/config.tex @@ -44,9 +44,11 @@ \stopcontents \renewcommand{\thechapter}{\arabic{chapter}}% \setcounter{chapter}{1} + \cref{appendix}{Anhang}{Anhänge} } % Reduzierung der Abstände zwischen Überschriften und Text +% \RedeclareSectionCommand[beforeskip=.0001\baselineskip, afterskip=.0001\baselineskip]{chapter} \RedeclareSectionCommand[afterskip=.0001\baselineskip]{section} \RedeclareSectionCommand[afterskip=.0001\baselineskip]{subsection} \RedeclareSectionCommand[afterskip=.0001\baselineskip]{subsubsection} @@ -56,7 +58,8 @@ \usepackage{fontspec} % Neue Deutsche Rechtschreibung und Deutsche Standardtexte -\usepackage[ngerman]{babel} +\usepackage[ngerman]{babel} +\usepackage{hyphenat} % 1/2-zeiliger Zeilenabstand \usepackage[onehalfspacing]{setspace} @@ -64,9 +67,18 @@ % Für die Verwendung von Grafiken \usepackage{graphicx} +% Bessere Zahlen und Einheiten +\usepackage{siunitx} + % Bessere Tabellen \usepackage{tabularx} +% Ragged Tabellene +\usepackage{ragged2e} +\newcolumntype{C}{>{\Centering}X} +\newcolumntype{L}{>{\RaggedRight}X} +\newcolumntype{R}{>{\RaggedLeft}X} + % diagonal unterteilte Tabellencellen \usepackage{diagbox} @@ -236,7 +248,7 @@ baselinestretch=1, breaklines=true, breakautoindent=true, - fontsize=\small + fontsize=\footnotesize } \newenvironment{code}{\captionsetup{type=listing}}{} diff --git a/main.tex b/main.tex index cbb63b1..8aa7576 100644 --- a/main.tex +++ b/main.tex @@ -6,7 +6,7 @@ \newcommand{\dokumentenuntertitel}{Untertitel} \newcommand{\dokumentenautor}{Marcel Struck} \newcommand{\matrikelnr}{100228} -\newcommand{\dokumentenautoradresse}{Adresse} +\newcommand{\dokumentenautoradresse}{Straße Hausnummer, PLZ Ort} \newcommand{\dokumentenpruefer}{Prüfer} \newcommand{\studiengang}{Software Engineering} \newcommand{\studiengruppe}{BFWS420A} diff --git a/templates/markdown/.drone.yml b/templates/markdown/.drone.yml index 8eafbd5..761aa8f 100644 --- a/templates/markdown/.drone.yml +++ b/templates/markdown/.drone.yml @@ -1,48 +1,44 @@ kind: pipeline type: docker -name: test - -steps: - - name: hunspell_chapters - image: fastexitlane/hunspell:latest - commands: - - export HUNSPELL_FINDINGS=`for filename in chapter/*.md; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore $filename; done | sort | uniq` - - echo $HUNSPELL_FINDINGS - - '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1' - failure: ignore - - name: hunspell_appendix - image: fastexitlane/hunspell:latest - commands: - - export HUNSPELL_FINDINGS=`for filename in appendix/*.tex; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore -t $filename; done | sort | uniq` - - echo $HUNSPELL_FINDINGS - - '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1' - failure: ignore - ---- -kind: pipeline -type: docker name: build steps: - name: pandoc - image: fastexitlane/pandoc-latex:latest + pull: always + image: kingofdog/pandoc-latex:latest commands: - ./build.sh pandoc + - name: prepare-files + image: kingofdog/pandoc-latex:latest + commands: - ci_commit_sha_short=`git rev-parse --short $CI_COMMIT_SHA` - - mv out/main.pdf "$(date +"%F-%H-%M")_$DRONE_REPO_NAME.pdf" + - cp out/main.pdf "$(date +"%F-%H-%M")_${DRONE_REPO_NAME}_${DRONE_BUILD_NUMBER}.pdf" + depends_on: + - pandoc + - name: log + image: kingofdog/pandoc-latex:latest + commands: + - cat out/main.log + - ls -l out + - ls -l appendix/generated + depends_on: + - pandoc - name: upload image: plugins/s3 settings: - bucket: praxisarbeit-artifacts + bucket: + from_secret: minio_bucket access_key: from_secret: minio_access_key secret_key: from_secret: minio_secret_key source: ./*.pdf region: eu-dogland - target: /version-${DRONE_BRANCH}-${DRONE_BUILD_NUMBER} + target: / path_style: true endpoint: https://minio.kingofdog.de + depends_on: + - prepare-files - name: release image: plugins/gitea-release settings: @@ -51,4 +47,27 @@ steps: base_url: https://git.kingofdog.de files: ./*.pdf when: - event: tag \ No newline at end of file + event: tag + depends_on: + - prepare-files + - name: hunspell_chapters + image: kingofdog/hunspell:latest + failure: ignore + commands: + - sed -i -E 's/\\acf?s?p?\{([^}]+)\}/\1/g' chapter/out.tex + - sed -i -E 's/\\\w+\{[^}]+\}//g' chapter/out.tex + - export HUNSPELL_FINDINGS="`hunspell -l -i UTF-8 -d de_DE_frami,en_US -p ./.hunspellignore chapter/out.tex | sort | uniq`" + - export HUNSPELL_FINDINGS_COUNT=`echo $HUNSPELL_FINDINGS | wc -w` + - echo "Found $HUNSPELL_FINDINGS_COUNT different incorrect words." + - '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1' + depends_on: + - pandoc + - name: hunspell_appendix + image: kingofdog/hunspell:latest + failure: ignore + commands: + - export HUNSPELL_FINDINGS=`for filename in appendix/*.tex; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore -t $filename; done | sort | uniq` + - echo $HUNSPELL_FINDINGS + - '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1' + depends_on: + - pandoc diff --git a/templates/markdown/tasks.json b/templates/markdown/tasks.json index be7465d..e95509b 100644 --- a/templates/markdown/tasks.json +++ b/templates/markdown/tasks.json @@ -6,26 +6,33 @@ { "label": "latexmk", "type": "shell", - "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh pandoc", + "command": "./build.sh pandoc", + "windows": { + "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh pandoc" + }, "group": { "kind": "build", "isDefault": true }, - "dependsOrder": "sequence", - "dependsOn": [ - "clean" - ] + "problemMatcher": [] }, { "label": "clean", "type": "shell", - "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh clean", - "group": "none" + "command": "./build.sh clean", + "windows": { + "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh clean" + }, + "group": "none", + "problemMatcher": [] }, { "label": "wordcount", "type": "shell", - "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest pandoc --lua-filter=/work/wordcount.lua /work/chapter/out.md", + "command": "pandoc --lua-filter=wordcount.lua chapter/out.md", + "windows": { + "command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest pandoc --lua-filter=/work/wordcount.lua /work/chapter/out.md" + }, "group": "none", "problemMatcher": [] }, @@ -36,6 +43,9 @@ "windows": { "command": "wsl cat chapter/out.md `| tr 'A-ZÄÖÜ' 'a-zäöü' `| sed 's/-/ /g' `| sed 's/[^a-zäöü]//g' `> words.txt" }, + "osx": { + "command": "cat chapter/out.md | tr 'A-ZÄÖÜ' 'a-zäöü' | sed -E 's/\\\\acf?s?p?\\{([^}]+)\\}/\\1/g' | sed 's/-/ /g' | sed 's/[^a-zäöü ]//g' | tr -s '[[:space:]]' '\\n' | sort | uniq -c | sort -nr | head -n100 > words.txt" + }, "group": "none", "problemMatcher": [] }