Add paperspec correct, check math forms and datasets, and give the tools public names
The work the other paper tools planned for paperspec (paperdesk PLAN M5.4, paperform PLAN 4.2): - paperspec correct and paperspec.revision apply proposed corrections to a package, folder or zip, and write it only once it validates. - doc.math.form is checked: label and style commands always, the form's own spelling when papermath is installed or forms= is passed. - paperspec.datasets and seven doc.dataset.* rules check a package's datasets. - fixtures/invalid gains suspect-witness and math-form-label (33 in all). - Canonical JSON reads numbers as doubles, so 1e20 round-trips. - The registries and the JSON-LD context ship in the wheel. - Public names for what paperdesk and paperform imported as private ones, with the old names kept as aliases. - The text and lossy-projection functions are about three times faster through the gate, tested equal to the old code on every code point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013XwDhn4LkrKQfw4ArDEr2E
This commit is contained in:
70 files changed
+4470
-270
No files matched your search
@@ -1,12 +1,13 @@
|
||||
# Command line
|
||||
|
||||
One command, `paperspec`, with six subcommands.
|
||||
One command, `paperspec`, with seven subcommands.
|
||||
`python -m paperspec` runs the same program.
|
||||
`paperspec --version` prints the package version and the Unicode version it pins, and `paperspec COMMAND --help` prints a command's options, advice and examples.
|
||||
|
||||
| Command | Works | Does |
|
||||
| --- | --- | --- |
|
||||
| [`validate`](#validate) | anywhere the package is installed with its `tools` extra | Validate packages, or run proposed corrections through the gate. |
|
||||
| [`correct`](#correct) | anywhere the package is installed with its `tools` extra | Apply proposed corrections to a package and write the corrected package. |
|
||||
| [`load`](#load) | anywhere the package is installed with its `tools` extra | Validate packages and load them into a SQLite database. |
|
||||
| [`check`](#check) | in a checkout | Check the whole repository. |
|
||||
| [`build`](#build) | in a checkout | Rebuild `fixtures/` and `vectors/` from their sources. |
|
||||
@@ -31,6 +32,26 @@ paperspec validate [-h] [--correction PROPOSALS] [--max-size BYTES] PACKAGE [PAC
|
||||
Each failure is printed to standard error as `package: where: rule: message`.
|
||||
Exit status: 0 when everything is valid, 1 when something is refused, 2 for a usage error.
|
||||
|
||||
## correct
|
||||
|
||||
```text
|
||||
paperspec correct [-h] --correction PROPOSALS [--out PATH] [--answered SUSPECT] [--asset FILE] [--max-size BYTES] PACKAGE
|
||||
```
|
||||
|
||||
| Option | Meaning |
|
||||
| --- | --- |
|
||||
| `PACKAGE` | A package folder or a zipped package. It is validated first. |
|
||||
| `--correction PROPOSALS` | A JSON file holding one proposed correction, or a JSON Lines file of several, applied in order. Nothing is written unless every one passes the gate. |
|
||||
| `--out PATH` | Write the corrected package here, a folder, or a zip for a zipped package, which must not exist. By default `PACKAGE` is replaced. |
|
||||
| `--answered SUSPECT` | The ID of a suspect the corrections answer, which leaves `suspects.jsonl`. Repeat for several. |
|
||||
| `--asset FILE` | A file to add under `assets/` as `<sha256>.<extension>`, such as a crop a correction's evidence names. Repeat for several. |
|
||||
| `--max-size BYTES` | As for `validate`. |
|
||||
|
||||
The corrected package is validated before it replaces anything.
|
||||
Each record appended to `corrections.jsonl` is printed, one per line; standard error names the derived lines and datasets left out because they read corrected text, and ends with the document's new revision and package hash.
|
||||
A refusal is printed as `validate` prints it, and nothing is written.
|
||||
Exit status: 0 when the corrections were applied, 1 when the package or a proposal is refused, 2 for a usage error.
|
||||
|
||||
## load
|
||||
|
||||
```text
|
||||
|
||||
Reference in new issue
Block a user