mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-07-30 09:49:07 +00:00
update
This commit is contained in:
14
node_modules/hamljs/.bower.json
generated
vendored
Normal file
14
node_modules/hamljs/.bower.json
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "haml.js",
|
||||
"homepage": "https://github.com/visionmedia/haml.js",
|
||||
"version": "0.6.2",
|
||||
"_release": "0.6.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.6.2",
|
||||
"commit": "52228c31b34a4c3461cc94b321f1c2a5ef391455"
|
||||
},
|
||||
"_source": "git://github.com/visionmedia/haml.js.git",
|
||||
"_target": "1.x",
|
||||
"_originalSource": "haml"
|
||||
}
|
3
node_modules/hamljs/.gitmodules
generated
vendored
Normal file
3
node_modules/hamljs/.gitmodules
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "benchmarks/haml-js"]
|
||||
path = benchmarks/haml-js
|
||||
url = git://github.com/creationix/haml-js.git
|
1
node_modules/hamljs/.ignore
generated
vendored
Normal file
1
node_modules/hamljs/.ignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
benchmarks
|
3
node_modules/hamljs/.npmignore
generated
vendored
Normal file
3
node_modules/hamljs/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
benchmarks
|
||||
examples
|
||||
spec
|
4
node_modules/hamljs/.travis.yml
generated
vendored
Normal file
4
node_modules/hamljs/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.10
|
19
node_modules/hamljs/Gruntfile.js
generated
vendored
Normal file
19
node_modules/hamljs/Gruntfile.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
urequire: {
|
||||
dist: {
|
||||
path: "lib",
|
||||
main: "haml",
|
||||
dstPath: ".",
|
||||
template: "AMD"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks("grunt-urequire");
|
||||
grunt.registerTask("default", ["urequire"]);
|
||||
|
||||
};
|
120
node_modules/hamljs/History.md
generated
vendored
Normal file
120
node_modules/hamljs/History.md
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
0.6.2 / 2014-02-17
|
||||
==================
|
||||
|
||||
* add support for string interpolation
|
||||
* add amd support
|
||||
* add `.renderFile`
|
||||
* ability to use both class tag and class attribute at the same time
|
||||
|
||||
0.6.1 / 2012-07-26
|
||||
==================
|
||||
|
||||
* fix global leak of Parser
|
||||
|
||||
0.6.0 / 2012-06-25
|
||||
==================
|
||||
|
||||
* remove engine restriction
|
||||
* [fix] Changed require('sys') to require('util') for compatibility with node v0.8
|
||||
* require('util') instead of require('sys')
|
||||
* Refactor tests to not use require.paths
|
||||
* Typechange (from a symlink to a file).
|
||||
|
||||
0.5.1 / 2011-03-30
|
||||
==================
|
||||
|
||||
* Exposing Parser for extension [Derek Hammer]
|
||||
|
||||
0.5.0 / 2011-03-04
|
||||
==================
|
||||
|
||||
* Added `.compile()` for Express 2.0
|
||||
* Fixed issue with to many newlines in output. Closes #24
|
||||
|
||||
0.4.5 / 2010-06-04
|
||||
==================
|
||||
|
||||
* Ignoring stray indent
|
||||
|
||||
0.4.4 / 2010-05-27
|
||||
==================
|
||||
|
||||
* Fixed arbitrary whitespace support
|
||||
|
||||
0.4.3 / 2010-05-25
|
||||
==================
|
||||
|
||||
* Fixed support for CRLF / CR line-endings, converted on input
|
||||
* Exporting HamlError
|
||||
|
||||
0.4.2 / 2010-05-25
|
||||
==================
|
||||
|
||||
* Added HamlError
|
||||
* Buffer newline indentation. Closes #23
|
||||
* Benchmarks with node-bench
|
||||
|
||||
0.4.1 / 2010-05-17
|
||||
==================
|
||||
|
||||
* Fixed "- each" with non-enumerables, no longer throws exception
|
||||
* Fixed array iteration
|
||||
|
||||
0.4.0 / 2010-05-06
|
||||
==================
|
||||
|
||||
* Using Function constructor instead of eval()
|
||||
* Performance enhanced by faster iteration implementation for "- each"
|
||||
|
||||
0.3.1 / 2010-04-26
|
||||
==================
|
||||
|
||||
* Fixed support for tags with hypens (both namespace / tag name, ex: "fb:login-button")
|
||||
|
||||
0.3.0 / 2010-04-16
|
||||
==================
|
||||
|
||||
* Added xml namespace support
|
||||
* Added xml support
|
||||
|
||||
0.2.0 / 2010-04-06
|
||||
==================
|
||||
|
||||
* Added conditional comment support [ciaranj]
|
||||
* Fixed; Trimming input string before tokenization
|
||||
* Fixed issue requiring quoting of "for" when used in attrs [aheckmann]
|
||||
* Fixed; Exposing Haml compilation cache. Closes #12
|
||||
* Fixed :javascript "type" attr, now "text/javascript" [aheckmann]
|
||||
|
||||
0.1.0 / 2010-03-31
|
||||
==================
|
||||
|
||||
* Added "cache" option, making haml.js over 90 times faster than haml-js
|
||||
* Improved textBlock whitespace replication
|
||||
* Fixed empty tags followed by class / ids on new lines. Closes #6
|
||||
|
||||
0.0.4 / 2010-03-29
|
||||
==================
|
||||
|
||||
* Added better error reporting
|
||||
|
||||
0.0.3 / 2010-03-29
|
||||
==================
|
||||
|
||||
* Added "filename" option support to aid in error reporting
|
||||
* Added exports.compile() to create intermediate javascript
|
||||
* Added `make benchmark`
|
||||
* Changed; caching function templates to increase performance
|
||||
* Fixed; ids and classes allowing underscores. Closes #5
|
||||
* Fixed outdent issue when \n is not followed by whitespace. Closes #8
|
||||
|
||||
0.0.2 / 2010-03-26
|
||||
==================
|
||||
|
||||
* Added haml.js vs haml-js benchmarks
|
||||
* Fixed; commenting :javascript CDATA
|
||||
|
||||
0.0.1 / 2010-03-26
|
||||
==================
|
||||
|
||||
* Initial release
|
11
node_modules/hamljs/Makefile
generated
vendored
Normal file
11
node_modules/hamljs/Makefile
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
REPORTER = spec
|
||||
test:
|
||||
@./node_modules/.bin/mocha \
|
||||
--require should \
|
||||
--reporter $(REPORTER) \
|
||||
test/test.js
|
||||
|
||||
benchmark:
|
||||
@node-bench benchmarks/run.js
|
||||
|
||||
.PHONY: test benchmark
|
318
node_modules/hamljs/Readme.md
generated
vendored
Normal file
318
node_modules/hamljs/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
# Haml.js
|
||||
|
||||
High performance JavaScript [Haml](http://haml-lang.com) implementation for [nodejs](http://nodejs.org)
|
||||
|
||||
For a higher quality implementation you may want to look at my [Jade](http://jade-lang.com) template engine,
|
||||
however the syntax is slightly different. Jade's engine may be back-ported to haml.js in the future.
|
||||
|
||||
[](https://travis-ci.org/visionmedia/haml.js)
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install hamljs
|
||||
|
||||
node> require('hamljs')
|
||||
|
||||
## Express
|
||||
|
||||
To use with [Express](http://expressjs.com) and the .haml extension, simply register the engine:
|
||||
|
||||
app.engine('.haml', require('hamljs').renderFile);
|
||||
|
||||
## About
|
||||
|
||||
Benchmarks rendering the same 21 line haml file located at _benchmarks/page.haml_,
|
||||
shows that this library is nearly **65%** or **3 times** faster than haml-js.
|
||||
|
||||
Winner: haml.js
|
||||
Compared with next highest (haml-js), it's:
|
||||
65.39% faster
|
||||
2.89 times as fast
|
||||
0 order(s) of magnitude faster
|
||||
|
||||
Haml.js attempts to comply with the original [Haml](http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html)
|
||||
implementation as well as possible. There are no magic "plugins" like
|
||||
found in other JavaScript haml implementations, for example the following
|
||||
will work just fine:
|
||||
|
||||
- if (items)
|
||||
%ul
|
||||
- for (var i = 0; i < items.length; ++i)
|
||||
%li= items[i]
|
||||
|
||||
Iteration is the one exception to these magical plugins,
|
||||
since this is **ugly** in JavaScript, you may also:
|
||||
|
||||
- if (items)
|
||||
%ul
|
||||
- each item in items
|
||||
%li= item
|
||||
|
||||
## Tags
|
||||
|
||||
%div text
|
||||
|
||||
html:
|
||||
|
||||
<div>text</div>
|
||||
|
||||
## Classes
|
||||
|
||||
%div.article.first
|
||||
article text here
|
||||
and here
|
||||
|
||||
html:
|
||||
|
||||
<div class="article first">
|
||||
article text here and here
|
||||
</div>
|
||||
|
||||
## Div Class Shortcut
|
||||
|
||||
.comment hey
|
||||
|
||||
html:
|
||||
|
||||
<div class="comment">hey</div>
|
||||
|
||||
## Div Id Shortcut
|
||||
|
||||
#article-1 foo
|
||||
|
||||
html:
|
||||
|
||||
<div id="article-1">foo</div>
|
||||
|
||||
## Combining Ids and Classes
|
||||
|
||||
You may chain id and classes in any order:
|
||||
|
||||
.article#first.summary content
|
||||
|
||||
html:
|
||||
|
||||
<div id="first" class="article summary">content</div>
|
||||
|
||||
## Attributes
|
||||
|
||||
%a{ href: 'http://google.com', title: 'Google It' } Google
|
||||
|
||||
html:
|
||||
|
||||
<a href="http://google.com" title="Google It">Google</a>
|
||||
|
||||
Attribute keys such as "for" are automatically quoted
|
||||
by haml.js, so instead of:
|
||||
|
||||
%label{ 'for': 'something' }
|
||||
|
||||
you should:
|
||||
|
||||
%label{ for: 'something' }
|
||||
|
||||
which will render:
|
||||
|
||||
<label for="something"></label>
|
||||
|
||||
## Boolean Attributes
|
||||
|
||||
%input{ type: 'checkbox', checked: true }
|
||||
|
||||
html:
|
||||
|
||||
<input type="checkbox" checked="checked"/>
|
||||
|
||||
## Combining Attributes, Ids, and Classes
|
||||
|
||||
Wemay also contain id and classes before or after:
|
||||
|
||||
%a.button{ href: 'http://google.com', title: 'Google It' }.first Google
|
||||
|
||||
html:
|
||||
|
||||
<a href="http://google.com" title="Google It" class="button first">Google</a>
|
||||
|
||||
## Code
|
||||
|
||||
Code starting with a hyphen will be executed but
|
||||
not buffered, where as code using the equals sign
|
||||
will be buffered:
|
||||
|
||||
- a = 1
|
||||
- b = 2
|
||||
= a + b
|
||||
|
||||
html:
|
||||
|
||||
3
|
||||
|
||||
HTML buffered with equals sign will **always** be escaped:
|
||||
|
||||
= "<br/>"
|
||||
|
||||
html:
|
||||
|
||||
<br/>
|
||||
|
||||
To prevent escaping of HTML entities we can use _!=_:
|
||||
|
||||
!= "<br/>"
|
||||
|
||||
html:
|
||||
|
||||
<br/>
|
||||
|
||||
## Iteration
|
||||
|
||||
%ul
|
||||
- each item in items
|
||||
%li= item
|
||||
|
||||
html:
|
||||
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
</ul>
|
||||
|
||||
If you require the key or index of the object
|
||||
or array during iteration simple append a comma
|
||||
following another id:
|
||||
|
||||
%ul
|
||||
- each item, index in items
|
||||
%li= item + '(' + index + ')'
|
||||
|
||||
html:
|
||||
|
||||
<ul>
|
||||
<li>one(0)</li>
|
||||
<li>two(1)</li>
|
||||
<li>three(2)</li>
|
||||
</ul>
|
||||
|
||||
## Doctypes
|
||||
|
||||
Defaults to transitional:
|
||||
|
||||
!!!
|
||||
|
||||
html:
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
Optionally pass a supported doctype name:
|
||||
|
||||
!!! strict
|
||||
|
||||
html:
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
currently supported doctypes, which can be
|
||||
extended simply by adding values to to _haml.doctypes_.
|
||||
|
||||
'5': '<!DOCTYPE html>',
|
||||
'xml': '<?xml version="1.0" encoding="utf-8" ?>',
|
||||
'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
||||
|
||||
## String interpolation
|
||||
|
||||
%div Hello #{world}
|
||||
|
||||
with locals:
|
||||
|
||||
{ world: "World!" }
|
||||
|
||||
html:
|
||||
|
||||
<div>Hello World!</div>
|
||||
|
||||
## :cdata
|
||||
|
||||
%script
|
||||
:cdata
|
||||
foo
|
||||
|
||||
html:
|
||||
|
||||
<script><![CDATA[
|
||||
foo
|
||||
]]></script>
|
||||
|
||||
## :javascript
|
||||
|
||||
%head
|
||||
:javascript
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert('baz')
|
||||
|
||||
html:
|
||||
|
||||
<head>
|
||||
<script type="javascript">
|
||||
//<![CDATA[
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert('baz')
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
## Extending Haml
|
||||
|
||||
### Adding Filters
|
||||
|
||||
var haml = require('hamljs')
|
||||
haml.filters.my_filter = function(str) {
|
||||
return doSomethingWith(str)
|
||||
}
|
||||
|
||||
by registering the filter function _my_filter_ we can now
|
||||
utilize it within our Haml templates as shown below:
|
||||
%p
|
||||
:my_filter
|
||||
some text
|
||||
here yay
|
||||
whoop awesome
|
||||
|
||||
### Adding Doctypes
|
||||
|
||||
var haml = require('hamljs')
|
||||
haml.doctypes.foo = '<!DOCTYPE ... >'
|
||||
|
||||
Will now allow you to:
|
||||
!!! foo
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 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.
|
436
node_modules/hamljs/haml.js
generated
vendored
Normal file
436
node_modules/hamljs/haml.js
generated
vendored
Normal file
@@ -0,0 +1,436 @@
|
||||
// Generated by uRequire v0.6.10 - template: 'AMD'
|
||||
(function (window, global) {
|
||||
|
||||
var __isAMD = !!(typeof define === 'function' && define.amd),
|
||||
__isNode = (typeof exports === 'object'),
|
||||
__isWeb = !__isNode;
|
||||
define(function (require, exports, module) {
|
||||
|
||||
|
||||
var HAML = {};
|
||||
HAML.version = "0.6.2";
|
||||
HAML.cache = {};
|
||||
HAML.errorContextLength = 15;
|
||||
HAML.selfClosing = [
|
||||
"meta",
|
||||
"img",
|
||||
"link",
|
||||
"br",
|
||||
"hr",
|
||||
"input",
|
||||
"area",
|
||||
"base"
|
||||
];
|
||||
HAML.doctypes = {
|
||||
"5": "<!DOCTYPE html>",
|
||||
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",
|
||||
"default": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
|
||||
"strict": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">",
|
||||
"frameset": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">",
|
||||
"1.1": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">",
|
||||
"basic": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">",
|
||||
"mobile": "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">"
|
||||
};
|
||||
HAML.filters = {
|
||||
plain: function (str, buf) {
|
||||
buf.push(str);
|
||||
},
|
||||
cdata: function (str, buf) {
|
||||
buf.push("<![CDATA[\n" + str + "\n]]>");
|
||||
},
|
||||
javascript: function (str, buf) {
|
||||
buf.push("<script type=\"text/javascript\">\n//<![CDATA[\n" + str + "\n//]]></script>");
|
||||
}
|
||||
};
|
||||
var HamlError = HAML.HamlError = function (msg) {
|
||||
this.name = "HamlError";
|
||||
this.message = msg;
|
||||
Error.captureStackTrace(this, HAML.render);
|
||||
};
|
||||
HamlError.super_ = Error;
|
||||
HamlError.prototype = Object.create(Error.prototype, {
|
||||
constructor: {
|
||||
value: HamlError,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
var rules = {
|
||||
indent: /^\n( *)(?! *-#)/,
|
||||
conditionalComment: /^\/(\[[^\n]+\])/,
|
||||
comment: /^\n? *\/ */,
|
||||
silentComment: /^\n? *-#([^\n]*)/,
|
||||
doctype: /^!!! *([^\n]*)/,
|
||||
escape: /^\\(.)/,
|
||||
filter: /^:(\w+) */,
|
||||
each: /^\- *each *(\w+)(?: *, *(\w+))? * in ([^\n]+)/,
|
||||
code: /^\-([^\n]+)/,
|
||||
outputCode: /^!=([^\n]+)/,
|
||||
escapeCode: /^=([^\n]+)/,
|
||||
attrs: /^\{(.*?)\}/,
|
||||
tag: /^%([-a-zA-Z][-a-zA-Z0-9:]*)/,
|
||||
class: /^\.([\w\-]+)/,
|
||||
id: /^\#([\w\-]+)/,
|
||||
text: /^([^\n]+)/
|
||||
};
|
||||
function context(str) {
|
||||
return String(str).substr(0, HAML.errorContextLength).replace(/\n/g, "\\n");
|
||||
}
|
||||
function tokenize(str) {
|
||||
var captures, token, tokens = [], line = 1, lastIndents = 0, str = String(str).trim().replace(/\r\n|\r|\n *\n/g, "\n");
|
||||
function error(msg) {
|
||||
throw new HamlError("(Haml):" + line + " " + msg);
|
||||
}
|
||||
while (str.length) {
|
||||
for (var type in rules)
|
||||
if (captures = rules[type].exec(str)) {
|
||||
token = {
|
||||
type: type,
|
||||
line: line,
|
||||
match: captures[0],
|
||||
val: captures.length > 2 ? captures.slice(1) : captures[1]
|
||||
};
|
||||
str = str.substr(captures[0].length);
|
||||
if (type === "indent")
|
||||
++line;
|
||||
else
|
||||
break;
|
||||
var indents = token.val.length / 2;
|
||||
if (indents % 1)
|
||||
error("invalid indentation; got " + token.val.length + " spaces, should be multiple of 2");
|
||||
else if (indents - 1 > lastIndents)
|
||||
error("invalid indentation; got " + indents + ", when previous was " + lastIndents);
|
||||
else if (lastIndents > indents)
|
||||
while (lastIndents-- > indents)
|
||||
tokens.push({
|
||||
type: "outdent",
|
||||
line: line
|
||||
});
|
||||
else if (lastIndents !== indents)
|
||||
tokens.push({
|
||||
type: "indent",
|
||||
line: line
|
||||
});
|
||||
else
|
||||
tokens.push({
|
||||
type: "newline",
|
||||
line: line
|
||||
});
|
||||
lastIndents = indents;
|
||||
}
|
||||
if (token) {
|
||||
if (token.type !== "silentComment")
|
||||
tokens.push(token);
|
||||
token = null;
|
||||
} else
|
||||
error("near \"" + context(str) + "\"");
|
||||
}
|
||||
return tokens.concat({ type: "eof" });
|
||||
}
|
||||
var Parser = HAML.Parser = function (str, options) {
|
||||
options = options || {};
|
||||
this.tokens = tokenize(str);
|
||||
this.xml = options.xml;
|
||||
};
|
||||
Parser.prototype = {
|
||||
get peek() {
|
||||
return this.tokens[0];
|
||||
},
|
||||
get advance() {
|
||||
return this.current = this.tokens.shift();
|
||||
},
|
||||
get outdent() {
|
||||
switch (this.peek.type) {
|
||||
case "eof":
|
||||
return;
|
||||
case "outdent":
|
||||
return this.advance;
|
||||
default:
|
||||
throw new HamlError("expected outdent, got " + this.peek.type);
|
||||
}
|
||||
},
|
||||
get text() {
|
||||
var text = this.advance.val.trim();
|
||||
text = text.replace(/#\{(.*)\}/, "\" + $1 + \"");
|
||||
this.buffer(text);
|
||||
},
|
||||
get block() {
|
||||
this.advance;
|
||||
while (this.peek.type !== "outdent" && this.peek.type !== "eof")
|
||||
this.expr;
|
||||
this.outdent;
|
||||
},
|
||||
get textBlock() {
|
||||
var token, indents = 1;
|
||||
this.advance;
|
||||
while (this.peek.type !== "eof" && indents)
|
||||
switch ((token = this.advance).type) {
|
||||
case "newline":
|
||||
this.buffer("\\n" + Array(indents).join(" ") + "");
|
||||
break;
|
||||
case "indent":
|
||||
++indents;
|
||||
this.buffer("\\n" + Array(indents).join(" ") + "");
|
||||
break;
|
||||
case "outdent":
|
||||
--indents;
|
||||
if (indents === 1)
|
||||
this.buffer("\\n");
|
||||
break;
|
||||
default:
|
||||
this.buffer(token.match.replace(/"/g, "\\\""));
|
||||
}
|
||||
},
|
||||
get attrs() {
|
||||
var attrs = [
|
||||
"attrs",
|
||||
"class",
|
||||
"id"
|
||||
], buf = [];
|
||||
while (attrs.indexOf(this.peek.type) !== -1)
|
||||
switch (this.peek.type) {
|
||||
case "id":
|
||||
buf.push("{ id: \"" + this.advance.val + "\" }");
|
||||
break;
|
||||
case "class":
|
||||
buf.push("{ class: \"" + this.advance.val + "\" }");
|
||||
break;
|
||||
case "attrs":
|
||||
buf.push("{ " + this.advance.val.replace(/(for) *:/gi, "\"$1\":") + " }");
|
||||
}
|
||||
return buf.length ? " \" + attrs([" + buf.join(", ") + "]) + \"" : "";
|
||||
},
|
||||
get tag() {
|
||||
var tag = this.advance.val, selfClosing = !this.xml && HAML.selfClosing.indexOf(tag) !== -1;
|
||||
this.buffer("\\n<" + tag + this.attrs + (selfClosing ? "/>" : ">"));
|
||||
switch (this.peek.type) {
|
||||
case "text":
|
||||
this.text;
|
||||
break;
|
||||
case "conditionalComment":
|
||||
this.conditionalComment;
|
||||
break;
|
||||
case "comment":
|
||||
this.comment;
|
||||
break;
|
||||
case "outputCode":
|
||||
this.outputCode;
|
||||
break;
|
||||
case "escapeCode":
|
||||
this.escapeCode;
|
||||
break;
|
||||
case "indent":
|
||||
this.block;
|
||||
}
|
||||
if (!selfClosing)
|
||||
this.buffer("</" + tag + ">");
|
||||
},
|
||||
get outputCode() {
|
||||
this.buffer(this.advance.val, false);
|
||||
},
|
||||
get escapeCode() {
|
||||
this.buffer("escape(" + this.advance.val + ")", false);
|
||||
},
|
||||
get doctype() {
|
||||
var doctype = this.advance.val.trim().toLowerCase() || "default";
|
||||
if (doctype in HAML.doctypes)
|
||||
this.buffer(HAML.doctypes[doctype].replace(/"/g, "\\\""));
|
||||
else
|
||||
throw new HamlError("doctype `" + doctype + "' does not exist");
|
||||
},
|
||||
get conditionalComment() {
|
||||
var condition = this.advance.val;
|
||||
this.buffer("<!--" + condition + ">");
|
||||
this.peek.type === "indent" ? this.block : this.expr;
|
||||
this.buffer("<![endif]-->");
|
||||
},
|
||||
get comment() {
|
||||
this.advance;
|
||||
this.buffer("<!-- ");
|
||||
var buf = this.peek.type === "indent" ? this.block : this.expr;
|
||||
this.buffer(" -->");
|
||||
},
|
||||
get code() {
|
||||
var code = this.advance.val;
|
||||
if (this.peek.type === "indent") {
|
||||
this.buf.push(code);
|
||||
this.buf.push("{");
|
||||
this.block;
|
||||
this.buf.push("}");
|
||||
return;
|
||||
}
|
||||
this.buf.push(code);
|
||||
},
|
||||
get filter() {
|
||||
var filter = this.advance.val;
|
||||
if (!(filter in HAML.filters))
|
||||
throw new HamlError("filter `" + filter + "' does not exist");
|
||||
if (this.peek.type !== "indent")
|
||||
throw new HamlError("filter `" + filter + "' expects a text block");
|
||||
this.buf.push("HAML.filters." + filter + "(");
|
||||
this.buf.push("(function(){");
|
||||
this.buf.push("var buf = []");
|
||||
this.textBlock;
|
||||
this.buf.push("return buf.join(\"\")");
|
||||
this.buf.push("}).call(this)");
|
||||
this.buf.push(", buf)");
|
||||
},
|
||||
get iterate() {
|
||||
var each = this.advance, key = each.val[1], vals = each.val[2], val = each.val[0];
|
||||
if (this.peek.type !== "indent")
|
||||
throw new HamlError("'- each' expects a block, but got " + this.peek.type);
|
||||
this.buf.push("for (var " + (key || "index") + " in " + vals + ") {");
|
||||
this.buf.push("var " + val + " = " + vals + "[" + (key || "index") + "];");
|
||||
this.block;
|
||||
this.buf.push("}");
|
||||
},
|
||||
get expr() {
|
||||
switch (this.peek.type) {
|
||||
case "id":
|
||||
case "class":
|
||||
this.tokens.unshift({
|
||||
type: "tag",
|
||||
val: "div"
|
||||
});
|
||||
return this.tag;
|
||||
case "tag":
|
||||
return this.tag;
|
||||
case "text":
|
||||
var buf = [];
|
||||
while (this.peek.type === "text") {
|
||||
buf.push(this.advance.val.trim());
|
||||
if (this.peek.type === "newline")
|
||||
this.advance;
|
||||
}
|
||||
return this.buffer(buf.join(" "));
|
||||
case "each":
|
||||
return this.iterate;
|
||||
case "code":
|
||||
return this.code;
|
||||
case "escape":
|
||||
return this.buffer(this.advance.val);
|
||||
case "doctype":
|
||||
return this.doctype;
|
||||
case "filter":
|
||||
return this.filter;
|
||||
case "conditionalComment":
|
||||
return this.conditionalComment;
|
||||
case "comment":
|
||||
return this.comment;
|
||||
case "escapeCode":
|
||||
return this.escapeCode;
|
||||
case "outputCode":
|
||||
return this.outputCode;
|
||||
case "newline":
|
||||
case "indent":
|
||||
case "outdent":
|
||||
this.advance;
|
||||
return this.expr;
|
||||
default:
|
||||
throw new HamlError("unexpected " + this.peek.type);
|
||||
}
|
||||
},
|
||||
get js() {
|
||||
this.buf = [
|
||||
"with (locals || {}) {",
|
||||
" var buf = [];"
|
||||
];
|
||||
while (this.peek.type !== "eof")
|
||||
this.expr;
|
||||
this.buf.push(" return buf.join(\"\")");
|
||||
this.buf.push("}");
|
||||
return this.buf.join("\n");
|
||||
},
|
||||
buffer: function (str, quoted) {
|
||||
if (typeof quoted === "undefined")
|
||||
var quoted = true;
|
||||
if (quoted)
|
||||
this.buf.push(" buf.push(\"" + str + "\")");
|
||||
else
|
||||
this.buf.push(" buf.push(" + str + ")");
|
||||
}
|
||||
};
|
||||
function escape(str) {
|
||||
return String(str).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
|
||||
}
|
||||
function attrs(attrs) {
|
||||
var finalAttrs = {}, classes = [], buf = [];
|
||||
for (var i = 0, len = attrs.length; i < len; i++)
|
||||
for (var attrName in attrs[i])
|
||||
if (attrName === "class")
|
||||
classes.push(attrs[i][attrName]);
|
||||
else
|
||||
finalAttrs[attrName] = attrs[i][attrName];
|
||||
if (classes.length)
|
||||
finalAttrs["class"] = classes.join(" ");
|
||||
for (var key in finalAttrs)
|
||||
if (typeof finalAttrs[key] === "boolean") {
|
||||
if (finalAttrs[key] === true)
|
||||
buf.push(key + "=\"" + key + "\"");
|
||||
} else if (finalAttrs[key])
|
||||
buf.push(key + "=\"" + escape(finalAttrs[key]) + "\"");
|
||||
return buf.join(" ");
|
||||
}
|
||||
HAML.compile = function (str, options) {
|
||||
var parser = new Parser(str, options);
|
||||
var fn = new Function("locals, attrs, escape, HAML", parser.js);
|
||||
return function (locals) {
|
||||
return fn.apply(this, [
|
||||
locals,
|
||||
attrs,
|
||||
escape,
|
||||
HAML
|
||||
]);
|
||||
};
|
||||
};
|
||||
HAML.render = function (str, options) {
|
||||
var parser, options = options || {};
|
||||
if (options.cache && !options.filename)
|
||||
throw new Error("filename option must be passed when cache is enabled");
|
||||
return function () {
|
||||
try {
|
||||
var fn;
|
||||
if (options.cache && HAML.cache[options.filename])
|
||||
fn = HAML.cache[options.filename];
|
||||
else {
|
||||
parser = new Parser(str, options);
|
||||
fn = Function("locals, attrs, escape, HAML", parser.js);
|
||||
}
|
||||
return (options.cache ? HAML.cache[options.filename] = fn : fn).call(options.context, options.locals, attrs, escape, HAML);
|
||||
} catch (err) {
|
||||
if (parser && err instanceof HamlError)
|
||||
err.message = "(Haml):" + parser.peek.line + " " + err.message;
|
||||
else if (!(err instanceof HamlError))
|
||||
err.message = "(Haml): " + err.message;
|
||||
if (options.filename)
|
||||
err.message = err.message.replace("Haml", options.filename);
|
||||
throw err;
|
||||
}
|
||||
}.call(options.context);
|
||||
};
|
||||
HAML.renderFile = function (filename, encoding, options, callback) {
|
||||
var fs = require("fs");
|
||||
options = options || {};
|
||||
options.filename = options.filename || filename;
|
||||
options.cache = options.hasOwnProperty("cache") ? options.cache : true;
|
||||
if (HAML.cache[filename]) {
|
||||
process.nextTick(function () {
|
||||
callback(null, HAML.render(null, options));
|
||||
});
|
||||
} else {
|
||||
fs.readFile(filename, encoding, function (err, str) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, HAML.render(str, options));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
module.exports = HAML;
|
||||
|
||||
return module.exports;
|
||||
|
||||
})
|
||||
}).call(this, (typeof exports === 'object' ? global : window), (typeof exports === 'object' ? global : window))
|
711
node_modules/hamljs/lib/haml.js
generated
vendored
Normal file
711
node_modules/hamljs/lib/haml.js
generated
vendored
Normal file
@@ -0,0 +1,711 @@
|
||||
// Haml - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
||||
|
||||
var HAML = {};
|
||||
|
||||
/**
|
||||
* Version.
|
||||
*/
|
||||
|
||||
HAML.version = '0.6.2'
|
||||
|
||||
/**
|
||||
* Haml template cache.
|
||||
*/
|
||||
|
||||
HAML.cache = {}
|
||||
|
||||
/**
|
||||
* Default error context length.
|
||||
*/
|
||||
|
||||
HAML.errorContextLength = 15
|
||||
|
||||
/**
|
||||
* Self closing tags.
|
||||
*/
|
||||
|
||||
HAML.selfClosing = [
|
||||
'meta',
|
||||
'img',
|
||||
'link',
|
||||
'br',
|
||||
'hr',
|
||||
'input',
|
||||
'area',
|
||||
'base'
|
||||
]
|
||||
|
||||
/**
|
||||
* Default supported doctypes.
|
||||
*/
|
||||
|
||||
HAML.doctypes = {
|
||||
'5': '<!DOCTYPE html>',
|
||||
'xml': '<?xml version="1.0" encoding="utf-8" ?>',
|
||||
'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
||||
}
|
||||
|
||||
/**
|
||||
* Default filters.
|
||||
*/
|
||||
|
||||
HAML.filters = {
|
||||
|
||||
/**
|
||||
* Return plain string.
|
||||
*/
|
||||
|
||||
plain: function(str, buf) {
|
||||
buf.push(str)
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrap with CDATA tags.
|
||||
*/
|
||||
|
||||
cdata: function(str, buf) {
|
||||
buf.push('<![CDATA[\n' + str + '\n]]>')
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrap with <script> and CDATA tags.
|
||||
*/
|
||||
|
||||
javascript: function(str, buf) {
|
||||
buf.push('<script type="text/javascript">\n//<![CDATA[\n' + str + '\n//]]></script>')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HamlError.
|
||||
*/
|
||||
|
||||
var HamlError = HAML.HamlError = function(msg) {
|
||||
this.name = 'HamlError'
|
||||
this.message = msg
|
||||
Error.captureStackTrace(this, HAML.render)
|
||||
}
|
||||
|
||||
/**
|
||||
* HamlError inherits from Error.
|
||||
*/
|
||||
HamlError.super_ = Error;
|
||||
HamlError.prototype = Object.create(Error.prototype, {
|
||||
constructor: {
|
||||
value: HamlError,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Lexing rules.
|
||||
*/
|
||||
|
||||
var rules = {
|
||||
indent: /^\n( *)(?! *-#)/,
|
||||
conditionalComment: /^\/(\[[^\n]+\])/,
|
||||
comment: /^\n? *\/ */,
|
||||
silentComment: /^\n? *-#([^\n]*)/,
|
||||
doctype: /^!!! *([^\n]*)/,
|
||||
escape: /^\\(.)/,
|
||||
filter: /^:(\w+) */,
|
||||
each: /^\- *each *(\w+)(?: *, *(\w+))? * in ([^\n]+)/,
|
||||
code: /^\-([^\n]+)/,
|
||||
outputCode: /^!=([^\n]+)/,
|
||||
escapeCode: /^=([^\n]+)/,
|
||||
attrs: /^\{(.*?)\}/,
|
||||
tag: /^%([-a-zA-Z][-a-zA-Z0-9:]*)/,
|
||||
class: /^\.([\w\-]+)/,
|
||||
id: /^\#([\w\-]+)/,
|
||||
text: /^([^\n]+)/
|
||||
}
|
||||
|
||||
/**
|
||||
* Return error context _str_.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function context(str) {
|
||||
return String(str)
|
||||
.substr(0, HAML.errorContextLength)
|
||||
.replace(/\n/g, '\\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenize _str_.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function tokenize(str) {
|
||||
var captures,
|
||||
token,
|
||||
tokens = [],
|
||||
line = 1,
|
||||
lastIndents = 0,
|
||||
str = String(str).trim().replace(/\r\n|\r|\n *\n/g, '\n')
|
||||
function error(msg){ throw new HamlError('(Haml):' + line + ' ' + msg) }
|
||||
while (str.length) {
|
||||
for (var type in rules)
|
||||
if (captures = rules[type].exec(str)) {
|
||||
token = {
|
||||
type: type,
|
||||
line: line,
|
||||
match: captures[0],
|
||||
val: captures.length > 2
|
||||
? captures.slice(1)
|
||||
: captures[1]
|
||||
}
|
||||
str = str.substr(captures[0].length)
|
||||
if (type === 'indent') ++line
|
||||
else break
|
||||
var indents = token.val.length / 2
|
||||
if (indents % 1)
|
||||
error('invalid indentation; got ' + token.val.length + ' spaces, should be multiple of 2')
|
||||
else if (indents - 1 > lastIndents)
|
||||
error('invalid indentation; got ' + indents + ', when previous was ' + lastIndents)
|
||||
else if (lastIndents > indents)
|
||||
while (lastIndents-- > indents)
|
||||
tokens.push({ type: 'outdent', line: line })
|
||||
else if (lastIndents !== indents)
|
||||
tokens.push({ type: 'indent', line: line })
|
||||
else
|
||||
tokens.push({ type: 'newline', line: line })
|
||||
lastIndents = indents
|
||||
}
|
||||
if (token) {
|
||||
if (token.type !== 'silentComment')
|
||||
tokens.push(token)
|
||||
token = null
|
||||
} else
|
||||
error('near "' + context(str) + '"')
|
||||
}
|
||||
return tokens.concat({ type: 'eof' })
|
||||
}
|
||||
|
||||
// --- Parser
|
||||
|
||||
/**
|
||||
* Initialize parser with _str_ and _options_.
|
||||
*/
|
||||
|
||||
var Parser = HAML.Parser = function (str, options) {
|
||||
options = options || {}
|
||||
this.tokens = tokenize(str)
|
||||
this.xml = options.xml
|
||||
}
|
||||
|
||||
Parser.prototype = {
|
||||
|
||||
/**
|
||||
* Lookahead a single token.
|
||||
*
|
||||
* @return {object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
get peek() {
|
||||
return this.tokens[0]
|
||||
},
|
||||
|
||||
/**
|
||||
* Advance a single token.
|
||||
*
|
||||
* @return {object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
get advance() {
|
||||
return this.current = this.tokens.shift()
|
||||
},
|
||||
|
||||
/**
|
||||
* outdent
|
||||
* | eof
|
||||
*/
|
||||
|
||||
get outdent() {
|
||||
switch (this.peek.type) {
|
||||
case 'eof':
|
||||
return
|
||||
case 'outdent':
|
||||
return this.advance
|
||||
default:
|
||||
throw new HamlError('expected outdent, got ' + this.peek.type)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* text
|
||||
*/
|
||||
|
||||
get text() {
|
||||
var text = this.advance.val.trim();
|
||||
|
||||
// String interpolation
|
||||
text = text.replace(/#\{(.*)\}/, '" + $1 + "')
|
||||
|
||||
this.buffer(text)
|
||||
},
|
||||
|
||||
/**
|
||||
* indent expr outdent
|
||||
*/
|
||||
|
||||
get block() {
|
||||
this.advance
|
||||
while (this.peek.type !== 'outdent' &&
|
||||
this.peek.type !== 'eof')
|
||||
this.expr
|
||||
this.outdent
|
||||
},
|
||||
|
||||
/**
|
||||
* indent expr
|
||||
*/
|
||||
|
||||
get textBlock() {
|
||||
var token,
|
||||
indents = 1
|
||||
this.advance
|
||||
while (this.peek.type !== 'eof' && indents)
|
||||
switch((token = this.advance).type) {
|
||||
case 'newline':
|
||||
this.buffer('\\n' + Array(indents).join(' ') + '')
|
||||
break
|
||||
case 'indent':
|
||||
++indents
|
||||
this.buffer('\\n' + Array(indents).join(' ') + '')
|
||||
break
|
||||
case 'outdent':
|
||||
--indents
|
||||
if (indents === 1) this.buffer('\\n')
|
||||
break
|
||||
default:
|
||||
this.buffer(token.match.replace(/"/g, '\\\"'))
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* ( attrs | class | id )*
|
||||
*/
|
||||
|
||||
get attrs() {
|
||||
var attrs = ['attrs', 'class', 'id'],
|
||||
buf = []
|
||||
|
||||
while (attrs.indexOf(this.peek.type) !== -1)
|
||||
switch (this.peek.type) {
|
||||
case 'id':
|
||||
buf.push('{ id: "' + this.advance.val + '" }')
|
||||
break
|
||||
case 'class':
|
||||
buf.push('{ class: "' + this.advance.val + '" }');
|
||||
break
|
||||
case 'attrs':
|
||||
buf.push('{ ' + this.advance.val.replace(/(for) *:/gi, '"$1":') + ' }')
|
||||
}
|
||||
|
||||
return buf.length
|
||||
? ' " + attrs([' + buf.join(', ') + ']) + "'
|
||||
: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* tag
|
||||
* | tag text
|
||||
* | tag conditionalComment
|
||||
* | tag comment
|
||||
* | tag outputCode
|
||||
* | tag escapeCode
|
||||
* | tag block
|
||||
*/
|
||||
|
||||
get tag() {
|
||||
var tag = this.advance.val,
|
||||
selfClosing = !this.xml && HAML.selfClosing.indexOf(tag) !== -1
|
||||
|
||||
this.buffer('\\n<' + tag + this.attrs + (selfClosing ? '/>' : '>'));
|
||||
switch (this.peek.type) {
|
||||
case 'text':
|
||||
this.text
|
||||
break
|
||||
case 'conditionalComment':
|
||||
this.conditionalComment
|
||||
break;
|
||||
case 'comment':
|
||||
this.comment
|
||||
break
|
||||
case 'outputCode':
|
||||
this.outputCode
|
||||
break
|
||||
case 'escapeCode':
|
||||
this.escapeCode
|
||||
break
|
||||
case 'indent':
|
||||
this.block
|
||||
}
|
||||
if (!selfClosing) this.buffer('</' + tag + '>')
|
||||
},
|
||||
|
||||
/**
|
||||
* outputCode
|
||||
*/
|
||||
|
||||
get outputCode() {
|
||||
this.buffer(this.advance.val, false)
|
||||
},
|
||||
|
||||
/**
|
||||
* escapeCode
|
||||
*/
|
||||
|
||||
get escapeCode() {
|
||||
this.buffer('escape(' + this.advance.val + ')', false)
|
||||
},
|
||||
|
||||
/**
|
||||
* doctype
|
||||
*/
|
||||
|
||||
get doctype() {
|
||||
var doctype = this.advance.val.trim().toLowerCase() || 'default'
|
||||
if (doctype in HAML.doctypes)
|
||||
this.buffer(HAML.doctypes[doctype].replace(/"/g, '\\"'))
|
||||
else
|
||||
throw new HamlError("doctype `" + doctype + "' does not exist")
|
||||
},
|
||||
|
||||
/**
|
||||
* conditional comment expr
|
||||
*/
|
||||
|
||||
get conditionalComment() {
|
||||
var condition= this.advance.val
|
||||
|
||||
this.buffer('<!--' + condition + '>')
|
||||
|
||||
this.peek.type === 'indent'
|
||||
? this.block
|
||||
: this.expr
|
||||
|
||||
this.buffer('<![endif]-->')
|
||||
},
|
||||
|
||||
/**
|
||||
* comment expr
|
||||
*/
|
||||
|
||||
get comment() {
|
||||
this.advance
|
||||
this.buffer('<!-- ')
|
||||
var buf = this.peek.type === 'indent'
|
||||
? this.block
|
||||
: this.expr
|
||||
this.buffer(' -->')
|
||||
},
|
||||
|
||||
/**
|
||||
* code
|
||||
* | code block
|
||||
*/
|
||||
|
||||
get code() {
|
||||
var code = this.advance.val
|
||||
|
||||
if (this.peek.type === 'indent') {
|
||||
this.buf.push(code)
|
||||
this.buf.push('{')
|
||||
this.block
|
||||
this.buf.push('}')
|
||||
return
|
||||
}
|
||||
|
||||
this.buf.push(code)
|
||||
},
|
||||
|
||||
/**
|
||||
* filter textBlock
|
||||
*/
|
||||
|
||||
get filter() {
|
||||
var filter = this.advance.val
|
||||
if (!(filter in HAML.filters))
|
||||
throw new HamlError("filter `" + filter + "' does not exist")
|
||||
if (this.peek.type !== 'indent')
|
||||
throw new HamlError("filter `" + filter + "' expects a text block")
|
||||
|
||||
this.buf.push('HAML.filters.' + filter + '(')
|
||||
this.buf.push('(function(){')
|
||||
this.buf.push('var buf = []')
|
||||
this.textBlock
|
||||
this.buf.push('return buf.join("")')
|
||||
this.buf.push('}).call(this)')
|
||||
this.buf.push(', buf)')
|
||||
},
|
||||
|
||||
/**
|
||||
* each block
|
||||
*/
|
||||
|
||||
get iterate() {
|
||||
var each = this.advance,
|
||||
key = each.val[1],
|
||||
vals = each.val[2],
|
||||
val = each.val[0]
|
||||
|
||||
if (this.peek.type !== 'indent')
|
||||
throw new HamlError("'- each' expects a block, but got " + this.peek.type)
|
||||
|
||||
this.buf.push('for (var ' + (key || 'index') + ' in ' + vals + ') {')
|
||||
this.buf.push('var ' + val + ' = ' + vals + '[' + (key || 'index') + '];')
|
||||
|
||||
this.block
|
||||
|
||||
this.buf.push('}')
|
||||
},
|
||||
|
||||
/**
|
||||
* eof
|
||||
* | tag
|
||||
* | text*
|
||||
* | each
|
||||
* | code
|
||||
* | escape
|
||||
* | doctype
|
||||
* | filter
|
||||
* | comment
|
||||
* | conditionalComment
|
||||
* | escapeCode
|
||||
* | outputCode
|
||||
*/
|
||||
|
||||
get expr() {
|
||||
switch (this.peek.type) {
|
||||
case 'id':
|
||||
case 'class':
|
||||
this.tokens.unshift({ type: 'tag', val: 'div' })
|
||||
return this.tag
|
||||
case 'tag':
|
||||
return this.tag
|
||||
case 'text':
|
||||
var buf = []
|
||||
while (this.peek.type === 'text') {
|
||||
buf.push(this.advance.val.trim())
|
||||
if (this.peek.type === 'newline')
|
||||
this.advance
|
||||
}
|
||||
return this.buffer(buf.join(' '))
|
||||
case 'each':
|
||||
return this.iterate
|
||||
case 'code':
|
||||
return this.code
|
||||
case 'escape':
|
||||
return this.buffer(this.advance.val);
|
||||
case 'doctype':
|
||||
return this.doctype
|
||||
case 'filter':
|
||||
return this.filter
|
||||
case 'conditionalComment':
|
||||
return this.conditionalComment
|
||||
case 'comment':
|
||||
return this.comment
|
||||
case 'escapeCode':
|
||||
return this.escapeCode
|
||||
case 'outputCode':
|
||||
return this.outputCode
|
||||
case 'newline':
|
||||
case 'indent':
|
||||
case 'outdent':
|
||||
this.advance
|
||||
return this.expr
|
||||
default:
|
||||
throw new HamlError('unexpected ' + this.peek.type)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* expr*
|
||||
*/
|
||||
|
||||
get js() {
|
||||
this.buf = [
|
||||
'with (locals || {}) {',
|
||||
' var buf = [];'
|
||||
]
|
||||
|
||||
while (this.peek.type !== 'eof')
|
||||
this.expr
|
||||
|
||||
this.buf.push(' return buf.join("")')
|
||||
this.buf.push('}');
|
||||
|
||||
return this.buf.join('\n')
|
||||
},
|
||||
|
||||
buffer: function (str, quoted) {
|
||||
if (typeof quoted === 'undefined')
|
||||
var quoted = true
|
||||
|
||||
if (quoted)
|
||||
this.buf.push(' buf.push("' + str + '")')
|
||||
else
|
||||
this.buf.push(' buf.push(' + str + ')')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape html entities in _str_.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function escape(str) {
|
||||
return String(str)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<')
|
||||
.replace(/"/g, '"')
|
||||
}
|
||||
|
||||
/**
|
||||
* Render _attrs_ to html escaped attributes.
|
||||
*
|
||||
* @param {array} attrs
|
||||
* @return {string}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function attrs(attrs) {
|
||||
var finalAttrs = {}
|
||||
, classes = []
|
||||
, buf = []
|
||||
|
||||
for (var i = 0, len = attrs.length; i < len; i++)
|
||||
for (var attrName in attrs[i])
|
||||
if (attrName === 'class')
|
||||
classes.push(attrs[i][attrName])
|
||||
else
|
||||
finalAttrs[attrName] = attrs[i][attrName]
|
||||
|
||||
if (classes.length)
|
||||
finalAttrs['class'] = classes.join(' ')
|
||||
|
||||
for (var key in finalAttrs)
|
||||
if (typeof finalAttrs[key] === 'boolean') {
|
||||
if (finalAttrs[key] === true)
|
||||
buf.push(key + '="' + key + '"')
|
||||
} else if (finalAttrs[key])
|
||||
buf.push(key + '="' + escape(finalAttrs[key]) + '"')
|
||||
return buf.join(' ')
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a function from the given `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
HAML.compile = function(str, options){
|
||||
var parser = new Parser(str, options);
|
||||
var fn = new Function('locals, attrs, escape, HAML', parser.js);
|
||||
return function(locals){
|
||||
return fn.apply(this, [locals, attrs, escape, HAML]);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Render a _str_ of haml.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - locals Local variables available to the template
|
||||
* - context Context in which the template is evaluated (becoming "this")
|
||||
* - filename Filename used to aid in error reporting
|
||||
* - cache Cache compiled javascript, requires "filename"
|
||||
* - xml Force xml support (no self-closing tags)
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {object} options
|
||||
* @return {string}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
HAML.render = function(str, options) {
|
||||
var parser,
|
||||
options = options || {}
|
||||
if (options.cache && !options.filename)
|
||||
throw new Error('filename option must be passed when cache is enabled')
|
||||
return (function(){
|
||||
try {
|
||||
var fn
|
||||
if (options.cache && HAML.cache[options.filename])
|
||||
fn = HAML.cache[options.filename]
|
||||
else {
|
||||
parser = new Parser(str, options)
|
||||
fn = Function('locals, attrs, escape, HAML', parser.js)
|
||||
}
|
||||
return (options.cache
|
||||
? HAML.cache[options.filename] = fn
|
||||
: fn).call(options.context, options.locals, attrs, escape, HAML)
|
||||
} catch (err) {
|
||||
if (parser && err instanceof HamlError)
|
||||
err.message = '(Haml):' + parser.peek.line + ' ' + err.message
|
||||
else if (!(err instanceof HamlError))
|
||||
err.message = '(Haml): ' + err.message
|
||||
if (options.filename)
|
||||
err.message = err.message.replace('Haml', options.filename)
|
||||
throw err
|
||||
}
|
||||
}).call(options.context)
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a file containing haml and cache the parser.
|
||||
*
|
||||
* @param {string} filename
|
||||
* @param {string} encoding
|
||||
* @param {object} options
|
||||
* @param {function} callback
|
||||
* @return {void}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
HAML.renderFile = function(filename, encoding, options, callback) {
|
||||
var fs = require('fs');
|
||||
options = options || {}
|
||||
options.filename = options.filename || filename
|
||||
options.cache = options.hasOwnProperty('cache') ? options.cache : true
|
||||
|
||||
if (HAML.cache[filename]) {
|
||||
process.nextTick(function() {
|
||||
callback(null, HAML.render(null, options))
|
||||
});
|
||||
} else {
|
||||
fs.readFile(filename, encoding, function(err, str) {
|
||||
if (err) {
|
||||
callback(err)
|
||||
} else {
|
||||
callback(null, HAML.render(str, options))
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HAML;
|
66
node_modules/hamljs/package.json
generated
vendored
Normal file
66
node_modules/hamljs/package.json
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"hamljs@0.6.2",
|
||||
"/Users/tatiana/selfdefined"
|
||||
]
|
||||
],
|
||||
"_from": "hamljs@0.6.2",
|
||||
"_id": "hamljs@0.6.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-e3EWz22+cnjkKz9u+HJaM+F3yOM=",
|
||||
"_location": "/hamljs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "hamljs@0.6.2",
|
||||
"name": "hamljs",
|
||||
"escapedName": "hamljs",
|
||||
"rawSpec": "0.6.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.6.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@11ty/eleventy"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/hamljs/-/hamljs-0.6.2.tgz",
|
||||
"_spec": "0.6.2",
|
||||
"_where": "/Users/tatiana/selfdefined",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/haml.js/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "Sascha Gehlich",
|
||||
"email": "sascha@gehlich.us"
|
||||
}
|
||||
],
|
||||
"description": "Faster / Express compliant Haml implementation",
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-urequire": "~0.6.0",
|
||||
"mocha": "~1.16.2",
|
||||
"should": "~2.1.1"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/haml.js#readme",
|
||||
"main": "lib/haml.js",
|
||||
"name": "hamljs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/haml.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "0.6.2"
|
||||
}
|
1
node_modules/hamljs/test/fixtures/class.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/class.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.users
|
1
node_modules/hamljs/test/fixtures/class.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/class.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div class="users"></div>
|
1
node_modules/hamljs/test/fixtures/classes.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/classes.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.foo.bar.baz_is-awesome
|
1
node_modules/hamljs/test/fixtures/classes.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/classes.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div class="foo bar baz_is-awesome"></div>
|
3
node_modules/hamljs/test/fixtures/code.each.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/code.each.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
%ul
|
||||
- each item in items
|
||||
%li= item
|
4
node_modules/hamljs/test/fixtures/code.each.html
generated
vendored
Normal file
4
node_modules/hamljs/test/fixtures/code.each.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li></ul>
|
3
node_modules/hamljs/test/fixtures/code.each.index.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/code.each.index.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
%ul
|
||||
- each item, index in items
|
||||
%li= item + '(' + index + ')'
|
4
node_modules/hamljs/test/fixtures/code.each.index.html
generated
vendored
Normal file
4
node_modules/hamljs/test/fixtures/code.each.index.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<ul>
|
||||
<li>one(0)</li>
|
||||
<li>two(1)</li>
|
||||
<li>three(2)</li></ul>
|
3
node_modules/hamljs/test/fixtures/code.each.non-enumerable.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/code.each.non-enumerable.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
%ul
|
||||
- each item, index in items
|
||||
%li= item + '(' + index + ')'
|
1
node_modules/hamljs/test/fixtures/code.each.non-enumerable.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.each.non-enumerable.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<ul></ul>
|
1
node_modules/hamljs/test/fixtures/code.escape.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.escape.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
= "<br" + "/>"
|
1
node_modules/hamljs/test/fixtures/code.escape.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.escape.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<br/>
|
1
node_modules/hamljs/test/fixtures/code.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!= "foo" + "bar"
|
1
node_modules/hamljs/test/fixtures/code.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foobar
|
5
node_modules/hamljs/test/fixtures/code.if.else.haml
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/code.if.else.haml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
- name = "not tj :("
|
||||
- if (name === 'tj')
|
||||
%p You are logged in
|
||||
- else
|
||||
%p You are NOT logged in
|
1
node_modules/hamljs/test/fixtures/code.if.else.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.if.else.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>You are NOT logged in</p>
|
3
node_modules/hamljs/test/fixtures/code.if.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/code.if.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
- name = "tj"
|
||||
- if (name === 'tj')
|
||||
%p You are logged in
|
1
node_modules/hamljs/test/fixtures/code.if.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.if.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>You are logged in</p>
|
5
node_modules/hamljs/test/fixtures/code.nested.haml
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/code.nested.haml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
- if (true)
|
||||
- if (false)
|
||||
%p nope
|
||||
- if (true)
|
||||
%p yay
|
1
node_modules/hamljs/test/fixtures/code.nested.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/code.nested.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>yay</p>
|
9
node_modules/hamljs/test/fixtures/comment.block.conditional.haml
generated
vendored
Normal file
9
node_modules/hamljs/test/fixtures/comment.block.conditional.haml
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/[if IE]
|
||||
%a{ 'href' : 'http://www.mozilla.com/en-US/firefox/' }
|
||||
%h1 Get Firefox
|
||||
/[if IE]
|
||||
%a{ 'href' : 'http://www.mozilla.com/en-US/firefox/' }
|
||||
/[if IE 6]
|
||||
%h1 Get Firefox (IE6 user)
|
||||
/[if IE 7]
|
||||
%h1 Get Firefox (IE7 user)
|
6
node_modules/hamljs/test/fixtures/comment.block.conditional.html
generated
vendored
Normal file
6
node_modules/hamljs/test/fixtures/comment.block.conditional.html
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<!--[if IE]>
|
||||
<a href="http://www.mozilla.com/en-US/firefox/">
|
||||
<h1>Get Firefox</h1></a><![endif]--><!--[if IE]>
|
||||
<a href="http://www.mozilla.com/en-US/firefox/"><!--[if IE 6]>
|
||||
<h1>Get Firefox (IE6 user)</h1><![endif]--><!--[if IE 7]>
|
||||
<h1>Get Firefox (IE7 user)</h1><![endif]--></a><![endif]-->
|
5
node_modules/hamljs/test/fixtures/comment.block.haml
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/comment.block.haml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/
|
||||
%ul
|
||||
%li nope
|
||||
%li nope
|
||||
%li nope
|
5
node_modules/hamljs/test/fixtures/comment.block.html
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/comment.block.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<!--
|
||||
<ul>
|
||||
<li>nope</li>
|
||||
<li>nope</li>
|
||||
<li>nope</li></ul> -->
|
3
node_modules/hamljs/test/fixtures/comment.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/comment.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
-# nothing
|
||||
%p yay
|
||||
-# whatever you want
|
1
node_modules/hamljs/test/fixtures/comment.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/comment.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>yay</p>
|
1
node_modules/hamljs/test/fixtures/comment.tag.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/comment.tag.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/ %p foo
|
2
node_modules/hamljs/test/fixtures/comment.tag.html
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/comment.tag.html
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
<!--
|
||||
<p>foo</p> -->
|
7
node_modules/hamljs/test/fixtures/comment.text.complex.haml
generated
vendored
Normal file
7
node_modules/hamljs/test/fixtures/comment.text.complex.haml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
%ul
|
||||
%li one
|
||||
/ first item
|
||||
%li two
|
||||
/ second item
|
||||
%ul
|
||||
%li three
|
5
node_modules/hamljs/test/fixtures/comment.text.complex.html
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/comment.text.complex.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li>one</li><!-- first item -->
|
||||
<li>two</li><!-- second item -->
|
||||
<ul>
|
||||
<li>three</li></ul></ul>
|
2
node_modules/hamljs/test/fixtures/comment.text.haml
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/comment.text.haml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
%p
|
||||
/ foo bar baz
|
1
node_modules/hamljs/test/fixtures/comment.text.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/comment.text.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p><!-- foo bar baz --></p>
|
1
node_modules/hamljs/test/fixtures/context.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/context.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%p= this
|
1
node_modules/hamljs/test/fixtures/context.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/context.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>yay</p>
|
1
node_modules/hamljs/test/fixtures/cr.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/cr.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#foo
|
3
node_modules/hamljs/test/fixtures/cr.html
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/cr.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<div id="foo">
|
||||
<div class="bar"></div>
|
||||
</div>
|
2
node_modules/hamljs/test/fixtures/crlf.haml
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/crlf.haml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#foo
|
||||
.bar
|
3
node_modules/hamljs/test/fixtures/crlf.html
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/crlf.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<div id="foo">
|
||||
<div class="bar"></div>
|
||||
</div>
|
1
node_modules/hamljs/test/fixtures/doctype.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!!!
|
1
node_modules/hamljs/test/fixtures/doctype.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
1
node_modules/hamljs/test/fixtures/doctype.xml.case.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.xml.case.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!!! xml
|
1
node_modules/hamljs/test/fixtures/doctype.xml.case.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.xml.case.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
1
node_modules/hamljs/test/fixtures/doctype.xml.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.xml.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!!! XML
|
1
node_modules/hamljs/test/fixtures/doctype.xml.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/doctype.xml.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
3
node_modules/hamljs/test/fixtures/error.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/error.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
%html
|
||||
%body
|
||||
%p
|
2
node_modules/hamljs/test/fixtures/escape.haml
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/escape.haml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
%p
|
||||
\.foo
|
1
node_modules/hamljs/test/fixtures/escape.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/escape.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>.foo</p>
|
11
node_modules/hamljs/test/fixtures/feed.haml
generated
vendored
Normal file
11
node_modules/hamljs/test/fixtures/feed.haml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
!!! xml
|
||||
%rss{ version: '2.0' }
|
||||
%channel
|
||||
%title ExpressJS
|
||||
%link http://expressjs.com
|
||||
%description Is super cool
|
||||
%language en-us
|
||||
%item
|
||||
%title Creating Routes
|
||||
%description Some stuff
|
||||
%link http://expressjs.com/routes
|
11
node_modules/hamljs/test/fixtures/feed.xml
generated
vendored
Normal file
11
node_modules/hamljs/test/fixtures/feed.xml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>ExpressJS</title>
|
||||
<link>http://expressjs.com</link>
|
||||
<description>Is super cool</description>
|
||||
<language>en-us</language>
|
||||
<item>
|
||||
<title>Creating Routes</title>
|
||||
<description>Some stuff</description>
|
||||
<link>http://expressjs.com/routes</link></item></channel></rss>
|
3
node_modules/hamljs/test/fixtures/filter.cdata.haml
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/filter.cdata.haml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
%script
|
||||
:cdata
|
||||
foo
|
3
node_modules/hamljs/test/fixtures/filter.cdata.html
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/filter.cdata.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<script><![CDATA[
|
||||
foo
|
||||
]]></script>
|
7
node_modules/hamljs/test/fixtures/filter.cdata.whitespace.haml
generated
vendored
Normal file
7
node_modules/hamljs/test/fixtures/filter.cdata.whitespace.haml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
%script
|
||||
:cdata
|
||||
$(function(){
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert('yay')
|
||||
})
|
7
node_modules/hamljs/test/fixtures/filter.cdata.whitespace.html
generated
vendored
Normal file
7
node_modules/hamljs/test/fixtures/filter.cdata.whitespace.html
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<script><![CDATA[
|
||||
$(function(){
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert('yay')
|
||||
})
|
||||
]]></script>
|
8
node_modules/hamljs/test/fixtures/filter.javascript.haml
generated
vendored
Normal file
8
node_modules/hamljs/test/fixtures/filter.javascript.haml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
%head
|
||||
:javascript
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert("baz")
|
||||
foo()
|
||||
bar()
|
||||
%title Yay
|
9
node_modules/hamljs/test/fixtures/filter.javascript.html
generated
vendored
Normal file
9
node_modules/hamljs/test/fixtures/filter.javascript.html
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<head><script type="text/javascript">
|
||||
//<![CDATA[
|
||||
if (foo)
|
||||
if (bar)
|
||||
alert("baz")
|
||||
foo()
|
||||
bar()
|
||||
//]]></script>
|
||||
<title>Yay</title></head>
|
5
node_modules/hamljs/test/fixtures/filter.plain.haml
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/filter.plain.haml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
%body
|
||||
:plain
|
||||
.foo
|
||||
bar
|
||||
= baz
|
3
node_modules/hamljs/test/fixtures/filter.plain.html
generated
vendored
Normal file
3
node_modules/hamljs/test/fixtures/filter.plain.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<body>.foo
|
||||
bar
|
||||
= baz</body>
|
2
node_modules/hamljs/test/fixtures/html.haml
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/html.haml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
%div
|
||||
<p>literal</p>
|
1
node_modules/hamljs/test/fixtures/html.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/html.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div><p>literal</p></div>
|
1
node_modules/hamljs/test/fixtures/id.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/id.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#users
|
1
node_modules/hamljs/test/fixtures/id.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/id.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div id="users"></div>
|
1
node_modules/hamljs/test/fixtures/issue.#10.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/issue.#10.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%label{ for: "forsomething"}
|
1
node_modules/hamljs/test/fixtures/issue.#10.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/issue.#10.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<label for="forsomething"></label>
|
4
node_modules/hamljs/test/fixtures/issue.#8.haml
generated
vendored
Normal file
4
node_modules/hamljs/test/fixtures/issue.#8.haml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
%ul
|
||||
- each item in items
|
||||
%li= item
|
||||
%p= "Total: " + items.length
|
5
node_modules/hamljs/test/fixtures/issue.#8.html
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/issue.#8.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li>foo</li>
|
||||
<li>bar</li>
|
||||
<li>baz</li></ul>
|
||||
<p>Total: 3</p>
|
1
node_modules/hamljs/test/fixtures/literals.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/literals.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%p= user
|
1
node_modules/hamljs/test/fixtures/literals.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/literals.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>tj</p>
|
1
node_modules/hamljs/test/fixtures/namespace.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/namespace.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%h:table{ 'xmlns:h': 'http://www.w3.org/1999/xhtml' }
|
5
node_modules/hamljs/test/fixtures/namespace.tag.haml
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/namespace.tag.haml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
%body
|
||||
%fb:test.a
|
||||
%fb:bar
|
||||
%fb:foo{ title: 'home' }
|
||||
%fb:login-button
|
5
node_modules/hamljs/test/fixtures/namespace.tag.html
generated
vendored
Normal file
5
node_modules/hamljs/test/fixtures/namespace.tag.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<body>
|
||||
<fb:test class="a"></fb:test>
|
||||
<fb:bar></fb:bar>
|
||||
<fb:foo title="home"></fb:foo>
|
||||
<fb:login-button></fb:login-button></body>
|
1
node_modules/hamljs/test/fixtures/namespace.xml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/namespace.xml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<h:table xmlns:h="http://www.w3.org/1999/xhtml"></h:table>
|
6
node_modules/hamljs/test/fixtures/nesting.complex.haml
generated
vendored
Normal file
6
node_modules/hamljs/test/fixtures/nesting.complex.haml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
%html
|
||||
%head
|
||||
%title Page Title
|
||||
%body
|
||||
%h1 Title
|
||||
%p some stuff
|
6
node_modules/hamljs/test/fixtures/nesting.complex.html
generated
vendored
Normal file
6
node_modules/hamljs/test/fixtures/nesting.complex.html
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title></head>
|
||||
<body>
|
||||
<h1>Title</h1>
|
||||
<p>some stuff</p></body></html>
|
6
node_modules/hamljs/test/fixtures/nesting.simple.haml
generated
vendored
Normal file
6
node_modules/hamljs/test/fixtures/nesting.simple.haml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
%ul
|
||||
%li one
|
||||
%li two
|
||||
%li
|
||||
%ul
|
||||
%li three
|
6
node_modules/hamljs/test/fixtures/nesting.simple.html
generated
vendored
Normal file
6
node_modules/hamljs/test/fixtures/nesting.simple.html
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>three</li></ul></li></ul>
|
12
node_modules/hamljs/test/fixtures/newlines.haml
generated
vendored
Normal file
12
node_modules/hamljs/test/fixtures/newlines.haml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
%ul
|
||||
%li one
|
||||
%li two
|
||||
%li three
|
||||
%li
|
||||
%ul
|
||||
%li four
|
||||
|
||||
%p foo
|
||||
%p
|
||||
bar
|
||||
baz
|
9
node_modules/hamljs/test/fixtures/newlines.html
generated
vendored
Normal file
9
node_modules/hamljs/test/fixtures/newlines.html
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>four</li></ul></li></ul>
|
||||
<p>foo</p>
|
||||
<p>bar baz</p>
|
4
node_modules/hamljs/test/fixtures/newlines.within-tags.haml
generated
vendored
Normal file
4
node_modules/hamljs/test/fixtures/newlines.within-tags.haml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
%head
|
||||
%title
|
||||
|
||||
tabineko
|
2
node_modules/hamljs/test/fixtures/newlines.within-tags.html
generated
vendored
Normal file
2
node_modules/hamljs/test/fixtures/newlines.within-tags.html
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
<head>
|
||||
<title>tabineko</title></head>
|
1
node_modules/hamljs/test/fixtures/string.complex-interpolation.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/string.complex-interpolation.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%p yay #{message + " {oh noes} y u do dis to me"}
|
1
node_modules/hamljs/test/fixtures/string.complex-interpolation.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/string.complex-interpolation.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>yay it works! {oh noes} y u do dis to me</p>
|
1
node_modules/hamljs/test/fixtures/string.interpolation.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/string.interpolation.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%p yay #{message}
|
1
node_modules/hamljs/test/fixtures/string.interpolation.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/string.interpolation.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>yay it works!</p>
|
1
node_modules/hamljs/test/fixtures/tag.attrs.bools.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/tag.attrs.bools.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%input{ type: 'checkbox', checked: true }
|
1
node_modules/hamljs/test/fixtures/tag.attrs.bools.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/tag.attrs.bools.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<input type="checkbox" checked="checked"/>
|
1
node_modules/hamljs/test/fixtures/tag.attrs.escape.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/tag.attrs.escape.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%option{ value: '<script></script>' }
|
1
node_modules/hamljs/test/fixtures/tag.attrs.escape.html
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/tag.attrs.escape.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<option value="<script></script>"></option>
|
1
node_modules/hamljs/test/fixtures/tag.attrs.haml
generated
vendored
Normal file
1
node_modules/hamljs/test/fixtures/tag.attrs.haml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%a{ href: '/', title: 'home' }
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user