Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function makeHtml({htmlSettings, scripts, links, styles}, config) {
/**
* Make build/index.html
*/
console.log(` Making ${htmlSettings.dest}`)
Object.assign(htmlSettings, {scripts, links, styles}) // add links + scripts
const sections = Array.from(genSections(htmlSettings, config))
const locals = Object.assign(htmlSettings, {sections})
const html = pug.renderFile('src/index.pug', locals)
fs.writeFileSync(htmlSettings.dest, html)
}
function render(template, target, object, outputDir = '') {
const src = path.join(websiteDir, template + '.pug');
const dst = path.join(buildDir, outputDir, target + '.html');
if (!fs.existsSync(src)) {
console.log('skipped:', target);
return;
}
const html = pug.renderFile(src, object);
fs.writeFileSync(dst, html);
console.log('emitted:', dst);
}
locals.collectionIcon = collectionIcon
locals.submissionCitations = submissionCitations
locals.meta.description = locals.meta.description.split(';').join('<br>')
locals.attachmentType = attachment.getAnnotation('http://wiki.synbiohub.org/wiki/Terms/synbiohub#attachmentType')
locals.attachmentHash = attachment.getAnnotation('http://wiki.synbiohub.org/wiki/Terms/synbiohub#attachmentHash')
locals.attachmentDownloadURL = url + '/download'
locals.size = attachment.getAnnotation('http://wiki.synbiohub.org/wiki/Terms/synbiohub#attachmentSize')
locals.attachmentIsImage = locals.attachmentType === 'http://wiki.synbiohub.org/wiki/Terms/synbiohub#imageAttachment'
locals.annotations = filterAnnotations(req, attachment.annotations);
res.send(pug.renderFile('templates/views/attachment.jade', locals))
}).catch((err) => {
}).catch((err) => {
if (req.forceNoHTML || !req.accepts('text/html')) {
res.status(500).type('text/plain').send(err.stack)
} else {
const locals = {
config: config.get(),
section: 'errors',
user: req.user,
errors: [err.stack]
}
res.send(pug.renderFile('templates/views/errors/errors.jade', locals))
}
})
})
function setupForm (req, res, settings, locals) {
locals = extend({
config: config.get(),
title: 'First Time Setup - SynBioHub',
settings: settings,
errors: []
}, locals)
res.send(pug.renderFile('templates/views/setup.jade', locals))
}
}).catch((err) => {
if (!req.accepts('text/html')) {
return res.status(404).send(uri + ' not found')
} else {
var locals = {
config: config.get(),
section: 'errors',
user: req.user,
errors: [ err.stack ]
}
res.send(pug.renderFile('templates/views/errors/errors.jade', locals))
}
})
}
locals = extend({
collectionMeta: collectionMeta,
objectTypes: [{ name: 'Collection' }, { name: 'ComponentDefinition' }, { name: 'Model' }, { name: 'ModuleDefinition' }, { name: 'Sequence' }],
creators: lists.creatorList,
partStatuses: lists.partStatusList,
sampleStatuses: lists.sampleStatusList,
statuses: lists.statusList,
experiences: lists.experienceList,
types: lists.typeList,
roles: lists.roleList,
igemRoles: lists.igemRoleList,
collections: lists.collectionList
}, locals)
if (req.originalUrl.endsWith('/createCollection')) {
res.send(pug.renderFile('templates/views/createCollection.jade', locals))
} else {
res.send(pug.renderFile('templates/views/advanced-search.jade', locals))
}
}).catch((err) => {
locals = {
const _createSprite = function(data, template) {
return pug.renderFile(template, data);
};
}).then((jobs) => {
var locals = {
config: config.get(),
section: 'admin',
adminSection: 'jobs',
user: req.user,
jobs: jobs
}
res.send(pug.renderFile('templates/views/admin/jobs.jade', locals))
}).catch((err) => {
res.status(500).send(err.stack)
user: req.user,
benchlingRemotes: benchlingRemotes,
submission: {}
}
res.send(pug.renderFile('templates/views/selectBenchlingRemote.jade', locals))
return
}
if (benchlingRemotes.length === 0) {
const locals = {
config: config.get(),
section: 'errors',
user: req.user,
errors: [ 'No Benchling remote instances configured' ]
}
res.send(pug.renderFile('templates/views/errors/errors.jade', locals))
return
}
if (benchlingRemotes.length === 1) {
benchlingRemote = benchlingRemotes[0].id
}
} else {
benchlingRemote = req.body.benchlingRemote
}
}
const { graphUri, uri, designId, share } = getUrisFromReq(req, res)
fetchSBOLObjectRecursive(uri, graphUri).then((result) => {
const sbol = result.sbol
const componentDefinition = result.object