1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
export function renderResume({
resumeDetails,
theme,
customStyleUrl,
sectionOrder,
sections,
savePDFIsVisible,
isOceanTheme,
ogImageUrl,
customTitle
}) {
const allSections = ['header', 'summary', 'education', 'work', 'projects', 'volunteer', 'awards', 'certificates', 'publications', 'skills', 'languages', 'interests', 'references'];
const uniqueSpecifiedOrder = Array.from(new Set(sectionOrder));
const order = uniqueSpecifiedOrder.concat(allSections.filter(section => !uniqueSpecifiedOrder.includes(section)));
const orderedSections = order.map(section => sections[section] ? sections[section](resumeDetails) : '').join('');
const customStyle = customStyleUrl ? `<link rel="stylesheet" href="${customStyleUrl}">` : '';
const name = resumeDetails?.basics?.name || 'Resume';
const title = customTitle || `${name}'s Resume`;
const ogImage = ogImageUrl ? `<meta property="og:image" content="${ogImageUrl}">` : '';
return `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title}</title>
<meta property="og:title" content="${title}">
<meta property="og:type" content="website">
${ogImage}
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><text y='50%' font-size='24' text-anchor='middle' x='50%' dy='.3em'>📄</text></svg>">
<style>
${theme.styles}
</style>
${theme.fontLink}
${customStyle}
</head>
<body class="font-sans">
${orderedSections}
${savePDFIsVisible ? `<button id="saveAsPDFButton">Save as PDF</button>` : ''}
${isOceanTheme ? `
<div class="fish-container">
</div>
<div class="bubble-container">
</div>
` : ''}
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.min.js"></script>
<script type="module" src="https://esm.town/v/iamseeley/savePDF"></script>
<script type="module" src="https://esm.town/v/iamseeley/oceanListener"></script>
</body>
</html>
`;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
August 16, 2024