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 = require('raptor-util/escapeXml');
|
||||||
var escapeXml = xmlUtil.escapeXml;
|
var escapeXmlAttr = escapeXml.attr;
|
||||||
var escapeXmlAttr = xmlUtil.escapeXmlAttr;
|
|
||||||
var runtime = require('./raptor-templates'); // Circular dependnecy, but that is okay
|
var runtime = require('./raptor-templates'); // Circular dependnecy, but that is okay
|
||||||
var extend = require('raptor-util').extend;
|
var extend = require('raptor-util/extend');
|
||||||
|
var attr = require('raptor-util/attr');
|
||||||
function attr(name, value, escapeXml) {
|
var attrs = require('raptor-util/attrs');
|
||||||
if (value === null || value === true) {
|
var forEach = require('raptor-util/forEach');
|
||||||
value = '';
|
|
||||||
} else if (value === undefined || value === false || typeof value === 'string' && value.trim() === '') {
|
|
||||||
return '';
|
|
||||||
} else {
|
|
||||||
value = '="' + (escapeXml === false ? value : escapeXmlAttr(value)) + '"';
|
|
||||||
}
|
|
||||||
return ' ' + name + value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function notEmpty(o) {
|
function notEmpty(o) {
|
||||||
if (Array.isArray(o) === true) {
|
if (Array.isArray(o) === true) {
|
||||||
@ -51,7 +42,7 @@ module.exports = {
|
|||||||
callback(o || '', loopStatus);
|
callback(o || '', loopStatus);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
f: require('raptor-util').forEach,
|
f: forEach,
|
||||||
fl: function (array, func) {
|
fl: function (array, func) {
|
||||||
if (array != null) {
|
if (array != null) {
|
||||||
if (!Array.isArray(array)) {
|
if (!Array.isArray(array)) {
|
||||||
@ -85,15 +76,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
a: attr,
|
a: attr,
|
||||||
|
|
||||||
as: function(_attrs, value, escapeXml) {
|
as: attrs,
|
||||||
var out = '';
|
|
||||||
for (var attrName in _attrs) {
|
|
||||||
if (_attrs.hasOwnProperty(attrName)) {
|
|
||||||
out += attr(attrName, _attrs[attrName]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
},
|
|
||||||
|
|
||||||
/* Helpers that require a context below: */
|
/* Helpers that require a context below: */
|
||||||
t: function (context, handler, props, body, namespacedProps) {
|
t: function (context, handler, props, body, namespacedProps) {
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
* in the {@link raptor/templating/compiler} module.
|
* in the {@link raptor/templating/compiler} module.
|
||||||
*/
|
*/
|
||||||
var renderContext = require('raptor-render-context');
|
var renderContext = require('raptor-render-context');
|
||||||
var createError = require('raptor-util').createError;
|
var createError = require('raptor-util/createError');
|
||||||
var Context = renderContext.Context;
|
var Context = renderContext.Context;
|
||||||
var helpers = require('./helpers');
|
var helpers = require('./helpers');
|
||||||
var loader = require('./loader');
|
var loader = require('./loader');
|
||||||
@ -88,7 +88,4 @@ exports.createContext = function(writer) {
|
|||||||
|
|
||||||
|
|
||||||
exports.helpers = helpers;
|
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 function stream(templatePath, data) {
|
||||||
return new Readable(templatePath, data);
|
return new Readable(templatePath, data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user