From 9032a5ce5d55ec392b1328ac6d8b28a546405074 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sat, 22 Oct 2022 17:15:20 -0400 Subject: Updated resume, and now it automatically generates --- download/build.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 download/build.js (limited to 'download/build.js') diff --git a/download/build.js b/download/build.js new file mode 100644 index 0000000..7e18973 --- /dev/null +++ b/download/build.js @@ -0,0 +1,38 @@ + + +const fs = require('fs'); +const childProcess = require('child_process'); + +const resumeHtml = fs.readFileSync('../resume.html').toString(); +const resumeCss = fs.readFileSync('./resume_dl.css').toString(); + +function getRidofTagsBetween(start, end, html) { + let si = newHtml.indexOf(start); + let ei = newHtml.indexOf(end, si) + end.length; + return html.substring(0, si) + newHtml.substring(ei); +} + +const newHeader = ` + + + + + + + + +` + +const startHead = resumeHtml.indexOf(''); +const endHead = resumeHtml.indexOf('') + ''.length; + +let newHtml = resumeHtml.substring(0, startHead) + newHeader + resumeHtml.substring(endHead); + +newHtml = getRidofTagsBetween('
', '
', newHtml); +newHtml = getRidofTagsBetween(`
`, '
', newHtml); + +fs.writeFileSync('./resume_dl.html', newHtml); + +childProcess.exec('wkhtmltopdf --encoding \'UTF-8\' ./resume_dl.html cv.pdf ') -- cgit v1.2.1