UNPKG

slush-gladius

Version:

Slush generator for bleeding edge weapo... ehr, applications!

25 lines (23 loc) 4.3 kB
// The MIT License) // // Copyright (c) 2009-2014 TJ Holowaychuk <tj@vision-media.ca> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // 'Software'), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(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);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(_dereq_,module,exports){"use strict";exports.merge=function merge(a,b){if(arguments.length===1){var attrs=a[0];for(var i=1;i<a.length;i++){attrs=merge(attrs,a[i])}return attrs}var ac=a["class"];var bc=b["class"];if(ac||bc){ac=ac||[];bc=bc||[];if(!Array.isArray(ac))ac=[ac];if(!Array.isArray(bc))bc=[bc];a["class"]=ac.concat(bc).filter(nulls)}for(var key in b){if(key!="class"){a[key]=b[key]}}return a};function nulls(val){return val!=null&&val!==""}exports.joinClasses=joinClasses;function joinClasses(val){return Array.isArray(val)?val.map(joinClasses).filter(nulls).join(" "):val}exports.cls=function cls(classes,escaped){var buf=[];for(var i=0;i<classes.length;i++){if(escaped&&escaped[i]){buf.push(exports.escape(joinClasses([classes[i]])))}else{buf.push(joinClasses(classes[i]))}}var text=joinClasses(buf);if(text.length){return' class="'+text+'"'}else{return""}};exports.attr=function attr(key,val,escaped,terse){if("boolean"==typeof val||null==val){if(val){return" "+(terse?key:key+'="'+key+'"')}else{return""}}else if(0==key.indexOf("data")&&"string"!=typeof val){return" "+key+"='"+JSON.stringify(val).replace(/'/g,"&apos;")+"'"}else if(escaped){return" "+key+'="'+exports.escape(val)+'"'}else{return" "+key+'="'+val+'"'}};exports.attrs=function attrs(obj,terse){var buf=[];var keys=Object.keys(obj);if(keys.length){for(var i=0;i<keys.length;++i){var key=keys[i],val=obj[key];if("class"==key){if(val=joinClasses(val)){buf.push(" "+key+'="'+val+'"')}}else{buf.push(exports.attr(key,val,false,terse))}}}return buf.join("")};exports.escape=function escape(html){var result=String(html).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");if(result===""+html)return html;else return result};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||_dereq_("fs").readFileSync(filename,"utf8")}catch(ex){rethrow(err,null,lineno)}var context=3,lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}},{fs:2}],2:[function(_dereq_,module,exports){},{}]},{},[1])(1)});