mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Switched to using submodules from raptor-util
This commit is contained in:
parent
bb7d7d7692
commit
ad97b90224
@ -1,19 +1,10 @@
|
||||
var xmlUtil = require('raptor-xml/util');
|
||||
var escapeXml = xmlUtil.escapeXml;
|
||||
var escapeXmlAttr = xmlUtil.escapeXmlAttr;
|
||||
var escapeXml = require('raptor-util/escapeXml');
|
||||
var escapeXmlAttr = escapeXml.attr;
|
||||
var runtime = require('./raptor-templates'); // Circular dependnecy, but that is okay
|
||||
var extend = require('raptor-util').extend;
|
||||
|
||||
function attr(name, value, escapeXml) {
|
||||
if (value === null || value === true) {
|
||||
value = '';
|
||||
} else if (value === undefined || value === false || typeof value === 'string' && value.trim() === '') {
|
||||
return '';
|
||||
} else {
|
||||
value = '="' + (escapeXml === false ? value : escapeXmlAttr(value)) + '"';
|
||||
}
|
||||
return ' ' + name + value;
|
||||
}
|
||||
var extend = require('raptor-util/extend');
|
||||
var attr = require('raptor-util/attr');
|
||||
var attrs = require('raptor-util/attrs');
|
||||
var forEach = require('raptor-util/forEach');
|
||||
|
||||
function notEmpty(o) {
|
||||
if (Array.isArray(o) === true) {
|
||||
@ -51,7 +42,7 @@ module.exports = {
|
||||
callback(o || '', loopStatus);
|
||||
}
|
||||
},
|
||||
f: require('raptor-util').forEach,
|
||||
f: forEach,
|
||||
fl: function (array, func) {
|
||||
if (array != null) {
|
||||
if (!Array.isArray(array)) {
|
||||
@ -85,15 +76,7 @@ module.exports = {
|
||||
},
|
||||
a: attr,
|
||||
|
||||
as: function(_attrs, value, escapeXml) {
|
||||
var out = '';
|
||||
for (var attrName in _attrs) {
|
||||
if (_attrs.hasOwnProperty(attrName)) {
|
||||
out += attr(attrName, _attrs[attrName]);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
},
|
||||
as: attrs,
|
||||
|
||||
/* Helpers that require a context below: */
|
||||
t: function (context, handler, props, body, namespacedProps) {
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
* in the {@link raptor/templating/compiler} module.
|
||||
*/
|
||||
var renderContext = require('raptor-render-context');
|
||||
var createError = require('raptor-util').createError;
|
||||
var createError = require('raptor-util/createError');
|
||||
var Context = renderContext.Context;
|
||||
var helpers = require('./helpers');
|
||||
var loader = require('./loader');
|
||||
@ -88,7 +88,4 @@ exports.createContext = function(writer) {
|
||||
|
||||
|
||||
exports.helpers = helpers;
|
||||
|
||||
exports.stream = require('./render-stream')(exports);
|
||||
|
||||
|
||||
exports.stream = require('./render-stream')(exports);
|
||||
@ -50,7 +50,7 @@ module.exports = function(runtime) {
|
||||
}
|
||||
};
|
||||
|
||||
require('raptor-util').inherit(Readable, stream.Readable);
|
||||
require('raptor-util/inherit')(Readable, stream.Readable);
|
||||
|
||||
return function stream(templatePath, data) {
|
||||
return new Readable(templatePath, data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user