@travetto/email-inky 3.1.19 → 3.1.21
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/README.md +1 -1
- package/package.json +2 -2
- package/src/render/context.ts +1 -1
- package/src/render/html.ts +2 -2
- package/src/render/markdown.ts +1 -1
- package/src/render/subject.ts +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ The underlying [Email](https://github.com/travetto/travetto/tree/main/module/ema
|
|
|
43
43
|
|
|
44
44
|
This means this module, while showing [inky](https://github.com/zurb/inky) components, will ultimately produce HTML/markdown that is [mustache](https://github.com/janl/mustache.js/) compatible. The syntax used by [mustache](https://github.com/janl/mustache.js/) and the syntax used by [JSX](https://en.wikipedia.org/wiki/JSX_(JavaScript)) are in conflict due to both of the tools relying on the uniqueness of `{}` brackets.
|
|
45
45
|
|
|
46
|
-
To that end, the module introduces additional components ([If Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L27), [Unless Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L29), and [For Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L30)) to assist with control flow logic. When it comes to variable substitution, and a desire to intermingle seamlessly with component properties,
|
|
46
|
+
To that end, the module introduces additional components ([If Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L27), [Unless Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L29), and [For Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L30)) to assist with control flow logic. When it comes to variable substitution, and a desire to intermingle seamlessly with component properties, `@@VALUE@@` are used to represent variable expressions. A more formal version can be found in the [Value Component](https://github.com/travetto/travetto/tree/main/module/email-inky/src/components.ts#L28) component, but this cannot be integrated into properties (e.g. an href)
|
|
47
47
|
|
|
48
48
|
## Template Extension Points
|
|
49
49
|
The template extension points are defined at:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email-inky",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.21",
|
|
4
4
|
"description": "Email Inky templating module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"foundation-emails": "^2.4.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@travetto/email-template": "^3.1.
|
|
37
|
+
"@travetto/email-template": "^3.1.18"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@travetto/cli": "^3.1.6"
|
package/src/render/context.ts
CHANGED
package/src/render/html.ts
CHANGED
|
@@ -83,7 +83,7 @@ export const Html: RenderProvider<RenderContext> = {
|
|
|
83
83
|
finalize: (html, context) => html
|
|
84
84
|
.replace(/(<[/](?:a)>)([A-Za-z0-9$])/g, (_, tag, v) => `${tag} ${v}`)
|
|
85
85
|
.replace(/(<[uo]l>)(<li>)/g, (_, a, b) => `${a} ${b}`)
|
|
86
|
-
.replace(
|
|
86
|
+
.replace(/@@([^@]+)@@/gm, (_, t) => `{{${t}}}`),
|
|
87
87
|
|
|
88
88
|
For: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|
|
89
89
|
If: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|
|
@@ -365,7 +365,7 @@ export const Html: RenderProvider<RenderContext> = {
|
|
|
365
365
|
};
|
|
366
366
|
|
|
367
367
|
export const HtmlWrap = async (content: string): Promise<string> => {
|
|
368
|
-
const wrapper = await new EmailResource(['@', '@travetto/email-inky
|
|
368
|
+
const wrapper = await new EmailResource(['@', '@travetto/email-inky#resources'])
|
|
369
369
|
.read('/email/inky.wrapper.html');
|
|
370
370
|
|
|
371
371
|
// Get Subject
|
package/src/render/markdown.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const Markdown: RenderProvider<RenderContext> = {
|
|
|
9
9
|
finalize: (text, context) => text
|
|
10
10
|
.replace(/(\[[^\]]+\]\([^)]+\))([A-Za-z0-9$]+)/g, (_, link, v) => v === 's' ? _ : `${link} ${v}`)
|
|
11
11
|
.replace(/(\S)\n(#)/g, (_, l, r) => `${l}\n\n${r}`)
|
|
12
|
-
.replace(
|
|
12
|
+
.replace(/@@([^@]+)@@/gm, (_, t) => `{{${t}}}`),
|
|
13
13
|
|
|
14
14
|
For: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|
|
15
15
|
If: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|
package/src/render/subject.ts
CHANGED
|
@@ -7,7 +7,7 @@ const visit = ({ recurse }: RenderState<JSXElement, RenderContext>): Promise<str
|
|
|
7
7
|
|
|
8
8
|
export const Subject: RenderProvider<RenderContext> = {
|
|
9
9
|
finalize: text => text
|
|
10
|
-
.replace(
|
|
10
|
+
.replace(/@@([^@]+)@@/gm, (_, t) => `{{${t}}}`),
|
|
11
11
|
|
|
12
12
|
For: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|
|
13
13
|
If: async ({ recurse, props }) => `{{#${props.attr}}}${await recurse()}{{/${props.attr}}}`,
|