diff --git a/ajax/libs/clientside-haml-js/5.1/haml.js b/ajax/libs/clientside-haml-js/5.1/haml.js index cdc5845142ed3a..a51889c51c9c1c 100644 --- a/ajax/libs/clientside-haml-js/5.1/haml.js +++ b/ajax/libs/clientside-haml-js/5.1/haml.js @@ -1,4 +1,5 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 + /* clientside HAML compiler for Javascript and Coffeescript (Version 5) @@ -8,7 +9,7 @@ (function() { - var Buffer, CodeGenerator, CoffeeCodeGenerator, HamlRuntime, JsCodeGenerator, ProductionJsCodeGenerator, Tokeniser, filters, root, _ref, + var Buffer, CodeGenerator, CoffeeCodeGenerator, HamlRuntime, JsCodeGenerator, ProductionJsCodeGenerator, Tokeniser, filters, root, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; @@ -21,20 +22,19 @@ HamlRuntime = { /* - Taken from underscore.string.js escapeHTML, and replace the apos entity with character 39 so that it renders - correctly in IE7 + Taken from underscore.string.js escapeHTML, and replace the apos entity with character 39 so that it renders + correctly in IE7 */ escapeHTML: function(str) { return String(str || '').replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, "'"); }, /* - Provides the implementation to preserve the whitespace as per the HAML reference + Provides the implementation to preserve the whitespace as per the HAML reference */ perserveWhitespace: function(str) { var i, out, re, result; - re = /<[a-zA-Z]+>[^<]*<\/[a-zA-Z]+>/g; out = ''; i = 0; @@ -53,12 +53,11 @@ return out; }, /* - Generates a error message including the current line in the source where the error occurred + Generates a error message including the current line in the source where the error occurred */ templateError: function(lineNumber, characterNumber, currentLine, error) { var i, message; - message = error + " at line " + lineNumber + " and character " + characterNumber + ":\n" + currentLine + '\n'; i = 0; while (i < characterNumber - 1) { @@ -69,30 +68,28 @@ return message; }, /* - Generates the attributes for the element by combining all the various sources together + Generates the attributes for the element by combining all the various sources together */ generateElementAttributes: function(context, id, classes, objRefFn, attrList, attrFunction, lineNumber, characterNumber, currentLine) { - var attr, attributes, className, e, ex, hash, html, object, objectId, value; - + var attr, attributes, className, dataAttr, dataAttributes, hash, html, object, objectId; attributes = {}; attributes = this.combineAttributes(attributes, 'id', id); if (classes.length > 0 && classes[0].length > 0) { attributes = this.combineAttributes(attributes, 'class', classes); } - if (attrList != null) { + if (attrList) { for (attr in attrList) { if (!__hasProp.call(attrList, attr)) continue; - value = attrList[attr]; - attributes = this.combineAttributes(attributes, attr, value); + attributes = this.combineAttributes(attributes, attr, attrList[attr]); } } - if (objRefFn != null) { + if (objRefFn) { try { object = objRefFn.call(context, context); - if (object != null) { + if (object) { objectId = null; - if (object.id != null) { + if (object.id) { objectId = object.id; } else if (object.get) { objectId = object.get('id'); @@ -106,24 +103,28 @@ } attributes = this.combineAttributes(attributes, 'class', className); } - } catch (_error) { - e = _error; + } catch (e) { throw haml.HamlRuntime.templateError(lineNumber, characterNumber, currentLine, "Error evaluating object reference - " + e); } } - if (attrFunction != null) { + if (attrFunction) { try { hash = attrFunction.call(context, context); - if (hash != null) { - hash = this._flattenHash(null, hash); + if (hash) { for (attr in hash) { if (!__hasProp.call(hash, attr)) continue; - value = hash[attr]; - attributes = this.combineAttributes(attributes, attr, value); + if (attr === 'data') { + dataAttributes = hash[attr]; + for (dataAttr in dataAttributes) { + if (!__hasProp.call(dataAttributes, dataAttr)) continue; + attributes = this.combineAttributes(attributes, 'data-' + dataAttr, dataAttributes[dataAttr]); + } + } else { + attributes = this.combineAttributes(attributes, attr, hash[attr]); + } } } - } catch (_error) { - ex = _error; + } catch (ex) { throw haml.HamlRuntime.templateError(lineNumber, characterNumber, currentLine, "Error evaluating attribute hash - " + ex); } } @@ -145,12 +146,11 @@ return html; }, /* - Returns a white space string with a length of indent * 2 + Returns a white space string with a length of indent * 2 */ indentText: function(indent) { var i, text; - text = ''; i = 0; while (i < indent) { @@ -160,13 +160,12 @@ return text; }, /* - Combines the attributes in the attributres hash with the given attribute and value - ID, FOR and CLASS attributes will expand to arrays when multiple values are provided + Combines the attributes in the attributres hash with the given attribute and value + ID, FOR and CLASS attributes will expand to arrays when multiple values are provided */ combineAttributes: function(attributes, attrName, attrValue) { var classes; - if (haml.hasValue(attrValue)) { if (attrName === 'id' && attrValue.toString().length > 0) { if (attributes && attributes.id instanceof Array) { @@ -214,45 +213,6 @@ } } return attributes; - }, - /* - Flattens a deeply nested hash into a single hash by combining the keys with a minus - */ - - _flattenHash: function(rootKey, object) { - var attr, flattenedValue, key, keys, newKey, newValue, result, value; - - result = {}; - if (this._isHash(object)) { - for (attr in object) { - if (!__hasProp.call(object, attr)) continue; - value = object[attr]; - keys = []; - if (rootKey != null) { - keys.push(rootKey); - } - keys.push(attr); - key = keys.join('-'); - flattenedValue = this._flattenHash(key, value); - if (this._isHash(flattenedValue)) { - for (newKey in flattenedValue) { - if (!__hasProp.call(flattenedValue, newKey)) continue; - newValue = flattenedValue[newKey]; - result[newKey] = newValue; - } - } else { - result[key] = flattenedValue; - } - } - } else if (rootKey != null) { - result[rootKey] = object; - } else { - result = object; - } - return result; - }, - _isHash: function(object) { - return (object != null) && typeof object === 'object' && !(object instanceof Array || object instanceof Date); } }; @@ -262,6 +222,7 @@ Tokeniser = (function() { + Tokeniser.prototype.currentLineMatcher = /[^\n]*/g; Tokeniser.prototype.tokenMatchers = { @@ -284,7 +245,6 @@ function Tokeniser(options) { var errorFn, successFn, template, _this = this; - this.buffer = null; this.bufferIndex = null; this.prevToken = null; @@ -322,13 +282,12 @@ } /* - Try to match a token with the given regexp + Try to match a token with the given regexp */ Tokeniser.prototype.matchToken = function(matcher) { var result; - matcher.lastIndex = this.bufferIndex; result = matcher.exec(this.buffer); if ((result != null ? result.index : void 0) === this.bufferIndex) { @@ -337,13 +296,12 @@ }; /* - Match a multi-character token + Match a multi-character token */ Tokeniser.prototype.matchMultiCharToken = function(matcher, token, tokenStr) { var matched, _ref; - if (!this.token) { matched = this.matchToken(matcher); if (matched) { @@ -356,7 +314,7 @@ }; /* - Match a single character token + Match a single character token */ @@ -370,13 +328,12 @@ }; /* - Match and return the next token in the input buffer + Match and return the next token in the input buffer */ Tokeniser.prototype.getNextToken = function() { var braceCount, ch, ch1, characterNumberStart, i, lineNumberStart, str; - if (isNaN(this.bufferIndex)) { throw haml.HamlRuntime.templateError(this.lineNumber, this.characterNumber, this.currentLine, "An internal parser error has occurred in the HAML parser"); } @@ -561,13 +518,12 @@ }; /* - Look ahead a number of tokens and return the token found + Look ahead a number of tokens and return the token found */ Tokeniser.prototype.lookAhead = function(numberOfTokens) { var bufferIndex, characterNumber, currentLine, currentToken, i, lineNumber, prevToken, token; - token = null; if (numberOfTokens > 0) { currentToken = this.token; @@ -591,7 +547,7 @@ }; /* - Initilise the line and character counters + Initilise the line and character counters */ @@ -604,13 +560,12 @@ }; /* - Returns the current line in the input buffer + Returns the current line in the input buffer */ Tokeniser.prototype.getCurrentLine = function(index) { var line; - this.currentLineMatcher.lastIndex = this.bufferIndex + (index != null ? index : 0); line = this.currentLineMatcher.exec(this.buffer); if (line) { @@ -621,7 +576,7 @@ }; /* - Returns an error string filled out with the line and character counters + Returns an error string filled out with the line and character counters */ @@ -630,13 +585,12 @@ }; /* - Skips to the end of the line and returns the string that was skipped + Skips to the end of the line and returns the string that was skipped */ Tokeniser.prototype.skipToEOLorEOF = function() { var contents, line, text; - text = ''; if (!(this.token.eof || this.token.eol)) { if (!this.token.unknown) { @@ -662,13 +616,12 @@ }; /* - Parses a multiline code block and returns the parsed text + Parses a multiline code block and returns the parsed text */ Tokeniser.prototype.parseMultiLine = function() { var contents, line, text; - text = ''; while (this.token.continueLine) { this.currentLineMatcher.lastIndex = this.bufferIndex; @@ -686,13 +639,12 @@ }; /* - Advances the input buffer pointer by a number of characters, updating the line and character counters + Advances the input buffer pointer by a number of characters, updating the line and character counters */ Tokeniser.prototype.advanceCharsInBuffer = function(numChars) { var ch, ch1, i; - i = 0; while (i < numChars) { ch = this.buffer.charCodeAt(this.bufferIndex + i); @@ -715,7 +667,7 @@ }; /* - Returns the current line and character counters + Returns the current line and character counters */ @@ -728,7 +680,7 @@ }; /* - Pushes back the current token onto the front of the input buffer + Pushes back the current token onto the front of the input buffer */ @@ -740,7 +692,7 @@ }; /* - Is the current token an end of line or end of input buffer + Is the current token an end of line or end of input buffer */ @@ -758,6 +710,7 @@ Buffer = (function() { + function Buffer(generator) { this.generator = generator; this.buffer = ''; @@ -765,25 +718,23 @@ } Buffer.prototype.append = function(str) { - if ((this.generator != null) && this.buffer.length === 0) { + if (this.buffer.length === 0) { this.generator.mark(); } - if ((str != null ? str.length : void 0) > 0) { + if (str && str.length > 0) { return this.buffer += str; } }; Buffer.prototype.appendToOutputBuffer = function(str) { - if ((str != null ? str.length : void 0) > 0) { + if (str && str.length > 0) { this.flush(); return this.outputBuffer += str; } }; Buffer.prototype.flush = function() { - var _ref; - - if (((_ref = this.buffer) != null ? _ref.length : void 0) > 0) { + if (this.buffer && this.buffer.length > 0) { this.outputBuffer += this.generator.generateFlush(this.buffer); } return this.buffer = ''; @@ -795,12 +746,11 @@ Buffer.prototype.trimWhitespace = function() { var ch, i; - if (this.buffer.length > 0) { i = this.buffer.length - 1; while (i > 0) { ch = this.buffer.charAt(i); - if (this._isWhitespace(ch)) { + if (ch === ' ' || ch === '\t' || ch === '\n') { i--; } else if (i > 1 && (ch === 'n' || ch === 't') && (this.buffer.charAt(i - 1) === '\\')) { i -= 2; @@ -810,16 +760,12 @@ } if (i > 0 && i < this.buffer.length - 1) { return this.buffer = this.buffer.substring(0, i + 1); - } else if (i === 0 && this._isWhitespace(this.buffer.charAt(0))) { + } else if (i === 0) { return this.buffer = ''; } } }; - Buffer.prototype._isWhitespace = function(ch) { - return ch === ' ' || ch === '\t' || ch === '\n'; - }; - return Buffer; })(); @@ -830,6 +776,7 @@ CodeGenerator = (function() { + function CodeGenerator() {} CodeGenerator.prototype.embeddedCodeBlockMatcher = /#{([^}]*)}/g; @@ -844,6 +791,7 @@ JsCodeGenerator = (function(_super) { + __extends(JsCodeGenerator, _super); function JsCodeGenerator() { @@ -851,7 +799,7 @@ } /* - Append a line with embedded javascript code + Append a line with embedded javascript code */ @@ -874,7 +822,7 @@ }; /* - Initilising the output buffer with any variables or code + Initilising the output buffer with any variables or code */ @@ -883,7 +831,7 @@ }; /* - Flush and close the output buffer and return the contents + Flush and close the output buffer and return the contents */ @@ -893,7 +841,7 @@ }; /* - Append a line of code to the output buffer + Append a line of code to the output buffer */ @@ -905,7 +853,7 @@ }; /* - Does the current line end with a function declaration? + Does the current line end with a function declaration? */ @@ -914,7 +862,7 @@ }; /* - Does the current line end with a starting code block + Does the current line end with a starting code block */ @@ -923,7 +871,7 @@ }; /* - Generate the code to close off a code block + Generate the code to close off a code block */ @@ -935,7 +883,7 @@ }; /* - Generate the code to close off a function parameter + Generate the code to close off a function parameter */ @@ -947,7 +895,7 @@ }; /* - Generate the code for dynamic attributes ({} form) + Generate the code for dynamic attributes ({} form) */ @@ -964,13 +912,12 @@ }; /* - Clean any reserved words in the given hash + Clean any reserved words in the given hash */ JsCodeGenerator.prototype.replaceReservedWordsInHash = function(hash) { var reservedWord, resultHash, _i, _len, _ref; - resultHash = hash; _ref = ['class', 'for']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -981,7 +928,7 @@ }; /* - Escape the line so it is safe to put into a javascript string + Escape the line so it is safe to put into a javascript string */ @@ -990,23 +937,20 @@ }; /* - Generate a function from the function body + Generate a function from the function body */ JsCodeGenerator.prototype.generateJsFunction = function(functionBody) { - var e; - try { return new Function('context', functionBody); - } catch (_error) { - e = _error; + } catch (e) { throw "Incorrect embedded code has resulted in an invalid Haml function - " + e + "\nGenerated Function:\n" + functionBody; } }; /* - Generate the code required to support a buffer flush + Generate the code required to support a buffer flush */ @@ -1015,7 +959,7 @@ }; /* - Set the current indent level + Set the current indent level */ @@ -1024,14 +968,14 @@ }; /* - Save the current indent level if required + Save the current indent level if required */ JsCodeGenerator.prototype.mark = function() {}; /* - Append the text contents to the buffer, expanding any embedded code + Append the text contents to the buffer, expanding any embedded code */ @@ -1047,13 +991,12 @@ }; /* - Interpolate any embedded code in the text + Interpolate any embedded code in the text */ JsCodeGenerator.prototype.interpolateString = function(text, currentParsePoint, options) { var index, precheedingChar, precheedingChar2, result; - index = 0; result = this.embeddedCodeBlockMatcher.exec(text); while (result) { @@ -1081,7 +1024,7 @@ }; /* - process text based on escape and preserve flags + process text based on escape and preserve flags */ @@ -1105,15 +1048,15 @@ ProductionJsCodeGenerator = (function(_super) { + __extends(ProductionJsCodeGenerator, _super); function ProductionJsCodeGenerator() { - _ref = ProductionJsCodeGenerator.__super__.constructor.apply(this, arguments); - return _ref; + return ProductionJsCodeGenerator.__super__.constructor.apply(this, arguments); } /* - Append a line with embedded javascript code + Append a line with embedded javascript code */ @@ -1131,7 +1074,7 @@ }; /* - Generate the code for dynamic attributes ({} form) + Generate the code for dynamic attributes ({} form) */ @@ -1148,7 +1091,7 @@ }; /* - Initilising the output buffer with any variables or code + Initilising the output buffer with any variables or code */ @@ -1166,6 +1109,7 @@ CoffeeCodeGenerator = (function(_super) { + __extends(CoffeeCodeGenerator, _super); function CoffeeCodeGenerator() { @@ -1174,7 +1118,6 @@ CoffeeCodeGenerator.prototype.appendEmbeddedCode = function(indentText, expression, escapeContents, perserveWhitespace, currentParsePoint) { var indent; - this.outputBuffer.flush(); indent = this.calcCodeIndent(); this.outputBuffer.appendToOutputBuffer(indent + "try\n"); @@ -1228,7 +1171,6 @@ CoffeeCodeGenerator.prototype.generateCodeForDynamicAttributes = function(id, classes, attributeList, attributeHash, objectRef, currentParsePoint) { var indent; - this.outputBuffer.flush(); indent = this.calcCodeIndent(); if (attributeHash.length > 0) { @@ -1242,25 +1184,23 @@ }; CoffeeCodeGenerator.prototype.replaceReservedWordsInHash = function(hash) { - var reservedWord, resultHash, _i, _len, _ref1; - + var reservedWord, resultHash, _i, _len, _ref; resultHash = hash; - _ref1 = ['class', 'for']; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - reservedWord = _ref1[_i]; + _ref = ['class', 'for']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + reservedWord = _ref[_i]; resultHash = resultHash.replace(reservedWord + ':', "'" + reservedWord + "':"); } return resultHash; }; /* - Escapes the string for insertion into the generated code. Embedded code blocks in strings must not be escaped + Escapes the string for insertion into the generated code. Embedded code blocks in strings must not be escaped */ CoffeeCodeGenerator.prototype.escapeCode = function(str) { var index, outString, precheedingChar, precheedingChar2, result; - outString = ''; index = 0; result = this.embeddedCodeBlockMatcher.exec(str); @@ -1294,20 +1234,18 @@ }; /* - Generates the javascript function by compiling the given code with coffeescript compiler + Generates the javascript function by compiling the given code with coffeescript compiler */ CoffeeCodeGenerator.prototype.generateJsFunction = function(functionBody) { - var e, fn; - + var fn; try { fn = CoffeeScript.compile(functionBody, { bare: true }); return new Function(fn); - } catch (_error) { - e = _error; + } catch (e) { throw "Incorrect embedded code has resulted in an invalid Haml function - " + e + "\nGenerated Function:\n" + fn; } }; @@ -1325,11 +1263,10 @@ }; CoffeeCodeGenerator.prototype.calcCodeIndent = function() { - var codeIndent, i, _i, _ref1, _ref2, _ref3; - + var codeIndent, i, _i, _ref, _ref1, _ref2; codeIndent = 0; - for (i = _i = 0, _ref1 = this.indent; 0 <= _ref1 ? _i <= _ref1 : _i >= _ref1; i = 0 <= _ref1 ? ++_i : --_i) { - if (((_ref2 = this.elementStack[i]) != null ? _ref2.block : void 0) || ((_ref3 = this.elementStack[i]) != null ? _ref3.fnBlock : void 0)) { + for (i = _i = 0, _ref = this.indent; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { + if (((_ref1 = this.elementStack[i]) != null ? _ref1.block : void 0) || ((_ref2 = this.elementStack[i]) != null ? _ref2.fnBlock : void 0)) { codeIndent += 1; } } @@ -1337,13 +1274,12 @@ }; /* - Append the text contents to the buffer (interpolating embedded code not required for coffeescript) + Append the text contents to the buffer (interpolating embedded code not required for coffeescript) */ CoffeeCodeGenerator.prototype.appendTextContents = function(text, shouldInterpolate, currentParsePoint, options) { var prefix, suffix; - if (shouldInterpolate && text.match(/#{[^}]*}/)) { this.outputBuffer.flush(); prefix = suffix = ''; @@ -1381,12 +1317,11 @@ filters = { /* - Plain filter, just renders the text in the block + Plain filter, just renders the text in the block */ plain: function(contents, generator, indentText, currentParsePoint) { var line, _i, _len; - for (_i = 0, _len = contents.length; _i < _len; _i++) { line = contents[_i]; generator.appendTextContents(indentText + line + '\n', true, currentParsePoint); @@ -1394,12 +1329,11 @@ return true; }, /* - Wraps the filter block in a javascript tag + Wraps the filter block in a javascript tag */ javascript: function(contents, generator, indentText, currentParsePoint) { var line, _i, _len; - generator.outputBuffer.append(indentText + "\n"); }, /* - Wraps the filter block in a style tag + Wraps the filter block in a style tag */ css: function(contents, generator, indentText, currentParsePoint) { var line, _i, _len; - generator.outputBuffer.append(indentText + "\n"); }, /* - Wraps the filter block in a CDATA tag + Wraps the filter block in a CDATA tag */ cdata: function(contents, generator, indentText, currentParsePoint) { var line, _i, _len; - generator.outputBuffer.append(indentText + "\n"); }, /* - Preserve filter, preserved blocks of text aren't indented, and newlines are replaced with the HTML escape code for newlines + Preserve filter, preserved blocks of text aren't indented, and newlines are replaced with the HTML escape code for newlines */ preserve: function(contents, generator, indentText, currentParsePoint) { @@ -1449,12 +1381,11 @@ }); }, /* - Escape filter, renders the text in the block with html escaped + Escape filter, renders the text in the block with html escaped */ escape: function(contents, generator, indentText, currentParsePoint) { var line, _i, _len; - for (_i = 0, _len = contents.length; _i < _len; _i++) { line = contents[_i]; generator.appendTextContents(indentText + line + '\n', true, currentParsePoint, { @@ -1472,28 +1403,27 @@ root.haml = { /* - Compiles the haml provided in the parameters to a Javascipt function + Compiles the haml provided in the parameters to a Javascipt function - Parameter: - String: Looks for a haml template in dom with this ID - Option Hash: The following options determines how haml sources and compiles the template - source - This contains the template in string form - sourceId - This contains the element ID in the dom which contains the haml source - sourceUrl - This contains the URL where the template can be fetched from - outputFormat - This determines what is returned, and has the following values: - string - The javascript source code - function - A javascript function (default) - generator - Which code generator to use - javascript (default) - coffeescript - productionjavascript + Parameter: + String: Looks for a haml template in dom with this ID + Option Hash: The following options determines how haml sources and compiles the template + source - This contains the template in string form + sourceId - This contains the element ID in the dom which contains the haml source + sourceUrl - This contains the URL where the template can be fetched from + outputFormat - This determines what is returned, and has the following values: + string - The javascript source code + function - A javascript function (default) + generator - Which code generator to use + javascript (default) + coffeescript + productionjavascript - Returns a javascript function + Returns a javascript function */ compileHaml: function(options) { var codeGenerator, result, tokinser; - if (typeof options === 'string') { return this._compileHamlTemplate(options, new haml.JsCodeGenerator()); } else { @@ -1531,21 +1461,20 @@ } }, /* - Compiles the haml in the script block with ID templateId using the coffeescript generator - Returns a javascript function + Compiles the haml in the script block with ID templateId using the coffeescript generator + Returns a javascript function */ compileCoffeeHaml: function(templateId) { return this._compileHamlTemplate(templateId, new haml.CoffeeCodeGenerator()); }, /* - Compiles the haml in the passed in string - Returns a javascript function + Compiles the haml in the passed in string + Returns a javascript function */ compileStringToJs: function(string) { var codeGenerator, result; - codeGenerator = new haml.JsCodeGenerator(); result = this._compileHamlToJs(new haml.Tokeniser({ template: string @@ -1553,13 +1482,12 @@ return codeGenerator.generateJsFunction(result); }, /* - Compiles the haml in the passed in string using the coffeescript generator - Returns a javascript function + Compiles the haml in the passed in string using the coffeescript generator + Returns a javascript function */ compileCoffeeHamlFromString: function(string) { var codeGenerator, result; - codeGenerator = new haml.CoffeeCodeGenerator(); result = this._compileHamlToJs(new haml.Tokeniser({ template: string @@ -1567,15 +1495,14 @@ return codeGenerator.generateJsFunction(result); }, /* - Compiles the haml in the passed in string - Returns the javascript function source + Compiles the haml in the passed in string + Returns the javascript function source - This is mainly used for precompiling the haml templates so they can be packaged. + This is mainly used for precompiling the haml templates so they can be packaged. */ compileHamlToJsString: function(string) { var result; - result = 'function (context) {\n'; result += this._compileHamlToJs(new haml.Tokeniser({ template: string @@ -1584,7 +1511,6 @@ }, _compileHamlTemplate: function(templateId, codeGenerator) { var fn, result; - haml.cache || (haml.cache = {}); if (haml.cache[templateId]) { return haml.cache[templateId]; @@ -1598,7 +1524,6 @@ }, _compileHamlToJs: function(tokeniser, generator) { var indent; - generator.elementStack = []; generator.initOutput(); tokeniser.getNextToken(); @@ -1638,7 +1563,6 @@ }, _doctype: function(tokeniser, indent, generator) { var contents, params; - if (tokeniser.token.doctype) { generator.outputBuffer.append(HamlRuntime.indentText(indent)); tokeniser.getNextToken(); @@ -1686,7 +1610,6 @@ }, _filter: function(tokeniser, indent, generator) { var filter, filterBlock, i, line; - if (tokeniser.token.filter) { filter = tokeniser.token.tokenString; if (!haml.filters[filter]) { @@ -1708,7 +1631,6 @@ }, _commentLine: function(tokeniser, indent, elementStack, generator) { var contents, i; - if (tokeniser.token.comment) { tokeniser.skipToEOLorEOF(); tokeniser.getNextToken(); @@ -1750,7 +1672,6 @@ }, _escapedLine: function(tokeniser, indent, elementStack, generator) { var contents; - if (tokeniser.token.amp) { haml._closeElements(indent, elementStack, tokeniser, generator); generator.outputBuffer.append(HamlRuntime.indentText(indent)); @@ -1765,7 +1686,6 @@ }, _ignoredLine: function(tokeniser, indent, elementStack, generator) { var contents; - if (tokeniser.token.exclamation) { tokeniser.getNextToken(); if (tokeniser.token.ws) { @@ -1778,7 +1698,6 @@ }, _embeddedJs: function(tokeniser, indent, elementStack, tagOptions, generator) { var currentParsePoint, escapeHtml, expression, indentText, perserveWhitespace; - if (elementStack) { haml._closeElements(indent, elementStack, tokeniser, generator); } @@ -1803,7 +1722,6 @@ }, _jsLine: function(tokeniser, indent, elementStack, generator) { var line; - if (tokeniser.token.minus) { haml._closeElements(indent, elementStack, tokeniser, generator); tokeniser.getNextToken(); @@ -1826,7 +1744,6 @@ }, _templateLine: function(tokeniser, elementStack, indent, generator) { var attrList, attributesHash, classes, contents, currentParsePoint, hasContents, id, identifier, indentText, lineHasElement, objectRef, shouldInterpolate, tagOptions; - if (!tokeniser.token.eol) { this._closeElements(indent, elementStack, tokeniser, generator); } @@ -1900,7 +1817,6 @@ }, _attributeHash: function(tokeniser) { var attr; - attr = ''; if (tokeniser.token.attributeHash) { attr = tokeniser.token.tokenString; @@ -1910,7 +1826,6 @@ }, _objectReference: function(tokeniser) { var attr; - attr = ''; if (tokeniser.token.objectReference) { attr = tokeniser.token.tokenString; @@ -1920,7 +1835,6 @@ }, _attributeList: function(tokeniser) { var attr, attrList; - attrList = {}; if (tokeniser.token.openBracket) { tokeniser.getNextToken(); @@ -1943,7 +1857,6 @@ }, _attribute: function(tokeniser) { var attr, name; - attr = null; if (tokeniser.token.identifier) { name = tokeniser.token.tokenString; @@ -1967,7 +1880,6 @@ }, _closeElement: function(indent, elementStack, tokeniser, generator) { var innerWhitespace, outerWhitespace; - if (elementStack[indent]) { generator.setIndent(indent); if (elementStack[indent].htmlComment) { @@ -1997,7 +1909,6 @@ }, _closeElements: function(indent, elementStack, tokeniser, generator) { var i, _results; - i = elementStack.length - 1; _results = []; while (i >= indent) { @@ -2007,7 +1918,6 @@ }, _openElement: function(currentParsePoint, indent, identifier, id, classes, objectRef, attributeList, attributeHash, elementStack, tagOptions, generator) { var element, parentInnerWhitespace, tagOuterWhitespace; - element = identifier.length === 0 ? "div" : identifier; parentInnerWhitespace = this._parentInnerWhitespace(elementStack, indent); tagOuterWhitespace = !tagOptions || tagOptions.outerWhitespace; @@ -2044,7 +1954,6 @@ }, _tagHasContents: function(indent, tokeniser) { var nextToken; - if (!tokeniser.isEolOrEof()) { return true; } else { @@ -2070,7 +1979,6 @@ }, _whitespace: function(tokeniser) { var i, indent, whitespace; - indent = 0; if (tokeniser.token.ws) { i = 0; @@ -2090,7 +1998,6 @@ }, _element: function(tokeniser) { var identifier; - identifier = ''; if (tokeniser.token.element) { identifier = tokeniser.token.tokenString; @@ -2107,7 +2014,6 @@ }, _idSelector: function(tokeniser) { var id; - id = ''; if (tokeniser.token.idSelector) { id = tokeniser.token.tokenString; @@ -2117,7 +2023,6 @@ }, _classSelector: function(tokeniser) { var classes; - classes = []; while (tokeniser.token.classSelector) { classes.push(tokeniser.token.tokenString); @@ -2151,7 +2056,3 @@ root.haml.filters = filters; }).call(this); - -/* -//@ sourceMappingURL=haml.map -*/ diff --git a/ajax/libs/clientside-haml-js/5.1/haml.min.js b/ajax/libs/clientside-haml-js/5.1/haml.min.js index 978bb4863d065a..72cc72daf65456 100644 --- a/ajax/libs/clientside-haml-js/5.1/haml.min.js +++ b/ajax/libs/clientside-haml-js/5.1/haml.min.js @@ -1,8 +1,8 @@ -// Generated by CoffeeScript 1.6.2 +// Generated by CoffeeScript 1.3.3 /* clientside HAML compiler for Javascript and Coffeescript (Version 5) Copyright 2011-12, Ronald Holshausen (https://github.com/uglyog) Released under the MIT License (http://www.opensource.org/licenses/MIT) -*/(function(){var e,t,n,r,i,s,o,u,a,f,l={}.hasOwnProperty,c=function(e,t){function r(){this.constructor=e}for(var n in t)l.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};a=this,r={escapeHTML:function(e){return String(e||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},perserveWhitespace:function(e){var t,n,r,i;r=/<[a-zA-Z]+>[^<]*<\/[a-zA-Z]+>/g,n="",t=0,i=r.exec(e);if(i){while(i)n+=e.substring(t,i.index),n+=i[0].replace(/\n/g," "),t=i.index+i[0].length,i=r.exec(e);n+=e.substring(t)}else n=e;return n},templateError:function(e,t,n,r){var i,s;s=r+" at line "+e+" and character "+t+":\n"+n+"\n",i=0;while(i0&&n[0].length>0&&(c=this.combineAttributes(c,"class",n));if(i!=null)for(f in i){if(!l.call(i,f))continue;b=i[f],c=this.combineAttributes(c,f,b)}if(r!=null)try{g=r.call(e,e),g!=null&&(y=null,g.id!=null?y=g.id:g.get&&(y=g.get("id")),c=this.combineAttributes(c,"id",y),h=null,g["class"]?h=g["class"]:g.get&&(h=g.get("class")),c=this.combineAttributes(c,"class",h))}catch(w){throw p=w,haml.HamlRuntime.templateError(o,u,a,"Error evaluating object reference - "+p)}if(s!=null)try{v=s.call(e,e);if(v!=null){v=this._flattenHash(null,v);for(f in v){if(!l.call(v,f))continue;b=v[f],c=this.combineAttributes(c,f,b)}}}catch(w){throw d=w,haml.HamlRuntime.templateError(o,u,a,"Error evaluating attribute hash - "+d)}m="";if(c)for(f in c){if(!l.call(c,f))continue;haml.hasValue(c[f])&&((f==="id"||f==="for")&&c[f]instanceof Array?m+=" "+f+'="'+_(c[f]).flatten().join("-")+'"':f==="class"&&c[f]instanceof Array?m+=" "+f+'="'+_(c[f]).flatten().join(" ")+'"':m+=" "+f+'="'+haml.attrValue(f,c[f])+'"')}return m},indentText:function(e){var t,n;n="",t=0;while(t0?e&&e.id instanceof Array?e.id.unshift(n):e&&e.id?e.id=[e.id,n]:e?e.id=n:e={id:n}:t==="for"&&n.toString().length>0?e&&e["for"]instanceof Array?e["for"].unshift(n):e&&e["for"]?e["for"]=[e["for"],n]:e?e["for"]=n:e={"for":n}:t==="class"?(r=[],n instanceof Array?r=r.concat(n):r.push(n),e&&e["class"]?e["class"]=e["class"].concat(r):e?e["class"]=r:e={"class":r}):t!=="id"&&(e||(e={}),e[t]=n)),e},_flattenHash:function(e,t){var n,r,i,s,o,u,a,f;a={};if(this._isHash(t))for(n in t){if(!l.call(t,n))continue;f=t[n],s=[],e!=null&&s.push(e),s.push(n),i=s.join("-"),r=this._flattenHash(i,f);if(this._isHash(r))for(o in r){if(!l.call(r,o))continue;u=r[o],a[o]=u}else a[i]=r}else e!=null?a[e]=t:a=t;return a},_isHash:function(e){return e!=null&&typeof e=="object"&&!(e instanceof Array||e instanceof Date)}},o=function(){function e(e){var t,n,r,i=this;this.buffer=null,this.bufferIndex=null,this.prevToken=null,this.token=null;if(e.templateId!=null){r=document.getElementById(e.templateId);if(!r)throw"Did not find a template with ID '"+e.templateId+"'";this.buffer=r.text,this.bufferIndex=0}else e.template!=null?(this.buffer=e.template,this.bufferIndex=0):e.templateUrl!=null&&(t=function(t,n,r){throw"Failed to fetch haml template at URL "+e.templateUrl+": "+n+" "+r},n=function(e){return i.buffer=e,i.bufferIndex=0},jQuery.ajax({url:e.templateUrl,success:n,error:t,dataType:"text",async:!1,beforeSend:function(e){return e.withCredentials=!0}}))}return e.prototype.currentLineMatcher=/[^\n]*/g,e.prototype.tokenMatchers={whitespace:/[ \t]+/g,element:/%[a-zA-Z][a-zA-Z0-9]*/g,idSelector:/#[a-zA-Z_\-][a-zA-Z0-9_\-]*/g,classSelector:/\.[a-zA-Z0-9_\-]+/g,identifier:/[a-zA-Z][a-zA-Z0-9\-]*/g,quotedString:/[\'][^\'\n]*[\']/g,quotedString2:/[\"][^\"\n]*[\"]/g,comment:/\-#/g,escapeHtml:/\&=/g,unescapeHtml:/\!=/g,objectReference:/\[[a-zA-Z_@][a-zA-Z0-9_]*\]/g,doctype:/!!!/g,continueLine:/\|\s*\n/g,filter:/:\w+/g},e.prototype.matchToken=function(e){var t;e.lastIndex=this.bufferIndex,t=e.exec(this.buffer);if((t!=null?t.index:void 0)===this.bufferIndex)return t[0]},e.prototype.matchMultiCharToken=function(e,t,n){var r,i;if(!this.token){r=this.matchToken(e);if(r)return this.token=t,this.token.tokenString=(i=typeof n==="function"?n(r):void 0)!=null?i:r,this.token.matched=r,this.advanceCharsInBuffer(r.length)}},e.prototype.matchSingleCharToken=function(e,t){if(!this.token&&this.buffer.charAt(this.bufferIndex)===e)return this.token=t,this.token.tokenString=e,this.token.matched=e,this.advanceCharsInBuffer(1)},e.prototype.getNextToken=function(){var e,t,n,r,i,s,o;if(isNaN(this.bufferIndex))throw haml.HamlRuntime.templateError(this.lineNumber,this.characterNumber,this.currentLine,"An internal parser error has occurred in the HAML parser");this.prevToken=this.token,this.token=null;if(this.buffer===null||this.buffer.length===this.bufferIndex)this.token={eof:!0,token:"EOF"};else{this.initLine();if(!this.token){t=this.buffer.charCodeAt(this.bufferIndex),n=this.buffer.charCodeAt(this.bufferIndex+1);if(t===10||t===13&&n===10)this.token={eol:!0,token:"EOL"},t===13&&n===10?(this.advanceCharsInBuffer(2),this.token.matched=String.fromCharCode(t)+String.fromCharCode(n)):(this.advanceCharsInBuffer(1),this.token.matched=String.fromCharCode(t)),this.characterNumber=0,this.currentLine=this.getCurrentLine()}this.matchMultiCharToken(this.tokenMatchers.whitespace,{ws:!0,token:"WS"}),this.matchMultiCharToken(this.tokenMatchers.continueLine,{continueLine:!0,token:"CONTINUELINE"}),this.matchMultiCharToken(this.tokenMatchers.element,{element:!0,token:"ELEMENT"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.idSelector,{idSelector:!0,token:"ID"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.classSelector,{classSelector:!0,token:"CLASS"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.identifier,{identifier:!0,token:"IDENTIFIER"}),this.matchMultiCharToken(this.tokenMatchers.doctype,{doctype:!0,token:"DOCTYPE"}),this.matchMultiCharToken(this.tokenMatchers.filter,{filter:!0,token:"FILTER"},function(e){return e.substring(1)}),this.token||(o=this.matchToken(this.tokenMatchers.quotedString),o||(o=this.matchToken(this.tokenMatchers.quotedString2)),o&&(this.token={string:!0,token:"STRING",tokenString:o.substring(1,o.length-1),matched:o},this.advanceCharsInBuffer(o.length))),this.matchMultiCharToken(this.tokenMatchers.comment,{comment:!0,token:"COMMENT"}),this.matchMultiCharToken(this.tokenMatchers.escapeHtml,{escapeHtml:!0,token:"ESCAPEHTML"}),this.matchMultiCharToken(this.tokenMatchers.unescapeHtml,{unescapeHtml:!0,token:"UNESCAPEHTML"}),this.matchMultiCharToken(this.tokenMatchers.objectReference,{objectReference:!0,token:"OBJECTREFERENCE"},function(e){return e.substring(1,e.length-1)});if(!this.token&&this.buffer&&this.buffer.charAt(this.bufferIndex)==="{"){i=this.bufferIndex+1,r=this.characterNumber,s=this.lineNumber,e=1;while(i1||this.buffer.charAt(i)!=="}"))this.buffer.charAt(i)==="{"?e++:this.buffer.charAt(i)==="}"&&e--,i++;if(i===this.buffer.length)throw this.characterNumber=r+1,this.lineNumber=s,this.parseError('Error parsing attribute hash - Did not find a terminating "}"');this.token={attributeHash:!0,token:"ATTRHASH",tokenString:this.buffer.substring(this.bufferIndex,i+1),matched:this.buffer.substring(this.bufferIndex,i+1)},this.advanceCharsInBuffer(i-this.bufferIndex+1)}this.matchSingleCharToken("(",{openBracket:!0,token:"OPENBRACKET"}),this.matchSingleCharToken(")",{closeBracket:!0,token:"CLOSEBRACKET"}),this.matchSingleCharToken("=",{equal:!0,token:"EQUAL"}),this.matchSingleCharToken("/",{slash:!0,token:"SLASH"}),this.matchSingleCharToken("!",{exclamation:!0,token:"EXCLAMATION"}),this.matchSingleCharToken("-",{minus:!0,token:"MINUS"}),this.matchSingleCharToken("&",{amp:!0,token:"AMP"}),this.matchSingleCharToken("<",{lt:!0,token:"LT"}),this.matchSingleCharToken(">",{gt:!0,token:"GT"}),this.matchSingleCharToken("~",{tilde:!0,token:"TILDE"}),this.token===null&&(this.token={unknown:!0,token:"UNKNOWN"})}return this.token},e.prototype.lookAhead=function(e){var t,n,r,i,s,o,u,a;a=null;if(e>0){i=this.token,u=this.prevToken,r=this.currentLine,o=this.lineNumber,n=this.characterNumber,t=this.bufferIndex,s=0;while(s++0)return this.buffer+=e},e.prototype.appendToOutputBuffer=function(e){if((e!=null?e.length:void 0)>0)return this.flush(),this.outputBuffer+=e},e.prototype.flush=function(){var e;return((e=this.buffer)!=null?e.length:void 0)>0&&(this.outputBuffer+=this.generator.generateFlush(this.buffer)),this.buffer=""},e.prototype.output=function(){return this.outputBuffer},e.prototype.trimWhitespace=function(){var e,t;if(this.buffer.length>0){t=this.buffer.length-1;while(t>0){e=this.buffer.charAt(t);if(e===" "||e===" "||e==="\n")t--;else{if(!(t>1)||e!=="n"&&e!=="t"||this.buffer.charAt(t-1)!=="\\")break;t-=2}}if(t>0&&t0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(' hashFunction = function () { return eval("hashObject = '+r.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"); };\n')),i.length>0&&this.outputBuffer.appendToOutputBuffer(' objRefFn = function () { return eval("objRef = '+i.replace(/"/g,'\\"')+'"); };\n'),this.outputBuffer.appendToOutputBuffer(' html.push(haml.HamlRuntime.generateElementAttributes(context, "'+e+'", ["'+t.join('","')+'"], objRefFn, '+JSON.stringify(n)+", hashFunction, "+s.lineNumber+", "+s.characterNumber+', "'+this.escapeCode(s.currentLine)+'"));\n')},t.prototype.replaceReservedWordsInHash=function(e){var t,n,r,i,s;n=e,s=["class","for"];for(r=0,i=s.length;r0&&(s=e.charAt(u.index-1)),u.index>1&&(o=e.charAt(u.index-2)),s==="\\"&&o!=="\\"?(u.index!==0&&this.outputBuffer.append(this.processText(e.substring(i,u.index-1),n)),this.outputBuffer.append(this.processText(u[0]),n)):(this.outputBuffer.append(this.processText(e.substring(i,u.index)),n),this.appendEmbeddedCode(r.indentText(this.indent+1),u[1],n.escapeHTML,n.perserveWhitespace,t)),i=this.embeddedCodeBlockMatcher.lastIndex,u=this.embeddedCodeBlockMatcher.exec(e);if(i0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(" hashFunction = function () { return "+r+"; };\n")),i.length>0&&this.outputBuffer.appendToOutputBuffer(" objRefFn = function () { return "+i+"; };\n"),this.outputBuffer.appendToOutputBuffer(' html.push(haml.HamlRuntime.generateElementAttributes(context, "'+e+'", ["'+t.join('","')+'"], objRefFn, '+JSON.stringify(n)+", hashFunction, "+s.lineNumber+", "+s.characterNumber+', "'+this.escapeCode(s.currentLine)+'"));\n')},t.prototype.initOutput=function(){return this.outputBuffer.appendToOutputBuffer(" var html = [];\n var hashFunction = null, hashObject = null, objRef = null, objRefFn = null, value= null;\n with (context || {}) {\n")},t}(i),n=function(e){function t(){this.outputBuffer=new haml.Buffer(this)}return c(t,e),t.prototype.appendEmbeddedCode=function(e,t,n,r,i){var s;return this.outputBuffer.flush(),s=this.calcCodeIndent(),this.outputBuffer.appendToOutputBuffer(s+"try\n"),this.outputBuffer.appendToOutputBuffer(s+" exp = CoffeeScript.compile('"+t.replace(/'/g,"\\'").replace(/\\n/g,"\\\\n")+"', bare: true)\n"),this.outputBuffer.appendToOutputBuffer(s+" value = eval(exp)\n"),this.outputBuffer.appendToOutputBuffer(s+" value ?= ''\n"),n?this.outputBuffer.appendToOutputBuffer(s+" html.push(haml.HamlRuntime.escapeHTML(String(value)))\n"):r?this.outputBuffer.appendToOutputBuffer(s+" html.push(haml.HamlRuntime.perserveWhitespace(String(value)))\n"):this.outputBuffer.appendToOutputBuffer(s+" html.push(String(value))\n"),this.outputBuffer.appendToOutputBuffer(s+"catch e \n"),this.outputBuffer.appendToOutputBuffer(s+" throw new Error(haml.HamlRuntime.templateError("+i.lineNumber+", "+i.characterNumber+", '"+this.escapeCode(i.currentLine)+"',\n"),this.outputBuffer.appendToOutputBuffer(s+" 'Error evaluating expression - ' + e))\n")},t.prototype.initOutput=function(){return this.outputBuffer.appendToOutputBuffer("html = []\n")},t.prototype.closeAndReturnOutput=function(){return this.outputBuffer.flush(),this.outputBuffer.output()+'return html.join("")\n'},t.prototype.appendCodeLine=function(e,t){return this.outputBuffer.flush(),this.outputBuffer.appendToOutputBuffer(this.calcCodeIndent()),this.outputBuffer.appendToOutputBuffer((_.str||_).trim(e)),this.outputBuffer.appendToOutputBuffer(t),this.prevCodeIndent=this.indent},t.prototype.lineMatchesStartFunctionBlock=function(e){return e.match(/\) [\-=]>\s*$/)},t.prototype.lineMatchesStartBlock=function(e){return!0},t.prototype.closeOffCodeBlock=function(e){return this.outputBuffer.flush()},t.prototype.closeOffFunctionBlock=function(e){return this.outputBuffer.flush()},t.prototype.generateCodeForDynamicAttributes=function(e,t,n,r,i,s){var o;return this.outputBuffer.flush(),o=this.calcCodeIndent(),r.length>0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(o+"hashFunction = () -> s = CoffeeScript.compile('"+r.replace(/'/g,"\\'").replace(/\n/g,"\\n")+"', bare: true); eval 'hashObject = ' + s\n")),i.length>0&&this.outputBuffer.appendToOutputBuffer(o+"objRefFn = () -> s = CoffeeScript.compile('"+i.replace(/'/g,"\\'")+"', bare: true); eval 'objRef = ' + s\n"),this.outputBuffer.appendToOutputBuffer(o+"html.push(haml.HamlRuntime.generateElementAttributes(this, '"+e+"', ['"+t.join("','")+"'], objRefFn ? null, "+JSON.stringify(n)+", hashFunction ? null, "+s.lineNumber+", "+s.characterNumber+", '"+this.escapeCode(s.currentLine)+"'))\n")},t.prototype.replaceReservedWordsInHash=function(e){var t,n,r,i,s;n=e,s=["class","for"];for(r=0,i=s.length;r0&&(r=e.charAt(s.index-1)),s.index>1&&(i=e.charAt(s.index-2)),r==="\\"&&i!=="\\"?(s.index!==0&&(n+=this._escapeText(e.substring(t,s.index-1))),n+=this._escapeText("\\"+s[0])):(n+=this._escapeText(e.substring(t,s.index)),n+=s[0]),t=this.embeddedCodeBlockMatcher.lastIndex,s=this.embeddedCodeBlockMatcher.exec(e);return t=i;t=0<=i?++n:--n)if(((s=this.elementStack[t])!=null?s.block:void 0)||((o=this.elementStack[t])!=null?o.fnBlock:void 0))e+=1;return r.indentText(e)},t.prototype.appendTextContents=function(e,t,n,r){var i,s;if(t&&e.match(/#{[^}]*}/)){this.outputBuffer.flush(),i=s="";if(r!=null?r.escapeHTML:void 0)i="haml.HamlRuntime.escapeHTML(",s=")";else if(r!=null?r.perserveWhitespace:void 0)i="haml.HamlRuntime.perserveWhitespace(",s=")";return this.outputBuffer.appendToOutputBuffer(this.calcCodeIndent()+"html.push("+i+'"'+this.escapeCode(e)+'"'+s+")\n")}if(r!=null?r.escapeHTML:void 0)e=haml.HamlRuntime.escapeHTML(e);if(r!=null?r.perserveWhitespace:void 0)e=haml.HamlRuntime.perserveWhitespace(e);return this.outputBuffer.append(e)},t}(t),u={plain:function(e,t,n,r){var i,s,o;for(s=0,o=e.length;s\n'),t.outputBuffer.append(n+"//\n"),t.outputBuffer.append(n+"\n")},css:function(e,t,n,r){var i,s,o;t.outputBuffer.append(n+'\n")},cdata:function(e,t,n,r){var i,s,o;t.outputBuffer.append(n+"\n")},preserve:function(e,t,n,r){return t.appendTextContents(e.join("\n")+"\n",!0,r,{perserveWhitespace:!0})},escape:function(e,t,n,r){var i,s,o;for(s=0,o=e.length;s0){s=i.split(/\s+/);switch(s[0]){case"XML":s.length>1?n.outputBuffer.append(""):n.outputBuffer.append("");break;case"Strict":n.outputBuffer.append('');break;case"Frameset":n.outputBuffer.append('');break;case"5":n.outputBuffer.append("");break;case"1.1":n.outputBuffer.append('');break;case"Basic":n.outputBuffer.append('');break;case"Mobile":n.outputBuffer.append('');break;case"RDFa":n.outputBuffer.append('')}}else n.outputBuffer.append('');return n.outputBuffer.append(this._newline(e)),e.getNextToken()}},_filter:function(e,t,n){var r,i,s,o;if(e.token.filter){r=e.token.tokenString;if(!haml.filters[r])throw e.parseError("Filter '"+r+"' not registered. Filter functions need to be added to 'haml.filters'.");e.skipToEOLorEOF(),e.getNextToken(),s=haml._whitespace(e),i=[];while(!e.token.eof&&s>t)o=e.skipToEOLorEOF(),i.push(haml.HamlRuntime.indentText(s-t-1)+o),e.getNextToken(),s=haml._whitespace(e);return haml.filters[r](i,n,haml.HamlRuntime.indentText(t),e.currentParsePoint()),e.pushBackToken()}},_commentLine:function(e,t,n,i){var s,o;if(e.token.comment){e.skipToEOLorEOF(),e.getNextToken(),o=this._whitespace(e);while(!e.token.eof&&o>t)e.skipToEOLorEOF(),e.getNextToken(),o=this._whitespace(e);if(o>0)return e.pushBackToken()}else if(e.token.slash)return haml._closeElements(t,n,e,i),i.outputBuffer.append(r.indentText(t)),i.outputBuffer.append(""+t[e].eol):t[e].htmlConditionalComment?i.outputBuffer.append(r.indentText(e)+""+t[e].eol):t[e].block?i.closeOffCodeBlock(n):t[e].fnBlock?i.closeOffFunctionBlock(n):(s=!t[e].tagOptions||t[e].tagOptions.innerWhitespace,s?i.outputBuffer.append(r.indentText(e)):i.outputBuffer.trimWhitespace(),i.outputBuffer.append(""),o=!t[e].tagOptions||t[e].tagOptions.outerWhitespace,haml._parentInnerWhitespace(t,e)&&o&&i.outputBuffer.append("\n")),t[e]=null,i.mark()},_closeElements:function(e,t,n,r){var i,s;i=t.length-1,s=[];while(i>=e)s.push(this._closeElement(i--,t,n,r));return s},_openElement:function(e,t,n,i,s,o,u,a,f,l,c){var h,p,d;h=n.length===0?"div":n,p=this._parentInnerWhitespace(f,t),d=!l||l.outerWhitespace,d||c.outputBuffer.trimWhitespace(),t>0&&p&&d&&c.outputBuffer.append(r.indentText(t)),c.outputBuffer.append("<"+h),a.length>0||o.length>0?c.generateCodeForDynamicAttributes(i,s,u,a,o,e):c.outputBuffer.append(r.generateElementAttributes(null,i,s,null,u,null,e.lineNumber,e.characterNumber,e.currentLine));if(l.selfClosingTag){c.outputBuffer.append("/>");if(l.outerWhitespace)return c.outputBuffer.append("\n")}else{c.outputBuffer.append(">"),f[t]={tag:h,tagOptions:l};if(l.innerWhitespace)return c.outputBuffer.append("\n")}},_isSelfClosingTag:function(e){return e==="meta"||e==="img"||e==="link"||e==="script"||e==="br"||e==="hr"},_tagHasContents:function(e,t){var n;return t.isEolOrEof()?(n=t.lookAhead(1),n.ws&&n.tokenString.length/2>e):!0},_parentInnerWhitespace:function(e,t){return t===0||!e[t-1]||!e[t-1].tagOptions||e[t-1].tagOptions.innerWhitespace},_lineHasElement:function(e,t,n){return e.length>0||t.length>0||n.length>0},hasValue:function(e){return e!=null&&e!==!1},attrValue:function(e,t){return e==="selected"||e==="checked"||e==="disabled"?e:t},_whitespace:function(e){var t,n,r;n=0;if(e.token.ws){t=0,r=e.token.tokenString;while(t/g,">").replace(/"/g,""").replace(/'/g,"'")},perserveWhitespace:function(e){var t,n,r,i;r=/<[a-zA-Z]+>[^<]*<\/[a-zA-Z]+>/g,n="",t=0,i=r.exec(e);if(i){while(i)n+=e.substring(t,i.index),n+=i[0].replace(/\n/g," "),t=i.index+i[0].length,i=r.exec(e);n+=e.substring(t)}else n=e;return n},templateError:function(e,t,n,r){var i,s;s=r+" at line "+e+" and character "+t+":\n"+n+"\n",i=0;while(i0&&n[0].length>0&&(c=this.combineAttributes(c,"class",n));if(i)for(l in i){if(!f.call(i,l))continue;c=this.combineAttributes(c,l,i[l])}if(r)try{g=r.call(e,e),g&&(y=null,g.id?y=g.id:g.get&&(y=g.get("id")),c=this.combineAttributes(c,"id",y),h=null,g["class"]?h=g["class"]:g.get&&(h=g.get("class")),c=this.combineAttributes(c,"class",h))}catch(b){throw haml.HamlRuntime.templateError(o,u,a,"Error evaluating object reference - "+b)}if(s)try{v=s.call(e,e);if(v)for(l in v){if(!f.call(v,l))continue;if(l==="data"){d=v[l];for(p in d){if(!f.call(d,p))continue;c=this.combineAttributes(c,"data-"+p,d[p])}}else c=this.combineAttributes(c,l,v[l])}}catch(w){throw haml.HamlRuntime.templateError(o,u,a,"Error evaluating attribute hash - "+w)}m="";if(c)for(l in c){if(!f.call(c,l))continue;haml.hasValue(c[l])&&((l==="id"||l==="for")&&c[l]instanceof Array?m+=" "+l+'="'+_(c[l]).flatten().join("-")+'"':l==="class"&&c[l]instanceof Array?m+=" "+l+'="'+_(c[l]).flatten().join(" ")+'"':m+=" "+l+'="'+haml.attrValue(l,c[l])+'"')}return m},indentText:function(e){var t,n;n="",t=0;while(t0?e&&e.id instanceof Array?e.id.unshift(n):e&&e.id?e.id=[e.id,n]:e?e.id=n:e={id:n}:t==="for"&&n.toString().length>0?e&&e["for"]instanceof Array?e["for"].unshift(n):e&&e["for"]?e["for"]=[e["for"],n]:e?e["for"]=n:e={"for":n}:t==="class"?(r=[],n instanceof Array?r=r.concat(n):r.push(n),e&&e["class"]?e["class"]=e["class"].concat(r):e?e["class"]=r:e={"class":r}):t!=="id"&&(e||(e={}),e[t]=n)),e}},o=function(){function e(e){var t,n,r,i=this;this.buffer=null,this.bufferIndex=null,this.prevToken=null,this.token=null;if(e.templateId!=null){r=document.getElementById(e.templateId);if(!r)throw"Did not find a template with ID '"+e.templateId+"'";this.buffer=r.text,this.bufferIndex=0}else e.template!=null?(this.buffer=e.template,this.bufferIndex=0):e.templateUrl!=null&&(t=function(t,n,r){throw"Failed to fetch haml template at URL "+e.templateUrl+": "+n+" "+r},n=function(e){return i.buffer=e,i.bufferIndex=0},jQuery.ajax({url:e.templateUrl,success:n,error:t,dataType:"text",async:!1,beforeSend:function(e){return e.withCredentials=!0}}))}return e.prototype.currentLineMatcher=/[^\n]*/g,e.prototype.tokenMatchers={whitespace:/[ \t]+/g,element:/%[a-zA-Z][a-zA-Z0-9]*/g,idSelector:/#[a-zA-Z_\-][a-zA-Z0-9_\-]*/g,classSelector:/\.[a-zA-Z0-9_\-]+/g,identifier:/[a-zA-Z][a-zA-Z0-9\-]*/g,quotedString:/[\'][^\'\n]*[\']/g,quotedString2:/[\"][^\"\n]*[\"]/g,comment:/\-#/g,escapeHtml:/\&=/g,unescapeHtml:/\!=/g,objectReference:/\[[a-zA-Z_@][a-zA-Z0-9_]*\]/g,doctype:/!!!/g,continueLine:/\|\s*\n/g,filter:/:\w+/g},e.prototype.matchToken=function(e){var t;e.lastIndex=this.bufferIndex,t=e.exec(this.buffer);if((t!=null?t.index:void 0)===this.bufferIndex)return t[0]},e.prototype.matchMultiCharToken=function(e,t,n){var r,i;if(!this.token){r=this.matchToken(e);if(r)return this.token=t,this.token.tokenString=(i=typeof n==="function"?n(r):void 0)!=null?i:r,this.token.matched=r,this.advanceCharsInBuffer(r.length)}},e.prototype.matchSingleCharToken=function(e,t){if(!this.token&&this.buffer.charAt(this.bufferIndex)===e)return this.token=t,this.token.tokenString=e,this.token.matched=e,this.advanceCharsInBuffer(1)},e.prototype.getNextToken=function(){var e,t,n,r,i,s,o;if(isNaN(this.bufferIndex))throw haml.HamlRuntime.templateError(this.lineNumber,this.characterNumber,this.currentLine,"An internal parser error has occurred in the HAML parser");this.prevToken=this.token,this.token=null;if(this.buffer===null||this.buffer.length===this.bufferIndex)this.token={eof:!0,token:"EOF"};else{this.initLine();if(!this.token){t=this.buffer.charCodeAt(this.bufferIndex),n=this.buffer.charCodeAt(this.bufferIndex+1);if(t===10||t===13&&n===10)this.token={eol:!0,token:"EOL"},t===13&&n===10?(this.advanceCharsInBuffer(2),this.token.matched=String.fromCharCode(t)+String.fromCharCode(n)):(this.advanceCharsInBuffer(1),this.token.matched=String.fromCharCode(t)),this.characterNumber=0,this.currentLine=this.getCurrentLine()}this.matchMultiCharToken(this.tokenMatchers.whitespace,{ws:!0,token:"WS"}),this.matchMultiCharToken(this.tokenMatchers.continueLine,{continueLine:!0,token:"CONTINUELINE"}),this.matchMultiCharToken(this.tokenMatchers.element,{element:!0,token:"ELEMENT"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.idSelector,{idSelector:!0,token:"ID"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.classSelector,{classSelector:!0,token:"CLASS"},function(e){return e.substring(1)}),this.matchMultiCharToken(this.tokenMatchers.identifier,{identifier:!0,token:"IDENTIFIER"}),this.matchMultiCharToken(this.tokenMatchers.doctype,{doctype:!0,token:"DOCTYPE"}),this.matchMultiCharToken(this.tokenMatchers.filter,{filter:!0,token:"FILTER"},function(e){return e.substring(1)}),this.token||(o=this.matchToken(this.tokenMatchers.quotedString),o||(o=this.matchToken(this.tokenMatchers.quotedString2)),o&&(this.token={string:!0,token:"STRING",tokenString:o.substring(1,o.length-1),matched:o},this.advanceCharsInBuffer(o.length))),this.matchMultiCharToken(this.tokenMatchers.comment,{comment:!0,token:"COMMENT"}),this.matchMultiCharToken(this.tokenMatchers.escapeHtml,{escapeHtml:!0,token:"ESCAPEHTML"}),this.matchMultiCharToken(this.tokenMatchers.unescapeHtml,{unescapeHtml:!0,token:"UNESCAPEHTML"}),this.matchMultiCharToken(this.tokenMatchers.objectReference,{objectReference:!0,token:"OBJECTREFERENCE"},function(e){return e.substring(1,e.length-1)});if(!this.token&&this.buffer&&this.buffer.charAt(this.bufferIndex)==="{"){i=this.bufferIndex+1,r=this.characterNumber,s=this.lineNumber,e=1;while(i1||this.buffer.charAt(i)!=="}"))this.buffer.charAt(i)==="{"?e++:this.buffer.charAt(i)==="}"&&e--,i++;if(i===this.buffer.length)throw this.characterNumber=r+1,this.lineNumber=s,this.parseError('Error parsing attribute hash - Did not find a terminating "}"');this.token={attributeHash:!0,token:"ATTRHASH",tokenString:this.buffer.substring(this.bufferIndex,i+1),matched:this.buffer.substring(this.bufferIndex,i+1)},this.advanceCharsInBuffer(i-this.bufferIndex+1)}this.matchSingleCharToken("(",{openBracket:!0,token:"OPENBRACKET"}),this.matchSingleCharToken(")",{closeBracket:!0,token:"CLOSEBRACKET"}),this.matchSingleCharToken("=",{equal:!0,token:"EQUAL"}),this.matchSingleCharToken("/",{slash:!0,token:"SLASH"}),this.matchSingleCharToken("!",{exclamation:!0,token:"EXCLAMATION"}),this.matchSingleCharToken("-",{minus:!0,token:"MINUS"}),this.matchSingleCharToken("&",{amp:!0,token:"AMP"}),this.matchSingleCharToken("<",{lt:!0,token:"LT"}),this.matchSingleCharToken(">",{gt:!0,token:"GT"}),this.matchSingleCharToken("~",{tilde:!0,token:"TILDE"}),this.token===null&&(this.token={unknown:!0,token:"UNKNOWN"})}return this.token},e.prototype.lookAhead=function(e){var t,n,r,i,s,o,u,a;a=null;if(e>0){i=this.token,u=this.prevToken,r=this.currentLine,o=this.lineNumber,n=this.characterNumber,t=this.bufferIndex,s=0;while(s++0)return this.buffer+=e},e.prototype.appendToOutputBuffer=function(e){if(e&&e.length>0)return this.flush(),this.outputBuffer+=e},e.prototype.flush=function(){return this.buffer&&this.buffer.length>0&&(this.outputBuffer+=this.generator.generateFlush(this.buffer)),this.buffer=""},e.prototype.output=function(){return this.outputBuffer},e.prototype.trimWhitespace=function(){var e,t;if(this.buffer.length>0){t=this.buffer.length-1;while(t>0){e=this.buffer.charAt(t);if(e===" "||e===" "||e==="\n")t--;else{if(!(t>1)||e!=="n"&&e!=="t"||this.buffer.charAt(t-1)!=="\\")break;t-=2}}if(t>0&&t0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(' hashFunction = function () { return eval("hashObject = '+r.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"); };\n')),i.length>0&&this.outputBuffer.appendToOutputBuffer(' objRefFn = function () { return eval("objRef = '+i.replace(/"/g,'\\"')+'"); };\n'),this.outputBuffer.appendToOutputBuffer(' html.push(haml.HamlRuntime.generateElementAttributes(context, "'+e+'", ["'+t.join('","')+'"], objRefFn, '+JSON.stringify(n)+", hashFunction, "+s.lineNumber+", "+s.characterNumber+', "'+this.escapeCode(s.currentLine)+'"));\n')},t.prototype.replaceReservedWordsInHash=function(e){var t,n,r,i,s;n=e,s=["class","for"];for(r=0,i=s.length;r0&&(s=e.charAt(u.index-1)),u.index>1&&(o=e.charAt(u.index-2)),s==="\\"&&o!=="\\"?(u.index!==0&&this.outputBuffer.append(this.processText(e.substring(i,u.index-1),n)),this.outputBuffer.append(this.processText(u[0]),n)):(this.outputBuffer.append(this.processText(e.substring(i,u.index)),n),this.appendEmbeddedCode(r.indentText(this.indent+1),u[1],n.escapeHTML,n.perserveWhitespace,t)),i=this.embeddedCodeBlockMatcher.lastIndex,u=this.embeddedCodeBlockMatcher.exec(e);if(i0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(" hashFunction = function () { return "+r+"; };\n")),i.length>0&&this.outputBuffer.appendToOutputBuffer(" objRefFn = function () { return "+i+"; };\n"),this.outputBuffer.appendToOutputBuffer(' html.push(haml.HamlRuntime.generateElementAttributes(context, "'+e+'", ["'+t.join('","')+'"], objRefFn, '+JSON.stringify(n)+", hashFunction, "+s.lineNumber+", "+s.characterNumber+', "'+this.escapeCode(s.currentLine)+'"));\n')},t.prototype.initOutput=function(){return this.outputBuffer.appendToOutputBuffer(" var html = [];\n var hashFunction = null, hashObject = null, objRef = null, objRefFn = null, value= null;\n with (context || {}) {\n")},t}(i),n=function(e){function t(){this.outputBuffer=new haml.Buffer(this)}return l(t,e),t.prototype.appendEmbeddedCode=function(e,t,n,r,i){var s;return this.outputBuffer.flush(),s=this.calcCodeIndent(),this.outputBuffer.appendToOutputBuffer(s+"try\n"),this.outputBuffer.appendToOutputBuffer(s+" exp = CoffeeScript.compile('"+t.replace(/'/g,"\\'").replace(/\\n/g,"\\\\n")+"', bare: true)\n"),this.outputBuffer.appendToOutputBuffer(s+" value = eval(exp)\n"),this.outputBuffer.appendToOutputBuffer(s+" value ?= ''\n"),n?this.outputBuffer.appendToOutputBuffer(s+" html.push(haml.HamlRuntime.escapeHTML(String(value)))\n"):r?this.outputBuffer.appendToOutputBuffer(s+" html.push(haml.HamlRuntime.perserveWhitespace(String(value)))\n"):this.outputBuffer.appendToOutputBuffer(s+" html.push(String(value))\n"),this.outputBuffer.appendToOutputBuffer(s+"catch e \n"),this.outputBuffer.appendToOutputBuffer(s+" throw new Error(haml.HamlRuntime.templateError("+i.lineNumber+", "+i.characterNumber+", '"+this.escapeCode(i.currentLine)+"',\n"),this.outputBuffer.appendToOutputBuffer(s+" 'Error evaluating expression - ' + e))\n")},t.prototype.initOutput=function(){return this.outputBuffer.appendToOutputBuffer("html = []\n")},t.prototype.closeAndReturnOutput=function(){return this.outputBuffer.flush(),this.outputBuffer.output()+'return html.join("")\n'},t.prototype.appendCodeLine=function(e,t){return this.outputBuffer.flush(),this.outputBuffer.appendToOutputBuffer(this.calcCodeIndent()),this.outputBuffer.appendToOutputBuffer((_.str||_).trim(e)),this.outputBuffer.appendToOutputBuffer(t),this.prevCodeIndent=this.indent},t.prototype.lineMatchesStartFunctionBlock=function(e){return e.match(/\) [\-=]>\s*$/)},t.prototype.lineMatchesStartBlock=function(e){return!0},t.prototype.closeOffCodeBlock=function(e){return this.outputBuffer.flush()},t.prototype.closeOffFunctionBlock=function(e){return this.outputBuffer.flush()},t.prototype.generateCodeForDynamicAttributes=function(e,t,n,r,i,s){var o;return this.outputBuffer.flush(),o=this.calcCodeIndent(),r.length>0&&(r=this.replaceReservedWordsInHash(r),this.outputBuffer.appendToOutputBuffer(o+"hashFunction = () -> s = CoffeeScript.compile('"+r.replace(/'/g,"\\'").replace(/\n/g,"\\n")+"', bare: true); eval 'hashObject = ' + s\n")),i.length>0&&this.outputBuffer.appendToOutputBuffer(o+"objRefFn = () -> s = CoffeeScript.compile('"+i.replace(/'/g,"\\'")+"', bare: true); eval 'objRef = ' + s\n"),this.outputBuffer.appendToOutputBuffer(o+"html.push(haml.HamlRuntime.generateElementAttributes(this, '"+e+"', ['"+t.join("','")+"'], objRefFn ? null, "+JSON.stringify(n)+", hashFunction ? null, "+s.lineNumber+", "+s.characterNumber+", '"+this.escapeCode(s.currentLine)+"'))\n")},t.prototype.replaceReservedWordsInHash=function(e){var t,n,r,i,s;n=e,s=["class","for"];for(r=0,i=s.length;r0&&(r=e.charAt(s.index-1)),s.index>1&&(i=e.charAt(s.index-2)),r==="\\"&&i!=="\\"?(s.index!==0&&(n+=this._escapeText(e.substring(t,s.index-1))),n+=this._escapeText("\\"+s[0])):(n+=this._escapeText(e.substring(t,s.index)),n+=s[0]),t=this.embeddedCodeBlockMatcher.lastIndex,s=this.embeddedCodeBlockMatcher.exec(e);return t=i;t=0<=i?++n:--n)if(((s=this.elementStack[t])!=null?s.block:void 0)||((o=this.elementStack[t])!=null?o.fnBlock:void 0))e+=1;return r.indentText(e)},t.prototype.appendTextContents=function(e,t,n,r){var i,s;if(t&&e.match(/#{[^}]*}/)){this.outputBuffer.flush(),i=s="";if(r!=null?r.escapeHTML:void 0)i="haml.HamlRuntime.escapeHTML(",s=")";else if(r!=null?r.perserveWhitespace:void 0)i="haml.HamlRuntime.perserveWhitespace(",s=")";return this.outputBuffer.appendToOutputBuffer(this.calcCodeIndent()+"html.push("+i+'"'+this.escapeCode(e)+'"'+s+")\n")}if(r!=null?r.escapeHTML:void 0)e=haml.HamlRuntime.escapeHTML(e);if(r!=null?r.perserveWhitespace:void 0)e=haml.HamlRuntime.perserveWhitespace(e);return this.outputBuffer.append(e)},t}(t),u={plain:function(e,t,n,r){var i,s,o;for(s=0,o=e.length;s\n'),t.outputBuffer.append(n+"//\n"),t.outputBuffer.append(n+"\n")},css:function(e,t,n,r){var i,s,o;t.outputBuffer.append(n+'\n")},cdata:function(e,t,n,r){var i,s,o;t.outputBuffer.append(n+"\n")},preserve:function(e,t,n,r){return t.appendTextContents(e.join("\n")+"\n",!0,r,{perserveWhitespace:!0})},escape:function(e,t,n,r){var i,s,o;for(s=0,o=e.length;s0){s=i.split(/\s+/);switch(s[0]){case"XML":s.length>1?n.outputBuffer.append(""):n.outputBuffer.append("");break;case"Strict":n.outputBuffer.append('');break;case"Frameset":n.outputBuffer.append('');break;case"5":n.outputBuffer.append("");break;case"1.1":n.outputBuffer.append('');break;case"Basic":n.outputBuffer.append('');break;case"Mobile":n.outputBuffer.append('');break;case"RDFa":n.outputBuffer.append('')}}else n.outputBuffer.append('');return n.outputBuffer.append(this._newline(e)),e.getNextToken()}},_filter:function(e,t,n){var r,i,s,o;if(e.token.filter){r=e.token.tokenString;if(!haml.filters[r])throw e.parseError("Filter '"+r+"' not registered. Filter functions need to be added to 'haml.filters'.");e.skipToEOLorEOF(),e.getNextToken(),s=haml._whitespace(e),i=[];while(!e.token.eof&&s>t)o=e.skipToEOLorEOF(),i.push(haml.HamlRuntime.indentText(s-t-1)+o),e.getNextToken(),s=haml._whitespace(e);return haml.filters[r](i,n,haml.HamlRuntime.indentText(t),e.currentParsePoint()),e.pushBackToken()}},_commentLine:function(e,t,n,i){var s,o;if(e.token.comment){e.skipToEOLorEOF(),e.getNextToken(),o=this._whitespace(e);while(!e.token.eof&&o>t)e.skipToEOLorEOF(),e.getNextToken(),o=this._whitespace(e);if(o>0)return e.pushBackToken()}else if(e.token.slash)return haml._closeElements(t,n,e,i),i.outputBuffer.append(r.indentText(t)),i.outputBuffer.append(""+t[e].eol):t[e].htmlConditionalComment?i.outputBuffer.append(r.indentText(e)+""+t[e].eol):t[e].block?i.closeOffCodeBlock(n):t[e].fnBlock?i.closeOffFunctionBlock(n):(s=!t[e].tagOptions||t[e].tagOptions.innerWhitespace,s?i.outputBuffer.append(r.indentText(e)):i.outputBuffer.trimWhitespace(),i.outputBuffer.append(""),o=!t[e].tagOptions|| +t[e].tagOptions.outerWhitespace,haml._parentInnerWhitespace(t,e)&&o&&i.outputBuffer.append("\n")),t[e]=null,i.mark()},_closeElements:function(e,t,n,r){var i,s;i=t.length-1,s=[];while(i>=e)s.push(this._closeElement(i--,t,n,r));return s},_openElement:function(e,t,n,i,s,o,u,a,f,l,c){var h,p,d;h=n.length===0?"div":n,p=this._parentInnerWhitespace(f,t),d=!l||l.outerWhitespace,d||c.outputBuffer.trimWhitespace(),t>0&&p&&d&&c.outputBuffer.append(r.indentText(t)),c.outputBuffer.append("<"+h),a.length>0||o.length>0?c.generateCodeForDynamicAttributes(i,s,u,a,o,e):c.outputBuffer.append(r.generateElementAttributes(null,i,s,null,u,null,e.lineNumber,e.characterNumber,e.currentLine));if(l.selfClosingTag){c.outputBuffer.append("/>");if(l.outerWhitespace)return c.outputBuffer.append("\n")}else{c.outputBuffer.append(">"),f[t]={tag:h,tagOptions:l};if(l.innerWhitespace)return c.outputBuffer.append("\n")}},_isSelfClosingTag:function(e){return e==="meta"||e==="img"||e==="link"||e==="script"||e==="br"||e==="hr"},_tagHasContents:function(e,t){var n;return t.isEolOrEof()?(n=t.lookAhead(1),n.ws&&n.tokenString.length/2>e):!0},_parentInnerWhitespace:function(e,t){return t===0||!e[t-1]||!e[t-1].tagOptions||e[t-1].tagOptions.innerWhitespace},_lineHasElement:function(e,t,n){return e.length>0||t.length>0||n.length>0},hasValue:function(e){return e!=null&&e!==!1},attrValue:function(e,t){return e==="selected"||e==="checked"||e==="disabled"?e:t},_whitespace:function(e){var t,n,r;n=0;if(e.token.ws){t=0,r=e.token.tokenString;while(t