@nakedcreativity/cee-ms-node 0.3.22 → 0.3.24

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 +40 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -186,6 +186,39 @@ function ceems(config) {
186
186
  }
187
187
  }
188
188
  })
189
+
190
+ this.engine.registerTag('external', {
191
+ parse: function (tagToken, remainTokens) {
192
+ this.match = tagToken.args.split(' '); // name // path[0] == navigation name
193
+ },
194
+ render: function (scope, hash) {
195
+
196
+ var filepath = Liquid.lexical.parseLiteral(this.match[0])
197
+ var jsonData = JSON.parse(fs.readFileSync(filepath, 'utf8'))
198
+
199
+ var scopeObj = {}
200
+ scopeObj['external'] = jsonData
201
+ scope.push(scopeObj)
202
+
203
+ //console.log(scope)
204
+ var template = Liquid.lexical.parseLiteral(this.match[1])
205
+ if (!template) {
206
+ template = this.match[1]
207
+ }
208
+
209
+ return engine.handleCache(template + '.liquid')
210
+ .then((templates) => {
211
+ return engine.renderer.renderTemplates(templates, scope);
212
+ })
213
+ .then((html) => {
214
+ scope.pop();
215
+ return html;
216
+ });
217
+
218
+ }
219
+ })
220
+
221
+
189
222
  this.engine.registerFilter('active', (path, match, cssClass) => {
190
223
 
191
224
  var regex = new RegExp("^"+match)
@@ -198,6 +231,13 @@ function ceems(config) {
198
231
 
199
232
  })
200
233
 
234
+
235
+ this.engine.registerFilter('url', (url) => {
236
+
237
+ return this.site.site.url+url
238
+
239
+ })
240
+
201
241
  this.engine.registerTag('image', {
202
242
  parse: function(tagToken, remainTokens) {
203
243
  this.args = tagToken.args.split(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {