@formfeed/engine 0.3.18 → 0.3.20
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/index.cjs +10 -2
- package/index.js +10 -2
- package/package.json +1 -1
- package/types/lib/assemble.d.cts +9 -0
- package/types/lib/assemble.d.ts +9 -0
package/index.cjs
CHANGED
|
@@ -5863,7 +5863,8 @@ async function renderVersion(version, data, ctx, mode = "print", extras = {}) {
|
|
|
5863
5863
|
currency: settings.currency ?? ctx.currency
|
|
5864
5864
|
};
|
|
5865
5865
|
const renderPart = async (source, name) => source ? engine.render(engine.compile(source, { name }), data, renderCtx) : void 0;
|
|
5866
|
-
const
|
|
5866
|
+
const meta = settings.pdf?.metadata;
|
|
5867
|
+
const [html, headerHtml, footerHtml, title, author, subject, keywords2] = await Promise.all([
|
|
5867
5868
|
engine.render(
|
|
5868
5869
|
engine.compile(version.html, { name: "template" }),
|
|
5869
5870
|
data,
|
|
@@ -5871,8 +5872,14 @@ async function renderVersion(version, data, ctx, mode = "print", extras = {}) {
|
|
|
5871
5872
|
),
|
|
5872
5873
|
renderPart(settings.header?.html, "header"),
|
|
5873
5874
|
renderPart(settings.footer?.html, "footer"),
|
|
5874
|
-
renderPart(
|
|
5875
|
+
renderPart(meta?.title, "title"),
|
|
5876
|
+
renderPart(meta?.author, "author"),
|
|
5877
|
+
renderPart(meta?.subject, "subject"),
|
|
5878
|
+
renderPart(meta?.keywords, "keywords")
|
|
5875
5879
|
]);
|
|
5880
|
+
const metadata = Object.fromEntries(
|
|
5881
|
+
Object.entries({ author, subject, keywords: keywords2 }).map(([key, value]) => [key, value?.trim()]).filter(([, value]) => value)
|
|
5882
|
+
);
|
|
5876
5883
|
const inlineCss = [
|
|
5877
5884
|
fontFaceCss(
|
|
5878
5885
|
extras.fonts,
|
|
@@ -5902,6 +5909,7 @@ ${brandFontFamilies(ctx.brand)}`
|
|
|
5902
5909
|
headerHtml,
|
|
5903
5910
|
footerHtml,
|
|
5904
5911
|
title: title?.trim() || void 0,
|
|
5912
|
+
metadata,
|
|
5905
5913
|
settings,
|
|
5906
5914
|
inlineCss
|
|
5907
5915
|
};
|
package/index.js
CHANGED
|
@@ -5643,7 +5643,8 @@ async function renderVersion(version, data, ctx, mode = "print", extras = {}) {
|
|
|
5643
5643
|
currency: settings.currency ?? ctx.currency
|
|
5644
5644
|
};
|
|
5645
5645
|
const renderPart = async (source, name) => source ? engine.render(engine.compile(source, { name }), data, renderCtx) : void 0;
|
|
5646
|
-
const
|
|
5646
|
+
const meta = settings.pdf?.metadata;
|
|
5647
|
+
const [html, headerHtml, footerHtml, title, author, subject, keywords2] = await Promise.all([
|
|
5647
5648
|
engine.render(
|
|
5648
5649
|
engine.compile(version.html, { name: "template" }),
|
|
5649
5650
|
data,
|
|
@@ -5651,8 +5652,14 @@ async function renderVersion(version, data, ctx, mode = "print", extras = {}) {
|
|
|
5651
5652
|
),
|
|
5652
5653
|
renderPart(settings.header?.html, "header"),
|
|
5653
5654
|
renderPart(settings.footer?.html, "footer"),
|
|
5654
|
-
renderPart(
|
|
5655
|
+
renderPart(meta?.title, "title"),
|
|
5656
|
+
renderPart(meta?.author, "author"),
|
|
5657
|
+
renderPart(meta?.subject, "subject"),
|
|
5658
|
+
renderPart(meta?.keywords, "keywords")
|
|
5655
5659
|
]);
|
|
5660
|
+
const metadata = Object.fromEntries(
|
|
5661
|
+
Object.entries({ author, subject, keywords: keywords2 }).map(([key, value]) => [key, value?.trim()]).filter(([, value]) => value)
|
|
5662
|
+
);
|
|
5656
5663
|
const inlineCss = [
|
|
5657
5664
|
fontFaceCss(
|
|
5658
5665
|
extras.fonts,
|
|
@@ -5682,6 +5689,7 @@ ${brandFontFamilies(ctx.brand)}`
|
|
|
5682
5689
|
headerHtml,
|
|
5683
5690
|
footerHtml,
|
|
5684
5691
|
title: title?.trim() || void 0,
|
|
5692
|
+
metadata,
|
|
5685
5693
|
settings,
|
|
5686
5694
|
inlineCss
|
|
5687
5695
|
};
|
package/package.json
CHANGED
package/types/lib/assemble.d.cts
CHANGED
|
@@ -177,6 +177,15 @@ export interface RenderedDocument {
|
|
|
177
177
|
footerHtml?: string;
|
|
178
178
|
/** PDF metadata title after template rendering. */
|
|
179
179
|
title?: string;
|
|
180
|
+
/**
|
|
181
|
+
* The rest of the PDF metadata, rendered with the same data as the title. Until 2026-10-19 only
|
|
182
|
+
* the title was, and a template's `{{ report.company }}` stood in a published PDF as its author.
|
|
183
|
+
*/
|
|
184
|
+
metadata?: {
|
|
185
|
+
author?: string;
|
|
186
|
+
subject?: string;
|
|
187
|
+
keywords?: string;
|
|
188
|
+
};
|
|
180
189
|
settings: TemplateSettings;
|
|
181
190
|
/** Font faces and extra CSS the header/footer templates need inlined (Chromium loads no external CSS there). */
|
|
182
191
|
inlineCss: string;
|
package/types/lib/assemble.d.ts
CHANGED
|
@@ -177,6 +177,15 @@ export interface RenderedDocument {
|
|
|
177
177
|
footerHtml?: string;
|
|
178
178
|
/** PDF metadata title after template rendering. */
|
|
179
179
|
title?: string;
|
|
180
|
+
/**
|
|
181
|
+
* The rest of the PDF metadata, rendered with the same data as the title. Until 2026-10-19 only
|
|
182
|
+
* the title was, and a template's `{{ report.company }}` stood in a published PDF as its author.
|
|
183
|
+
*/
|
|
184
|
+
metadata?: {
|
|
185
|
+
author?: string;
|
|
186
|
+
subject?: string;
|
|
187
|
+
keywords?: string;
|
|
188
|
+
};
|
|
180
189
|
settings: TemplateSettings;
|
|
181
190
|
/** Font faces and extra CSS the header/footer templates need inlined (Chromium loads no external CSS there). */
|
|
182
191
|
inlineCss: string;
|