haml_coffee_assets 0.8.6 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/haml_coffee_assets/version.rb +1 -1
- data/lib/js/haml-coffee.js +72 -33
- metadata +6 -3
data/lib/js/haml-coffee.js
CHANGED
@@ -963,7 +963,7 @@ require.define("/nodes/text.js", function (require, module, exports, __dirname,
|
|
963
963
|
require.define("/nodes/haml.js", function (require, module, exports, __dirname, __filename) {
|
964
964
|
(function() {
|
965
965
|
var Haml, Node, escapeQuotes,
|
966
|
-
__hasProp =
|
966
|
+
__hasProp = {}.hasOwnProperty,
|
967
967
|
__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; };
|
968
968
|
|
969
969
|
Node = require('./node');
|
@@ -974,8 +974,10 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
974
974
|
|
975
975
|
__extends(Haml, _super);
|
976
976
|
|
977
|
+
Haml.name = 'Haml';
|
978
|
+
|
977
979
|
function Haml() {
|
978
|
-
Haml.__super__.constructor.apply(this, arguments);
|
980
|
+
return Haml.__super__.constructor.apply(this, arguments);
|
979
981
|
}
|
980
982
|
|
981
983
|
Haml.prototype.evaluate = function() {
|
@@ -1039,16 +1041,18 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1039
1041
|
};
|
1040
1042
|
|
1041
1043
|
Haml.prototype.parseExpression = function(exp) {
|
1042
|
-
var attribute, attributes, classes, id, tag, _i, _len, _ref,
|
1044
|
+
var attribute, attributes, classes, id, tag, _i, _len, _ref, _ref1;
|
1043
1045
|
tag = this.parseTag(exp);
|
1044
|
-
if (this.preserveTags.indexOf(tag.tag) !== -1)
|
1046
|
+
if (this.preserveTags.indexOf(tag.tag) !== -1) {
|
1047
|
+
this.preserve = true;
|
1048
|
+
}
|
1045
1049
|
id = (_ref = tag.ids) != null ? _ref.pop() : void 0;
|
1046
1050
|
classes = tag.classes;
|
1047
1051
|
attributes = [];
|
1048
1052
|
if (tag.attributes) {
|
1049
|
-
|
1050
|
-
for (_i = 0, _len =
|
1051
|
-
attribute =
|
1053
|
+
_ref1 = tag.attributes;
|
1054
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
1055
|
+
attribute = _ref1[_i];
|
1052
1056
|
if (attribute.key === 'id') {
|
1053
1057
|
if (id) {
|
1054
1058
|
id += '_' + attribute.value;
|
@@ -1093,7 +1097,9 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1093
1097
|
assignment = void 0;
|
1094
1098
|
}
|
1095
1099
|
if (whitespace) {
|
1096
|
-
if (whitespace.indexOf('>') !== -1)
|
1100
|
+
if (whitespace.indexOf('>') !== -1) {
|
1101
|
+
this.wsRemoval.around = true;
|
1102
|
+
}
|
1097
1103
|
if (whitespace.indexOf('<') !== -1) {
|
1098
1104
|
this.wsRemoval.inside = true;
|
1099
1105
|
this.preserve = true;
|
@@ -1132,14 +1138,14 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1132
1138
|
};
|
1133
1139
|
|
1134
1140
|
Haml.prototype.parseAttributes = function(exp) {
|
1135
|
-
var attributes, bool,
|
1141
|
+
var attributes, bool, key, quoted, value, _ref;
|
1136
1142
|
attributes = [];
|
1137
|
-
if (exp === void 0)
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
value =
|
1143
|
+
if (exp === void 0) {
|
1144
|
+
return attributes;
|
1145
|
+
}
|
1146
|
+
_ref = this.extractAttributes(exp);
|
1147
|
+
for (key in _ref) {
|
1148
|
+
value = _ref[key];
|
1143
1149
|
bool = false;
|
1144
1150
|
if (['false', ''].indexOf(value) === -1) {
|
1145
1151
|
if (['true'].indexOf(value) !== -1) {
|
@@ -1160,8 +1166,12 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1160
1166
|
}
|
1161
1167
|
}
|
1162
1168
|
}
|
1163
|
-
if (quoted = value.match(/^("|')(.*)\1$/))
|
1164
|
-
|
1169
|
+
if (quoted = value.match(/^("|')(.*)\1$/)) {
|
1170
|
+
value = quoted[2];
|
1171
|
+
}
|
1172
|
+
if (quoted = key.match(/^("|')(.*)\1$/)) {
|
1173
|
+
key = quoted[2];
|
1174
|
+
}
|
1165
1175
|
attributes.push({
|
1166
1176
|
key: key,
|
1167
1177
|
value: value,
|
@@ -1169,24 +1179,51 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1169
1179
|
});
|
1170
1180
|
}
|
1171
1181
|
}
|
1172
|
-
return attributes
|
1182
|
+
return attributes;
|
1173
1183
|
};
|
1174
1184
|
|
1175
|
-
Haml.prototype.
|
1176
|
-
var
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1185
|
+
Haml.prototype.extractAttributes = function(exp) {
|
1186
|
+
var attributes, dataAttribute, key, keyValue, keys, pairs, unwrapped, value, _ref, _ref1;
|
1187
|
+
attributes = {};
|
1188
|
+
unwrapped = exp.substring(1, exp.length - 1).replace(/^\s+|\s+$/g, '');
|
1189
|
+
switch (exp.substring(0, 1)) {
|
1190
|
+
case '(':
|
1191
|
+
keys = /([-\w]+[\w:-]*\w?|'\w+[\w:-]*\w?'|"\w+[\w:-]*\w?")\s*=/g;
|
1192
|
+
unwrapped = unwrapped.replace(/\=\s*"([^"]*?)=([^"]*?)"/g, '="$1\u0090=$2"').replace(/\=\s*'([^']*?)=([^']*?)'/g, '=\'$1\u0090=$2\'');
|
1193
|
+
break;
|
1194
|
+
case '{':
|
1195
|
+
if (exp.indexOf('=>') === -1) {
|
1196
|
+
keys = /(\w+[\w:-]*\w?|'[-\w]+[\w:-]*\w?'|"[-\w]+[\w:-]*\w?"):/g;
|
1197
|
+
unwrapped = unwrapped.replace(/\:\s*"([^"]*?):([^"]*?)"/g, ':"$1\u0090:$2"').replace(/\:\s*'([^']*?):([^']*?)'/g, ':\'$1\u0090=$2\'');
|
1198
|
+
} else {
|
1199
|
+
keys = /:?(\w+[\w:-]*\w?|'[-\w]+[\w:-]*\w?'|"[-\w]+[\w:-]*\w?")\s*=>/g;
|
1200
|
+
unwrapped = unwrapped.replace(/\=>\s*"([^"]*?)=>([^"]*?)"/g, '=>"$1\u0090:$2"').replace(/\=>\s*'([^']*?)=>([^']*?)'/g, '=>\'$1\u0090=>$2\'');
|
1201
|
+
}
|
1184
1202
|
}
|
1185
|
-
|
1203
|
+
pairs = unwrapped.split(keys).filter(Boolean);
|
1204
|
+
dataAttribute = false;
|
1205
|
+
while (pairs.length) {
|
1206
|
+
keyValue = pairs.splice(0, 2);
|
1207
|
+
key = (_ref = keyValue[0]) != null ? _ref.replace(/^\s+|\s+$/g, '').replace(/^:/, '') : void 0;
|
1208
|
+
value = (_ref1 = keyValue[1]) != null ? _ref1.replace(/^\s+|\s+$/g, '').replace(/,$/, '').replace(/\u0090/, '') : void 0;
|
1209
|
+
if (key === 'data') {
|
1210
|
+
dataAttribute = true;
|
1211
|
+
} else if (key && value) {
|
1212
|
+
if (dataAttribute) {
|
1213
|
+
key = "data-" + key;
|
1214
|
+
if (/}$/.test(value)) {
|
1215
|
+
value = value.substring(0, value.length - 1).replace(/^\s+|\s+$/g, '');
|
1216
|
+
dataAttribute = false;
|
1217
|
+
}
|
1218
|
+
}
|
1219
|
+
attributes[key] = value;
|
1220
|
+
}
|
1221
|
+
}
|
1222
|
+
return attributes;
|
1186
1223
|
};
|
1187
1224
|
|
1188
1225
|
Haml.prototype.buildHtmlTagPrefix = function(tokens) {
|
1189
|
-
var attribute, classes, interpolation, klass, tagParts, _i, _j, _len,
|
1226
|
+
var attribute, classes, interpolation, klass, tagParts, _i, _j, _len, _len1, _ref, _ref1;
|
1190
1227
|
tagParts = ["<" + tokens.tag];
|
1191
1228
|
if (tokens.classes) {
|
1192
1229
|
classes = tokens.classes.sort().join(' ');
|
@@ -1207,11 +1244,13 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
|
|
1207
1244
|
}
|
1208
1245
|
tagParts.push("class='" + classes + "'");
|
1209
1246
|
}
|
1210
|
-
if (tokens.id)
|
1247
|
+
if (tokens.id) {
|
1248
|
+
tagParts.push("id='" + tokens.id + "'");
|
1249
|
+
}
|
1211
1250
|
if (tokens.attributes) {
|
1212
|
-
|
1213
|
-
for (_j = 0,
|
1214
|
-
attribute =
|
1251
|
+
_ref1 = tokens.attributes;
|
1252
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
1253
|
+
attribute = _ref1[_j];
|
1215
1254
|
if (attribute.bool && this.format === 'html5') {
|
1216
1255
|
tagParts.push("" + attribute.key);
|
1217
1256
|
} else {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_coffee_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|
@@ -219,6 +219,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- - ! '>='
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
|
+
segments:
|
223
|
+
- 0
|
224
|
+
hash: -1713191990820436821
|
222
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
226
|
none: false
|
224
227
|
requirements:
|
@@ -227,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
230
|
version: 1.3.6
|
228
231
|
requirements: []
|
229
232
|
rubyforge_project: haml_coffee_assets
|
230
|
-
rubygems_version: 1.8.
|
233
|
+
rubygems_version: 1.8.24
|
231
234
|
signing_key:
|
232
235
|
specification_version: 3
|
233
236
|
summary: Haml CoffeeScript templates
|