5
0
Fork 0

funktionsfähig gefixt

This commit is contained in:
haasmi 2023-06-07 14:21:19 +02:00
parent 94b15ff4f6
commit 0aaf9a43eb
2 changed files with 34 additions and 22 deletions

View file

@ -2,7 +2,7 @@
version=1.0
editor=$USER
title=''
title=
file=
ending=tex
# path to this script
@ -35,23 +35,27 @@ echo Please add a filename to your command
echo Try 'pandocPipeline --help' for more information
}
ARGS=$(getopt -a --options hvutfe --long "help, version, user, title, file, ending" -- "$@")
# ARGS=$(getopt -a --options hvutfe --long "help, version, user, title, file, ending" -- "$@")
POSITIONAL_ARGS=()
eval set -- "$ARGS"
#eval set -- "$ARGS"
while true; do
case "$1" in
#while true; do
while [[ $# -gt 0 ]]; do
echo $1
echo $2
case $1 in
-u|--user)
editor=$2
editor="$2"
shift 2;;
-t|--title)
title=$2
title="$2"
shift 2;;
-f|--file)
file=$2
file="$2"
shift 2;;
-e|--ending)
ending=$2
ending="$2"
shift 2;;
-v|--version)
echo mktex $version
@ -64,20 +68,29 @@ while true; do
esac
done
echo Editor $editor
echo Title $title
if [[ -z "$file" ]]; then
Errorfile
exit
fi
if [[ "$ending" == "pdf" ]]
echo $ending
if [[ "$ending" == "pdf" ]]; then
header=$script/header.md
echo $header
sedfile=$script/body.sed
picture=$script/Logo.png
sed -i 's,Editor:.*,Editor: '$editor' \\\\\\\\,' $header
sed -i 's,Title:.*,Title: '$title',' $header
sed -i 's,textwidth]{.*,textwidth]{'%picture%'}},' $header
cat %file%.md $header | sed -E -f $sedfile| pandoc --filter $pandocenv --number-sections --toc -i - -o $file.pdf
echo $sedfile
picture=$script/Logo.png
echo $picture
sed -i 's,Editor:.*,Editor: '"$editor"' \\\\,' $header
echo 1
sed -i 's,Title:.*,Title: '"$title"',' $header
echo 2
sed -i 's,textwidth]{.*,textwidth]{'"$picture"'}},' $header
echo 3
cat $file.md $header | sed -E -f $sedfile| pandoc --filter pandoc-latex-environment --number-sections --toc -i - -o $file.pdf
xdg-open $file.pdf
fi