Socket
Socket
Sign inDemoInstall

pug

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pug - npm Package Compare versions

Comparing version 2.0.0-rc.4 to 2.0.0

3

lib/index.js

@@ -106,4 +106,3 @@ 'use strict';

type: 'path',
line: token.line,
col: token.col,
loc: token.loc,
val: token.val + '.pug'

@@ -110,0 +109,0 @@ };

{
"name": "pug",
"description": "A clean, whitespace-sensitive template language for writing HTML",
"version": "2.0.0-rc.4",
"version": "2.0.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -23,10 +23,10 @@ "maintainers": [

"dependencies": {
"pug-code-gen": "^2.0.0",
"pug-filters": "^2.1.5",
"pug-lexer": "^3.1.0",
"pug-linker": "^3.0.3",
"pug-load": "^2.0.9",
"pug-parser": "^4.0.0",
"pug-runtime": "^2.0.3",
"pug-strip-comments": "^1.0.2"
"pug-code-gen": "^2.0.1",
"pug-filters": "^3.0.0",
"pug-lexer": "^4.0.0",
"pug-linker": "^3.0.4",
"pug-load": "^2.0.10",
"pug-parser": "^4.0.1",
"pug-runtime": "^2.0.4",
"pug-strip-comments": "^1.0.3"
},

@@ -33,0 +33,0 @@ "devDependencies": {

@@ -48,3 +48,3 @@ function pug_attr(t, e, n, f) {

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -51,0 +51,0 @@

@@ -78,3 +78,3 @@ function pug_attr(t, e, n, f) {

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -86,3 +86,3 @@

(function(Date) {
pug_html = pug_html + '<a href="/contact">contact</a><a class="button" href="/save">save</a><a foo="foo" bar="bar" baz="baz"></a><a foo="foo, bar, baz" bar="1"></a><a foo="((foo))" bar="1"></a><select><option value="foo" selected="selected">Foo</option><option selected="selected" value="bar">Bar</option></select><a foo="class:"></a><input pattern="\\S+"/><a href="/contact">contact</a><a class="button" href="/save">save</a><a foo="foo" bar="bar" baz="baz"></a><a foo="foo, bar, baz" bar="1"></a><a foo="((foo))" bar="1"></a><select><option value="foo" selected="selected">Foo</option><option selected="selected" value="bar">Bar</option></select><a foo="class:"></a><input pattern="\\S+"/><foo terse="true"></foo><foo' + pug_attr("date", new Date(0), true, false) + '></foo><foo abc="abc" def="def"></foo><foo abc="abc" def="def"></foo><foo abc="abc" def="def"></foo><foo abc="abc" def="def"></foo><foo abc="abc" def="def"></foo><foo abc="abc" def="def"></foo>';
pug_html = pug_html + '<a href="/contact">contact</a><a class="button" href="/save">save</a><a' + (pug_attr("foo", true, true, false) + pug_attr("bar", true, true, false) + pug_attr("baz", true, true, false)) + '></a><a foo="foo, bar, baz" bar="1"></a><a foo="((foo))" bar="1"></a><select><option' + (' value="foo"' + pug_attr("selected", true, true, false)) + ">Foo</option><option" + (pug_attr("selected", true, true, false) + ' value="bar"') + '>Bar</option></select><a foo="class:"></a><input pattern="\\S+"/><a href="/contact">contact</a><a class="button" href="/save">save</a><a' + (pug_attr("foo", true, true, false) + pug_attr("bar", true, true, false) + pug_attr("baz", true, true, false)) + '></a><a foo="foo, bar, baz" bar="1"></a><a foo="((foo))" bar="1"></a><select><option' + (' value="foo"' + pug_attr("selected", true, true, false)) + ">Foo</option><option" + (pug_attr("selected", true, true, false) + ' value="bar"') + '>Bar</option></select><a foo="class:"></a><input pattern="\\S+"/><foo terse="true"></foo><foo' + pug_attr("date", new Date(0), true, false) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo><foo" + (pug_attr("abc", true, true, false) + pug_attr("def", true, true, false)) + "></foo>";
var attrs = {

@@ -89,0 +89,0 @@ foo: "bar",

@@ -71,15 +71,17 @@ function pug_attr(t, e, n, f) {

function pug_merge(r, e) {
function pug_merge(e, r) {
if (1 === arguments.length) {
for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]);
for (var t = e[0], g = 1; g < e.length; g++) t = pug_merge(t, e[g]);
return t;
}
for (var g in e) if ("class" === g) {
var l = r[g] || [];
r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []);
} else if ("style" === g) {
var l = pug_style(r[g]), n = pug_style(e[g]);
r[g] = l + n;
} else r[g] = e[g];
return r;
for (var l in r) if ("class" === l) {
var n = e[l] || [];
e[l] = (Array.isArray(n) ? n : [ n ]).concat(r[l] || []);
} else if ("style" === l) {
var n = pug_style(e[l]);
n = n && ";" !== n[n.length - 1] ? n + ";" : n;
var a = pug_style(r[l]);
a = a && ";" !== a[a.length - 1] ? a + ";" : a, e[l] = n + a;
} else e[l] = r[l];
return e;
}

@@ -94,3 +96,3 @@

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -97,0 +99,0 @@

@@ -0,5 +1,43 @@

function pug_attr(t, e, n, f) {
return !1 !== e && null != e && (e || "class" !== t && "style" !== t) ? !0 === e ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()),
"string" == typeof e || (e = JSON.stringify(e), n || -1 === e.indexOf('"')) ? (n && (e = pug_escape(e)),
" " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "&#39;") + "'") : "";
}
function pug_escape(e) {
var a = "" + e, t = pug_match_html.exec(a);
if (!t) return e;
var r, c, n, s = "";
for (r = t.index, c = 0; r < a.length; r++) {
switch (a.charCodeAt(r)) {
case 34:
n = "&quot;";
break;
case 38:
n = "&amp;";
break;
case 60:
n = "&lt;";
break;
case 62:
n = "&gt;";
break;
default:
continue;
}
c !== r && (s += a.substring(c, r)), c = r + 1, s += n;
}
return c !== r ? s + a.substring(c, r) : s;
}
var pug_match_html = /["&<>]/;
function template(locals) {
var pug_html = "", pug_mixins = {}, pug_interp;
pug_html = pug_html + '<!DOCTYPE html><input type="checkbox" checked><input type="checkbox" checked><input type="checkbox">';
pug_html = pug_html + "<!DOCTYPE html><input" + (' type="checkbox"' + pug_attr("checked", true, true, true)) + '><input type="checkbox" checked><input type="checkbox">';
return pug_html;
}

@@ -71,15 +71,17 @@ function pug_attr(t, e, n, f) {

function pug_merge(r, e) {
function pug_merge(e, r) {
if (1 === arguments.length) {
for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]);
for (var t = e[0], g = 1; g < e.length; g++) t = pug_merge(t, e[g]);
return t;
}
for (var g in e) if ("class" === g) {
var l = r[g] || [];
r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []);
} else if ("style" === g) {
var l = pug_style(r[g]), n = pug_style(e[g]);
r[g] = l + n;
} else r[g] = e[g];
return r;
for (var l in r) if ("class" === l) {
var n = e[l] || [];
e[l] = (Array.isArray(n) ? n : [ n ]).concat(r[l] || []);
} else if ("style" === l) {
var n = pug_style(e[l]);
n = n && ";" !== n[n.length - 1] ? n + ";" : n;
var a = pug_style(r[l]);
a = a && ";" !== a[a.length - 1] ? a + ";" : a, e[l] = n + a;
} else e[l] = r[l];
return e;
}

@@ -94,3 +96,3 @@

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -97,0 +99,0 @@

@@ -71,15 +71,17 @@ function pug_attr(t, e, n, f) {

function pug_merge(r, e) {
function pug_merge(e, r) {
if (1 === arguments.length) {
for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]);
for (var t = e[0], g = 1; g < e.length; g++) t = pug_merge(t, e[g]);
return t;
}
for (var g in e) if ("class" === g) {
var l = r[g] || [];
r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []);
} else if ("style" === g) {
var l = pug_style(r[g]), n = pug_style(e[g]);
r[g] = l + n;
} else r[g] = e[g];
return r;
for (var l in r) if ("class" === l) {
var n = e[l] || [];
e[l] = (Array.isArray(n) ? n : [ n ]).concat(r[l] || []);
} else if ("style" === l) {
var n = pug_style(e[l]);
n = n && ";" !== n[n.length - 1] ? n + ";" : n;
var a = pug_style(r[l]);
a = a && ";" !== a[a.length - 1] ? a + ";" : a, e[l] = n + a;
} else e[l] = r[l];
return e;
}

@@ -94,3 +96,3 @@

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -97,0 +99,0 @@

@@ -71,15 +71,17 @@ function pug_attr(t, e, n, f) {

function pug_merge(r, e) {
function pug_merge(e, r) {
if (1 === arguments.length) {
for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]);
for (var t = e[0], g = 1; g < e.length; g++) t = pug_merge(t, e[g]);
return t;
}
for (var g in e) if ("class" === g) {
var l = r[g] || [];
r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []);
} else if ("style" === g) {
var l = pug_style(r[g]), n = pug_style(e[g]);
r[g] = l + n;
} else r[g] = e[g];
return r;
for (var l in r) if ("class" === l) {
var n = e[l] || [];
e[l] = (Array.isArray(n) ? n : [ n ]).concat(r[l] || []);
} else if ("style" === l) {
var n = pug_style(e[l]);
n = n && ";" !== n[n.length - 1] ? n + ";" : n;
var a = pug_style(r[l]);
a = a && ";" !== a[a.length - 1] ? a + ";" : a, e[l] = n + a;
} else e[l] = r[l];
return e;
}

@@ -94,3 +96,3 @@

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -97,0 +99,0 @@

@@ -0,5 +1,43 @@

function pug_attr(t, e, n, f) {
return !1 !== e && null != e && (e || "class" !== t && "style" !== t) ? !0 === e ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()),
"string" == typeof e || (e = JSON.stringify(e), n || -1 === e.indexOf('"')) ? (n && (e = pug_escape(e)),
" " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "&#39;") + "'") : "";
}
function pug_escape(e) {
var a = "" + e, t = pug_match_html.exec(a);
if (!t) return e;
var r, c, n, s = "";
for (r = t.index, c = 0; r < a.length; r++) {
switch (a.charCodeAt(r)) {
case 34:
n = "&quot;";
break;
case 38:
n = "&amp;";
break;
case 60:
n = "&lt;";
break;
case 62:
n = "&gt;";
break;
default:
continue;
}
c !== r && (s += a.substring(c, r)), c = r + 1, s += n;
}
return c !== r ? s + a.substring(c, r) : s;
}
var pug_match_html = /["&<>]/;
function template(locals) {
var pug_html = "", pug_mixins = {}, pug_interp;
pug_html = pug_html + '<html><audio preload="auto" autobuffer="autobuffer" controls="controls"><source src="foo"/><source src="bar"/></audio></html>';
pug_html = pug_html + "<html><audio" + (' preload="auto"' + pug_attr("autobuffer", true, true, false) + pug_attr("controls", true, true, false)) + '><source src="foo"/><source src="bar"/></audio></html>';
return pug_html;
}

@@ -78,3 +78,3 @@ function pug_attr(t, e, n, f) {

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -84,3 +84,3 @@

var pug_html = "", pug_mixins = {}, pug_interp;
pug_html = pug_html + '<html><head><style>body {\n padding: 50px;\n}</style></head><body><div style="color:red;background:green;"></div><div style="color:red;background:green;"></div><div' + pug_attrs({
pug_html = pug_html + '<html><head><style>body {\n padding: 50px;\n}</style></head><body><div style="color:red;background:green"></div><div style="color:red;background:green;"></div><div' + pug_attrs({
style: "color:red;background:green"

@@ -99,3 +99,3 @@ }, false) + "></div><div" + pug_attrs({

attributes: {
style: "color:red;background:green;"
style: "color:red;background:green"
}

@@ -102,0 +102,0 @@ });

@@ -78,3 +78,3 @@ function pug_attr(t, e, n, f) {

}
return r += "", ";" !== r[r.length - 1] ? r + ";" : r;
return r + "";
}

@@ -86,3 +86,3 @@

var foo = "bar";
pug_html = pug_html + "<" + tag + ">value</" + tag + "><" + tag + ' foo="bar">value</' + tag + "><" + (foo ? "a" : "li") + ' something="something">here</' + (foo ? "a" : "li") + ">";
pug_html = pug_html + "<" + tag + ">value</" + tag + "><" + tag + ' foo="bar">value</' + tag + "><" + (foo ? "a" : "li") + pug_attr("something", true, true, false) + ">here</" + (foo ? "a" : "li") + ">";
pug_mixins["item"] = pug_interp = function(icon) {

@@ -89,0 +89,0 @@ var block = this && this.block, attributes = this && this.attributes || {};

@@ -374,4 +374,4 @@ 'use strict';

assert.equal('<meta name="viewport" content="width=device-width"/>', pug.render("meta(name= 'viewport', content='width=device-width')"), 'Test attrs that contain attr separators');
assert.equal('<div style="color= white;"></div>', pug.render("div(style='color= white')"));
assert.equal('<div style="color: white;"></div>', pug.render("div(style='color: white')"));
assert.equal('<div style="color= white"></div>', pug.render("div(style='color= white')"));
assert.equal('<div style="color: white"></div>', pug.render("div(style='color: white')"));
assert.equal('<p class="foo"></p>', pug.render("p('class'='foo')"), 'Test keys with single quotes');

@@ -393,6 +393,6 @@ assert.equal('<p class="foo"></p>', pug.render("p(\"class\"= 'foo')"), 'Test keys with double quotes');

assert.equal('<div style="background: url(/images/test.png);">Foo</div>', pug.render("div(style= 'background: url(/images/test.png)') Foo"));
assert.equal('<div style="background = url(/images/test.png);">Foo</div>', pug.render("div(style= 'background = url(/images/test.png)') Foo"));
assert.equal('<div style="foo;">Foo</div>', pug.render("div(style= ['foo', 'bar'][0]) Foo"));
assert.equal('<div style="bar;">Foo</div>', pug.render("div(style= { foo: 'bar', baz: 'raz' }['foo']) Foo"));
assert.equal('<div style="background: url(/images/test.png)">Foo</div>', pug.render("div(style= 'background: url(/images/test.png)') Foo"));
assert.equal('<div style="background = url(/images/test.png)">Foo</div>', pug.render("div(style= 'background = url(/images/test.png)') Foo"));
assert.equal('<div style="foo">Foo</div>', pug.render("div(style= ['foo', 'bar'][0]) Foo"));
assert.equal('<div style="bar">Foo</div>', pug.render("div(style= { foo: 'bar', baz: 'raz' }['foo']) Foo"));
assert.equal('<a href="def">Foo</a>', pug.render("a(href='abcdefg'.substr(3,3)) Foo"));

@@ -399,0 +399,0 @@ assert.equal('<a href="def">Foo</a>', pug.render("a(href={test: 'abcdefg'}.test.substr(3,3)) Foo"));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc