dsh-office-kit 0.4.1 → 0.4.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/assets/skills/excel-live-control/SKILL.md +120 -148
- package/assets/skills/excel-live-control/container_tools/live_excel.py +9 -0
- package/assets/skills/excel-live-control/domain_guidance/financial_models.md +42 -58
- package/assets/skills/excel-live-control/domain_guidance/healthcare.md +36 -42
- package/assets/skills/excel-live-control/domain_guidance/marketing_advertising.md +33 -34
- package/assets/skills/excel-live-control/domain_guidance/scientific_research.md +34 -36
- package/assets/skills/excel-live-control/references/office-automation.md +127 -153
- package/assets/skills/excel-live-control/references/read_only_qna.md +40 -45
- package/assets/skills/excel-live-control/style_guidelines.md +56 -64
- package/assets/skills/excel-live-control/workflows/create_workflows.md +40 -47
- package/assets/skills/excel-live-control/workflows/edit_workflows.md +37 -45
- package/assets/skills/office-documents/SKILL.md +24 -60
- package/assets/skills/office-documents/examples/end_to_end_smoke_test.md +5 -5
- package/assets/skills/office-documents/ooxml/comments.md +8 -8
- package/assets/skills/office-documents/ooxml/hyperlinks_and_fields.md +10 -10
- package/assets/skills/office-documents/ooxml/rels_and_content_types.md +7 -7
- package/assets/skills/office-documents/ooxml/tracked_changes.md +12 -12
- package/assets/skills/office-documents/references/docx-structure.md +11 -13
- package/assets/skills/office-documents/references/template-elicitation.md +11 -13
- package/assets/skills/office-documents/references/writing-quality.md +20 -20
- package/assets/skills/office-documents/tasks/accessibility_a11y.md +16 -22
- package/assets/skills/office-documents/tasks/captions_crossrefs.md +23 -26
- package/assets/skills/office-documents/tasks/clean_tracked_changes.md +17 -22
- package/assets/skills/office-documents/tasks/comments_manage.md +9 -11
- package/assets/skills/office-documents/tasks/compare_diff.md +10 -16
- package/assets/skills/office-documents/tasks/create_edit.md +14 -16
- package/assets/skills/office-documents/tasks/equations.md +17 -28
- package/assets/skills/office-documents/tasks/fields_update.md +14 -16
- package/assets/skills/office-documents/tasks/fixtures_edge_cases.md +19 -33
- package/assets/skills/office-documents/tasks/footnotes_endnotes.md +12 -14
- package/assets/skills/office-documents/tasks/forms_content_controls.md +16 -20
- package/assets/skills/office-documents/tasks/headings_numbering.md +17 -22
- package/assets/skills/office-documents/tasks/images_figures.md +15 -25
- package/assets/skills/office-documents/tasks/multi_doc_merge.md +13 -23
- package/assets/skills/office-documents/tasks/navigation_internal_links.md +18 -21
- package/assets/skills/office-documents/tasks/privacy_scrub_metadata.md +16 -22
- package/assets/skills/office-documents/tasks/protection_restrict_editing.md +19 -21
- package/assets/skills/office-documents/tasks/read_review.md +9 -20
- package/assets/skills/office-documents/tasks/redaction_anonymization.md +17 -18
- package/assets/skills/office-documents/tasks/sections_layout.md +16 -23
- package/assets/skills/office-documents/tasks/style_lint_normalize.md +18 -22
- package/assets/skills/office-documents/tasks/tables_spreadsheets.md +21 -31
- package/assets/skills/office-documents/tasks/templates_style_packs.md +17 -21
- package/assets/skills/office-documents/tasks/toc_workflow.md +10 -14
- package/assets/skills/office-documents/tasks/verify_render.md +11 -23
- package/assets/skills/office-documents/tasks/watermarks_background.md +11 -15
- package/assets/skills/office-documents/troubleshooting/libreoffice_headless.md +9 -9
- package/assets/skills/office-documents/troubleshooting/run_splitting.md +12 -12
- package/assets/skills/office-pdf/SKILL.md +36 -51
- package/assets/skills/office-pdf/references/form-fields.md +20 -20
- package/assets/skills/office-pdf/references/geometry.md +10 -10
- package/assets/skills/office-pdf/references/layout-quality.md +13 -13
- package/assets/skills/office-pdf/references/limits.md +12 -56
- package/assets/skills/office-pdf/tasks/annotations.md +5 -5
- package/assets/skills/office-pdf/tasks/create.md +6 -9
- package/assets/skills/office-pdf/tasks/edit-pages.md +14 -14
- package/assets/skills/office-pdf/tasks/forms.md +15 -15
- package/assets/skills/office-pdf/tasks/read.md +9 -9
- package/assets/skills/office-pdf/tasks/redact.md +18 -18
- package/assets/skills/office-pdf/tasks/stamp.md +10 -10
- package/assets/skills/office-presentations/SKILL.md +71 -91
- package/assets/skills/office-presentations/container_tools/render_slides.py +1 -1
- package/assets/skills/office-presentations/domain_guidance/finance.md +16 -16
- package/assets/skills/office-presentations/recipes/README.md +24 -35
- package/assets/skills/office-presentations/recipes/autolayout.md +12 -13
- package/assets/skills/office-presentations/recipes/connectors.md +11 -12
- package/assets/skills/office-presentations/recipes/images.md +11 -12
- package/assets/skills/office-presentations/recipes/master-and-layouts.md +18 -18
- package/assets/skills/office-presentations/recipes/native-charts.md +8 -8
- package/assets/skills/office-presentations/recipes/rich-text-runs.md +13 -13
- package/assets/skills/office-presentations/recipes/speaker-notes.md +7 -7
- package/assets/skills/office-presentations/recipes/tables.md +14 -14
- package/assets/skills/office-presentations/recipes/textbox-at-coordinate.md +9 -9
- package/assets/skills/office-presentations/recipes/theme-tokens.md +7 -8
- package/assets/skills/office-presentations/references/authoring-workflow.md +38 -43
- package/assets/skills/office-presentations/references/finalization.md +10 -12
- package/assets/skills/office-presentations/references/native-bullets.md +14 -18
- package/assets/skills/office-presentations/references/native-evidence.md +18 -32
- package/assets/skills/office-presentations/references/style-guidelines.md +27 -32
- package/assets/skills/office-presentations/references/templates.md +31 -60
- package/assets/skills/office-presentations/routing/google_slides.md +4 -4
- package/assets/skills/office-presentations/tasks/apply-annotations.md +17 -17
- package/assets/skills/office-presentations/tasks/charts-tables-notes.md +20 -23
- package/assets/skills/office-presentations/tasks/create-deck.md +19 -19
- package/assets/skills/office-presentations/tasks/edit-deck.md +14 -16
- package/assets/skills/office-presentations/tasks/inspect-and-verify.md +31 -34
- package/assets/skills/office-presentations/tasks/template-following.md +23 -28
- package/assets/skills/office-spreadsheets/SKILL.md +32 -39
- package/assets/skills/office-spreadsheets/recipes/charts.md +8 -26
- package/assets/skills/office-spreadsheets/recipes/conditional-formats.md +9 -26
- package/assets/skills/office-spreadsheets/recipes/data-tables.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/named-ranges.md +8 -21
- package/assets/skills/office-spreadsheets/recipes/number-formats.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/sparklines.md +7 -20
- package/assets/skills/office-spreadsheets/references/charts.md +15 -34
- package/assets/skills/office-spreadsheets/references/domain/financial-models.md +10 -25
- package/assets/skills/office-spreadsheets/references/domain/healthcare.md +8 -19
- package/assets/skills/office-spreadsheets/references/domain/marketing.md +8 -22
- package/assets/skills/office-spreadsheets/references/domain/research.md +8 -19
- package/assets/skills/office-spreadsheets/references/formula-patterns.md +20 -50
- package/assets/skills/office-spreadsheets/references/style-guidelines.md +19 -44
- package/assets/skills/office-spreadsheets/references/workbook-structure.md +12 -35
- package/assets/skills/office-spreadsheets/routing/google-sheets.md +11 -26
- package/assets/skills/office-spreadsheets/tasks/analyze-workbook.md +10 -25
- package/assets/skills/office-spreadsheets/tasks/annotations.md +12 -30
- package/assets/skills/office-spreadsheets/tasks/create-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/diff-workbooks.md +2 -2
- package/assets/skills/office-spreadsheets/tasks/edit-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/inspect-workbook.md +9 -9
- package/assets/skills/office-spreadsheets/tasks/recalc-and-check.md +10 -30
- package/assets/skills/shared/annotation-recipes.md +98 -120
- package/assets/skills/shared/common-workflow.md +70 -80
- package/dist/index.js +105 -29
- package/package.json +1 -1
- package/postinstall.mjs +58 -17
- package/python/office_cli.py +70 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hyperlinks and fields
|
|
2
2
|
|
|
3
|
-
A hyperlink and a field are both "a run that looks like text but is a pointer", and both break
|
|
3
|
+
A hyperlink and a field are both "a run that looks like text but is a pointer", and both break the same way: the visible result is cached, so editing the text updates nothing.
|
|
4
4
|
|
|
5
5
|
## Hyperlinks
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ A hyperlink and a field are both "a run that looks like text but is a pointer",
|
|
|
10
10
|
</w:hyperlink>
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
- The target is a relationship in `word/_rels/document.xml.rels
|
|
13
|
+
- The target is a relationship in `word/_rels/document.xml.rels`: `TargetMode="External"` for a URL, a bare relative path for a file inside the package.
|
|
14
14
|
- An internal link uses `w:anchor="bookmarkName"` and no relationship at all.
|
|
15
|
-
- `w:hyperlink`
|
|
15
|
+
- `w:hyperlink` wraps runs; a link spanning paragraphs is not legal — one link per paragraph.
|
|
16
16
|
|
|
17
|
-
A link whose relationship is missing renders as blue underlined text that goes nowhere.
|
|
17
|
+
A link whose relationship is missing renders as blue underlined text that goes nowhere. Copy-paste between documents produces the same thing.
|
|
18
18
|
|
|
19
19
|
## Simple fields
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ A link whose relationship is missing renders as blue underlined text that goes n
|
|
|
24
24
|
</w:fldSimple>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
The `w:t` inside is a cache, not the truth
|
|
27
|
+
The `w:t` inside is a cache, not the truth: change the text and the next field update overwrites it.
|
|
28
28
|
|
|
29
29
|
## Complex fields
|
|
30
30
|
|
|
@@ -36,13 +36,13 @@ The `w:t` inside is a cache, not the truth. Change the text and the next field u
|
|
|
36
36
|
<w:r><w:fldChar w:fldCharType="end"/></w:r>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
The begin/instrText/separate/result/end sequence
|
|
39
|
+
The begin/instrText/separate/result/end sequence keeps that order inside one paragraph. Word shows the result between `separate` and `end`, or recomputes on open when `settings.xml` sets:
|
|
40
40
|
|
|
41
41
|
```xml
|
|
42
42
|
<w:updateFields w:val="true"/>
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
That makes Word prompt or update on open. A viewer that ignores it (PDF export, some libraries) keeps the cache — which is why a document delivered as PDF can show "1" for every page number.
|
|
46
46
|
|
|
47
47
|
## Which field for which job
|
|
48
48
|
|
|
@@ -57,9 +57,9 @@ Setting it makes Word prompt or update on open. A viewer that ignores it (a PDF
|
|
|
57
57
|
## Editing fields safely
|
|
58
58
|
|
|
59
59
|
- To freeze a result, replace the whole field span with a plain run (`fields_materialize.py`, `flatten_ref_fields.py`).
|
|
60
|
-
- To renumber, update the cached result and leave the instruction alone;
|
|
61
|
-
- `w:instrText
|
|
62
|
-
- Bookmarks referenced by `REF` must exist (`w:bookmarkStart
|
|
60
|
+
- To renumber, update the cached result and leave the instruction alone; never delete the begin/end markers.
|
|
61
|
+
- The instruction lives in `w:instrText`, so a search-and-replace over `w:t` will not find `TOC`.
|
|
62
|
+
- Bookmarks referenced by `REF` must exist (`w:bookmarkStart` / `w:bookmarkEnd` with matching `w:id`); a missing bookmark shows "Error! Reference source not found.".
|
|
63
63
|
|
|
64
64
|
## See also
|
|
65
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Relationships and content types
|
|
2
2
|
|
|
3
|
-
A `.docx` is a zip of parts, and every relationship between parts is declared twice: once as a relationship entry, once as a content type. Miss either and the file
|
|
3
|
+
A `.docx` is a zip of parts, and every relationship between parts is declared twice: once as a relationship entry, once as a content type. Miss either and the file loses the feature or refuses to open.
|
|
4
4
|
|
|
5
5
|
## The two registries
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ _rels/.rels # package -> document, core props
|
|
|
10
10
|
word/_rels/document.xml.rels # document -> styles, numbering, media, header, footer, comments, hyperlinks
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`[Content_Types].xml`
|
|
13
|
+
`[Content_Types].xml` uses `<Default Extension="xml" ContentType="..."/>` for extension defaults and `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/>` for parts that do not follow an extension rule.
|
|
14
14
|
|
|
15
15
|
A relationship:
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ A relationship:
|
|
|
20
20
|
Target="comments.xml"/>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
`Id` is scoped to the part that owns the `.rels` file, so `rId5` in the document and `rId5` in a header are unrelated. `Target` is relative to the owner directory unless
|
|
23
|
+
`Id` is scoped to the part that owns the `.rels` file, so `rId5` in the document and `rId5` in a header are unrelated. `Target` is relative to the owner directory unless absolute (`/word/media/image1.png`) or external (`TargetMode="External"`, used for hyperlinks).
|
|
24
24
|
|
|
25
25
|
## What breaks
|
|
26
26
|
|
|
@@ -32,13 +32,13 @@ A relationship:
|
|
|
32
32
|
| Broken link | Relationship removed but `r:id` left in the body |
|
|
33
33
|
| Lost image | Media copied without a new relationship id |
|
|
34
34
|
|
|
35
|
-
Ids
|
|
35
|
+
Ids are unique within a `.rels` part. Read the existing ids and take `max+1`; reusing an id silently rewires an unrelated reference.
|
|
36
36
|
|
|
37
37
|
## The parts that exist only when used
|
|
38
38
|
|
|
39
|
-
`word/comments.xml`, `word/footnotes.xml`, `word/endnotes.xml`, `word/headerN.xml`, `word/footerN.xml`, `word/numbering.xml`, `docProps/custom.xml` — none are required, and each needs three pieces when added:
|
|
39
|
+
`word/comments.xml`, `word/footnotes.xml`, `word/endnotes.xml`, `word/headerN.xml`, `word/footerN.xml`, `word/numbering.xml`, `docProps/custom.xml` — none are required, and each needs three pieces when added: part, override, relationship. Removing one means removing all three, or Word reports corruption.
|
|
40
40
|
|
|
41
|
-
Headers and footers are referenced from the section properties, not
|
|
41
|
+
Headers and footers are referenced from the section properties, not the document root:
|
|
42
42
|
|
|
43
43
|
```xml
|
|
44
44
|
<w:sectPr>
|
|
@@ -59,4 +59,4 @@ Headers and footers are referenced from the section properties, not from the doc
|
|
|
59
59
|
|
|
60
60
|
## Rebuild rather than regenerate
|
|
61
61
|
|
|
62
|
-
When a package is broken,
|
|
62
|
+
When a package is broken, unzip it, fix the two registries and rezip with `[Content_Types].xml` first (stored, not deflated). The kit writes that order on save for this reason.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tracked changes
|
|
2
2
|
|
|
3
|
-
Tracked changes are markup, not a diff. The file
|
|
3
|
+
Tracked changes are markup, not a diff. The file holds both old and new text, wrapped in elements that say which is which, plus enough metadata for Word to show reviewer names and accept or reject each edit.
|
|
4
4
|
|
|
5
5
|
## The elements
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Tracked changes are markup, not a diff. The file contains both the old and the n
|
|
|
13
13
|
| `w:delText` | The deleted characters — not `w:t` |
|
|
14
14
|
| `w:delInstrText` | A deleted field instruction |
|
|
15
15
|
|
|
16
|
-
Each carries `w:id`, `w:author
|
|
16
|
+
Each carries `w:id`, `w:author` and `w:date`. Ids are unique within the document; reusing one makes Word show the wrong reviewer.
|
|
17
17
|
|
|
18
18
|
A deletion is a `w:del` containing runs with `w:delText`, not a run with a strikethrough:
|
|
19
19
|
|
|
@@ -28,21 +28,21 @@ A deletion is a `w:del` containing runs with `w:delText`, not a run with a strik
|
|
|
28
28
|
|
|
29
29
|
## Tracking has to be on
|
|
30
30
|
|
|
31
|
-
`<w:trackRevisions/>` in `word/settings.xml` makes *Word* track subsequent edits
|
|
31
|
+
`<w:trackRevisions/>` in `word/settings.xml` makes *Word* track subsequent edits; it does not affect markup already in the file. Write the markup directly when generating a change; turn tracking on when the user will continue editing.
|
|
32
32
|
|
|
33
33
|
## Accepting and rejecting
|
|
34
34
|
|
|
35
|
-
- **Accept** — keep `w:ins` content and unwrap it
|
|
36
|
-
- **Reject** — delete `w:ins` content
|
|
37
|
-
- Either way, remove the revision containers afterwards;
|
|
38
|
-
- Format-change elements
|
|
35
|
+
- **Accept** — keep `w:ins` content and unwrap it, delete `w:del` entirely, and for moves keep `w:moveTo`.
|
|
36
|
+
- **Reject** — delete `w:ins` content, keep `w:del` content and convert `w:delText` back to `w:t` (unwrap the `w:del`).
|
|
37
|
+
- Either way, remove the revision containers afterwards; an empty `w:ins` shows a stray marker.
|
|
38
|
+
- Format-change elements are not content: accepting keeps the new properties, rejecting restores the old ones.
|
|
39
39
|
|
|
40
40
|
## Where tracking hides
|
|
41
41
|
|
|
42
|
-
- Inside headers, footers, footnotes, endnotes, table cells
|
|
43
|
-
- Table
|
|
44
|
-
- Paragraph
|
|
45
|
-
- Comments are separate markup; a comment can survive its being accepted.
|
|
42
|
+
- Inside headers, footers, footnotes, endnotes, table cells and text boxes.
|
|
43
|
+
- Table level: `w:trPr/w:ins` for an inserted row, `w:tcPr/w:cellIns` for a cell.
|
|
44
|
+
- Paragraph level: an inserted or deleted paragraph mark uses `w:rPr/w:ins` in `w:pPr`, so "delete this paragraph" is not a `w:del` around the paragraph.
|
|
45
|
+
- Comments are separate markup; a comment can survive its text being accepted.
|
|
46
46
|
|
|
47
47
|
## Reading markup without a renderer
|
|
48
48
|
|
|
@@ -50,4 +50,4 @@ A deletion is a `w:del` containing runs with `w:delText`, not a run with a strik
|
|
|
50
50
|
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode report
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
The report lists insertions and deletions with authors and the text on each side
|
|
53
|
+
The report lists insertions and deletions with authors and the text on each side — the honest answer to "what changed" with no rendered view, and the way to confirm a generated change landed as markup rather than as plain text.
|
|
@@ -19,9 +19,7 @@ word/comments.xml, footnotes.xml, endnotes.xml optional
|
|
|
19
19
|
|
|
20
20
|
## The body
|
|
21
21
|
|
|
22
|
-
`word/document.xml` is a sequence of block
|
|
23
|
-
|
|
24
|
-
A paragraph is:
|
|
22
|
+
`word/document.xml` is a sequence of block elements — `w:p` (paragraph), `w:tbl` (table), `w:sdt` (content control) — plus one `w:sectPr` per section: the last sits in the body, earlier ones inside a paragraph's `pPr`.
|
|
25
23
|
|
|
26
24
|
```xml
|
|
27
25
|
<w:p>
|
|
@@ -39,9 +37,9 @@ A paragraph is:
|
|
|
39
37
|
</w:p>
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
Everything a reader sees is a run inside a paragraph; everything that makes it
|
|
40
|
+
Everything a reader sees is a run inside a paragraph; everything that makes it differ from its style is direct formatting in `pPr`/`rPr`, which is why `style_normalize.py` exists (`tasks/style_lint_normalize.md`).
|
|
43
41
|
|
|
44
|
-
A table is `w:tbl` > `w:tblPr` (style, width, layout) + `w:tblGrid` (column widths) + `w:tr` > `w:tc` > `w:p`.
|
|
42
|
+
A table is `w:tbl` > `w:tblPr` (style, width, layout) + `w:tblGrid` (column widths) + `w:tr` > `w:tc` > `w:p`. Every cell holds at least one paragraph.
|
|
45
43
|
|
|
46
44
|
## Units
|
|
47
45
|
|
|
@@ -52,31 +50,31 @@ A table is `w:tbl` > `w:tblPr` (style, width, layout) + `w:tblGrid` (column widt
|
|
|
52
50
|
| eighth-point | border widths (`w:sz` on borders) | 8 per point |
|
|
53
51
|
| EMU (914400/in) | drawing extents | 914400 per inch |
|
|
54
52
|
|
|
55
|
-
A Letter page is 12240×15840 twips. Text width = page width − left − right margins (
|
|
53
|
+
A Letter page is 12240×15840 twips. Text width = page width − left − right margins (9360 twips at 1in margins).
|
|
56
54
|
|
|
57
55
|
## Styles
|
|
58
56
|
|
|
59
|
-
`w:style` with `w:type` of `paragraph`, `character`, `table` or `numbering
|
|
57
|
+
`w:style` with `w:type` of `paragraph`, `character`, `table` or `numbering`; attributes `w:styleId` (internal name), `w:name` (UI name), `w:basedOn`, `w:next`, `w:link`, plus `w:pPr` / `w:rPr`.
|
|
60
58
|
|
|
61
|
-
- `Normal` is the root; `Heading1`..`Heading9` drive
|
|
62
|
-
-
|
|
59
|
+
- `Normal` is the root; `Heading1`..`Heading9` drive outline level and the TOC.
|
|
60
|
+
- `w:outlineLvl` (0-based) in `pPr` sets an outline level explicitly: a paragraph can look like a heading without being one, and the TOC will not see it.
|
|
63
61
|
- Latent styles do not exist in the file until used; a document may reference `Heading3` while `styles.xml` has no definition for it.
|
|
64
62
|
|
|
65
63
|
## Numbering
|
|
66
64
|
|
|
67
|
-
`word/numbering.xml` holds `w:abstractNum` (
|
|
65
|
+
`word/numbering.xml` holds `w:abstractNum` (list definition: per level its format, text and indentation) and `w:num` (`w:numId` → `w:abstractNumId`, optionally overridden). A paragraph joins a list with `w:numPr` referencing a `numId`; two paragraphs with the same `numId` share a counter.
|
|
68
66
|
|
|
69
67
|
## Sections
|
|
70
68
|
|
|
71
|
-
`w:sectPr` carries page size (`w:pgSz`), margins (`w:pgMar`), orientation (implied by width vs height, or `w:orient`), columns
|
|
69
|
+
`w:sectPr` carries page size (`w:pgSz`), margins (`w:pgMar`), orientation (implied by width vs height, or `w:orient`), columns and header/footer references. A single-section document has one `sectPr`; a new section is a paragraph whose `pPr` contains the *previous* section's `sectPr`.
|
|
72
70
|
|
|
73
71
|
## Fields
|
|
74
72
|
|
|
75
|
-
Simple (`w:fldSimple`) and complex (`fldChar` begin/separate/end with `w:instrText`). The visible text is a cache
|
|
73
|
+
Simple (`w:fldSimple`) and complex (`fldChar` begin/separate/end with `w:instrText`). The visible text is a cache; `w:updateFields` in `settings.xml` asks the editor to refresh on open. See `ooxml/hyperlinks_and_fields.md`.
|
|
76
74
|
|
|
77
75
|
## Revision markup
|
|
78
76
|
|
|
79
|
-
`w:ins`, `w:del` (with `w:delText`), `w:moveFrom
|
|
77
|
+
`w:ins`, `w:del` (with `w:delText`), `w:moveFrom` / `w:moveTo`, `w:rPrChange` / `w:pPrChange`, each with author and date. See `ooxml/tracked_changes.md`.
|
|
80
78
|
|
|
81
79
|
## Minimum valid package
|
|
82
80
|
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# Eliciting a template
|
|
2
2
|
|
|
3
|
-
A user who says "use our house style" has a file somewhere.
|
|
3
|
+
A user who says "use our house style" has a file somewhere. One question gets it; guessing produces a document that has to be redone.
|
|
4
4
|
|
|
5
5
|
## Ask for the artefact, not the description
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
One sentence is enough:
|
|
7
|
+
A description ("blue headings, maybe 11pt") produces a different document every time. The artefact (`house-template.dotx`, an old `.docx` of the same kind, a PDF of the last report) carries the actual styles, margins and fonts.
|
|
10
8
|
|
|
11
9
|
> Is there an existing document in this style I should match? Send the file (`.dotx`, or any `.docx` in that style) and I will follow it exactly.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
With no file, ask for two or three specifics that cannot be guessed and take the rest from `SKILL.md` defaults:
|
|
14
12
|
|
|
15
|
-
- page size and margins, if
|
|
16
|
-
-
|
|
13
|
+
- page size and margins, if the organisation is not US Letter,
|
|
14
|
+
- heading and body typeface and sizes,
|
|
17
15
|
- anything required by policy (logo in the header, classification mark in the footer).
|
|
18
16
|
|
|
19
17
|
## Read the template before using it
|
|
@@ -24,7 +22,7 @@ If they have no file, ask for two or three specifics that cannot be guessed and
|
|
|
24
22
|
"<python>" "<skill>/scripts/section_audit.py" "<template.docx>"
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
From `styles.xml`, note the `styleId` of what will be used: `Heading1`..`Heading3`, `Title`, `Caption`, `Quote`, `ListParagraph`. From the section audit, record page size, margins, header
|
|
25
|
+
From `styles.xml`, note the `styleId` of what will be used: `Heading1`..`Heading3`, `Title`, `Caption`, `Quote`, `ListParagraph`. From the section audit, record page size, margins, header and footer text, and whether the first page is different.
|
|
28
26
|
|
|
29
27
|
## Apply it
|
|
30
28
|
|
|
@@ -32,18 +30,18 @@ From `styles.xml`, note the `styleId` of what will be used: `Heading1`..`Heading
|
|
|
32
30
|
"<python>" "<skill>/scripts/apply_template_styles.py" --template "<template.docx>" --target "<draft.docx>" --out "<styled.docx>"
|
|
33
31
|
```
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
Merges style definitions (and numbering) by id; the body content is untouched, so anything written with direct formatting keeps it. Then:
|
|
36
34
|
|
|
37
35
|
```bash
|
|
38
|
-
"<python>" "<skill>/scripts/style_normalize.py" "<styled.docx>" --out "<styled-final.docx
|
|
36
|
+
"<python>" "<skill>/scripts/style_normalize.py" "<styled.docx>" --out "<styled-final.docx" --clear_paragraph_format --enforce_heading_spacing
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
The text now picks up the template's look instead of the draft's.
|
|
42
40
|
|
|
43
41
|
## When the template is a PDF or an image
|
|
44
42
|
|
|
45
|
-
Extract structure, not styles: heading hierarchy, section order, table layout, caption convention, margin proportions.
|
|
43
|
+
Extract structure, not styles: heading hierarchy, section order, table layout, caption convention, margin proportions. Reproduce them with named styles in a generated document. Say which parts were matched approximately — a PDF does not reveal a heading's font size, only how it looks.
|
|
46
44
|
|
|
47
45
|
## When there is no template and no details
|
|
48
46
|
|
|
49
|
-
Fall back to the
|
|
47
|
+
Fall back to the `SKILL.md` defaults (Letter, 1in margins, 11–12pt body, black headings, `#D9D9D9` table borders) and state the assumption in one line with the delivered file. Do not stall on a question the user may not care about.
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
# Writing quality
|
|
2
2
|
|
|
3
|
-
Content quality is the part of a document the format cannot fix.
|
|
3
|
+
Content quality is the part of a document the format cannot fix. Apply these rules while drafting, before any rendering.
|
|
4
4
|
|
|
5
5
|
## Structure before prose
|
|
6
6
|
|
|
7
|
-
- Every heading states a claim the reader can disagree with ("Services carried the quarter", not "Services").
|
|
7
|
+
- Every heading states a claim the reader can disagree with ("Services carried the quarter", not "Services").
|
|
8
8
|
- A section that cannot be summarised in one sentence is two sections.
|
|
9
|
-
- Three levels
|
|
10
|
-
- Nothing between a heading and its first paragraph
|
|
9
|
+
- Three heading levels is the practical maximum; a fourth means the content wants a table or an appendix.
|
|
10
|
+
- Nothing between a heading and its first paragraph — no label line, no restated title.
|
|
11
11
|
|
|
12
12
|
## Paragraphs
|
|
13
13
|
|
|
14
|
-
- One idea per paragraph, first sentence
|
|
15
|
-
- 3–6 sentences is
|
|
16
|
-
- No em-dash pile-ups, no "furthermore/moreover" chains, no sentence that only announces the next
|
|
17
|
-
- The last paragraph of a section says what
|
|
14
|
+
- One idea per paragraph, carried by the first sentence.
|
|
15
|
+
- 3–6 sentences is comfortable; a 1600-word paragraph is a formatting defect even when the prose is good.
|
|
16
|
+
- No em-dash pile-ups, no "furthermore/moreover" chains, no sentence that only announces the next one.
|
|
17
|
+
- The last paragraph of a section says what the section meant, not that it is finished.
|
|
18
18
|
|
|
19
19
|
## Lists and tables
|
|
20
20
|
|
|
21
21
|
- Bullets for parallel items of equal weight; never for a sequence (that is a numbered list).
|
|
22
|
-
-
|
|
23
|
-
- Table headers are nouns
|
|
22
|
+
- Items with two attributes belong in a table, not a bulleted list with parentheticals.
|
|
23
|
+
- Table headers are nouns with units ("Revenue ($m)"); numbers right-aligned.
|
|
24
24
|
- Every table earns its caption; a table without a purpose is a screenshot of data.
|
|
25
25
|
|
|
26
26
|
## Voice
|
|
27
27
|
|
|
28
|
-
- Active unless the actor is unknown or unimportant
|
|
28
|
+
- Active unless the actor is unknown or unimportant: "We found", not "It was found".
|
|
29
29
|
- Present tense for findings, past for actions taken.
|
|
30
|
-
- No unsupported superlatives
|
|
31
|
-
- Define an acronym once, then use it
|
|
30
|
+
- No unsupported superlatives: "18% growth" beats "strong growth"; if the number is unknown, say so instead of adding an adverb.
|
|
31
|
+
- Define an acronym once, then use it; never redefine it elsewhere.
|
|
32
32
|
|
|
33
33
|
## Numbers
|
|
34
34
|
|
|
35
|
-
- Consistent precision
|
|
35
|
+
- Consistent precision: do not mix "12.4%" and "8%" in one table unless the source did.
|
|
36
36
|
- Percentages below 1 take a leading zero (0.4%, not .4%).
|
|
37
|
-
- State
|
|
38
|
-
- A number
|
|
37
|
+
- State period and currency in the table or its caption, not in surrounding prose.
|
|
38
|
+
- A prose number must match the table number; rendering does not catch this, re-reading does.
|
|
39
39
|
|
|
40
40
|
## What to cut
|
|
41
41
|
|
|
42
|
-
- Opening paragraphs
|
|
43
|
-
- Closing paragraphs
|
|
42
|
+
- Opening paragraphs explaining that the document will explain something.
|
|
43
|
+
- Closing paragraphs thanking the reader.
|
|
44
44
|
- Bold on every second phrase: emphasis used everywhere is emphasis used nowhere.
|
|
45
|
-
- Sentences
|
|
45
|
+
- Sentences beginning "It is important to note that".
|
|
46
46
|
|
|
47
47
|
## Where this connects
|
|
48
48
|
|
|
49
|
-
`references/docx-structure.md` covers how
|
|
49
|
+
`references/docx-structure.md` covers how structure is expressed in Word — styles, captions, table layout. `tasks/verify_render.md` covers checking the result on a page. Neither replaces reading the text once asking whether a busy reader would get the point from the headings alone.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Accessibility
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The accessibility tree in Word comes from structure, not appearance. Bold text announces as bold; a `Heading 1` announces as a heading and appears in the navigation pane. Alt text lives in `wp:docPr @descr`.
|
|
3
|
+
Accessibility comes from structure, not appearance: bold announces as bold, `Heading 1` announces as a heading and appears in the navigation pane. Alt text lives in `wp:docPr @descr`.
|
|
6
4
|
|
|
7
5
|
## Audit
|
|
8
6
|
|
|
@@ -10,36 +8,32 @@ The accessibility tree in Word comes from structure, not appearance. Bold text a
|
|
|
10
8
|
"<python>" "<skill>/scripts/a11y_audit.py" "<file.docx>" --out_json "<report.json>"
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
Checks
|
|
14
|
-
|
|
15
|
-
Exit code 1 means at least one finding; `--out_json` writes the same report for a larger pass.
|
|
11
|
+
Checks images without description or title, tables without a repeating header row, heading levels that jump, empty headings, link text that is only "click here", "here" or "link", and a missing core title. Exit 1 means at least one finding.
|
|
16
12
|
|
|
17
|
-
##
|
|
13
|
+
## Mechanical fixes
|
|
18
14
|
|
|
19
15
|
```bash
|
|
20
|
-
"<python>" "<skill>/scripts/a11y_audit.py" "<file.docx>"
|
|
21
|
-
--fix_image_alt from_filename --fix_table_headers first_row \
|
|
22
|
-
--out "<file-a11y.docx>"
|
|
16
|
+
"<python>" "<skill>/scripts/a11y_audit.py" "<file.docx>" --fix_image_alt from_filename --fix_table_headers first_row --out "<file-a11y.docx"
|
|
23
17
|
```
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
These are honest placeholders, not substitutes for real text.
|
|
26
20
|
|
|
27
|
-
##
|
|
21
|
+
## Judgement fixes
|
|
28
22
|
|
|
29
|
-
- **Alt text
|
|
30
|
-
- **Link text
|
|
31
|
-
- **Reading order
|
|
32
|
-
- **Colour
|
|
33
|
-
- **
|
|
23
|
+
- **Alt text** describes what the reader loses, e.g. "Bar chart: revenue by region, EMEA 4.1M ahead of APAC 3.2M". Decorative rules and dividers get an empty description.
|
|
24
|
+
- **Link text** names the destination: "Download the Q2 ledger", not "click here".
|
|
25
|
+
- **Reading order:** decorative text boxes and floating images land awkwardly; convert them to inline.
|
|
26
|
+
- **Colour alone** (red = bad) fails colour-blind readers; add a word.
|
|
27
|
+
- **Layout tables** announce as data tables; restructure them as paragraphs.
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
Longer documents also want a TOC (`tasks/toc_workflow.md`) and language tags.
|
|
36
30
|
|
|
37
31
|
## Verify
|
|
38
32
|
|
|
39
|
-
Re-run the audit to zero findings
|
|
33
|
+
Re-run the audit to zero findings and render. Heading hierarchy is visible; alt text is metadata and stays invisible; the header row must be distinct. With a screen reader available, navigate by heading.
|
|
40
34
|
|
|
41
35
|
## Pitfalls
|
|
42
36
|
|
|
43
|
-
- Alt text on a decorative image is worse than none
|
|
44
|
-
- A
|
|
45
|
-
- Images inside
|
|
37
|
+
- Alt text on a decorative image is worse than none: use an empty description plus `title` to mark it decorative.
|
|
38
|
+
- A header row is `w:tblHeader` on the row, not a bold first row.
|
|
39
|
+
- Images inside table cells still need descriptions.
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
# Captions and cross-references
|
|
1
|
+
# Captions and numbered cross-references
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Two parts: a caption paragraph with a `SEQ` field (`SEQ Table \* ARABIC`), and a bookmark around it that the prose reaches with a `REF` field. Without the bookmark a `REF` has nothing to point at.
|
|
3
|
+
A caption is a paragraph with a `SEQ` field (`SEQ Table \* ARABIC`) plus a bookmark; the prose reaches that bookmark with a `REF` field. Without the bookmark a `REF` has no target.
|
|
6
4
|
|
|
7
5
|
## Add captions
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
"<python>" "<skill>/scripts/captions_and_crossrefs.py" "<file.docx>" "<file-captioned.docx>"
|
|
11
|
-
--tables --figures --bookmarks --caption_text "Source: finance ledger"
|
|
8
|
+
"<python>" "<skill>/scripts/captions_and_crossrefs.py" "<file.docx>" "<file-captioned.docx>" --tables --figures --bookmarks --caption_text "Source: finance ledger"
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
- `--tables` adds `Table N` under each table
|
|
15
|
-
-
|
|
16
|
-
- `--bookmarks` names
|
|
17
|
-
- `--materialize` writes literal numbers
|
|
18
|
-
- `--caption_text` appends a fixed note
|
|
11
|
+
- `--tables` adds `Table N` under each table; `--figures` adds `Figure N` under each picture.
|
|
12
|
+
- Neither flag runs both.
|
|
13
|
+
- `--bookmarks` names them `tbl1`, `tbl2`, `fig1`, … — the `tblN`/`figN` pattern `insert_ref_fields.py` expects.
|
|
14
|
+
- `--materialize` writes literal numbers: for a frozen PDF export, not for a document that will change.
|
|
15
|
+
- `--caption_text` appends a fixed note.
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
Captions use the `Caption` style and stay in the same visual block as the object, so a page break cannot orphan them.
|
|
21
18
|
|
|
22
|
-
##
|
|
19
|
+
## Cross-reference
|
|
23
20
|
|
|
24
|
-
Write placeholders in
|
|
21
|
+
Write `[[REF:tbl1]]` placeholders in the prose, then:
|
|
25
22
|
|
|
26
23
|
```bash
|
|
27
|
-
"<python>" "<skill>/scripts/insert_ref_fields.py" "<file.docx>" "<file-refs.docx
|
|
24
|
+
"<python>" "<skill>/scripts/insert_ref_fields.py" "<file.docx>" "<file-refs.docx"
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
That produces a `REF tbl1 \h` field, so the number follows the table. `--pattern` accepts your own regex with the named group `bookmark`; `--prefix` prepends text such as `Table `.
|
|
31
28
|
|
|
32
|
-
If
|
|
29
|
+
If a reference should read "Table 2" rather than "2", set the REF field's `\n` behaviour off and put the label in the prose: a field cannot know whether it points at a table or a figure.
|
|
33
30
|
|
|
34
|
-
## Order
|
|
31
|
+
## Order
|
|
35
32
|
|
|
36
|
-
1. Add or restructure tables and figures.
|
|
37
|
-
2. Run `captions_and_crossrefs.py
|
|
38
|
-
3. Run `insert_ref_fields.py
|
|
39
|
-
4. Re-render
|
|
33
|
+
1. Add or restructure the tables and figures.
|
|
34
|
+
2. Run `captions_and_crossrefs.py`.
|
|
35
|
+
3. Run `insert_ref_fields.py`.
|
|
36
|
+
4. Re-render.
|
|
40
37
|
|
|
41
38
|
## Verify
|
|
42
39
|
|
|
43
|
-
`fields_report.py`: one
|
|
40
|
+
Run `fields_report.py`: one SEQ per caption, one REF per reference, and no REF with an empty result. Then render. The usual defects are a caption above its table, or a caption separated from it by a page break.
|
|
44
41
|
|
|
45
42
|
## Pitfalls
|
|
46
43
|
|
|
47
|
-
-
|
|
48
|
-
- A
|
|
49
|
-
- Bookmarks must be unique
|
|
44
|
+
- Numbering changes on field update, so two captions can claim `Table 2` until Word recalculates.
|
|
45
|
+
- A hand-typed caption number never renumbers.
|
|
46
|
+
- Bookmarks must be unique: copying a caption copies its bookmark name and breaks the reference.
|
|
@@ -1,49 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Proposed and tracked changes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A tracked edit is markup: an insertion wraps runs in `w:ins`, a deletion wraps `w:delText` in `w:del`, a move is `w:moveFrom`/`w:moveTo` paired by `w:name`, and a formatting change is `w:rPrChange`/`w:pPrChange`. `w:trackRevisions` in `word/settings.xml` makes Word record new edits.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Propose an edit
|
|
5
|
+
## Propose
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
"<python>" "<skill>/scripts/add_tracked_replacements.py" "<file.docx>" --out "<file-tracked.docx>"
|
|
11
|
-
--author "Review" --replace "18%=21%" --replace "flat=steady"
|
|
8
|
+
"<python>" "<skill>/scripts/add_tracked_replacements.py" "<file.docx>" --out "<file-tracked.docx>" --author "Review" --replace "18%=21%" --replace "flat=steady"
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
Each `--replace` is `OLD=NEW
|
|
11
|
+
Each `--replace` is `OLD=NEW`. The script splits runs at the match so only the changed characters are marked, keeps the surrounding formatting, and turns on `trackRevisions`. Quote the `--author` the reviewer should see.
|
|
15
12
|
|
|
16
|
-
Limit: one replacement per pattern per paragraph
|
|
13
|
+
Limit: one replacement per pattern per paragraph. A match split across runs is still found because the split is computed on paragraph text; reword if a paragraph repeats the phrase.
|
|
17
14
|
|
|
18
|
-
## Inspect
|
|
15
|
+
## Inspect
|
|
19
16
|
|
|
20
17
|
```bash
|
|
21
18
|
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode report
|
|
22
19
|
"<python>" "<skill>/scripts/docx_kit.py" xml "<file.docx>" word/document.xml
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
The report counts insertions, deletions, move pairs and format changes.
|
|
22
|
+
The report counts insertions, deletions, move pairs and format changes.
|
|
26
23
|
|
|
27
24
|
## Accept or reject
|
|
28
25
|
|
|
29
26
|
```bash
|
|
30
|
-
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode accept --out "<file-accepted.docx
|
|
31
|
-
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode reject --out "<file-rejected.docx
|
|
27
|
+
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode accept --out "<file-accepted.docx"
|
|
28
|
+
"<python>" "<skill>/scripts/accept_tracked_changes.py" "<file.docx>" --mode reject --out "<file-rejected.docx"
|
|
32
29
|
```
|
|
33
30
|
|
|
34
|
-
Accept keeps inserted text and drops deleted text; reject
|
|
35
|
-
|
|
36
|
-
## Before delivery
|
|
31
|
+
Accept keeps inserted text and drops deleted text; reject reverses that and restores `w:delText` as ordinary text. Format-only changes are discarded either way. `--keep_tracking_on` leaves `trackRevisions` enabled.
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
Before delivery: rendered pages contain no markup, so a file can look finished while carrying redlines. Always run `--mode report` on a file about to be sent, then accept or reject explicitly.
|
|
39
34
|
|
|
40
35
|
## Verify
|
|
41
36
|
|
|
42
|
-
After accepting, `docx_kit.py text`
|
|
37
|
+
After accepting, `docx_kit.py text` shows the new wording and `word/document.xml` contains no `w:ins`/`w:del`. Render the affected page.
|
|
43
38
|
|
|
44
39
|
## Pitfalls
|
|
45
40
|
|
|
46
|
-
- `w:del` contains `w:delText`, not `w:t`;
|
|
47
|
-
- Tables, headers and footnotes can each carry
|
|
48
|
-
- Accepting a move pair
|
|
49
|
-
- Comments are not tracked changes
|
|
41
|
+
- `w:del` contains `w:delText`, not `w:t`; extraction that reads only `w:t` loses deletions.
|
|
42
|
+
- Tables, headers and footnotes can each carry tracked changes. The script covers every text part; a hand edit can miss one.
|
|
43
|
+
- Accepting a move pair as two unrelated edits duplicates content. The script treats them as a pair.
|
|
44
|
+
- Comments are not tracked changes; see `comments_manage.md`.
|