docrev 0.9.16 → 0.9.18
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/dist/lib/build.d.ts +112 -1
- package/dist/lib/build.d.ts.map +1 -1
- package/dist/lib/build.js +360 -25
- package/dist/lib/build.js.map +1 -1
- package/dist/lib/commands/build.d.ts.map +1 -1
- package/dist/lib/commands/build.js +25 -10
- package/dist/lib/commands/build.js.map +1 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +37 -0
- package/dist/lib/schema.js.map +1 -1
- package/issues.md +180 -0
- package/lib/build.ts +420 -26
- package/lib/commands/build.ts +32 -10
- package/lib/schema.ts +37 -0
- package/package.json +1 -1
- package/skill/REFERENCE.md +66 -0
- package/skill/SKILL.md +25 -4
- package/.claude/settings.local.json +0 -9
package/lib/schema.ts
CHANGED
|
@@ -91,6 +91,23 @@ export const revYamlSchema: Schema = {
|
|
|
91
91
|
type: 'string',
|
|
92
92
|
description: 'Journal profile name for formatting defaults and validation',
|
|
93
93
|
},
|
|
94
|
+
'pandoc-args': {
|
|
95
|
+
type: 'array',
|
|
96
|
+
description: 'Extra pandoc args applied to every format build (e.g. --lua-filter=...). Format-specific lists are appended after these; --pandoc-arg CLI values are appended last.',
|
|
97
|
+
items: { type: 'string' },
|
|
98
|
+
},
|
|
99
|
+
output: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
description: 'Per-format output filenames. Keys are format names (pdf, docx, tex, beamer, pptx); values are paths. Relative paths resolve under outputDir; absolute paths are honored as-is. Extension auto-added if missing. CLI `-o` overrides this map.',
|
|
102
|
+
properties: {
|
|
103
|
+
pdf: { type: 'string' },
|
|
104
|
+
docx: { type: 'string' },
|
|
105
|
+
tex: { type: 'string' },
|
|
106
|
+
beamer: { type: 'string' },
|
|
107
|
+
pptx: { type: 'string' },
|
|
108
|
+
},
|
|
109
|
+
additionalProperties: false,
|
|
110
|
+
},
|
|
94
111
|
sections: {
|
|
95
112
|
type: 'array',
|
|
96
113
|
description: 'Ordered list of section files to include',
|
|
@@ -160,6 +177,11 @@ export const revYamlSchema: Schema = {
|
|
|
160
177
|
toc: { type: 'boolean', default: false },
|
|
161
178
|
header: { type: 'string' },
|
|
162
179
|
footer: { type: 'string' },
|
|
180
|
+
'pandoc-args': {
|
|
181
|
+
type: 'array',
|
|
182
|
+
description: 'Extra pandoc args for PDF builds. Appended after the top-level pandoc-args list.',
|
|
183
|
+
items: { type: 'string' },
|
|
184
|
+
},
|
|
163
185
|
},
|
|
164
186
|
additionalProperties: true,
|
|
165
187
|
},
|
|
@@ -170,6 +192,16 @@ export const revYamlSchema: Schema = {
|
|
|
170
192
|
reference: { type: 'string', description: 'Reference document for styling' },
|
|
171
193
|
keepComments: { type: 'boolean', default: true },
|
|
172
194
|
toc: { type: 'boolean', default: false },
|
|
195
|
+
translateRawFigures: {
|
|
196
|
+
type: 'boolean',
|
|
197
|
+
default: true,
|
|
198
|
+
description: 'Auto-translate the common \\begin{figure}...\\end{figure} shape to portable ![](){#fig: ...} markdown so figures render in docx. Pandoc strips raw LaTeX in docx output silently otherwise.',
|
|
199
|
+
},
|
|
200
|
+
'pandoc-args': {
|
|
201
|
+
type: 'array',
|
|
202
|
+
description: 'Extra pandoc args for DOCX builds. Appended after the top-level pandoc-args list.',
|
|
203
|
+
items: { type: 'string' },
|
|
204
|
+
},
|
|
173
205
|
},
|
|
174
206
|
additionalProperties: true,
|
|
175
207
|
},
|
|
@@ -178,6 +210,11 @@ export const revYamlSchema: Schema = {
|
|
|
178
210
|
description: 'LaTeX output settings',
|
|
179
211
|
properties: {
|
|
180
212
|
standalone: { type: 'boolean', default: true },
|
|
213
|
+
'pandoc-args': {
|
|
214
|
+
type: 'array',
|
|
215
|
+
description: 'Extra pandoc args for TeX builds. Appended after the top-level pandoc-args list.',
|
|
216
|
+
items: { type: 'string' },
|
|
217
|
+
},
|
|
181
218
|
},
|
|
182
219
|
additionalProperties: true,
|
|
183
220
|
},
|
package/package.json
CHANGED
package/skill/REFERENCE.md
CHANGED
|
@@ -62,11 +62,77 @@ rev build docx # DOCX only
|
|
|
62
62
|
rev build --toc # Include table of contents
|
|
63
63
|
rev build docx --dual # Clean + annotated versions
|
|
64
64
|
rev build docx --show-changes # DOCX with visible track changes (audit)
|
|
65
|
+
rev build docx --pandoc-arg=--lua-filter=tofill.lua # Pass extra args to pandoc
|
|
66
|
+
rev build -o Final_Report # Override output filename (extension auto-added)
|
|
67
|
+
rev build pdf --verbose # Echo the pandoc invocation (useful for filter debugging)
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
By default, outputs land in `output/` next to `rev.yaml`. Override or
|
|
68
71
|
disable via the `outputDir` field in rev.yaml (see below).
|
|
69
72
|
|
|
73
|
+
#### Choosing output filenames
|
|
74
|
+
|
|
75
|
+
By default, the output basename is derived from `title:` (slugified — e.g.
|
|
76
|
+
"My Paper" → `my-paper.docx`). Long titles are truncated at word boundaries
|
|
77
|
+
(at the last `-` at-or-before 80 chars), so `communities` stays whole instead
|
|
78
|
+
of becoming `communitie`.
|
|
79
|
+
|
|
80
|
+
To pick your own filename, set per-format names in `rev.yaml`:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
output:
|
|
84
|
+
docx: ADAPT_proposal_draft.docx
|
|
85
|
+
pdf: ADAPT_proposal_draft.pdf
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Extensions are optional — `ADAPT_proposal_draft` is fine, the right extension
|
|
89
|
+
is added per format. Relative paths resolve under `outputDir`; absolute paths
|
|
90
|
+
bypass `outputDir`.
|
|
91
|
+
|
|
92
|
+
Or override on the command line with `-o, --output <path>`:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
rev build docx -o Final_Report # → output/Final_Report.docx
|
|
96
|
+
rev build pdf docx -o Final_Report # Applies to both formats
|
|
97
|
+
rev build -o /tmp/draft.docx docx # Absolute path bypasses outputDir
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
CLI `-o` wins over `output:` in `rev.yaml`. When `--dual` is on, the
|
|
101
|
+
`_comments` variant piggybacks on the chosen name (e.g.
|
|
102
|
+
`Final_Report_comments.docx`). When `--show-changes` is on, the audit DOCX
|
|
103
|
+
uses the chosen name with a `-changes` suffix
|
|
104
|
+
(e.g. `Final_Report-changes.docx`).
|
|
105
|
+
|
|
106
|
+
#### Passing custom pandoc args
|
|
107
|
+
|
|
108
|
+
For pandoc flags rev doesn't surface directly (Lua/JSON filters, custom
|
|
109
|
+
templates, variables, etc.), use the repeatable `--pandoc-arg` flag or the
|
|
110
|
+
`pandoc-args` field in `rev.yaml`:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
# rev.yaml — applies to every format
|
|
114
|
+
pandoc-args:
|
|
115
|
+
- --lua-filter=tofill.lua
|
|
116
|
+
- --shift-heading-level-by=1
|
|
117
|
+
|
|
118
|
+
# Format-specific (concatenated after the top-level list)
|
|
119
|
+
docx:
|
|
120
|
+
pandoc-args:
|
|
121
|
+
- --lua-filter=docx_only.lua
|
|
122
|
+
pdf:
|
|
123
|
+
pandoc-args:
|
|
124
|
+
- --variable=papersize:a4
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# CLI overrides — appended last, so pandoc's last-wins rule lets CLI flags
|
|
129
|
+
# beat repeated config flags
|
|
130
|
+
rev build docx --pandoc-arg=--lua-filter=cli.lua --pandoc-arg=--metadata=draft:true
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Run with `--verbose` to print the full pandoc command line (one per format).
|
|
134
|
+
Copy-paste it into a terminal to reproduce a build manually.
|
|
135
|
+
|
|
70
136
|
The `--dual` flag produces:
|
|
71
137
|
- `output/<title>.docx` — clean, for submission
|
|
72
138
|
- `output/<title>_comments.docx` — includes comment threads as Word comments
|
package/skill/SKILL.md
CHANGED
|
@@ -17,9 +17,8 @@ Layout is controlled in `rev.yaml`:
|
|
|
17
17
|
|
|
18
18
|
```yaml
|
|
19
19
|
title: "My Document"
|
|
20
|
-
|
|
21
|
-
docx
|
|
22
|
-
reference-doc: template.docx
|
|
20
|
+
docx:
|
|
21
|
+
reference: template.docx
|
|
23
22
|
```
|
|
24
23
|
|
|
25
24
|
Change the template, rebuild, and every document gets the new formatting.
|
|
@@ -98,7 +97,15 @@ revision is rendered as a visible Word track change. Useful when a co-author
|
|
|
98
97
|
wants to see what changed since the last shared version.
|
|
99
98
|
|
|
100
99
|
Outputs land in `output/` by default; set `outputDir: null` in `rev.yaml`
|
|
101
|
-
to keep them alongside `paper.md` (legacy layout).
|
|
100
|
+
to keep them alongside `paper.md` (legacy layout). The basename is derived
|
|
101
|
+
from `title:` unless overridden — set `output: { docx: foo.docx, pdf: foo.pdf }`
|
|
102
|
+
in `rev.yaml` or pass `-o, --output <path>` on the CLI. See REFERENCE.md →
|
|
103
|
+
"Choosing output filenames".
|
|
104
|
+
|
|
105
|
+
For pandoc flags rev doesn't surface directly (Lua filters, custom variables,
|
|
106
|
+
templates), use `--pandoc-arg` (repeatable) or `pandoc-args:` in `rev.yaml`
|
|
107
|
+
(both top-level and per-format). Run with `--verbose` to see the exact pandoc
|
|
108
|
+
invocation. See REFERENCE.md → "Passing custom pandoc args" for details.
|
|
102
109
|
|
|
103
110
|
### 8. Archive reviewer files
|
|
104
111
|
|
|
@@ -183,6 +190,20 @@ Use in markdown files:
|
|
|
183
190
|
- `@eq:label` - Equation reference
|
|
184
191
|
- `{#fig:label}` - Anchor for figures
|
|
185
192
|
|
|
193
|
+
Insert a figure with the format-portable syntax (renders in both PDF and Word):
|
|
194
|
+
|
|
195
|
+
```markdown
|
|
196
|
+
{#fig:foo width=80%}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Raw `\begin{figure}...\end{figure}` LaTeX blocks are PDF-only. For docx
|
|
200
|
+
builds, `rev` auto-translates the common shape (single `\includegraphics`
|
|
201
|
+
with optional `\caption{...}` and `\label{...}`) to the markdown form above
|
|
202
|
+
so figures still render. Exotic blocks (`\subfloat`, `\rotatebox`, multiple
|
|
203
|
+
`\includegraphics`) are left alone and warned about — convert them by hand
|
|
204
|
+
or supply a custom Lua filter via `--pandoc-arg`. Opt out of auto-translate
|
|
205
|
+
with `docx.translateRawFigures: false` in `rev.yaml`.
|
|
206
|
+
|
|
186
207
|
## Template Variables
|
|
187
208
|
|
|
188
209
|
Available in section files (processed during build):
|