refactor: streamline resume generation script
- Improve maintainability by using functions and arrays for input/output handling - Reduce redundancy in pandoc command calls
This commit is contained in:
+25
-12
@@ -10,23 +10,36 @@ PDF_FONT="Lato"
|
|||||||
PDF_FONT_SIZE="11pt"
|
PDF_FONT_SIZE="11pt"
|
||||||
PDF_ALIGNMENT="raggedright"
|
PDF_ALIGNMENT="raggedright"
|
||||||
|
|
||||||
PDF_OPTIONS=(
|
pdfOptions=(
|
||||||
-V geometry:margin="$PDF_MARGIN"
|
-V geometry:margin="$PDF_MARGIN"
|
||||||
-V mainfont="$PDF_FONT"
|
-V mainfont="$PDF_FONT"
|
||||||
-V fontsize="$PDF_FONT_SIZE"
|
-V fontsize="$PDF_FONT_SIZE"
|
||||||
-V "$PDF_ALIGNMENT"
|
-V "$PDF_ALIGNMENT"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "Generating PDFs..."
|
# Define resumes in "input_file|output_basename" format
|
||||||
pandoc resume.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi_Resume.pdf" "${PDF_OPTIONS[@]}"
|
resumes=(
|
||||||
pandoc remote-support-engineer.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-Remote_Support_Engineer.pdf" "${PDF_OPTIONS[@]}"
|
"resume.md|Charles_Danesi_Resume"
|
||||||
pandoc it-support.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-IT_Support_Specialist.pdf" "${PDF_OPTIONS[@]}"
|
"remote-support-engineer.md|Charles_Danesi-Remote_Support_Engineer"
|
||||||
pandoc system-admin.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-System_Administrator.pdf" "${PDF_OPTIONS[@]}"
|
"it-support.md|Charles_Danesi-IT_Support_Specialist"
|
||||||
|
"system-admin.md|Charles_Danesi-System_Administrator"
|
||||||
|
)
|
||||||
|
|
||||||
echo "Generating DOCX files..."
|
generate_files() {
|
||||||
pandoc resume.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi_Resume.docx"
|
local input="$1"
|
||||||
pandoc remote-support-engineer.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi-Remote_Support_Engineer.docx"
|
local output="$2"
|
||||||
pandoc it-support.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi-IT_Support_Specialist.docx"
|
|
||||||
pandoc system-admin.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi-System_Administrator.docx"
|
|
||||||
|
|
||||||
echo "All files have been generated."
|
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."
|
||||||
|
|||||||
Reference in New Issue
Block a user