in lib/utils/projects.js [86:122]
export function parseProjectMeta(HTML) {
const DParser = getDOMParser();
const parser = new DParser();
const doc = parser.parseFromString(HTML, 'text/html');
const engineers = doc
.evaluate(
"//details//dl/dt[contains(., 'Engineering')]/following-sibling::dd[1]",
doc,
null,
2,
null,
)
.stringValue.replace(/ ?@/g, '')
.split(',');
const goalType = doc
.evaluate(
"//details//dl/dt[contains(., 'Goal Type')]/following-sibling::dd[1]",
doc,
null,
2,
null,
)
.stringValue.toLowerCase();
const size = doc.evaluate(
"//details//dl/dt[contains(., 'Size')]/following-sibling::dd[1]",
doc,
null,
2,
null,
).stringValue;
const details = doc.querySelector('details');
if (details) {
// Remove the meta data HTML from the doc.
details.parentNode.removeChild(details);
}
return [{ engineers, goalType, size }, doc.documentElement.outerHTML];
}