Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
context: {
...context,
...page.file,
...templates.page,
cssFiles: [...templates.page.cssFiles, ...cssFiles],
jsFiles: [...templates.page.jsFiles, ...jsFiles],
html: $.html(),
},
});
return writePage({ console, path, data, page }, cb);
});
}
// No need to go through webpack so go only through ejs
const data = ejs.compile(templates.page.file)({
context: {
...context,
...page.file,
...templates.page,
jsFiles: [...templates.page.jsFiles, ...jsFiles],
html,
},
});
return writePage({ console, path, data }, cb);
});
}
const parsed = frontMatter(content);
const metadata = parsed.attributes;
const title = metadata.title;
const destination = metadata.permalink;
const data = _.merge({
_,
title,
metadata,
url: destination
}, app.templateData);
let html = parsed.body;
try {
// Allow ejs code in content
html = ejs.compile(html, {
cache: false,
filename: fullPath
})(data);
// Parse any markdown in the resulting html
if (_.includes(app.htmlOptions.markdownExtensions, ext)) {
html = marked(html);
}
} catch (err) {
log.error(`Unable to compile html from ${fullPath}`);
throw err;
// Uncomment the following for more details
// log.error(err);
// log.error('Call stack');
// log.error(err.stack);
}
#! /usr/bin/env node
'use strict';
require('babel-register');
let argv = require('yargs').argv;
let path = require('path');
let _ = require('lodash');
let fs = require('fs');
let ncp = require('ncp').ncp;
let ejs = require('ejs');
let chalk = require('chalk');
let pjson = require('./package.json');
// Get the execution directory
let cwd = path.resolve('.');
let templateFile = fs.readFileSync(`${__dirname}/templates/index.ejs`).toString();
let template = ejs.compile(templateFile);
let outputDir = _.trimEnd(argv.o, '/');
const generateDocs = (data, key) => {
let html = template({
swagDocData: data,
js: 'static/js/react-bundle.js',
css: 'static/css/style.css',
});
// Save the doc data file
fs.writeFile(`${cwd}/${outputDir}/${key.toLowerCase()}.html`, html , 'utf8', () => {
});
};
<p>$\{ item.desc }</p>
<div class="todo-meta">
<span>$\{ item.category.title } | </span>
</div>
<a href="/edit/$\{ item.id }" class="fa fa-pencil"></a>
<i class="fa fa-check></i>
<i class="></i>
`);
let ejsRenderer = ejs.compile(`
<div class="todos">
<a class="todo-add" href="#/add"><i class="fa fa-plus-square"></i></a>
<ul class="filter-category">
<% for(let i = 0; i < categories.length; i++){ let item = categories[i]; %>
<li style="background: <%= item.color %>">
<a href="/todos/category/<%= item.id %>"><%= item.title %></a>
</li>
<% } %>
</ul>
<ul class="todo-list">
<% for(let index = 0; index < todos.length; index++){ let item = todos[index]; %>
<li class="<%= item.done ? 'todo-done' : ''%>" style="border-color: <%= item.category.color%>">
<h3><%= item.title %></h3></li></ul></div>
'<% } else if (msgType === "transfer_customer_service") { %>',
'<% if (content && content.kfAccount) { %>',
'',
']]>',
'',
'<% } %>',
'<% } else { %>',
'<content>]]></content>',
'<% } %>',
''
].join('');
/*!
* 编译过后的模版
*/
const compiled = ejs.compile(tpl);
const wrapTpl =
'' +
']]>' +
']]>' +
'<%-timestamp%>' +
']]>' +
'';
const encryptWrap = ejs.compile(wrapTpl);
export default class Wechat {
static propTypes = {
goBack: -1
};
function renderCategoryTree(tree, depth, root) {
var ul = ejs.compile(
'<ul data-path-depth="<%- depth %>" class="aigis-categoryList">' +
'<% children.forEach(function(child) { %><%- child %><% }) %>' +
'</ul>'
);
var li = ejs.compile(
'<li data-path-depth="<%- depth %>" class="aigis-categoryList__item">' +
' href="<%- href %>"<% } %>><%- name %>' +
'<%- children %>' +
'</li>'
);
if (!tree) {
return '';
}
var node = ul({
function _getTemplate(name) {
var data = fs.readFileSync(__dirname + '/../data/defaults/' + name + '.json', 'ascii');
return ejs.compile(data, {});
}
function _mergeRoutes() {
function gen_idl() {
var _idl = ejs.compile(fs.readTextFile(path.join(__dirname, './tmpl/idl.md')));
for (var m in defs) {
var p = path.join(docsFolder, defs[m].declare.type == 'module' ? "module" : "object", "ifs", m + ".md");
var md = _idl(defs[m]);
md = md.replace(/\n\s+```/g, '\n```');
md = md.replace(/\n```JavaScript\s+((.|\n)*?)\s+```\s+/gi, function (s, p1, p2, p3) {
return '\n\n```JavaScript\n' + beautify(p1.replace(/\n( |\t)*/g, '\n')).replace(/^static\(/g, 'static (') + '\n```\n\n';
});
md = md.replace(/\n\n+/g, '\n\n');
fs.writeFile(p, md);
}
}
var http = require('http');
var util = require('util');
var UUID = require('node-uuid');
var ssdp = require('peer-ssdp');
//var ssdp = require('ssdp');
var ROOT_DEVICE = "upnp:rootdevice";
var UPNP_VERSION = "UPnP/1.1";
var OS_NAME = os.type() || "unknown";
var OS_VERSION = os.release() || "0.0";
var INTERVAL = 10000;
var DEVICE_TEMPLATE = fs.readFileSync(__dirname + '/../xml/device-desc.xml', 'utf8');
var SERVICE_TEMPLATE = fs.readFileSync(__dirname + '/../xml/service-desc.xml', 'utf8');
var SOAP_REQ_TEMPLATE = fs.readFileSync(__dirname + '/../xml/soap-req.xml', 'utf8');
var SOAP_RSP_TEMPLATE = fs.readFileSync(__dirname + '/../xml/soap-rsp.xml', 'utf8');
var EVENT_TEMPLATE = fs.readFileSync(__dirname + '/../xml/event.xml', 'utf8');
var RENDER_DEVICE = ejs.compile(DEVICE_TEMPLATE);
var RENDER_SERVICE = ejs.compile(SERVICE_TEMPLATE);
var RENDER_SOAP_REQ = ejs.compile(SOAP_REQ_TEMPLATE);
var RENDER_SOAP_RSP = ejs.compile(SOAP_RSP_TEMPLATE);
var RENDER_EVENT = ejs.compile(EVENT_TEMPLATE);
var SSDP_ALL = "ssdp:all";
var UPnPError = function(message,code) {
Error.call(this);
Error.captureStackTrace(this, this.constructor);
this.name = "UPnPError";
this.message = message;
this.code = parseInt(code) || 0;
};
util.inherits(UPnPError, Error);
var createPeer = function(options){