From d6dab3c0964314024faf6d21a8fbaa1936704798 Mon Sep 17 00:00:00 2001 From: "m.haas" Date: Tue, 10 Oct 2023 15:20:50 +0200 Subject: [PATCH] Shell versio --- pandocPipeline/pandocPipeline.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pandocPipeline/pandocPipeline.sh b/pandocPipeline/pandocPipeline.sh index 86bd856..d28b17f 100755 --- a/pandocPipeline/pandocPipeline.sh +++ b/pandocPipeline/pandocPipeline.sh @@ -17,15 +17,19 @@ echo Usage: pandocPipeline [OPTION] [COMMAND] echo -h, --help show this help screen echo -f, --file specify filename without extension echo -e, --ending spefify target file format -echo -u, --user=$editor enter name of file editor set between "" \(only for target format pdf\) -echo -t, --title enter title of document set between "" \(only for target format pdf\) echo -c, --toc prints a table of content at the start of the document echo -p, --picture changes the default picture to a specified picture relative to current path echo Pipeline is optimized for target format pdf and docx but works with others as well echo Possible fileformats see: https://pandoc.org/diagram.svgz?v=20230203095535 echo Examples: -echo md -\> pdf : pandocPipeline -u "Dokumentbearbeiter" -t "Dokumententitel" -f dateiname -e pdf +echo md -\> pdf : pandocPipeline -f dateiname -e pdf echo md -\> docx : pandocPipeline -f dateiname -e docx +echo Author is by default $editor +echo to change the author write follwing in your markdown file +echo \[Author\]: \# \(your name\) +echo Title is by default the filename +echo to change the title write follwing in your markdown file +echo \[Title\]: \# \(document title\) } Errorfile() { @@ -43,12 +47,6 @@ POSITIONAL_ARGS=() while [[ $# -gt 0 ]]; do case $1 in - -u|--user) - editor="$2" - shift 2;; - -t|--title) - title="$2" - shift 2;; -f|--file) file="$2" shift 2;; @@ -75,7 +73,12 @@ done if [[ -z "$file" ]]; then Errorfile exit -elif [[ "$ending" == "pdf" ]]; then +title=$file +editor=$(grep '\[Author\]: # \(.*\)' $file.md) +editor=${editor:13:-1} +title=$(grep '\[Title\]: # \(.*\)' $file.md) +title=${title:13:-1} +if [[ "$ending" == "pdf" ]]; then header=$script/header.md sedfile=$script/body.sed sed -i 's,Editor:.*,Editor: '"$editor"' \\\\,' $header