5
0
Fork 0

Merge branch 'pandocErweiterung' of https://git.famhahn.xyz/nick/hedgedoc2pdf into pandocErweiterung

This commit is contained in:
m.haas 2023-06-13 12:25:45 +02:00
commit b3570862ec

View file

@ -5,6 +5,7 @@ editor=$USER
title=
file=
ending=tex
toc=false
# path to this script
script=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
@ -15,13 +16,14 @@ 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 -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 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 -> docx : pandocPipeline -f dateiname -e docx
echo md -\> pdf : pandocPipeline -u "Dokumentbearbeiter" -t "Dokumententitel" -f dateiname -e pdf
echo md -\> docx : pandocPipeline -f dateiname -e docx
}
Errorfile() {
@ -38,8 +40,6 @@ Open() {
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
echo $1
echo $2
case $1 in
-u|--user)
editor="$2"
@ -56,6 +56,9 @@ while [[ $# -gt 0 ]]; do
-v|--version)
echo pandocPipeline $version
exit;;
-c|--toc)
toc=true
shift;;
-h|--help)
Help
exit;;
@ -69,18 +72,16 @@ if [[ -z "$file" ]]; then
exit
elif [[ "$ending" == "pdf" ]]; then
header=$script/header.md
echo $header
sedfile=$script/body.sed
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
if "$toc"; then
cat $file.md $header | sed -E -f $sedfile| pandoc --filter pandoc-latex-environment --number-sections --toc -i - -o $file.pdf
else
cat $file.md $header | sed -E -f $sedfile| pandoc --filter pandoc-latex-environment --number-sections -i - -o $file.pdf
fi
Open
elif [[ "$ending" == "docx" ]]; then
refdoc=$script/custom-reference.docx