(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pug = f()}})(function(){var define,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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o|Object.|string)} val * @param {?Array.} escaping * @return {String} */ exports.classes = pug_classes; function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); classString = classString + padding + className; padding = ' '; } return classString; } function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { classString = classString + padding + key; padding = ' '; } } return classString; } function pug_classes(val, escaping) { if (Array.isArray(val)) { return pug_classes_array(val, escaping); } else if (val && typeof val === 'object') { return pug_classes_object(val); } else { return val || ''; } } /** * Convert object or string to a string of CSS styles delimited by a semicolon. * * @param {(Object.|string)} val * @return {String} */ exports.style = pug_style; function pug_style(val) { if (!val) return ''; if (typeof val === 'object') { var out = '', delim = ''; for (var style in val) { /* istanbul ignore else */ if (pug_has_own_property.call(val, style)) { out = out + delim + style + ':' + val[style]; delim = ';'; } } return out; } else { val = '' + val; if (val[val.length - 1] === ';') return val.slice(0, -1); return val; } }; /** * Render the given attribute. * * @param {String} key * @param {String} val * @param {Boolean} escaped * @param {Boolean} terse * @return {String} */ exports.attr = pug_attr; function pug_attr(key, val, escaped, terse) { if (val === false || val == null || !val && (key === 'class' || key === 'style')) { return ''; } if (val === true) { return ' ' + (terse ? key : key + '="' + key + '"'); } if (typeof val.toJSON === 'function') { val = val.toJSON(); } if (typeof val !== 'string') { val = JSON.stringify(val); if (!escaped && val.indexOf('"') !== -1) { return ' ' + key + '=\'' + val.replace(/'/g, ''') + '\''; } } if (escaped) val = pug_escape(val); return ' ' + key + '="' + val + '"'; }; /** * Render the given attributes object. * * @param {Object} obj * @param {Object} terse whether to use HTML5 terse boolean attributes * @return {String} */ exports.attrs = pug_attrs; function pug_attrs(obj, terse){ var attrs = ''; for (var key in obj) { if (pug_has_own_property.call(obj, key)) { var val = obj[key]; if ('class' === key) { val = pug_classes(val); attrs = pug_attr(key, val, false, terse) + attrs; continue; } if ('style' === key) { val = pug_style(val); } attrs += pug_attr(key, val, false, terse); } } return attrs; }; /** * Escape the given string of `html`. * * @param {String} html * @return {String} * @api private */ var pug_match_html = /["&<>]/; exports.escape = pug_escape; function pug_escape(_html){ var html = '' + _html; var regexResult = pug_match_html.exec(html); if (!regexResult) return _html; var result = ''; var i, lastIndex, escape; for (i = regexResult.index, lastIndex = 0; i < html.length; i++) { switch (html.charCodeAt(i)) { case 34: escape = '"'; break; case 38: escape = '&'; break; case 60: escape = '<'; break; case 62: escape = '>'; break; default: continue; } if (lastIndex !== i) result += html.substring(lastIndex, i); lastIndex = i + 1; result += escape; } if (lastIndex !== i) return result + html.substring(lastIndex, i); else return result; }; /** * Re-throw the given `err` in context to the * the pug in `filename` at the given `lineno`. * * @param {Error} err * @param {String} filename * @param {String} lineno * @param {String} str original source * @api private */ exports.rethrow = pug_rethrow; function pug_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) { pug_rethrow(err, null, lineno) } var context = 3 , lines = str.split('\n') , start = Math.max(lineno - context, 0) , end = Math.min(lines.length, lineno + context); // Error context var context = lines.slice(start, end).map(function(line, i){ var curr = i + start + 1; return (curr == lineno ? ' > ' : ' ') + curr + '| ' + line; }).join('\n'); // Alter exception message err.path = filename; err.message = (filename || 'Pug') + ':' + lineno + '\n' + context + '\n\n' + err.message; throw err; }; },{"fs":2}],2:[function(require,module,exports){ },{}]},{},[1])(1) });