5
0
Fork 0

Shell versio

This commit is contained in:
m.haas 2023-10-10 15:20:50 +02:00
parent 494e9aa984
commit d6dab3c096

View file

@ -17,15 +17,19 @@ echo Usage: pandocPipeline [OPTION] [COMMAND]
echo -h, --help show this help screen echo -h, --help show this help screen
echo -f, --file specify filename without extension echo -f, --file specify filename without extension
echo -e, --ending spefify target file format 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 -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 -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 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 Possible fileformats see: https://pandoc.org/diagram.svgz?v=20230203095535
echo Examples: 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 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() { Errorfile() {
@ -43,12 +47,6 @@ POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-u|--user)
editor="$2"
shift 2;;
-t|--title)
title="$2"
shift 2;;
-f|--file) -f|--file)
file="$2" file="$2"
shift 2;; shift 2;;
@ -75,7 +73,12 @@ done
if [[ -z "$file" ]]; then if [[ -z "$file" ]]; then
Errorfile Errorfile
exit 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 header=$script/header.md
sedfile=$script/body.sed sedfile=$script/body.sed
sed -i 's,Editor:.*,Editor: '"$editor"' \\\\,' $header sed -i 's,Editor:.*,Editor: '"$editor"' \\\\,' $header