5
0
Fork 0

changed place where metadata is extracted

This commit is contained in:
m.haas 2023-10-10 16:14:26 +02:00
parent 6cfef54e23
commit 31494b80c3
2 changed files with 10 additions and 20 deletions

View file

@ -54,15 +54,13 @@ IF %file%==none (goto :errorfile) ELSE (goto :extract_metadata)
:extract_metadata :extract_metadata
set title=%file% set title=%file%
For /F "UseBackQ Tokens=1,*" %%G In ("%file%.md") Do ( For /F "UseBackQ Tokens=1,*" %%G In ("%file%.md") Do (
If "%%~G" == "[Title]:" ( If "%%~G" == "title:" (
set title=%%H set title=%%H
) )
If "%%~G" == "[Author]:" ( If "%%~G" == "author:" (
set editor=%%H set editor=%%H
) )
) )
set title=%title:~3,-1%
set editor=%editor:~3,-1%
goto :selection goto :selection
:selection :selection
@ -109,12 +107,8 @@ echo -f, --file specify filename without extension
echo -e, --ending spefify target file format echo -e, --ending spefify target file format
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 Author is by default %USERNAME% echo Author is by default %USERNAME% to change the author add the author to the metadata in your markdown file
echo to change the author write follwing in your markdown file echo Title is by default the filename to change the title add the title to the metadata 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)
goto :end goto :end
:version :version

View file

@ -24,12 +24,8 @@ echo Possible fileformats see: https://pandoc.org/diagram.svgz?v=20230203095535
echo Examples: echo Examples:
echo md -\> pdf : pandocPipeline -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 Author is by default $editor to change the author add the author to the metadata in your markdown file
echo to change the author write follwing in your markdown file echo Title is by default the filename to change the title add the title to the metadata 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() {
@ -74,10 +70,10 @@ if [[ -z "$file" ]]; then
Errorfile Errorfile
exit exit
title=$file title=$file
editor=$(grep '\[Author\]: # \(.*\)' $file.md) editor=$(grep 'author: .*' $file.md)
editor=${editor:13:-1} editor=${editor:8}
title=$(grep '\[Title\]: # \(.*\)' $file.md) title=$(grep 'title: .*' $file.md)
title=${title:13:-1} title=${title:7}
if [[ "$ending" == "pdf" ]]; then if [[ "$ending" == "pdf" ]]; then
header=$script/header.md header=$script/header.md
sedfile=$script/body.sed sedfile=$script/body.sed