68bb1f9249
- Improve maintainability by using functions and arrays for input/output handling - Reduce redundancy in pandoc command calls
46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script generates PDF and DOCX files from markdown resumes using Pandoc
|
|
# Requirements: Pandoc must be installed and accessible in the system PATH
|
|
|
|
DOC_DIR="$HOME/Documents/@working"
|
|
|
|
PDF_MARGIN="0.75in"
|
|
PDF_FONT="Lato"
|
|
PDF_FONT_SIZE="11pt"
|
|
PDF_ALIGNMENT="raggedright"
|
|
|
|
pdfOptions=(
|
|
-V geometry:margin="$PDF_MARGIN"
|
|
-V mainfont="$PDF_FONT"
|
|
-V fontsize="$PDF_FONT_SIZE"
|
|
-V "$PDF_ALIGNMENT"
|
|
)
|
|
|
|
# Define resumes in "input_file|output_basename" format
|
|
resumes=(
|
|
"resume.md|Charles_Danesi_Resume"
|
|
"remote-support-engineer.md|Charles_Danesi-Remote_Support_Engineer"
|
|
"it-support.md|Charles_Danesi-IT_Support_Specialist"
|
|
"system-admin.md|Charles_Danesi-System_Administrator"
|
|
)
|
|
|
|
generate_files() {
|
|
local input="$1"
|
|
local output="$2"
|
|
|
|
echo " -> Generating PDF: $output.pdf"
|
|
pandoc "$input" -f markdown -t pdf -o "$DOC_DIR/$output.pdf" "${pdfOptions[@]}"
|
|
|
|
echo " -> Generating DOCX: $output.docx"
|
|
pandoc "$input" -f markdown -t docx -o "$DOC_DIR/$output.docx"
|
|
}
|
|
|
|
echo "Generating resumes..."
|
|
for entry in "${resumes[@]}"; do
|
|
IFS="|" read -r input base <<< "$entry"
|
|
generate_files "$input" "$base"
|
|
done
|
|
|
|
echo "All files have been generated in $DOC_DIR."
|