@bookshop/hugo-engine 3.4.0-beta.1 → 3.4.0-beta.3
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/.nyc_output/{4266a04d-f79f-4e25-82b5-a5503aad4653.json → 344d16a6-acc4-4349-b4c7-ffdc41d3e64f.json} +0 -0
- package/.nyc_output/{5a2007e8-1bda-4eda-b271-6d7323d49bdd.json → ad191300-a822-422a-892c-f6bdd9f65622.json} +0 -0
- package/.nyc_output/{6dd4f497-4c32-412e-906a-d5f84380dee6.json → b63e9a5b-2daa-4333-9cbc-511e31b8dec0.json} +0 -0
- package/.nyc_output/{bc1d4fe0-2b67-4190-bcd2-9fd06daf74c0.json → c1702c73-10b3-4031-a62b-78de0f5a0eda.json} +0 -0
- package/.nyc_output/{bc6fd14e-b803-4750-ac28-dfe4b8d1c235.json → d9c4bafc-f898-4591-b134-c70616d033a8.json} +0 -0
- package/.nyc_output/processinfo/{4266a04d-f79f-4e25-82b5-a5503aad4653.json → 344d16a6-acc4-4349-b4c7-ffdc41d3e64f.json} +1 -1
- package/.nyc_output/processinfo/{6dd4f497-4c32-412e-906a-d5f84380dee6.json → ad191300-a822-422a-892c-f6bdd9f65622.json} +1 -1
- package/.nyc_output/processinfo/{bc1d4fe0-2b67-4190-bcd2-9fd06daf74c0.json → b63e9a5b-2daa-4333-9cbc-511e31b8dec0.json} +1 -1
- package/.nyc_output/processinfo/c1702c73-10b3-4031-a62b-78de0f5a0eda.json +1 -0
- package/.nyc_output/processinfo/{bc6fd14e-b803-4750-ac28-dfe4b8d1c235.json → d9c4bafc-f898-4591-b134-c70616d033a8.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/full-hugo-renderer/hugo_renderer.wasm +0 -0
- package/full-hugo-renderer/hugo_renderer.wasm.gz +0 -0
- package/lib/engine.js +66 -5
- package/lib/hugoIdentifierParser.js +0 -5
- package/lib/translateTextTemplate.js +28 -6
- package/lib/translateTextTemplate.test.js +54 -3
- package/package.json +2 -2
- package/.nyc_output/processinfo/5a2007e8-1bda-4eda-b271-6d7323d49bdd.json +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","pid":5464,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1671138230217,"ppid":5424,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/344d16a6-acc4-4349-b4c7-ffdc41d3e64f.json","externalId":"","uuid":"344d16a6-acc4-4349-b4c7-ffdc41d3e64f","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","pid":5441,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1671138229848,"ppid":5424,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/ad191300-a822-422a-892c-f6bdd9f65622.json","externalId":"","uuid":"ad191300-a822-422a-892c-f6bdd9f65622","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","pid":5435,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1671138229841,"ppid":5424,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/b63e9a5b-2daa-4333-9cbc-511e31b8dec0.json","externalId":"","uuid":"b63e9a5b-2daa-4333-9cbc-511e31b8dec0","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":5424,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1671138229402,"ppid":5413,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/c1702c73-10b3-4031-a62b-78de0f5a0eda.json","externalId":"","uuid":"c1702c73-10b3-4031-a62b-78de0f5a0eda","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","pid":5457,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1671138230206,"ppid":5424,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/d9c4bafc-f898-4591-b134-c70616d033a8.json","externalId":"","uuid":"d9c4bafc-f898-4591-b134-c70616d033a8","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"344d16a6-acc4-4349-b4c7-ffdc41d3e64f":{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","children":[]},"ad191300-a822-422a-892c-f6bdd9f65622":{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","children":[]},"b63e9a5b-2daa-4333-9cbc-511e31b8dec0":{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","children":[]},"c1702c73-10b3-4031-a62b-78de0f5a0eda":{"parent":null,"children":["344d16a6-acc4-4349-b4c7-ffdc41d3e64f","ad191300-a822-422a-892c-f6bdd9f65622","b63e9a5b-2daa-4333-9cbc-511e31b8dec0","d9c4bafc-f898-4591-b134-c70616d033a8"]},"d9c4bafc-f898-4591-b134-c70616d033a8":{"parent":"c1702c73-10b3-4031-a62b-78de0f5a0eda","children":[]}},"files":{},"externalIds":{}}
|
|
Binary file
|
|
Binary file
|
package/lib/engine.js
CHANGED
|
@@ -15,6 +15,22 @@ const dig = (obj, path) => {
|
|
|
15
15
|
return obj;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
let mapHugoVariablesToParams = (obj, path) => {
|
|
19
|
+
let resolved = {};
|
|
20
|
+
for (let [k,v] of Object.entries(obj)) {
|
|
21
|
+
if (k.startsWith('$')) {
|
|
22
|
+
const remapped = `__bksh_${k.substring(1)}`;
|
|
23
|
+
obj[remapped] = v;
|
|
24
|
+
resolved[k] = `${path}.${remapped}`;
|
|
25
|
+
} else {
|
|
26
|
+
if (typeof v === 'object' && !Array.isArray(v)) {
|
|
27
|
+
resolved = {...resolved, ...mapHugoVariablesToParams(v, `${path}.${k}`)}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return resolved
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
export class Engine {
|
|
19
35
|
constructor(options) {
|
|
20
36
|
options = {
|
|
@@ -224,24 +240,69 @@ export class Engine {
|
|
|
224
240
|
}
|
|
225
241
|
}
|
|
226
242
|
|
|
227
|
-
async eval(str, props = [{}]) {
|
|
243
|
+
async eval(str, props = [{}], logger) {
|
|
228
244
|
while (!window.buildHugo) await sleep(10);
|
|
229
245
|
let props_obj = props.reduce((a, b) => { return { ...a, ...b } });
|
|
246
|
+
let full_props = props_obj;
|
|
230
247
|
|
|
231
248
|
// We're capable of looking up a simple variable
|
|
232
249
|
// (and it's hard to pass to wasm since we store variables on the context)
|
|
233
250
|
if (/^\$/.test(str)) {
|
|
234
|
-
return
|
|
251
|
+
logger?.log?.(`Trying to short circuit to return a variable`);
|
|
252
|
+
if (props_obj[str]) return props_obj[str];
|
|
235
253
|
}
|
|
236
254
|
|
|
237
255
|
// If we have assigned a root scope we need to pass that in as the context
|
|
238
|
-
if (props_obj["."])
|
|
256
|
+
if (props_obj["."]) {
|
|
257
|
+
logger?.log?.(`Nesting the props object into its dot scope`);
|
|
258
|
+
props_obj = props_obj["."];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (str === ".") {
|
|
262
|
+
logger?.log?.(`Short circuiting dot notation to return the scope`);
|
|
263
|
+
return props_obj;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
let normalized = this.normalize(str);
|
|
267
|
+
if (typeof normalized === 'object') {
|
|
268
|
+
logger?.log?.(`Digging into the object ${JSON.stringify(normalized)}`);
|
|
269
|
+
const process = async (obj) => {
|
|
270
|
+
for (const [k,v] of Object.entries(obj)) {
|
|
271
|
+
if (typeof v === "string") {
|
|
272
|
+
if (/^".*"$/.test(v)) {
|
|
273
|
+
// Normalized strings look like "\"string\""
|
|
274
|
+
logger?.log?.(`Unwrapping the string ${k}: ${v}`);
|
|
275
|
+
obj[k] = JSON.parse(v);
|
|
276
|
+
} else {
|
|
277
|
+
// No inner quotes means it needs to be evaled again
|
|
278
|
+
logger?.log?.(`Evaluating the inner ${k}: ${v}`);
|
|
279
|
+
obj[k] = await this.eval(v, [props_obj], logger.nested());
|
|
280
|
+
}
|
|
281
|
+
} else if (typeof v === "object") {
|
|
282
|
+
logger?.log?.(`Processing the inner object ${k}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
await process(normalized);
|
|
287
|
+
return normalized;
|
|
288
|
+
}
|
|
289
|
+
if (/^\w+(\.\w+)*$/.test(normalized)) {
|
|
290
|
+
logger?.log?.(`Trying to short circuit to return the dot notation ${normalized}`);
|
|
291
|
+
// We're capable of looking up a simple dot notation access
|
|
292
|
+
const result = dig(props_obj, normalized);
|
|
293
|
+
if (result !== undefined) return result
|
|
294
|
+
}
|
|
239
295
|
|
|
240
296
|
// Rewrite array.0 into index array 0
|
|
241
297
|
str = str.replace(/(.*)\.(\d+)$/, (_, obj, index) => {
|
|
242
298
|
return `index (${obj}) ${index}`;
|
|
243
299
|
})
|
|
244
300
|
|
|
301
|
+
const variable_pairs = mapHugoVariablesToParams(full_props, ".Params.full_props");
|
|
302
|
+
const variable_decl = Object.entries(variable_pairs).map(([k,v]) => {
|
|
303
|
+
return `{{ ${k} := ${v} }}`
|
|
304
|
+
}).join('');
|
|
305
|
+
|
|
245
306
|
const assignments = Object.entries(props_obj).filter(([key]) => key.startsWith('$')).map(([key, value]) => {
|
|
246
307
|
if (Array.isArray(value)) {
|
|
247
308
|
return `{{ ${key} := index ( \`{"a": ${JSON.stringify(value)}}\` | transform.Unmarshal ) "a" }}`
|
|
@@ -251,10 +312,10 @@ export class Engine {
|
|
|
251
312
|
return `{{ ${key} := ${JSON.stringify(value)} }}`
|
|
252
313
|
}
|
|
253
314
|
}).join('');
|
|
254
|
-
const eval_str =
|
|
315
|
+
const eval_str = `${variable_decl}{{ with .Params.props }}${assignments}{{ jsonify (${str}) }}{{ end }}`;
|
|
255
316
|
window.writeHugoFiles(JSON.stringify({
|
|
256
317
|
"layouts/index.html": eval_str,
|
|
257
|
-
"content/_index.md": JSON.stringify({ props: props_obj }, null, 2)
|
|
318
|
+
"content/_index.md": JSON.stringify({ props: props_obj, full_props: full_props }, null, 2)
|
|
258
319
|
}));
|
|
259
320
|
|
|
260
321
|
const buildError = window.buildHugo();
|
|
@@ -36,11 +36,6 @@ export class IdentifierParser {
|
|
|
36
36
|
return `${variable}.${index}`;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// strip the leading .Params. from basic variable references
|
|
40
|
-
// if (/^\s*\./.test(this.input)) {
|
|
41
|
-
// return this.input.replace(/^\s*\.Params\.([^\.\s])/, '$1');
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
39
|
// strip the leading . from basic variable references
|
|
45
40
|
if (/^\s*\./.test(this.input)) {
|
|
46
41
|
return this.input.replace(/^\s*\.([^\.\s])/, '$1');
|
|
@@ -2,6 +2,8 @@ import { Tokenizer } from 'liquidjs';
|
|
|
2
2
|
|
|
3
3
|
// Homebrewed pretty-regex writer
|
|
4
4
|
const tokens = {
|
|
5
|
+
ENTER_COMMENT: `\\*/}}`,
|
|
6
|
+
EXIT_COMMENT: `{{/\\*`,
|
|
5
7
|
END: `{{ end }}`,
|
|
6
8
|
BEGIN: `{{ (if)`,
|
|
7
9
|
BEGIN_SCOPED: `{{ (range|with|define|block|template)`,
|
|
@@ -11,6 +13,7 @@ const tokens = {
|
|
|
11
13
|
REASSIGN: `{{ (\\$\\S+) = () }}`,
|
|
12
14
|
WITH: `{{ with () }}`,
|
|
13
15
|
BOOKSHOP: `{{ partial "bookshop" \\( slice "()" () \\) }}`,
|
|
16
|
+
BOOKSHOP_VAR: `{{ partial "bookshop" \\( slice (\\S+) () \\) }}`,
|
|
14
17
|
BOOKSHOP_SCOPED: `{{ partial "bookshop" \\(? \\. \\)? }}`,
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -26,30 +29,42 @@ Object.entries(tokens).forEach(([name, r]) => {
|
|
|
26
29
|
* that we already have in the bundle.
|
|
27
30
|
* All go templating tags will come through as value tokens.
|
|
28
31
|
*/
|
|
29
|
-
const rewriteTag = function (token, src,
|
|
32
|
+
const rewriteTag = function (token, src, state, liveMarkup) {
|
|
30
33
|
let raw = token.getText();
|
|
31
34
|
let outputToken = {
|
|
32
35
|
text: raw
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
if (TOKENS.ENTER_COMMENT.test(raw)) {
|
|
39
|
+
state.inComment = true
|
|
40
|
+
}
|
|
41
|
+
if (TOKENS.EXIT_COMMENT.test(raw)) {
|
|
42
|
+
state.inComment = false
|
|
43
|
+
return outputToken;
|
|
44
|
+
}
|
|
45
|
+
if (state.inComment) {
|
|
46
|
+
return outputToken;
|
|
47
|
+
}
|
|
35
48
|
// Skip non-value tags
|
|
36
49
|
if (token.kind !== 8) return outputToken;
|
|
50
|
+
|
|
37
51
|
if (TOKENS.END.test(raw)) {
|
|
38
|
-
endTags.push(outputToken);
|
|
52
|
+
state.endTags.push(outputToken);
|
|
39
53
|
return outputToken;
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
if (TOKENS.BEGIN.test(raw)) {
|
|
43
|
-
endTags.pop();
|
|
57
|
+
state.endTags.pop();
|
|
44
58
|
}
|
|
45
59
|
|
|
46
60
|
if (TOKENS.BEGIN_SCOPED.test(raw)) {
|
|
47
61
|
outputToken.text = `${outputToken.text}{{ \`<!--bookshop-live stack-->\` | safeHTML }}`;
|
|
48
62
|
|
|
49
|
-
let matchingEnd = endTags.pop();
|
|
63
|
+
let matchingEnd = state.endTags.pop();
|
|
50
64
|
matchingEnd.text = `{{ \`<!--bookshop-live unstack-->\` | safeHTML }}${matchingEnd.text}`;
|
|
51
65
|
}
|
|
52
66
|
|
|
67
|
+
|
|
53
68
|
if (liveMarkup && TOKENS.INDEX_LOOP.test(raw)) {
|
|
54
69
|
let [, index_variable, iterator] = raw.match(TOKENS.INDEX_LOOP);
|
|
55
70
|
const r = required_wrapper_hugo_func(iterator);
|
|
@@ -89,6 +104,10 @@ const rewriteTag = function (token, src, endTags, liveMarkup) {
|
|
|
89
104
|
`${outputToken.text}`,
|
|
90
105
|
`{{ \`<!--bookshop-live end-->\` | safeHTML }}`
|
|
91
106
|
].join('');
|
|
107
|
+
} else if (liveMarkup && TOKENS.BOOKSHOP_VAR.test(raw)) {
|
|
108
|
+
let [, variable, params] = raw.match(TOKENS.BOOKSHOP_VAR);
|
|
109
|
+
const r = required_wrapper_hugo_func(params);
|
|
110
|
+
outputToken.text = `{{${r[0]} (printf \`<!--bookshop-live name(%s) params(.: (${tidy(params)}))-->\`${r[1]} (${variable})) | safeHTML }}${outputToken.text}{{ \`<!--bookshop-live end-->\` | safeHTML }}`
|
|
92
111
|
}
|
|
93
112
|
|
|
94
113
|
return outputToken;
|
|
@@ -111,10 +130,13 @@ export default function (text, opts) {
|
|
|
111
130
|
const tokenizer = new Tokenizer(text.toString());
|
|
112
131
|
const tokens = tokenizer.readTopLevelTokens();
|
|
113
132
|
const output = [];
|
|
114
|
-
const
|
|
133
|
+
const state = {
|
|
134
|
+
endTags: [],
|
|
135
|
+
inComment: false
|
|
136
|
+
};
|
|
115
137
|
|
|
116
138
|
tokens.reverse().forEach(tag => {
|
|
117
|
-
output.unshift(rewriteTag(tag, text,
|
|
139
|
+
output.unshift(rewriteTag(tag, text, state, opts.liveMarkup));
|
|
118
140
|
});
|
|
119
141
|
|
|
120
142
|
return output.map(t => t.text).join('');
|
|
@@ -11,6 +11,16 @@ test("add live markup to bookshop tags", t => {
|
|
|
11
11
|
t.is(translateTextTemplate(input, {}), expected);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
test("add live markup to bookshop tags referencing variables", t => {
|
|
15
|
+
const input = `{{ partial "bookshop" (slice .item._bookshop_name .item.something )}}`;
|
|
16
|
+
const expected = [
|
|
17
|
+
`{{ (printf \`<!--bookshop-live name(%s) params(.: (.item.something))-->\` (.item._bookshop_name)) | safeHTML }}`,
|
|
18
|
+
`{{ partial "bookshop" (slice .item._bookshop_name .item.something )}}`,
|
|
19
|
+
`{{ \`<!--bookshop-live end-->\` | safeHTML }}`
|
|
20
|
+
].join('');
|
|
21
|
+
t.is(translateTextTemplate(input, {}), expected);
|
|
22
|
+
});
|
|
23
|
+
|
|
14
24
|
test("add live markup to scoped bookshop tags", t => {
|
|
15
25
|
const input = `{{ partial "bookshop" . }}`;
|
|
16
26
|
const expected = [
|
|
@@ -30,8 +40,18 @@ test("don't add live markup to bookshop_partial tags", t => {
|
|
|
30
40
|
|
|
31
41
|
test("don't add live markup if no bookshop found", t => {
|
|
32
42
|
let input = `{{ $a := .b }}`;
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
t.is(translateTextTemplate(input, {}), input);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("don't add live markup to commented out regions", t => {
|
|
47
|
+
const input = [
|
|
48
|
+
`{{/* comment start <div>`,
|
|
49
|
+
` . {{ partial "bookshop" (slice "content" (dict "content_html" .Params.note_html "type" "note")) }}`,
|
|
50
|
+
` <h1> Hello World </h1>`,
|
|
51
|
+
` . {{ partial "bookshop" . }}`,
|
|
52
|
+
`</div> comment end */}}`
|
|
53
|
+
].join('\n');
|
|
54
|
+
t.is(translateTextTemplate(input, {}), input);
|
|
35
55
|
});
|
|
36
56
|
|
|
37
57
|
test("add live markup to assigns", t => {
|
|
@@ -175,4 +195,35 @@ test("add live markup to complex components", t => {
|
|
|
175
195
|
{{ safeHTML $close }}
|
|
176
196
|
{{ \`<!--bookshop-live unstack-->\` | safeHTML }}{{ end }}`;
|
|
177
197
|
t.is(translateTextTemplate(input, {}), expected);
|
|
178
|
-
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// test("add live markup to another complex component", t => {
|
|
201
|
+
// const input = `
|
|
202
|
+
// {{ if site.Params.env_bookshop_live }}
|
|
203
|
+
|
|
204
|
+
// {{ partial "bookshop" (slice "layout_options" (slice (partial "bookshop" (slice "filtered_posts/component" .)) .)) }}
|
|
205
|
+
|
|
206
|
+
// {{ else }}
|
|
207
|
+
// {{ $content := partial "bookshop" (slice "filtered_posts/component" .) }}
|
|
208
|
+
// {{ $content = $content | strings.ReplaceRE \`<!--.*?-->\` "" | strings.ReplaceRE \`^\s+(.*?)\s+$\` "$1" | safeHTML }}
|
|
209
|
+
|
|
210
|
+
// {{ if $content }}
|
|
211
|
+
// {{ partial "bookshop" (slice "layout_options" (slice $content .)) }}
|
|
212
|
+
// {{ end }}
|
|
213
|
+
// {{ end }}`;
|
|
214
|
+
// const expected = `
|
|
215
|
+
// {{ if site.Params.env_bookshop_live }}
|
|
216
|
+
|
|
217
|
+
// {{ partial "bookshop" (slice "layout_options" (slice (partial "bookshop" (slice "filtered_posts/component" .)) .)) }}
|
|
218
|
+
|
|
219
|
+
// {{ else }}
|
|
220
|
+
// {{ $content := partial "bookshop" (slice "filtered_posts/component" .) }}
|
|
221
|
+
// {{ $content = $content | strings.ReplaceRE \`<!--.*?-->\` "" | strings.ReplaceRE \`^\s+(.*?)\s+$\` "$1" | safeHTML }}
|
|
222
|
+
|
|
223
|
+
// {{ if $content }}
|
|
224
|
+
// {{ partial "bookshop" (slice "layout_options" (slice $content .)) }}
|
|
225
|
+
// {{ end }}
|
|
226
|
+
// {{ end }}`;
|
|
227
|
+
// console.log(translateTextTemplate(input, {}))
|
|
228
|
+
// t.is(translateTextTemplate(input, {}), expected);
|
|
229
|
+
// });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bookshop/hugo-engine",
|
|
3
3
|
"packageManager": "yarn@3.0.0",
|
|
4
|
-
"version": "3.4.0-beta.
|
|
4
|
+
"version": "3.4.0-beta.3",
|
|
5
5
|
"description": "Bookshop frontend Hugo renderer",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"nyc": "^15.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@bookshop/helpers": "3.4.0-beta.
|
|
33
|
+
"@bookshop/helpers": "3.4.0-beta.3",
|
|
34
34
|
"esbuild": "^0.13.10",
|
|
35
35
|
"fflate": "^0.7.3",
|
|
36
36
|
"liquidjs": "9.28.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":5578,"argv":["/opt/hostedtoolcache/node/16.18.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1670907491400,"ppid":5566,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/5a2007e8-1bda-4eda-b271-6d7323d49bdd.json","externalId":"","uuid":"5a2007e8-1bda-4eda-b271-6d7323d49bdd","files":[]}
|