Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Release 1.7.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Dec 16, 2013
1 parent dc49b99 commit 7aa0e07
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .npmignore
Expand Up @@ -7,7 +7,5 @@ CVS/
*.bak
.DS_Store
npm-debug.log
test/
src/
test.js
CHANGELOG.md

3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
# jade-brunch 1.7.4 (16 december 2013)
* New runtime.

# jade-brunch 1.7.3 (20 November 2013)
* Support watching of plain-html partials referenced in jade source files.

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "jade-brunch",
"version": "1.7.3",
"version": "1.7.4",
"description": "Adds Jade support to brunch.",
"author": "Paul Miller (http://paulmillr.com/)",
"homepage": "https://github.com/brunch/jade-brunch",
Expand Down
61 changes: 45 additions & 16 deletions vendor/runtime.js
@@ -1,5 +1,6 @@
(function(e){if("function"==typeof bootstrap)bootstrap("jade",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJade=e}else"undefined"!=typeof window?window.jade=e():global.jade=e()})(function(){var define,ses,bootstrap,module,exports;
return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

jade = (function(exports){
/*!
* Jade - runtime
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
Expand Down Expand Up @@ -53,9 +54,7 @@ exports.merge = function merge(a, b) {
bc = bc || [];
if (!Array.isArray(ac)) ac = [ac];
if (!Array.isArray(bc)) bc = [bc];
ac = ac.filter(nulls);
bc = bc.filter(nulls);
a['class'] = ac.concat(bc).join(' ');
a['class'] = ac.concat(bc).filter(nulls);
}

for (var key in b) {
Expand All @@ -70,13 +69,25 @@ exports.merge = function merge(a, b) {
/**
* Filter null `val`s.
*
* @param {Mixed} val
* @return {Mixed}
* @param {*} val
* @return {Boolean}
* @api private
*/

function nulls(val) {
return val != null;
return val != null && val !== '';
}

/**
* join array as classes.
*
* @param {*} val
* @return {String}
* @api private
*/

function joinClasses(val) {
return Array.isArray(val) ? val.map(joinClasses).filter(nulls).join(' ') : val;
}

/**
Expand Down Expand Up @@ -110,8 +121,16 @@ exports.attrs = function attrs(obj, escaped){
}
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
buf.push(key + "='" + JSON.stringify(val) + "'");
} else if ('class' == key && Array.isArray(val)) {
buf.push(key + '="' + exports.escape(val.join(' ')) + '"');
} else if ('class' == key) {
if (escaped && escaped[key]){
if (val = exports.escape(joinClasses(val))) {
buf.push(key + '="' + val + '"');
}
} else {
if (val = joinClasses(val)) {
buf.push(key + '="' + val + '"');
}
}
} else if (escaped && escaped[key]) {
buf.push(key + '="' + exports.escape(val) + '"');
} else {
Expand All @@ -133,7 +152,7 @@ exports.attrs = function attrs(obj, escaped){

exports.escape = function escape(html){
return String(html)
.replace(/&(?!(\w+|\#\d+);)/g, '&amp;')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
Expand All @@ -149,11 +168,18 @@ exports.escape = function escape(html){
* @api private
*/

exports.rethrow = function rethrow(err, filename, lineno){
if (!filename) throw err;

exports.rethrow = function rethrow(err, filename, lineno, str){
if (!(err instanceof Error)) throw err;
if ((typeof window != 'undefined' || !filename) && !str) {
err.message += ' on line ' + lineno;
throw err;
}
try {
str = str || require('fs').readFileSync(filename, 'utf8')
} catch (ex) {
rethrow(err, null, lineno)
}
var context = 3
, str = require('fs').readFileSync(filename, 'utf8')
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
Expand All @@ -174,6 +200,9 @@ exports.rethrow = function rethrow(err, filename, lineno){
throw err;
};

return exports;
},{"fs":2}],2:[function(require,module,exports){
// nothing to see here... no file methods for the browser

})({});
},{}]},{},[1])(1)
});
;

0 comments on commit 7aa0e07

Please sign in to comment.