mahabhuta 0.7.2 → 0.7.6

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.
package/built-in.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const mahabhuta = require('./index');
4
- const globfs = require('globfs');
3
+ THIS APPEARS TO NOT BE USED
5
4
 
5
+ const mahabhuta = require('./index');
6
6
  exports.mahabhuta = new mahabhuta.MahafuncArray("mahabhuta built-in", {});
7
7
 
8
8
  class SiteVerification extends mahabhuta.CustomElement {
@@ -13,7 +13,7 @@
13
13
  "ejs": "^2.4.2",
14
14
  "express": "~4.13.4",
15
15
  "fs-extra-promise": "^0.4.1",
16
- "morgan": "~1.7.0",
16
+ "morgan": "~1.9.1",
17
17
  "serve-favicon": "~2.3.0",
18
18
  "mahabhuta": ">=0.5"
19
19
  }
package/index.js CHANGED
@@ -27,10 +27,10 @@
27
27
 
28
28
  const cheerio = require('cheerio');
29
29
  const util = require('util');
30
- const fs = require('fs-extra');
31
30
 
32
31
  var configCheerio;
33
32
  var traceFlag = false;
33
+ var tracePerf = false;
34
34
 
35
35
  exports.config = function(_configCheerio) {
36
36
  configCheerio = _configCheerio;
@@ -85,11 +85,24 @@ exports.CustomElement = class CustomElement extends exports.Mahafunc {
85
85
  try {
86
86
  var elements = custom.findElements($);
87
87
  if (elements.length <= 0) return;
88
+ // Performance testing
89
+ let _start;
90
+ if (tracePerf) _start = new Date();
91
+
92
+ /* if (this.elementName === "site-verification") {
93
+ console.log(`CustomElement ${this.elementName} `, $.html());
94
+ } */
95
+
88
96
  for (var element of elements) {
89
97
  let replaceWith = await custom.process($(element), metadata, setDirty);
90
98
  // console.log(`CustomElement ${this.elementName} process returned ${replaceWith}`);
91
99
  $(element).replaceWith(replaceWith);
92
100
  }
101
+ /* if (this.elementName === "site-verification") {
102
+ console.log(`CustomElement ${this.elementName} `, $.html());
103
+ } */
104
+ // Performance testing
105
+ if (tracePerf) console.log(`CustomElement ${this.array.name} ${this.elementName} ${(new Date() - _start) / 1000} seconds`);
93
106
  } catch (e) {
94
107
  console.error(`CustomElement ${custom.elementName} Errored with ${util.inspect(e)}`);
95
108
  throw e;
@@ -112,9 +125,15 @@ exports.Munger = class Munger extends exports.Mahafunc {
112
125
  try {
113
126
  var elements = munger.findElements($);
114
127
  if (elements.length <= 0) return;
128
+ // Performance testing
129
+ let _start;
130
+ if (tracePerf) _start = new Date();
131
+ // console.log(`Munger ${this.array.name} ${this.elementName} found ${elements.length} elements`);
115
132
  for (let element of elements) {
116
133
  await munger.process($, $(element), metadata, setDirty);
117
134
  }
135
+ // Performance testing
136
+ if (tracePerf) console.log(`Munger ${this.array.name} ${this.elementName} ${(new Date() - _start) / 1000} seconds`);
118
137
  } catch (e) {
119
138
  console.error(`Munger ${munger.selector} Errored with ${util.inspect(e)}`);
120
139
  throw e;
@@ -199,24 +218,37 @@ exports.MahafuncArray = class MahafuncArray {
199
218
  if (traceFlag) console.log(`Mahabhuta FINISHED Munger ${this.name} ${mahafunc.selector}`);
200
219
  // loops.push(`... Munger ${mahafunc.selector} ${(new Date() - startProcessing) / 1000} seconds`);
201
220
  } else if (mahafunc instanceof exports.PageProcessor) {
221
+ // Performance testing
222
+ let _start;
223
+ if (tracePerf) _start = new Date();
202
224
  if (traceFlag) console.log(`Mahabhuta calling ${this.name} PageProcessor `);
203
225
  try {
204
226
  await mahafunc.process($, metadata, dirty);
205
227
  } catch (errPageProcessor) {
206
228
  throw new Error(`Mahabhuta ${this.name} caught error in PageProcessor: ${errPageProcessor.message}`);
207
229
  }
230
+ // Performance testing
231
+ if (tracePerf) console.log(`PageProcessor ${this.name} ${(new Date() - _start) / 1000} seconds`)
208
232
  // loops.push(`... PageProcessor ${(new Date() - startProcessing) / 1000} seconds`);
209
233
  } else if (mahafunc instanceof exports.MahafuncArray) {
234
+ // Performance testing
235
+ let _start;
236
+ if (tracePerf) _start = new Date();
210
237
  let results = [];
211
238
  try {
212
239
  results = await mahafunc.process($, metadata, dirty);
213
240
  } catch (errMahafuncArray) {
214
241
  throw new Error(`Mahabhuta ${this.name} caught error in MahafuncArray: ${errMahafuncArray.message}`);
215
242
  }
243
+ // Performance testing
244
+ if (tracePerf) console.log(`MahafuncArray ${this.name} ${mahafunc.name} ${(new Date() - _start) / 1000} seconds`)
216
245
 
217
246
  // results.forEach(result => { loops.push(` ... "${mahafunc.name} result" ${result} ${(new Date() - startProcessing) / 1000} seconds`); });
218
247
  // loops.push(`... MahafuncArray ${mahafunc.name} ${(new Date() - startProcessing) / 1000} seconds`);
219
248
  } else if (typeof mahafunc === 'function') {
249
+ // Performance testing
250
+ let _start;
251
+ if (tracePerf) _start = new Date();
220
252
  if (traceFlag) console.log(`Mahabhuta calling an ${this.name} "function" `);
221
253
  try {
222
254
  await new Promise((resolve, reject) => {
@@ -228,11 +260,18 @@ exports.MahafuncArray = class MahafuncArray {
228
260
  } catch (errFunction) {
229
261
  throw new Error(`Mahabhuta ${this.name} caught error in function: ${errFunction.message}`);
230
262
  }
263
+ // Performance testing
264
+ if (tracePerf) console.log(`function ${this.name} ${(new Date() - _start) / 1000} seconds`)
231
265
  // loops.push(`... MahafuncArray "function" ${(new Date() - startProcessing) / 1000} seconds`);
232
266
  } else if (Array.isArray(mahafunc)) {
267
+ // Performance testing
268
+ let _start;
269
+ if (tracePerf) _start = new Date();
233
270
  let mhObj = new exports.MahafuncArray("inline", this._config);
234
271
  mhObj.setMahafuncArray(mahafunc);
235
272
  let results = await mhObj.process($, metadata, dirty);
273
+ // Performance testing
274
+ if (tracePerf) console.log(`Array ${this.name} inline ${(new Date() - _start) / 1000} seconds`)
236
275
  // results.forEach(result => { loops.push(` ... "inline result" ${result} ${(new Date() - startProcessing) / 1000} seconds`); });
237
276
  // loops.push(`... MahafuncArray "inline array" ${(new Date() - startProcessing) / 1000} seconds`);
238
277
  } else {
@@ -257,15 +296,19 @@ exports.processAsync = async function(text, metadata, mahabhutaFuncs) {
257
296
 
258
297
  if (!mahabhutaFuncs || mahabhutaFuncs.length < 0) mahabhutaFuncs = [];
259
298
 
260
- var cleanOrDirty = 'first-time';
299
+ let cleanOrDirty = 'first-time';
300
+
301
+ // console.log(`processAsync text at start ${text}`);
261
302
 
262
303
  // Allow a pre-parsed context to be passed in
263
- var $ = typeof text === 'function' ? text : exports.parse(text);
304
+ const $ = typeof text === 'function' ? text : exports.parse(text);
305
+
306
+ // console.log(`processAsync $ at start `, $.html());
264
307
 
265
308
  const loops = [];
266
- const startProcessing = new Date();
267
309
  do {
268
- var mhObj;
310
+ let startProcessing = new Date();
311
+ let mhObj;
269
312
  if (Array.isArray(mahabhutaFuncs)) {
270
313
  // console.log(`ARRAY substitution`);
271
314
  mhObj = new exports.MahafuncArray("master", {});
@@ -279,7 +322,7 @@ exports.processAsync = async function(text, metadata, mahabhutaFuncs) {
279
322
  let results = await mhObj.process($, metadata, () => { cleanOrDirty = 'dirty'; });
280
323
 
281
324
  // results.forEach(result => { loops.push(mhObj.name +' '+ result); });
282
- // loops.push(`MAHABHUTA processAsync ${metadata.document.path} FINISH ${(new Date() - startProcessing) / 1000} seconds ${cleanOrDirty}`);
325
+ // console.log(`MAHABHUTA processAsync ${metadata.document.path} FINISH ${(new Date() - startProcessing) / 1000} seconds ${cleanOrDirty}`);
283
326
  } while (cleanOrDirty === 'dirty');
284
327
 
285
328
  // loops.forEach(l => { console.log(l); });
package/maha/metadata.js CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  const url = require('url');
4
4
  const path = require('path');
5
+ // const util = require('util');
5
6
  const mahabhuta = require('../index');
7
+ const cheerio = require('cheerio');
6
8
 
7
9
  // TODO JavaScript script tags
8
10
  // TODO some metadata like rel=canonical
@@ -17,7 +19,9 @@ class SiteVerification extends mahabhuta.CustomElement {
17
19
  var ret = '';
18
20
  var google = $element.attr('google');
19
21
  if (google) {
20
- ret += `<meta name="google-site-verification" content="${google}"/>`;
22
+ let $ = /* mahabhuta.parse */ cheerio.load('<meta name="google-site-verification" content=""/>', null, false);
23
+ $('meta').attr('content', google);
24
+ ret += $.html();
21
25
  }
22
26
  // TBD site verification for other services
23
27
  return ret;
@@ -40,9 +44,15 @@ class DNSPrefetch extends mahabhuta.CustomElement {
40
44
  var ret = '';
41
45
 
42
46
  if (control) {
43
- ret += `<meta http-equiv="x-dns-prefetch-control" content="${control}"/>`;
47
+ let $ = /* mahabhuta.parse */ cheerio.load('<meta name="x-dns-prefetch-control" content=""/>', null, false);
48
+ $('meta').attr('content', control);
49
+ ret += $.html();
44
50
  }
45
- dns.forEach(item => { ret += `<link rel="dns-prefetch" href="${item}"/>`; });
51
+ dns.forEach(item => {
52
+ let $ = /* mahabhuta.parse */ cheerio.load('<link rel="dns-prefetch" href=""/>', null, false);
53
+ $('link').attr('href', item);
54
+ ret += $.html();
55
+ });
46
56
 
47
57
  return ret;
48
58
  }
@@ -70,7 +80,10 @@ class XMLSitemap extends mahabhuta.CustomElement {
70
80
  title = "Sitemap";
71
81
  }
72
82
  }
73
- return `<link rel="sitemap" type="application/xml" title="${title}" href="${href}" />`;
83
+ let $ = /* mahabhuta.parse */ cheerio.load('<link rel="sitemap" type="application/xml" href=""/>', null, false);
84
+ $('link').attr('href', href);
85
+ $('link').attr('title', title);
86
+ return $.html();
74
87
  }
75
88
  }
76
89
 
@@ -80,32 +93,33 @@ class ExternalStylesheet extends mahabhuta.CustomElement {
80
93
  var href = $element.attr('href');
81
94
  if (!href) throw new Error("No href supplied");
82
95
  var media = $element.attr('media');
96
+ let $ = /* mahabhuta.parse */ cheerio.load('<link rel="stylesheet" type="text/css" href=""/>', null, false);
97
+ $('link').attr('href', href);
83
98
  if (media) {
84
- return `<link rel="stylesheet" type="text/css" href="${href}" media="${media}"/>`;
85
- } else {
86
- return `<link rel="stylesheet" type="text/css" href="${href}"/>`;
99
+ $('link').attr('media', media);
87
100
  }
101
+ return $.html();
88
102
  }
89
103
  }
90
104
 
91
- class RSSHeaderMeta extends mahabhuta.Munger {
105
+ class RSSHeaderMeta extends mahabhuta.CustomElement {
92
106
  get selector() { return "rss-header-meta"; }
107
+ get elementName() { return "rss-header-meta"; }
93
108
 
94
- async process($, $link, metadata, dirty) {
95
- if ($('html head').get(0)) {
96
- var href = $link.attr('href');
97
- if (!href) {
98
- throw new Error("No href in rss-header-meta tag");
99
- }
100
- if (this.array.options.root_url) {
101
- let pRootUrl = url.parse(this.array.options.root_url);
102
- href = path.normalize(
103
- path.join(pRootUrl.pathname, href)
104
- );
105
- }
106
- $('head').append(`<link rel="alternate" type="application/rss+xml" href="${href}"/>`);
107
- $link.remove();
109
+ process($element, metadata, dirty) {
110
+ var href = $element.attr('href');
111
+ if (!href) {
112
+ throw new Error("No href in rss-header-meta tag");
113
+ }
114
+ if (this.array.options.root_url) {
115
+ let pRootUrl = url.parse(this.array.options.root_url);
116
+ href = path.normalize(
117
+ path.join(pRootUrl.pathname, href)
118
+ );
108
119
  }
120
+ let $link = /* mahabhuta.parse */ cheerio.load('<link rel="alternate" type="application/rss+xml" href=""/>', null, false);
121
+ $link('link').attr('href', href);
122
+ return $link.html();
109
123
  }
110
124
  }
111
125
 
package/maha/partial.js CHANGED
@@ -1,11 +1,13 @@
1
1
 
2
2
  const mahabhuta = require('../index');
3
- const globfs = require('globfs');
4
3
  const ejs = require('ejs');
4
+ const nunjucks = require('nunjucks');
5
+ const Liquid = require('liquid');
6
+ const engine = new Liquid.Engine();
7
+ const Handlebars = require("handlebars");
5
8
  const path = require('path');
6
9
  const util = require('util');
7
- const fs = require('fs-extra');
8
- // const literal = require('template-literal');
10
+ const fs = require('fs/promises');
9
11
 
10
12
  const pluginName = "mahabhuta partials built-in";
11
13
 
@@ -36,6 +38,25 @@ class Partial extends mahabhuta.CustomElement {
36
38
  : module.exports.renderPartial(fname, d, this.options);
37
39
  }
38
40
  }
41
+
42
+ async function lookForPartial(partialDirs, partialfn) {
43
+ for (let dir of partialDirs) {
44
+ let fn2check = path.join(dir, partialfn);
45
+ let stats;
46
+ try {
47
+ stats = await fs.stat(fn2check);
48
+ } catch (err) { stats = undefined; }
49
+ if (stats.isFile()) {
50
+ return {
51
+ basedir: dir,
52
+ path: partialfn,
53
+ fullpath: fn2check
54
+ };
55
+ }
56
+ }
57
+ return undefined;
58
+ }
59
+
39
60
  module.exports.renderPartial = async function (fname, attrs, options) {
40
61
 
41
62
  let partialDirs;
@@ -49,11 +70,8 @@ module.exports.renderPartial = async function (fname, attrs, options) {
49
70
  }
50
71
 
51
72
  // console.log(`renderPartial looking for ${util.inspect(partialDirs)} ${fname}`);
52
- var partialFound = await globfs.findAsync(partialDirs, fname);
73
+ const partialFound = await lookForPartial(partialDirs, fname);
53
74
  if (!partialFound) throw new Error(`No partial found for ${fname} in ${util.inspect(partialDirs)}`);
54
- // Pick the first partial found
55
- // console.log(`renderPartial found `, partialFound);
56
- partialFound = partialFound[0];
57
75
  // console.log(`module.exports.configuration renderPartial ${partialFound}`);
58
76
  if (!partialFound) throw new Error(`No partial found for ${fname} in ${util.inspect(partialDirs)}`);
59
77
 
@@ -68,6 +86,31 @@ module.exports.renderPartial = async function (fname, attrs, options) {
68
86
  } catch (e) {
69
87
  throw new Error(`EJS rendering of ${fname} failed because of ${e}`);
70
88
  }
89
+ } else if (/\.liquid$/i.test(partialFound.fullpath)) {
90
+ try {
91
+ let partialText = await fs.readFile(partialFound.fullpath, 'utf8');
92
+ let template = await engine.parse(partialText);
93
+ let result = await template.render(attrs);
94
+ return result;
95
+ } catch (e) {
96
+ throw new Error(`Liquid rendering of ${fname} failed because of ${e}`);
97
+ }
98
+ } else if (/\.njk$/i.test(partialFound.fullpath)) {
99
+ try {
100
+ let partialText = await fs.readFile(partialFound.fullpath, 'utf8');
101
+ nunjucks.configure({ autoescape: false });
102
+ return nunjucks.renderString(partialText, attrs);
103
+ } catch (e) {
104
+ throw new Error(`Nunjucks rendering of ${fname} failed because of ${e}`);
105
+ }
106
+ } else if (/\.handlebars$/i.test(partialFound.fullpath)) {
107
+ try {
108
+ let partialText = await fs.readFile(partialFound.fullpath, 'utf8');
109
+ const template = Handlebars.compile(partialText);
110
+ return template(attrs);
111
+ } catch (e) {
112
+ throw new Error(`Handlebars rendering of ${fname} failed because of ${e}`);
113
+ }
71
114
  } /* else if (/\.literal$/i.test(partialFname)) {
72
115
  try {
73
116
  const t = literal(partialText);
@@ -102,10 +145,8 @@ module.exports.configuration = {
102
145
  partialDirs = module.exports.configuration.partialDirs;
103
146
  }
104
147
 
105
- var partialFound = await globfs.findAsync(partialDirs, fname);
148
+ const partialFound = await lookForPartial(partialDirs, fname);
106
149
  if (!partialFound) throw new Error(`No partial found for ${fname} in ${util.inspect(partialDirs)}`);
107
- // Pick the first partial found
108
- partialFound = partialFound[0];
109
150
  // console.log(`module.exports.configuration renderPartial ${partialFound}`);
110
151
  if (!partialFound) throw new Error(`No partial found for ${fname} in ${util.inspect(partialDirs)}`);
111
152
 
@@ -135,98 +176,6 @@ module.exports.configuration = {
135
176
  }
136
177
  };
137
178
 
138
- module.exports.doPartialAsync = async function (fname, attrs) {
139
-
140
- throw new Error("Deprecated");
141
-
142
- /*
143
- // find the partial
144
- // render the partial using the data provided
145
-
146
- // TBD configuration for partialDirs
147
- // console.log(`doPartialAsync ${util.inspect(fname)} ${util.inspect(module.exports.configuration.partialDirs)}`);
148
- var partialFound = await globfs.findAsync(module.exports.configuration.partialDirs, fname);
149
- // console.log(`doPartialAsync ${partialFound}`);
150
- if (!partialFound) throw new Error(`No partial directory found for ${fname}`);
151
- // Pick the first partial found
152
- partialFound = partialFound[0];
153
- if (!partialFound) throw new Error(`No partial directory found for ${fname}`);
154
-
155
- var partialFname = path.join(partialFound.basedir, partialFound.path);
156
- // console.log(`doPartialAsync before reading ${partialFname}`);
157
- var stats = await fs.stat(partialFname);
158
- if (!stats.isFile()) {
159
- throw new Error(`doPartialAsync non-file found for ${fname} - ${partialFname}`);
160
- }
161
- var partialText = await fs.readFile(partialFname, 'utf8');
162
- // console.log(`doPartialAsync after reading ${partialFname} text length=${partialText.length}`);
163
-
164
- // TODO based on file extension render through a template engine
165
- // TODO Need support for a broader spectrum of template engines
166
-
167
- // dirty();
168
- if (/\.ejs$/i.test(partialFname)) {
169
- try { return ejs.render(partialText, attrs); } catch (e) {
170
- throw new Error(`EJS rendering of ${fname} failed because of ${e}`);
171
- }
172
- } /* else if (/\.literal$/i.test(partialFname)) {
173
- try {
174
- const t = literal.compile(partialText);
175
- return t(attrs);
176
- } catch (e) {
177
- throw new Error(`Literal rendering of ${fname} failed because of ${e}`);
178
- }
179
- } * / else if (/\.html$/i.test(partialFname)) {
180
- // NOTE: The partialBody gets lost in this case
181
- return partialText;
182
- } else {
183
- throw new Error("No rendering support for ${fname}");
184
- } */
185
- };
186
-
187
-
188
- module.exports.doPartialSync = function(fname, attrs) {
189
- throw new Error("Deprecated");
190
-
191
- /* var partialFound = globfs.findSync(module.exports.configuration.partialDirs, fname);
192
- if (!partialFound) throw new Error(`No partial directory found for ${fname}`);
193
- // Pick the first partial found
194
- partialFound = partialFound[0];
195
-
196
- // console.log(`doPartialSync found ${util.inspect(partialFound)} for ${util.inspect(module.exports.configuration.partialDirs)} ${fname}`);
197
-
198
- var partialFname = path.join(partialFound.basedir, partialFound.path);
199
- // console.log(`doPartialSync before reading ${partialFname}`);
200
- var stats = fs.statSync(partialFname);
201
- if (!stats.isFile()) {
202
- throw new Error(`doPartialSync non-file found for ${fname} - ${partialFname}`);
203
- }
204
- var partialText = fs.readFileSync(partialFname, 'utf8');
205
-
206
- // TODO based on file extension render through a template engine
207
- // TODO Need support for a broader spectrum of template engines
208
-
209
- // dirty();
210
- if (/\.ejs$/i.test(partialFname)) {
211
- try { return ejs.render(partialText, attrs); } catch (e) {
212
- throw new Error(`EJS rendering of ${fname} failed because of ${e}`);
213
- }
214
- } /* else if (/\.literal$/i.test(partialFname)) {
215
- try {
216
- const t = literal.compile(partialText);
217
- return t(attrs);
218
- } catch (e) {
219
- throw new Error(`Literal rendering of ${fname} failed because of ${e}`);
220
- }
221
- } * / else if (/\.html$/i.test(partialFname)) {
222
- // NOTE: The partialBody gets lost in this case
223
- return partialText;
224
- } else {
225
- throw new Error("No rendering support for ${fname}");
226
- } */
227
- };
228
-
229
-
230
179
  module.exports.mahabhutaArray = function(options) {
231
180
  let ret = new mahabhuta.MahafuncArray(pluginName, options);
232
181
  ret.addMahafunc(new Partial());
package/package.json CHANGED
@@ -21,15 +21,15 @@
21
21
  "type": "git",
22
22
  "url": "https://github.com/akashacms/mahabhuta.git"
23
23
  },
24
- "version": "0.7.2",
24
+ "version": "0.7.6",
25
25
  "engines": {
26
26
  "node": ">=12.4"
27
27
  },
28
28
  "dependencies": {
29
- "cheerio": ">=0.22.x",
30
- "globfs": ">=0.3",
29
+ "cheerio": "0.22.x",
31
30
  "ejs": "*",
32
- "fs-extra": ">=4.0.1",
33
- "template-literal": ">=1.x"
31
+ "handlebars": "^4.7.6",
32
+ "liquid": "^4.1.0",
33
+ "nunjucks": "^3.2.2"
34
34
  }
35
35
  }
@@ -1,10 +0,0 @@
1
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. ${d.hello} Quamvis enim depravatae non sint, pravae tamen esse possunt. <i>At eum nihili facit;</i> <i>Audeo dicere, inquit.</i> Hanc ergo intuens debet institutum illud quasi signum absolvere. <a href="http://loripsum.net/" target="_blank">Qui-vere falsone, quaerere mittimus-dicitur oculis se privasse;</a> Intellegi quidem, ut propter aliam quampiam rem, verbi gratia propter voluptatem, nos amemus; <a href="http://loripsum.net/" target="_blank">Suo genere perveniant ad extremum;</a> Non enim iam stirpis bonum quaeret, sed animalis. Duo Reges: constructio interrete. </p>
2
-
3
- ${d.middle}
4
-
5
- <p>Causa autem fuit huc veniendi ut quosdam hinc libros promerem. Nihil enim iam habes, quod ad corpus referas; Fieri, inquam, Triari, nullo pacto potest, ut non dicas, quid non probes eius, a quo dissentias. Nam his libris eum malo quam reliquo ornatu villae delectari. Verum tamen cum de rebus grandioribus dicas, ipsae res verba rapiunt; Deinde disputat, quod cuiusque generis animantium statui deceat extremum. Qui potest igitur habitare in beata vita summi mali metus? Sed fortuna fortis; Quamvis enim depravatae non sint, pravae tamen esse possunt. Universa enim illorum ratione cum tota vestra confligendum puto. Itaque e contrario moderati aequabilesque habitus, affectiones ususque corporis apti esse ad naturam videntur. </p>
6
-
7
- ${d.helloFunction()}
8
-
9
- <p>Quae cum essent dicta, discessimus. Non enim iam stirpis bonum quaeret, sed animalis. Nunc omni virtuti vitium contrario nomine opponitur. </p>
10
-
@@ -1,23 +0,0 @@
1
-
2
- const mahabhuta = require('../index');
3
- const mahaPartial = require('../maha/partial');
4
-
5
- mahaPartial.configuration.partialDirs.push('partials1');
6
-
7
- mahabhuta.processAsync(`
8
- <header>Head of the page</header>
9
-
10
- <partial file-name="test1.literal"></partial>
11
-
12
- <footer>Bottom of the page</footer>
13
- `, {
14
- hello: "Hello, World!",
15
- middle: "A paragraph for the middle of somewhere.",
16
- helloFunction: () => {
17
- return "Hello, Function!";
18
- }
19
- }, [
20
- mahaPartial.mahabhuta
21
- ])
22
- .then(result => { console.log(`OK: ${result}`); })
23
- .catch(error => { console.error(`FAIL: ${error.stack}`); })