jade-js-source 0.27.6 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -483,8 +483,9 @@ Compiler.prototype = {
483
483
  */
484
484
 
485
485
  visitText: function(text){
486
- text = utils.text(text.val.replace(/\\/g, '\\\\'));
486
+ text = utils.text(text.val.replace(/\\/g, '_SLASH_'));
487
487
  if (this.escape) text = escape(text);
488
+ text = text.replace(/_SLASH_/g, '\\\\');
488
489
  this.buffer(text);
489
490
  },
490
491
 
@@ -587,7 +588,9 @@ Compiler.prototype = {
587
588
 
588
589
  this.buf.push(''
589
590
  + ' } else {\n'
591
+ + ' var $$l = 0;\n'
590
592
  + ' for (var ' + each.key + ' in ' + each.obj + ') {\n'
593
+ + ' $$l++;'
591
594
  + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){'
592
595
  + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
593
596
 
@@ -595,7 +598,13 @@ Compiler.prototype = {
595
598
 
596
599
  this.buf.push(' }\n');
597
600
 
598
- this.buf.push(' }\n }\n}).call(this);\n');
601
+ this.buf.push(' }\n');
602
+ if (each.alternative) {
603
+ this.buf.push(' if ($$l === 0) {');
604
+ this.visit(each.alternative);
605
+ this.buf.push(' }');
606
+ }
607
+ this.buf.push(' }\n}).call(this);\n');
599
608
  },
600
609
 
601
610
  /**
@@ -813,7 +822,6 @@ module.exports = {
813
822
  */
814
823
 
815
824
  coffeescript: function(str){
816
- str = str.replace(/\\n/g, '\n');
817
825
  var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
818
826
  return '<script type="text/javascript">\\n' + js + '</script>';
819
827
  }
@@ -1283,6 +1291,8 @@ Lexer.prototype = {
1283
1291
  var captures;
1284
1292
  if (captures = /^\n *\n/.exec(this.input)) {
1285
1293
  this.consume(captures[0].length - 1);
1294
+
1295
+ ++this.lineno;
1286
1296
  if (this.pipeless) return this.tok('text', '');
1287
1297
  return this.next();
1288
1298
  }
@@ -3585,12 +3595,16 @@ require.register("utils.js", function(module, exports, require){
3585
3595
  */
3586
3596
 
3587
3597
  var interpolate = exports.interpolate = function(str){
3588
- return str.replace(/(\\)?([#!]){(.*?)}/g, function(str, escape, flag, code){
3598
+ return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){
3599
+ code = code
3600
+ .replace(/\\'/g, "'")
3601
+ .replace(/_SLASH_/g, '\\');
3602
+
3589
3603
  return escape
3590
- ? str.slice(1)
3604
+ ? str.slice(7)
3591
3605
  : "' + "
3592
3606
  + ('!' == flag ? '' : 'escape')
3593
- + "((interp = " + code.replace(/\\'/g, "'")
3607
+ + "((interp = " + code
3594
3608
  + ") == null ? '' : interp) + '";
3595
3609
  });
3596
3610
  };
File without changes
@@ -0,0 +1,13 @@
1
+ module JadeJs
2
+ module Source
3
+
4
+ def self.bundled_path
5
+ File.expand_path("../../../../jade.js", __FILE__)
6
+ end
7
+
8
+ def self.bundled_runtime_path
9
+ File.expand_path("../../../../runtime.js", __FILE__)
10
+ end
11
+
12
+ end
13
+ end
metadata CHANGED
@@ -1,33 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jade-js-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.6
4
+ version: 0.28.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - TJ Holowaychuk
9
- - David Haslem
8
+ - TJ Holowaychuk <tj@vision-media.ca>
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2013-01-11 00:00:00.000000000 Z
14
13
  dependencies: []
15
- description: ! " Jade is a high performance template engine heavily influenced
16
- by Haml \n and implemented with JavaScript for node.\n"
17
- email: therabidbanana@gmail.com
14
+ description:
15
+ email:
18
16
  executables: []
19
17
  extensions: []
20
18
  extra_rdoc_files: []
21
19
  files:
22
- - lib/jade_js/jade.js
23
- - lib/jade_js/runtime.js
24
- - lib/jade_js/source.rb
25
- homepage: https://github.com/visionmedia/jade
20
+ - jade.js
21
+ - runtime.js
22
+ - !binary |-
23
+ c3VwcG9ydC9ydWJ5L2phZGVfanMvc291cmNlLnJi
24
+ homepage: http://jade-lang.com/
26
25
  licenses: []
27
26
  post_install_message:
28
27
  rdoc_options: []
29
28
  require_paths:
30
- - lib
29
+ - !binary |-
30
+ c3VwcG9ydC9ydWJ5
31
31
  required_ruby_version: !ruby/object:Gem::Requirement
32
32
  none: false
33
33
  requirements:
@@ -41,9 +41,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  requirements: []
44
- rubyforge_project: jade-js-source
44
+ rubyforge_project:
45
45
  rubygems_version: 1.8.17
46
46
  signing_key:
47
47
  specification_version: 3
48
- summary: Jade - template engine
48
+ summary: Jade template engine
49
49
  test_files: []
50
+ has_rdoc:
@@ -1,10 +0,0 @@
1
- module JadeJs
2
- module Source
3
- def self.bundled_path
4
- File.expand_path("../jade.js", __FILE__)
5
- end
6
- def self.bundled_runtime_path
7
- File.expand_path("../runtime.js", __FILE__)
8
- end
9
- end
10
- end