pi-filler 0.2.0 → 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/README.md +87 -32
- package/package.json +4 -2
- package/src/docx.ts +273 -61
- package/src/index.ts +286 -30
- package/src/pandoc.ts +91 -16
- package/src/pptx.ts +511 -0
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ version](https://img.shields.io/npm/v/pi-filler.svg)](https://www.npmjs.com/pack
|
|
|
10
10
|
downloads](https://img.shields.io/npm/dt/pi-filler.svg)](https://www.npmjs.com/package/pi-filler)
|
|
11
11
|
[](https://gitlab.com/Joao-O-Santos/pi-filler/-/blob/main/LICENSE)
|
|
12
12
|
|
|
13
|
-
**Deterministic DOCX, PDF, and XLSX tooling for Pi.**
|
|
13
|
+
**Deterministic DOCX, PDF, PPTX, and XLSX tooling for Pi.**
|
|
14
14
|
|
|
15
15
|
`pi-filler` covers document tasks that do not fit an ordinary Markdown
|
|
16
16
|
workflow. It delegates conversion and PDF extraction to mature
|
|
17
|
-
command-line tools while keeping DOCX and XLSX mutations narrow,
|
|
17
|
+
command-line tools while keeping DOCX, PPTX, and XLSX mutations narrow,
|
|
18
18
|
transactional, and inspectable.
|
|
19
19
|
|
|
20
20
|
The project is experimental and pre-1.0. The README documents the
|
|
@@ -45,28 +45,35 @@ Node.js and do not require an office suite.
|
|
|
45
45
|
The extension exposes one `filler` tool:
|
|
46
46
|
|
|
47
47
|
``` text
|
|
48
|
-
format: docx | pdf | xlsx
|
|
48
|
+
format: docx | pdf | pptx | xlsx
|
|
49
49
|
action: read | search | write | patch
|
|
50
|
-
view: text | formatting | image | structure
|
|
50
|
+
view: text | formatting | image | structure | review
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
`format` names the document or target format, not every input: DOCX
|
|
54
|
-
writes take Markdown at `path`, and XLSX writes take a workbook
|
|
55
|
-
at `path` plus CSV at `source_csv`. Choose a supported
|
|
56
|
-
supply only its relevant fields:
|
|
53
|
+
`format` names the document or target format, not every input: DOCX and
|
|
54
|
+
PPTX writes take Markdown at `path`, and XLSX writes take a workbook
|
|
55
|
+
template at `path` plus CSV at `source_csv`. Choose a supported
|
|
56
|
+
combination and supply only its relevant fields:
|
|
57
57
|
|
|
58
58
|
| Format | Action | View | Required additional fields |
|
|
59
59
|
|---------------|---------------|---------------|---------------------------|
|
|
60
|
-
| DOCX | `read` | `text`
|
|
60
|
+
| DOCX | `read` | `text` | optional `track_changes` |
|
|
61
|
+
| DOCX | `read` | `formatting` | none |
|
|
62
|
+
| DOCX | `read` | `review` | optional `review_offset`, `review_limit` |
|
|
61
63
|
| DOCX | `read` | `image` | `output`; optional `first_page`, `last_page` |
|
|
62
|
-
| DOCX | `search` | `text` or omitted | `query`; optional `ignore_case` |
|
|
64
|
+
| DOCX | `search` | `text` or omitted | `query`; optional `ignore_case`, `track_changes` |
|
|
63
65
|
| DOCX | `write` | omitted | Markdown `path`, `output`; optional `reference_docx` |
|
|
64
66
|
| DOCX | `patch` | omitted | `output`, `patches`; optional `dry_run` |
|
|
67
|
+
| PPTX | `read` | `text` or `formatting` | none |
|
|
68
|
+
| PPTX | `read` | `image` | `output`; optional `first_page`, `last_page` |
|
|
69
|
+
| PPTX | `search` | `text` or omitted | `query`; optional `ignore_case` |
|
|
70
|
+
| PPTX | `write` | omitted | Markdown `path`, `output`; optional `reference_pptx` |
|
|
71
|
+
| PPTX | `patch` | omitted | `output`, `pptx_patches`; optional `dry_run` |
|
|
65
72
|
| PDF | `read` | `text` | optional `first_page`, `last_page` |
|
|
66
73
|
| PDF | `read` | `image` | `output`; optional `first_page`, `last_page` |
|
|
67
74
|
| PDF | `search` | `text` or omitted | `query`; optional `first_page`, `last_page`, `literal`, `ignore_case` |
|
|
68
75
|
| XLSX | `read` | `structure` | none |
|
|
69
|
-
| XLSX | `read` | `image` | `output`; optional `first_page`, `last_page
|
|
76
|
+
| XLSX | `read` | `image` | `output`; optional `first_page`, `last_page` select resulting workbook print pages |
|
|
70
77
|
| XLSX | `write` | omitted | template `path`, `source_csv`, `sheet`, A1 `start_cell`, `output`; optional `column_map` |
|
|
71
78
|
| XLSX | `patch` | omitted | `sheet`, A1 `range`, `xlsx_patches`, `output` |
|
|
72
79
|
|
|
@@ -115,8 +122,9 @@ filler({
|
|
|
115
122
|
```
|
|
116
123
|
|
|
117
124
|
Results may be truncated. For a truncated PDF text read, use a page
|
|
118
|
-
range; for PDF or
|
|
119
|
-
a page range. Dry runs still read and validate all local
|
|
125
|
+
range; for PDF, DOCX, or PPTX search, narrow the query. PDF search can
|
|
126
|
+
also use a page range. Dry runs still read and validate all local
|
|
127
|
+
inputs.
|
|
120
128
|
|
|
121
129
|
## PDF operations
|
|
122
130
|
|
|
@@ -130,17 +138,40 @@ a page range. Dry runs still read and validate all local inputs.
|
|
|
130
138
|
|
|
131
139
|
## DOCX operations
|
|
132
140
|
|
|
133
|
-
- Text reads and search
|
|
141
|
+
- Text reads and search use Pandoc Markdown, not GFM. `track_changes`
|
|
142
|
+
defaults to `accept`; choose `reject` for pre-edit text or `all` for
|
|
143
|
+
insertion/deletion spans and comments. This selects an extraction
|
|
144
|
+
view; it does not perform native Word acceptance or rejection.
|
|
134
145
|
- Image reads convert DOCX through LibreOffice and then render the
|
|
135
146
|
resulting PDF pages.
|
|
136
|
-
- Writes convert
|
|
137
|
-
|
|
147
|
+
- Writes convert Pandoc Markdown into a validated DOCX, including
|
|
148
|
+
supported native review spans and anchored comments. Smart typography
|
|
149
|
+
is disabled, preserving literal quotes and dashes. An optional
|
|
150
|
+
reference DOCX supplies styles and layout defaults; conversion is not
|
|
151
|
+
a lossless round trip of existing Word layout, comment threads, or
|
|
152
|
+
every revision type.
|
|
138
153
|
- Formatting reads inspect page setup, margins, sections, line and page
|
|
139
154
|
numbering, comments, inserted/deleted tracked-change markers, and
|
|
140
155
|
common core metadata.
|
|
156
|
+
- Review reads return comment IDs, bounded text/author/date fields,
|
|
157
|
+
main-document anchor excerpts, and supported legacy reply/resolution
|
|
158
|
+
metadata. They never edit comments or resolve threads.
|
|
141
159
|
- Patches change first-section page setup, margins, line numbering, page
|
|
142
160
|
numbering, and common core metadata.
|
|
143
161
|
|
|
162
|
+
Review pagination uses zero-based `review_offset` (default 0) and
|
|
163
|
+
`review_limit` (default 20, maximum 50). A byte budget may return fewer
|
|
164
|
+
records; follow `nextOffset` until it is null. Comment text is capped at
|
|
165
|
+
1,000 Unicode code points and anchor excerpts at 200, with truncation
|
|
166
|
+
flags; author/date fields are bounded to 128/64 UTF-16 code units.
|
|
167
|
+
Ranges include insertion and deletion text, not an accepted-view
|
|
168
|
+
projection. Point anchors show paragraph context. A missing anchor means
|
|
169
|
+
not found in the main document, not necessarily a damaged comment.
|
|
170
|
+
Legacy `commentsExtended` metadata supports resolution and reply-parent
|
|
171
|
+
reporting where matched; additional modern thread features may be
|
|
172
|
+
unsupported and are reported as warnings. This is not native Word
|
|
173
|
+
acceptance/rejection or a complete review-history export.
|
|
174
|
+
|
|
144
175
|
DOCX page dimensions and margins use twips (twentieths of a point); 1
|
|
145
176
|
inch is 1,440 twips. Page setup, margins, line numbering, and page
|
|
146
177
|
numbering patches apply to the first section only. Core-metadata patches
|
|
@@ -156,17 +187,20 @@ or element ordering may change.
|
|
|
156
187
|
|
|
157
188
|
## XLSX operations and privacy
|
|
158
189
|
|
|
159
|
-
Spreadsheet cell values, CSV fields,
|
|
160
|
-
|
|
161
|
-
|
|
190
|
+
Spreadsheet cell values, CSV fields, formula contents, and comments are
|
|
191
|
+
processed locally and are not returned to the model. When a
|
|
192
|
+
deterministic XLSX write or patch does not require inspection, do not
|
|
193
|
+
read CSV or cell contents into model context merely to perform it.
|
|
194
|
+
Structural results may contain sheet names, ranges, dimensions, counts,
|
|
162
195
|
merged-range addresses, hidden row and column ranges, changed package
|
|
163
|
-
parts, and write status---not
|
|
164
|
-
|
|
165
|
-
|
|
196
|
+
parts, and write status---not cell or CSV contents. Layout-range arrays
|
|
197
|
+
are capped and report whether they were truncated; this metadata can
|
|
198
|
+
reveal limited layout and occupancy information.
|
|
166
199
|
|
|
167
200
|
- `read` with `view: "structure"` reports workbook and worksheet shape.
|
|
168
|
-
- `read` with `view: "image"` renders
|
|
201
|
+
- `read` with `view: "image"` renders workbook print pages through
|
|
169
202
|
LibreOffice to numbered PNG files; it does not select a sheet.
|
|
203
|
+
`first_page` and `last_page` select resulting print pages.
|
|
170
204
|
- `write` fills an existing workbook template from CSV.
|
|
171
205
|
- `patch` changes formatting or layout while preserving cell contents.
|
|
172
206
|
|
|
@@ -189,12 +223,31 @@ calculation or generation, spreadsheet scripting, or manipulation of
|
|
|
189
223
|
charts, pivots, macros, comments, named ranges, tables, data validation,
|
|
190
224
|
conditional formatting, or external data.
|
|
191
225
|
|
|
226
|
+
## PPTX operations
|
|
227
|
+
|
|
228
|
+
- Text reads and search convert PPTX through Pandoc to GFM Markdown.
|
|
229
|
+
- Writes convert GFM Markdown into a validated PPTX; an optional
|
|
230
|
+
reference PPTX supplies Pandoc presentation styles.
|
|
231
|
+
- Formatting reads report slide dimensions, slide count, and common core
|
|
232
|
+
metadata.
|
|
233
|
+
- Patches change slide dimensions, common core metadata, and targeted
|
|
234
|
+
text in slide text paragraphs. Text replacements may target one
|
|
235
|
+
1-based slide or all slides. They can span formatted text runs, with
|
|
236
|
+
replacement text inheriting the first run's formatting.
|
|
237
|
+
- PPTX-to-Markdown extraction is semantic and lossy: it is not a
|
|
238
|
+
reversible representation of positions, animations, themes, or all
|
|
239
|
+
presentation objects.
|
|
240
|
+
|
|
241
|
+
Slide dimensions use EMUs (English Metric Units); 914,400 EMUs equal one
|
|
242
|
+
inch. PPTX image reads convert slides through LibreOffice to PDF and
|
|
243
|
+
render numbered PNG files; `first_page` and `last_page` select slides.
|
|
244
|
+
|
|
192
245
|
## Output and mutation behavior
|
|
193
246
|
|
|
194
|
-
DOCX and XLSX writes and patches use temporary sibling files,
|
|
195
|
-
the result, and rename it into place only after success. Source
|
|
196
|
-
are not modified. PDF image rendering similarly
|
|
197
|
-
until the new render succeeds.
|
|
247
|
+
DOCX, PPTX, and XLSX writes and patches use temporary sibling files,
|
|
248
|
+
validate the result, and rename it into place only after success. Source
|
|
249
|
+
files are not modified. PDF and office image rendering similarly
|
|
250
|
+
protects prior output until the new render succeeds.
|
|
198
251
|
|
|
199
252
|
`dry_run` validates the requested operation and inputs without creating
|
|
200
253
|
or replacing output; its required `output` path is still validated.
|
|
@@ -203,10 +256,11 @@ or replacing output; its required `output` path is still validated.
|
|
|
203
256
|
|
|
204
257
|
Required for the corresponding operations:
|
|
205
258
|
|
|
206
|
-
- `pandoc` for DOCX text conversion, search, and generation;
|
|
207
|
-
- `libreoffice` for DOCX and XLSX image rendering
|
|
259
|
+
- `pandoc` for DOCX/PPTX text conversion, search, and generation;
|
|
260
|
+
- `libreoffice` for DOCX, PPTX, and XLSX image rendering (each
|
|
261
|
+
conversion uses a private temporary profile, removed on completion);
|
|
208
262
|
- `pdftotext` for PDF text extraction;
|
|
209
|
-
- `pdftocairo` for PDF, DOCX, and XLSX page rendering; and
|
|
263
|
+
- `pdftocairo` for PDF, DOCX, PPTX, and XLSX page rendering; and
|
|
210
264
|
- `pdfgrep` for page-aware PDF search.
|
|
211
265
|
|
|
212
266
|
A missing executable produces an explicit error naming the unavailable
|
|
@@ -221,8 +275,9 @@ make site
|
|
|
221
275
|
```
|
|
222
276
|
|
|
223
277
|
`make verify` runs typechecking, lint and formatting checks,
|
|
224
|
-
deterministic tests,
|
|
225
|
-
the tracked static site
|
|
278
|
+
deterministic tests, project-wide line/function coverage checks, and
|
|
279
|
+
`npm pack --dry-run`. `make site` regenerates the tracked static site
|
|
280
|
+
after documentation changes.
|
|
226
281
|
|
|
227
282
|
Dependencies and CI actions follow current upstream releases rather than
|
|
228
283
|
being pinned. GitLab is canonical and the only release authority. GitHub
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-filler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Deterministic DOCX, PDF, and XLSX tooling for Pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"pi-extension",
|
|
8
8
|
"docx",
|
|
9
|
+
"pptx",
|
|
9
10
|
"pdf",
|
|
10
11
|
"xlsx",
|
|
11
12
|
"pandoc",
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
],
|
|
33
34
|
"scripts": {
|
|
34
35
|
"test": "node --import tsx --test test/*.test.ts",
|
|
36
|
+
"test:coverage": "node --import tsx --test --experimental-test-coverage --test-coverage-include=src/**/*.ts --test-coverage-lines=90 --test-coverage-functions=90 test/*.test.ts",
|
|
35
37
|
"typecheck": "tsc --noEmit",
|
|
36
38
|
"lint": "biome lint src test scripts",
|
|
37
39
|
"format:check": "biome ci --linter-enabled=false --assist-enabled=false src test scripts biome.json package.json tsconfig.json",
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
"markdown:check": "node scripts/format-markdown.mjs",
|
|
40
42
|
"markdown:fix": "node scripts/format-markdown.mjs --write",
|
|
41
43
|
"style": "npm run lint && npm run format:check && npm run markdown:check",
|
|
42
|
-
"check": "npm run typecheck && npm run style && npm test",
|
|
44
|
+
"check": "npm run typecheck && npm run style && npm test && npm run test:coverage",
|
|
43
45
|
"site": "make site"
|
|
44
46
|
},
|
|
45
47
|
"pi": {
|