@nakedcreativity/cee-ms-node 0.3.16 → 0.3.18

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.
Files changed (2) hide show
  1. package/index.js +13 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,6 +6,7 @@ var Liquid = require('nakedcreativity-liquid');
6
6
  var cheerio = require('cheerio');
7
7
  var bodyParser = require("body-parser");
8
8
 
9
+ var lexical = Liquid.lexical;
9
10
 
10
11
  var site;
11
12
  var engine;
@@ -66,20 +67,28 @@ function ceems(config) {
66
67
  this.match = tagToken.args.split(' '); // name // path[0] == navigation name
67
68
  },
68
69
  render: function(scope, hash){
69
- //var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
70
+
71
+ var value = Liquid.evalValue(this.match[0], scope)
72
+ if(!value){
73
+ value = Liquid.lexical.parseLiteral(this.match[0])
74
+ }
70
75
  var page = scope.scopes[0]
71
76
 
72
77
  if(page.path && this.match[0] == 'page.path[0]' && site.navigation[page.path[0]]){
73
78
  scope.push(site.navigation[page.path[0]]);
74
79
  }else if(page.path && this.match[0] == 'page.path[1]' && site.navigation[page.path[1]]){
75
80
  scope.push(site.navigation[page.path[1]]);
76
- }else if(site.navigation[this.match[0]]){
77
- scope.push(site.navigation[this.match[0]]);
81
+ }else if(site.navigation[value]){
82
+ scope.push(site.navigation[value]);
78
83
  }else {
79
84
  return
80
85
  }
86
+ var template = Liquid.lexical.parseLiteral(this.match[1])
87
+ if(!template){
88
+ template = this.match[1]
89
+ }
81
90
 
82
- return engine.handleCache(this.match[1]+'.liquid')
91
+ return engine.handleCache(template+'.liquid')
83
92
  .then((templates) => {
84
93
  return engine.renderer.renderTemplates(templates, scope);
85
94
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {