pptx-templates 0.3.8 → 0.4.0
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/AI-INSTRUCTOR.md +91 -2
- package/CHANGELOG.md +125 -1
- package/dist/automizer.js +143 -176
- package/dist/automizer.js.map +1 -1
- package/dist/classes/content-type-registry.js +23 -36
- package/dist/classes/content-type-registry.js.map +1 -1
- package/dist/classes/element-importer.js +129 -148
- package/dist/classes/element-importer.js.map +1 -1
- package/dist/classes/has-shapes.js +81 -126
- package/dist/classes/has-shapes.js.map +1 -1
- package/dist/classes/layout.js +47 -67
- package/dist/classes/layout.js.map +1 -1
- package/dist/classes/master.js +70 -89
- package/dist/classes/master.js.map +1 -1
- package/dist/classes/placeholder-normalizer.js +48 -37
- package/dist/classes/placeholder-normalizer.js.map +1 -1
- package/dist/classes/related-content-copier.js +65 -86
- package/dist/classes/related-content-copier.js.map +1 -1
- package/dist/classes/shape.js +79 -110
- package/dist/classes/shape.js.map +1 -1
- package/dist/classes/slide-master-remover.js +108 -130
- package/dist/classes/slide-master-remover.js.map +1 -1
- package/dist/classes/slide-notes-copier.js +24 -41
- package/dist/classes/slide-notes-copier.js.map +1 -1
- package/dist/classes/slide.js +112 -141
- package/dist/classes/slide.js.map +1 -1
- package/dist/classes/template.js +82 -117
- package/dist/classes/template.js.map +1 -1
- package/dist/errors.js +5 -5
- package/dist/errors.js.map +1 -1
- package/dist/extensions/cli/index.js +3 -13
- package/dist/extensions/cli/index.js.map +1 -1
- package/dist/extensions/hide-slide/index.js +48 -46
- package/dist/extensions/hide-slide/index.js.map +1 -1
- package/dist/extensions/master-parts/index.js +36 -49
- package/dist/extensions/master-parts/index.js.map +1 -1
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +56 -70
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -1
- package/dist/extensions/regexp-escape/index.d.ts +10 -0
- package/dist/extensions/regexp-escape/index.js +15 -0
- package/dist/extensions/regexp-escape/index.js.map +1 -0
- package/dist/extensions/run-merge/index.js +4 -5
- package/dist/extensions/run-merge/index.js.map +1 -1
- package/dist/extensions/shape-geometry/index.d.ts +2 -0
- package/dist/extensions/shape-geometry/index.js +13 -13
- package/dist/extensions/shape-geometry/index.js.map +1 -1
- package/dist/extensions/template-lint/cli.js +49 -41
- package/dist/extensions/template-lint/cli.js.map +1 -1
- package/dist/extensions/template-lint/config.js +18 -10
- package/dist/extensions/template-lint/config.js.map +1 -1
- package/dist/extensions/template-lint/data-model.js +17 -20
- package/dist/extensions/template-lint/data-model.js.map +1 -1
- package/dist/extensions/template-lint/init-cli.js +12 -17
- package/dist/extensions/template-lint/init-cli.js.map +1 -1
- package/dist/extensions/template-lint/lint.js +195 -62
- package/dist/extensions/template-lint/lint.js.map +1 -1
- package/dist/extensions/template-lint/skeleton.js +5 -6
- package/dist/extensions/template-lint/skeleton.js.map +1 -1
- package/dist/extensions/template-lint/usage-cli.js +10 -14
- package/dist/extensions/template-lint/usage-cli.js.map +1 -1
- package/dist/extensions/template-lint/usage.js +8 -9
- package/dist/extensions/template-lint/usage.js.map +1 -1
- package/dist/extensions/template-logic/clone.d.ts +2 -16
- package/dist/extensions/template-logic/clone.js +15 -90
- package/dist/extensions/template-logic/clone.js.map +1 -1
- package/dist/extensions/template-logic/commands.d.ts +8 -0
- package/dist/extensions/template-logic/commands.js +21 -12
- package/dist/extensions/template-logic/commands.js.map +1 -1
- package/dist/extensions/template-logic/expression.d.ts +6 -0
- package/dist/extensions/template-logic/expression.js +56 -54
- package/dist/extensions/template-logic/expression.js.map +1 -1
- package/dist/extensions/template-logic/images.d.ts +14 -0
- package/dist/extensions/template-logic/images.js +277 -49
- package/dist/extensions/template-logic/images.js.map +1 -1
- package/dist/extensions/template-logic/index.js +20 -27
- package/dist/extensions/template-logic/index.js.map +1 -1
- package/dist/extensions/template-logic/list-commands.js +31 -16
- package/dist/extensions/template-logic/list-commands.js.map +1 -1
- package/dist/extensions/template-logic/renderer.d.ts +24 -0
- package/dist/extensions/template-logic/renderer.js +505 -380
- package/dist/extensions/template-logic/renderer.js.map +1 -1
- package/dist/extensions/template-logic/types.d.ts +5 -0
- package/dist/extensions/template-logic/types.js +6 -0
- package/dist/extensions/template-logic/types.js.map +1 -1
- package/dist/extensions/template-render/cli.js +7 -18
- package/dist/extensions/template-render/cli.js.map +1 -1
- package/dist/extensions/template-render/index.js +152 -107
- package/dist/extensions/template-render/index.js.map +1 -1
- package/dist/extensions/template-render/prune.d.ts +14 -0
- package/dist/extensions/template-render/prune.js +131 -0
- package/dist/extensions/template-render/prune.js.map +1 -0
- package/dist/extensions/template-render/zip-text.d.ts +9 -0
- package/dist/extensions/template-render/zip-text.js +27 -0
- package/dist/extensions/template-render/zip-text.js.map +1 -0
- package/dist/extensions/template-render/zip-writer.d.ts +16 -0
- package/dist/extensions/template-render/zip-writer.js +151 -0
- package/dist/extensions/template-render/zip-writer.js.map +1 -0
- package/dist/extensions/text-flow/flow.d.ts +5 -0
- package/dist/extensions/text-flow/flow.js +196 -207
- package/dist/extensions/text-flow/flow.js.map +1 -1
- package/dist/extensions/text-flow/font-file.js +9 -7
- package/dist/extensions/text-flow/font-file.js.map +1 -1
- package/dist/extensions/text-flow/fonts.d.ts +4 -0
- package/dist/extensions/text-flow/fonts.js +45 -22
- package/dist/extensions/text-flow/fonts.js.map +1 -1
- package/dist/extensions/text-flow/layout.js +5 -6
- package/dist/extensions/text-flow/layout.js.map +1 -1
- package/dist/extensions/text-flow/slide-styles.js +18 -22
- package/dist/extensions/text-flow/slide-styles.js.map +1 -1
- package/dist/extensions/text-flow/styles.d.ts +11 -0
- package/dist/extensions/text-flow/styles.js +121 -62
- package/dist/extensions/text-flow/styles.js.map +1 -1
- package/dist/helper/archive/archive-fs.js +102 -138
- package/dist/helper/archive/archive-fs.js.map +1 -1
- package/dist/helper/archive/archive-jszip.js +101 -125
- package/dist/helper/archive/archive-jszip.js.map +1 -1
- package/dist/helper/archive/archive.d.ts +6 -0
- package/dist/helper/archive/archive.js +21 -30
- package/dist/helper/archive/archive.js.map +1 -1
- package/dist/helper/archive/jszip-fast-read.d.ts +19 -0
- package/dist/helper/archive/jszip-fast-read.js +153 -0
- package/dist/helper/archive/jszip-fast-read.js.map +1 -0
- package/dist/helper/compute-src-rect.js +4 -5
- package/dist/helper/compute-src-rect.js.map +1 -1
- package/dist/helper/content-tracker.js +86 -114
- package/dist/helper/content-tracker.js.map +1 -1
- package/dist/helper/count-helper.js +48 -78
- package/dist/helper/count-helper.js.map +1 -1
- package/dist/helper/css-style-parser.js +1 -2
- package/dist/helper/css-style-parser.js.map +1 -1
- package/dist/helper/file-helper.js +30 -48
- package/dist/helper/file-helper.js.map +1 -1
- package/dist/helper/generate/generate-pptxgenjs.js +36 -48
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -1
- package/dist/helper/html-to-multitext-helper.js +34 -18
- package/dist/helper/html-to-multitext-helper.js.map +1 -1
- package/dist/helper/hyperlink-processor.js +125 -139
- package/dist/helper/hyperlink-processor.js.map +1 -1
- package/dist/helper/jszip-helper.js +23 -32
- package/dist/helper/jszip-helper.js.map +1 -1
- package/dist/helper/layout-index.js +51 -71
- package/dist/helper/layout-index.js.map +1 -1
- package/dist/helper/logger.js +4 -4
- package/dist/helper/logger.js.map +1 -1
- package/dist/helper/media-deduplicator.d.ts +24 -0
- package/dist/helper/media-deduplicator.js +81 -34
- package/dist/helper/media-deduplicator.js.map +1 -1
- package/dist/helper/modify-background-helper.js +46 -46
- package/dist/helper/modify-background-helper.js.map +1 -1
- package/dist/helper/modify-chart-helper.js +597 -591
- package/dist/helper/modify-chart-helper.js.map +1 -1
- package/dist/helper/modify-cleanup-helper.js +112 -112
- package/dist/helper/modify-cleanup-helper.js.map +1 -1
- package/dist/helper/modify-color-helper.js +53 -53
- package/dist/helper/modify-color-helper.js.map +1 -1
- package/dist/helper/modify-helper.js +25 -25
- package/dist/helper/modify-helper.js.map +1 -1
- package/dist/helper/modify-hyperlink-helper.js +143 -154
- package/dist/helper/modify-hyperlink-helper.js.map +1 -1
- package/dist/helper/modify-image-helper.js +121 -132
- package/dist/helper/modify-image-helper.js.map +1 -1
- package/dist/helper/modify-presentation-helper.js +137 -154
- package/dist/helper/modify-presentation-helper.js.map +1 -1
- package/dist/helper/modify-shape-helper.js +262 -262
- package/dist/helper/modify-shape-helper.js.map +1 -1
- package/dist/helper/modify-table-helper.js +84 -84
- package/dist/helper/modify-table-helper.js.map +1 -1
- package/dist/helper/modify-text-helper.js +187 -189
- package/dist/helper/modify-text-helper.js.map +1 -1
- package/dist/helper/modify-xml-helper.js +36 -36
- package/dist/helper/modify-xml-helper.js.map +1 -1
- package/dist/helper/multitext-helper.js +9 -7
- package/dist/helper/multitext-helper.js.map +1 -1
- package/dist/helper/ppt-paths.js +17 -17
- package/dist/helper/ppt-paths.js.map +1 -1
- package/dist/helper/shape-type-detector.js +18 -29
- package/dist/helper/shape-type-detector.js.map +1 -1
- package/dist/helper/text-replace-helper.js +6 -7
- package/dist/helper/text-replace-helper.js.map +1 -1
- package/dist/helper/xml-clone.d.ts +24 -0
- package/dist/helper/xml-clone.js +269 -0
- package/dist/helper/xml-clone.js.map +1 -0
- package/dist/helper/xml-elements.js +17 -20
- package/dist/helper/xml-elements.js.map +1 -1
- package/dist/helper/xml-find.d.ts +4 -0
- package/dist/helper/xml-find.js +48 -0
- package/dist/helper/xml-find.js.map +1 -0
- package/dist/helper/xml-helper.js +99 -134
- package/dist/helper/xml-helper.js.map +1 -1
- package/dist/helper/xml-parse-cache.d.ts +31 -0
- package/dist/helper/xml-parse-cache.js +71 -0
- package/dist/helper/xml-parse-cache.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.js +10 -10
- package/dist/helper/xml-placeholder-helper.js.map +1 -1
- package/dist/helper/xml-relationship-helper.js +120 -144
- package/dist/helper/xml-relationship-helper.js.map +1 -1
- package/dist/helper/xml-serializer.d.ts +2 -0
- package/dist/helper/xml-serializer.js +192 -0
- package/dist/helper/xml-serializer.js.map +1 -0
- package/dist/helper/xml-slide-helper.js +109 -129
- package/dist/helper/xml-slide-helper.js.map +1 -1
- package/dist/helper/xml-template-helper.js +120 -144
- package/dist/helper/xml-template-helper.js.map +1 -1
- package/dist/helper/xmldom-sax-patch.js +52 -2
- package/dist/helper/xmldom-sax-patch.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/modify/modify-chart.js +35 -23
- package/dist/modify/modify-chart.js.map +1 -1
- package/dist/modify/modify-table.js +11 -14
- package/dist/modify/modify-table.js.map +1 -1
- package/dist/shapes/chart.js +238 -287
- package/dist/shapes/chart.js.map +1 -1
- package/dist/shapes/diagram.js +73 -104
- package/dist/shapes/diagram.js.map +1 -1
- package/dist/shapes/generic.js +62 -83
- package/dist/shapes/generic.js.map +1 -1
- package/dist/shapes/hyperlink.js +98 -124
- package/dist/shapes/hyperlink.js.map +1 -1
- package/dist/shapes/image.js +112 -151
- package/dist/shapes/image.js.map +1 -1
- package/dist/shapes/ole.js +148 -188
- package/dist/shapes/ole.js.map +1 -1
- package/package.json +3 -4
package/AI-INSTRUCTOR.md
CHANGED
|
@@ -813,7 +813,8 @@ equal share of the frame. If no text is left in the shape after rendering,
|
|
|
813
813
|
the shape is removed and only the pictures remain.
|
|
814
814
|
|
|
815
815
|
- The shape needs its own position and size. Placeholders that inherit
|
|
816
|
-
them from the layout are not supported
|
|
816
|
+
them from the layout are not supported in the text; write the tag into
|
|
817
|
+
their alt text instead (see below).
|
|
817
818
|
- A string that ends in `.png`, `.jpg`, `.jpeg` or `.gif` is a file path
|
|
818
819
|
(base64 has no dot). It is read from `imageRoot` and cannot leave that
|
|
819
820
|
folder; without `imageRoot` it is an error. `null`, `undefined` and `''`
|
|
@@ -823,6 +824,91 @@ the shape is removed and only the pictures remain.
|
|
|
823
824
|
- `IMAGE` writes a media file, so it needs `slide.modify(modify.renderTemplate(…))`.
|
|
824
825
|
A `modifyElement()` callback cannot add files and rejects with an error.
|
|
825
826
|
|
|
827
|
+
#### Picture placeholders: the tag in the alt text
|
|
828
|
+
|
|
829
|
+
To fill a picture placeholder of the slide master, for example a circle,
|
|
830
|
+
write the tag into the **alt text** of the placeholder on the slide (right
|
|
831
|
+
click → *View Alt Text*), not into its text:
|
|
832
|
+
|
|
833
|
+
```text
|
|
834
|
+
{{IMAGE foto}}
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
The picture then fills the placeholder the way a picture inserted in
|
|
838
|
+
PowerPoint does:
|
|
839
|
+
|
|
840
|
+
- It covers the whole shape **without distortion**. A picture with another
|
|
841
|
+
aspect ratio than the placeholder is cropped evenly on both sides
|
|
842
|
+
(`a:srcRect`), so no edge stays empty, also in a circle.
|
|
843
|
+
- Position, size and shape stay the ones of the placeholder, inherited
|
|
844
|
+
from the layout. The result is a picture *in the placeholder*: in
|
|
845
|
+
PowerPoint you can still replace it by hand (*Change Picture*), and
|
|
846
|
+
deleting it brings back the empty placeholder.
|
|
847
|
+
- **Backup picture:** if the placeholder already holds a picture, the new
|
|
848
|
+
one replaces it. Without a value (`null`, `undefined`, `''`) the backup
|
|
849
|
+
stays. The alt text is removed either way, or set to `alt`.
|
|
850
|
+
|
|
851
|
+
The same works in the alt text of an empty picture or content placeholder
|
|
852
|
+
(it becomes a picture in that placeholder) and of any picture. Every other
|
|
853
|
+
shape keeps its text and gets the picture as its fill, cropped the same
|
|
854
|
+
way: a shape that is no placeholder, a title or text placeholder, and a
|
|
855
|
+
placeholder that already holds text. Tables, charts and groups cannot
|
|
856
|
+
take a picture; a tag in their alt text is an error.
|
|
857
|
+
|
|
858
|
+
The object form takes `alt`, `shape`, `cornerRadius`, `shapeAdjustments`
|
|
859
|
+
and `border` as above. `width`, `height` and `rotation` are an error here,
|
|
860
|
+
since the shape decides them; `lintTemplate` reports them as well.
|
|
861
|
+
|
|
862
|
+
An alt text counts as a template only when it holds **nothing but tags,
|
|
863
|
+
with an `IMAGE` among them**. Any other alt text stays as it is, so a
|
|
864
|
+
description like `Preis {{ in Euro`, `Foto: {{IMAGE foto}}` or `{{name}}`
|
|
865
|
+
is not rendered; `lintTemplate` warns about the last two, since their tag
|
|
866
|
+
most likely was meant to work. The tags use the configured delimiters
|
|
867
|
+
(`openingTag`/`closingTag` or `cmdDelimiter`, see
|
|
868
|
+
[Options](#options)), like the text.
|
|
869
|
+
|
|
870
|
+
Only the alt texts of the template are rendered. An `alt` from the data
|
|
871
|
+
(`{{IMAGE ({ data: foto, alt: caption })}}`) is written as it is, also
|
|
872
|
+
when it contains tags.
|
|
873
|
+
|
|
874
|
+
##### Conditions and loops in the alt text
|
|
875
|
+
|
|
876
|
+
Besides `IMAGE`, these work in the alt text:
|
|
877
|
+
`IF`/`ELSE-IF`/`ELSE`/`END-IF`, `FOR`/`END-FOR` and `EXEC`. Any other
|
|
878
|
+
tag, or a block that is not closed, is an error. With an `errorHandler`,
|
|
879
|
+
the alt text is removed and the shape stays as it is. One shape takes one
|
|
880
|
+
picture: if the alt text yields more than one, that is an error. If it
|
|
881
|
+
yields none, the backup stays.
|
|
882
|
+
|
|
883
|
+
```text
|
|
884
|
+
{{IF person.foto}}{{IMAGE person.foto}}{{ELSE}}{{IMAGE 'avatar.png'}}{{END-IF}}
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
For a choice between two pictures, the ternary operator is shorter:
|
|
888
|
+
|
|
889
|
+
```text
|
|
890
|
+
{{IMAGE person.foto ? person.foto : 'avatar.png'}}
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
Alt-text tags are rendered after the text of the slide, so variables from
|
|
894
|
+
`EXEC` apply. Loop variables of a `FOR` in the text do not, because a
|
|
895
|
+
loop in the text repeats paragraphs, not shapes.
|
|
896
|
+
|
|
897
|
+
In a [`flow()` card](https://daborsten.github.io/pptx-templates/text-flow.md#cards-one-entry-in-several-text-boxes)
|
|
898
|
+
(a group), `flow(list)` in the alt text of a picture or shape gives the
|
|
899
|
+
entries of that card, the same as in the text boxes of the card. So each
|
|
900
|
+
card shows the picture of its own entry:
|
|
901
|
+
|
|
902
|
+
```text
|
|
903
|
+
{{FOR p IN flow(people, 1)}}{{IMAGE p.foto}}{{END-FOR}}
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
Outside a card, `flow()` in an alt text is an error.
|
|
907
|
+
|
|
908
|
+
PowerPoint's *Picture (fill)* and *Picture (fit)* placeholders only take
|
|
909
|
+
effect when you insert a picture by hand; a generated file stores the crop
|
|
910
|
+
itself. The tag always crops as *fill* does.
|
|
911
|
+
|
|
826
912
|
### Expressions
|
|
827
913
|
|
|
828
914
|
Expressions support property paths (`a.b`, `a[0]`, `a['key']`, `a?.b`),
|
|
@@ -1300,7 +1386,10 @@ as not shown. The second slide repeats as usual while projects are left.
|
|
|
1300
1386
|
- `flow`, `flowRest`, `flowContinue`, `flowPage` and `flowPages` are built in. The same name
|
|
1301
1387
|
in your data or in `additionalJsContext` takes precedence.
|
|
1302
1388
|
- To count the slides, `renderDeck` and `countFlowPages` render the slide
|
|
1303
|
-
once more. Functions in your data are called again then.
|
|
1389
|
+
once more. Functions in your data are called again then. Pictures of
|
|
1390
|
+
`{{IMAGE}}` are not loaded for the count, since they do not change where
|
|
1391
|
+
the text goes: a missing image file is reported when the slide itself is
|
|
1392
|
+
rendered, not by `countFlowPages`.
|
|
1304
1393
|
|
|
1305
1394
|
## Hide Slides
|
|
1306
1395
|
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,128 @@ semver, with the pre-1.0 convention that **breaking changes bump the minor**.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.4.0] - 2026-11-24
|
|
10
|
+
|
|
11
|
+
Generating is several times faster, with the same slides. Most of the
|
|
12
|
+
speed-ups are in code every `Automizer` run uses (reading, parsing and
|
|
13
|
+
writing parts, copying XML nodes, finding duplicate pictures), not only in
|
|
14
|
+
`renderDeck`. Compared with 0.3.9, the content of every part is the same;
|
|
15
|
+
the bytes of a `renderDeck` deck differ: parts it does not change are taken
|
|
16
|
+
over from the template as they are instead of parsed and written again,
|
|
17
|
+
pictures are stored instead of deflated (about 1 % larger), and parts no
|
|
18
|
+
relationship reaches are left out.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Behavior change:** `countFlowPages` loads no `{{IMAGE}}` picture. The
|
|
23
|
+
value is still evaluated, so an error in the expression is still
|
|
24
|
+
reported, but a missing file, a path outside `imageRoot`, an unknown
|
|
25
|
+
image format, `IMAGE` in a table cell or two `IMAGE` tags in one alt
|
|
26
|
+
text are reported only when the slide is rendered, not by
|
|
27
|
+
`countFlowPages`. `renderDeck` renders every slide it counts, so it
|
|
28
|
+
reports the same errors as before; an `errorHandler` gets them once
|
|
29
|
+
instead of twice on a `flow()` slide.
|
|
30
|
+
- `renderDeck` is more than twice as fast, with the same slides: a deck
|
|
31
|
+
of 8 template slides, three of them with `flow()` lists that make 2 to 4
|
|
32
|
+
slides each, takes about 0.1 instead of 0.23 seconds.
|
|
33
|
+
- `renderDeck` and `countFlowPages` count the slides a `flow()` slide
|
|
34
|
+
needs by rendering that slide by itself, instead of building a whole
|
|
35
|
+
deck for each such slide. The count is the same.
|
|
36
|
+
- The system font folders are listed once per process, not on every
|
|
37
|
+
render with `flow()` (on Windows a `stat` for each of hundreds of
|
|
38
|
+
fonts). Fonts installed while the process runs are found after a
|
|
39
|
+
restart. The `fonts` folders passed in the options are still listed on
|
|
40
|
+
every render, so font files added to them are found right away.
|
|
41
|
+
- `renderDeck` drops the parts no relationship reaches any more (the
|
|
42
|
+
template's own slides with their notes, charts, embeddings and
|
|
43
|
+
pictures) from the `.rels` parts, instead of parsing every slide once
|
|
44
|
+
more for Automizer's `cleanup`. A picture whose relationship the slide
|
|
45
|
+
does not use is still dropped.
|
|
46
|
+
- `renderDeck` packs the .pptx with Node's zlib instead of JSZip's
|
|
47
|
+
JavaScript deflate. Stored pictures stay stored, as PowerPoint saves
|
|
48
|
+
them, and so do the pictures `{{IMAGE}}` adds (JSZip deflated them for
|
|
49
|
+
about 1 % less).
|
|
50
|
+
- `renderDeck` loads the template once instead of three times (JSZip
|
|
51
|
+
reads the whole file byte by byte on every load).
|
|
52
|
+
- Identical pictures are found by comparing only pictures of the same
|
|
53
|
+
size: each run read and hashed every picture of the template before.
|
|
54
|
+
With 3 MB of pictures in the template, a deck takes 0.1 instead of
|
|
55
|
+
0.5 seconds.
|
|
56
|
+
- `flow()` tokenizes a box once for all the entries it measures, and
|
|
57
|
+
neither its trial renders nor counting the slides load `{{IMAGE}}`
|
|
58
|
+
pictures.
|
|
59
|
+
- `renderDeck` is about 40 % faster again, with the same output byte for
|
|
60
|
+
byte. A deck of 25 template slides (360 text boxes with tags, 30
|
|
61
|
+
pictures of 0.5 MB, 10 `flow()` slides that make 35 slides) takes 0.28
|
|
62
|
+
instead of 0.5 seconds; the same deck with pptx-automizer 0.9.4 (tags
|
|
63
|
+
replaced with `replaceText`, pictures swapped, lists split by hand,
|
|
64
|
+
nothing measured) takes 1.3 to 1.9 seconds.
|
|
65
|
+
- The build targets ES2022 instead of ES6, so `async`/`await` runs
|
|
66
|
+
natively instead of through generators (Node 20 is required already).
|
|
67
|
+
- Parts are read without JSZip's pipeline where the result is the same:
|
|
68
|
+
parts of the template inflated with Node's zlib, parts written during
|
|
69
|
+
the run taken as they were given. JSZip inflated in JavaScript and
|
|
70
|
+
passed every 16 KB through a chain of workers. Parts above 1 MB are
|
|
71
|
+
inflated on Node's thread pool, so they do not block the event loop.
|
|
72
|
+
A part that inflates to more than its zip header says (a corrupt file
|
|
73
|
+
or a zip bomb) is rejected before it fills the memory; JSZip rejected
|
|
74
|
+
it only after inflating all of it.
|
|
75
|
+
- A part parsed before is copied instead of parsed again (a slide added
|
|
76
|
+
several times, the many identical `.rels` parts). A part parsed once
|
|
77
|
+
keeps only a checksum; the copies kept are limited to 4 million
|
|
78
|
+
characters of XML per archive (about 150 MB at most).
|
|
79
|
+
- XML is written by a serializer of its own, with the output of
|
|
80
|
+
xmldom's, about a third faster.
|
|
81
|
+
- Copying XML nodes is about three times as fast (properties copied by
|
|
82
|
+
name instead of by `Object.keys`), and so is finding elements by tag
|
|
83
|
+
name; the unsupported tags of a slide are found in one pass.
|
|
84
|
+
- xmldom checks each element and attribute name against a long Unicode
|
|
85
|
+
pattern; the result is now kept per name.
|
|
86
|
+
- The .pptx is deflated on Node's thread pool, several parts at a time.
|
|
87
|
+
- `flow()` looks up the list styles of a paragraph level once per box
|
|
88
|
+
instead of once per paragraph, and the font of a run once per box.
|
|
89
|
+
- The system fonts are read only when the `fonts` folders have no exact
|
|
90
|
+
match (same family, bold and italic) for a font the slide uses. Before,
|
|
91
|
+
the first render with `flow()` in a process read every system font.
|
|
92
|
+
- A picture `{{IMAGE}}` adds is hashed once instead of twice.
|
|
93
|
+
- `@xmldom/xmldom` is pinned to exactly 0.9.12 instead of `^0.9.12`. The
|
|
94
|
+
library's own XML serializer and node copy produce xmldom 0.9.12's
|
|
95
|
+
output; a newer xmldom comes with a release of this library once that
|
|
96
|
+
output is checked against it.
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
|
|
100
|
+
- `renderDeck`: a `{{HIDE-SLIDE …}}` tag that spell check had split inside
|
|
101
|
+
the keyword (`{{HI` and `DE-SLIDE …}}` in two runs) stayed in the speaker
|
|
102
|
+
notes of a slide that is shown. The slide itself was hidden or shown
|
|
103
|
+
correctly.
|
|
104
|
+
|
|
105
|
+
### Removed
|
|
106
|
+
|
|
107
|
+
- The dependency `regexp.escape`, which installed 91 packages. Tag
|
|
108
|
+
delimiters are escaped by a small function in the library instead, with
|
|
109
|
+
the same matches.
|
|
110
|
+
|
|
111
|
+
## [0.3.9] - 2026-11-22
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- `{{IMAGE …}}` in the **alt text** of a picture placeholder (or any
|
|
116
|
+
picture or shape) fills it with the picture, cropped to cover it
|
|
117
|
+
without distortion, also in a circle. The placeholder keeps its
|
|
118
|
+
position, shape and link to the layout, so the picture can still be
|
|
119
|
+
replaced by hand in PowerPoint. A picture already in the placeholder is
|
|
120
|
+
the backup: it stays when the value is empty. The alt text can choose the
|
|
121
|
+
picture with `IF`/`ELSE`, `FOR`, `EXEC` or the ternary operator. In a
|
|
122
|
+
`flow()` card, `flow(list)` there gives the entry of the card, so every
|
|
123
|
+
card shows its own picture. `listTemplateCommands` and `lintTemplate` see
|
|
124
|
+
these tags too.
|
|
125
|
+
- Only an alt text that holds nothing but tags, with an `IMAGE` among
|
|
126
|
+
them, is rendered, with the configured delimiters. Every other alt text
|
|
127
|
+
stays as it is, as before (`Preis {{ in Euro`, `Foto: {{IMAGE foto}}`);
|
|
128
|
+
`lintTemplate` warns when one of them contains a tag. An `alt` from the
|
|
129
|
+
data is never rendered.
|
|
130
|
+
|
|
9
131
|
## [0.3.8] - 2026-11-19
|
|
10
132
|
|
|
11
133
|
### Changed
|
|
@@ -375,7 +497,9 @@ for that history.
|
|
|
375
497
|
into one `.png` part. The fallback now gets the same placeholder PNG that
|
|
376
498
|
pptxgenjs 3.12 wrote.
|
|
377
499
|
|
|
378
|
-
[Unreleased]: https://github.com/DaBorsten/pptx-templates/compare/v0.
|
|
500
|
+
[Unreleased]: https://github.com/DaBorsten/pptx-templates/compare/v0.4.0...HEAD
|
|
501
|
+
[0.4.0]: https://github.com/DaBorsten/pptx-templates/compare/v0.3.9...v0.4.0
|
|
502
|
+
[0.3.9]: https://github.com/DaBorsten/pptx-templates/compare/v0.3.8...v0.3.9
|
|
379
503
|
[0.3.8]: https://github.com/DaBorsten/pptx-templates/compare/v0.3.7...v0.3.8
|
|
380
504
|
[0.3.7]: https://github.com/DaBorsten/pptx-templates/compare/v0.3.6...v0.3.7
|
|
381
505
|
[0.3.6]: https://github.com/DaBorsten/pptx-templates/compare/v0.3.5...v0.3.6
|