Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/// pug.compileClient(source, ?options) https://pugjs.org/api/reference.html#pugcompileclientsource-options
clientFunctionString = pug.compileClient(path);
str = pug.compileClient(path);
}
{
/// pug.compileClientWithDependenciesTracked(source, ?options) https://pugjs.org/api/reference.html#pugcompileclientwithdependenciestrackedsource-options
let obj = pug.compileClientWithDependenciesTracked(source);
clientFunctionString = obj.body;
str = obj.body;
let strArray: string[] = obj.dependencies;
}
{
/// pug.compileFileClient(path, ?options) https://pugjs.org/api/reference.html#pugcompilefileclientpath-options
clientFunctionString = pug.compileFileClient(path);
str = pug.compileFileClient(path);
}
{
/// pug.render(source, ?options, ?callback) https://pugjs.org/api/reference.html#pugrendersource-options-callback
str = pug.render(source);
// test type for callback paraments
pug.render(source, {}, (err, html) => {
let e: Error = err;
str = html;
});
}
{
/// pug.renderFile(path, ?options, ?callback) https://pugjs.org/api/reference.html#pugrenderfilepath-options-callback
clientFunctionString = pug.compileClient(path);
str = pug.compileClient(path);
}
{
/// pug.compileClientWithDependenciesTracked(source, ?options) https://pugjs.org/api/reference.html#pugcompileclientwithdependenciestrackedsource-options
let obj = pug.compileClientWithDependenciesTracked(source);
clientFunctionString = obj.body;
str = obj.body;
let strArray: string[] = obj.dependencies;
}
{
/// pug.compileFileClient(path, ?options) https://pugjs.org/api/reference.html#pugcompilefileclientpath-options
clientFunctionString = pug.compileFileClient(path);
str = pug.compileFileClient(path);
}
{
/// pug.render(source, ?options, ?callback) https://pugjs.org/api/reference.html#pugrendersource-options-callback
str = pug.render(source);
// test type for callback paraments
pug.render(source, {}, (err, html) => {
let e: Error = err;
str = html;
});
}
{
/// pug.renderFile(path, ?options, ?callback) https://pugjs.org/api/reference.html#pugrenderfilepath-options-callback
str = pug.renderFile(path);
function renderFile(path, rootPath) {
var isPug = /\.(?:pug|jade)$/;
var isIgnored = /([\/\\]_)|(^_)/;
var stat = fs.lstatSync(path);
// Found pug file
if (stat.isFile() && isPug.test(path) && !isIgnored.test(path)) {
// Try to watch the file if needed. watchFile takes care of duplicates.
if (program.watch) watchFile(path, null, rootPath);
if (program.nameAfterFile) {
options.name = getNameFromFileName(path);
}
var fn = options.client
? pug.compileFileClient(path, options)
: pug.compileFile(path, options);
if (program.watch && fn.dependencies) {
// watch dependencies, and recompile the base
fn.dependencies.forEach(function (dep) {
watchFile(dep, path, rootPath);
});
}
// --extension
var extname;
if (program.extension) extname = '.' + program.extension;
else if (options.client) extname = '.js';
else if (program.extension === '') extname = '';
else extname = '.html';
// path: foo.pug -> foo.
// Copyright (c) 2018 Chandan B N. All rights reserved.
var fs = require('fs');
var pug = require('pug');
const conf = require ('../config/conf');
var optSet = require('../models/set');
var cfc = pug.compileFileClient('views/subcontent.pug', {
basedir: 'views',
name: 'subdocRender',
compileDebug: false,
inlineRuntimeFunctions: true
});
fs.writeFileSync('public/js/subcontent.js', cfc);
for (section of conf.sections) {
console.log('rendering ' + section);
//var s = conf.sections[section];
var opts = optSet(section);
if (!opts.conf.readonly) {
if (opts.render == 'render') {
opts.render = '../views/render';
}
var pugRender = pug.compileFileClient(__dirname + '/' + opts.render + '.pug', {
cveProps.CVE_data_meta.properties.STATE.enum =
cveProps.CVE_data_meta.properties.STATE.enum.filter(x => !['DRAFT','REVIEW', 'READY'].includes(x));
fs.writeFileSync("standalone/index.html", cveEdit({
title: 'Vulnogram CVE Editor',
idpath: 'CVE_data_meta.ID',
min: true,
doc: null,
conf: conf,
confOpts: confOpts,
opts: confOpts.cve,
schemaName: 'cve',
allowAjax: false,
}));
var pugRender = pug.compileFileClient(renderTemplate, {
basedir: 'views',
name: 'pugRender',
compileDebug: false,
inlineRuntimeFunctions: true,
});
for (jsDir of ['standalone', 'standalone/js', 'standalone/js/cve']) {
if (!fs.existsSync(jsDir)) {
fs.mkdirSync(jsDir);
}
}
fs.writeFileSync("standalone/js/cve/render.js", pugRender);
basedir: 'views',
name: 'subdocRender',
compileDebug: false,
inlineRuntimeFunctions: true
});
fs.writeFileSync('public/js/subcontent.js', cfc);
for (section of conf.sections) {
console.log('rendering ' + section);
//var s = conf.sections[section];
var opts = optSet(section);
if (!opts.conf.readonly) {
if (opts.render == 'render') {
opts.render = '../views/render';
}
var pugRender = pug.compileFileClient(__dirname + '/' + opts.render + '.pug', {
basedir: 'views',
name: 'pugRender',
compileDebug: false,
inlineRuntimeFunctions: true
});
var jsDir = 'public/js/' + section;
if (!fs.existsSync(jsDir)) {
fs.mkdirSync(jsDir);
}
fs.writeFileSync('public/js/' + section + '/render.js', pugRender);
}
}
views.forEach((view) => {
if (path.extname(view) === ".pug") {
outputStr += pug.compileFileClient(path.join(config.Dashboard.views, view), {name: path.basename(view, ".pug")});
}
});