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:
+26
-13
@@ -10,23 +10,36 @@ PDF_FONT="Lato"
|
||||
PDF_FONT_SIZE="11pt"
|
||||
PDF_ALIGNMENT="raggedright"
|
||||
|
||||
PDF_OPTIONS=(
|
||||
pdfOptions=(
|
||||
-V geometry:margin="$PDF_MARGIN"
|
||||
-V mainfont="$PDF_FONT"
|
||||
-V fontsize="$PDF_FONT_SIZE"
|
||||
-V "$PDF_ALIGNMENT"
|
||||
)
|
||||
)
|
||||
|
||||
echo "Generating PDFs..."
|
||||
pandoc resume.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi_Resume.pdf" "${PDF_OPTIONS[@]}"
|
||||
pandoc remote-support-engineer.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-Remote_Support_Engineer.pdf" "${PDF_OPTIONS[@]}"
|
||||
pandoc it-support.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-IT_Support_Specialist.pdf" "${PDF_OPTIONS[@]}"
|
||||
pandoc system-admin.md -f markdown -t pdf -o "$DOC_DIR/Charles_Danesi-System_Administrator.pdf" "${PDF_OPTIONS[@]}"
|
||||
# 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"
|
||||
)
|
||||
|
||||
echo "Generating DOCX files..."
|
||||
pandoc resume.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi_Resume.docx"
|
||||
pandoc remote-support-engineer.md -f markdown -t docx -o "$DOC_DIR/Charles_Danesi-Remote_Support_Engineer.docx"
|
||||
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"
|
||||
generate_files() {
|
||||
local input="$1"
|
||||
local output="$2"
|
||||
|
||||
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