convert sideProjects and render it in template
This commit is contained in:
parent
d4084e6230
commit
4ba27dd018
|
|
@ -102,6 +102,16 @@ const conversionMap = {
|
||||||
"endDate": 'date.end',
|
"endDate": 'date.end',
|
||||||
"summary": 'summary',
|
"summary": 'summary',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// custom section
|
||||||
|
sideProjects: {
|
||||||
|
'name': 'title',
|
||||||
|
'url': 'url',
|
||||||
|
'description': 'summary',
|
||||||
|
'keywords': 'keywords',
|
||||||
|
"startDate": 'date.start',
|
||||||
|
"endDate": 'date.end',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert function
|
// convert function
|
||||||
|
|
@ -214,6 +224,20 @@ function convert(source) {
|
||||||
formatDatesInResult(result)
|
formatDatesInResult(result)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/* custom sections */
|
||||||
|
const sideProjectsSectionNames = ['side-projects', 'open-source']
|
||||||
|
for (const section of Object.values(sections)) {
|
||||||
|
if (section.type !== 'custom') continue
|
||||||
|
|
||||||
|
const sectionName = section.name.toLowerCase()
|
||||||
|
if (!sideProjectsSectionNames.includes(sectionName)) continue
|
||||||
|
|
||||||
|
result.sideProjects = section.items.map(item => convertObject(item, conversionMap.sideProjects, (item, result) => {
|
||||||
|
formatDatesInResult(result)
|
||||||
|
}))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Educations -->
|
<!-- Educations -->
|
||||||
|
<% if (locals.education) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Educations</h2>
|
<h2>Educations</h2>
|
||||||
<% for (const item of education) { %>
|
<% for (const item of education) { %>
|
||||||
|
|
@ -18,8 +19,10 @@
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<!-- Work -->
|
<!-- Work -->
|
||||||
|
<% if (locals.work) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Work</h2>
|
<h2>Work</h2>
|
||||||
<% for (const item of work) { %>
|
<% for (const item of work) { %>
|
||||||
|
|
@ -37,13 +40,16 @@
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<!-- Projects -->
|
<!-- Projects -->
|
||||||
|
<% if (locals.projects) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Projects</h2>
|
<h2>Projects</h2>
|
||||||
<% for (const item of projects) { %>
|
<% for (const item of projects) { %>
|
||||||
<div class="project">
|
<div class="project">
|
||||||
<h3><%= item.name %></h3>
|
<h3><%= item.name %></h3>
|
||||||
|
<p><%= item.url %></p>
|
||||||
<p><%= item.description %></p>
|
<p><%= item.description %></p>
|
||||||
<p><%= item.startDate %> - <%= item.endDate %></p>
|
<p><%= item.startDate %> - <%= item.endDate %></p>
|
||||||
<div class="highlights">
|
<div class="highlights">
|
||||||
|
|
@ -59,13 +65,30 @@
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<!-- Side-projects -->
|
<!-- Side-projects -->
|
||||||
|
<% if (locals.sideProjects) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Side-projects</h2>
|
<h2>Side-projects</h2>
|
||||||
|
<% for (const item of sideProjects) { %>
|
||||||
|
<div class="sideproject">
|
||||||
|
<h3><%= item.name %></h3>
|
||||||
|
<p><%= item.url %></p>
|
||||||
|
<p><%= item.description %></p>
|
||||||
|
<p><%= item.startDate %> - <%= item.endDate %></p>
|
||||||
|
<div class="keywords">
|
||||||
|
<% for (const kw of item.keywords) { %>
|
||||||
|
<span class="item"><%= kw %></span>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<!-- Skills -->
|
<!-- Skills -->
|
||||||
|
<% if (locals.skills) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Skills</h2>
|
<h2>Skills</h2>
|
||||||
<% for (const item of skills) { %>
|
<% for (const item of skills) { %>
|
||||||
|
|
@ -80,8 +103,10 @@
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<!-- Languages -->
|
<!-- Languages -->
|
||||||
|
<% if (locals.languages) { %>
|
||||||
<section>
|
<section>
|
||||||
<h2>Languages</h2>
|
<h2>Languages</h2>
|
||||||
<% for (const item of languages) { %>
|
<% for (const item of languages) { %>
|
||||||
|
|
@ -91,3 +116,4 @@
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
|
<% } %>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue