Skip to content

Commit 5cc0f9d

Browse files
committed
minimal setup to generate error association table
1 parent 0797686 commit 5cc0f9d

File tree

7 files changed

+111
-1
lines changed

7 files changed

+111
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[unclosed span
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reached end of file before finding closing ']' for span.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{"column":14,"row":0,"state":933,"sym":"end"}
2+
3+
[
4+
{
5+
"column": 14,
6+
"row": 0,
7+
"state": 933,
8+
"sym": "end",
9+
"errorMsg": "Reached end of file before finding closing ']' for span."
10+
}
11+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env deno run --allow-read --allow-write --allow-env --allow-run
2+
3+
import { error } from "node:console";
4+
import * as fs from "node:fs";
5+
import { basename } from "node:path";
6+
7+
// deno-lint-ignore no-explicit-any
8+
const result: any = [];
9+
10+
for (const file of fs.globSync("resources/error-corpus/*.qmd")) {
11+
const base = basename(file, ".qmd");
12+
const errorMsg = Deno.readTextFileSync(`resources/error-corpus/${base}.txt`);
13+
const parseResult = new Deno.Command("cargo", {
14+
args: ["run", "--", "--_internal-report-error-state", "-i", file],
15+
});
16+
const output = await parseResult.output();
17+
const outputStdout = new TextDecoder().decode(output.stdout);
18+
console.log(outputStdout);
19+
const reportedError = JSON.parse(outputStdout);
20+
result.push({
21+
...reportedError,
22+
errorMsg: errorMsg,
23+
});
24+
}
25+
26+
console.log(JSON.stringify(result, null, 2));

crates/quarto-markdown-pandoc/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn main() {
8888
if args._internal_report_error_state {
8989
let error_messages = readers::qmd::read_bad_qmd_for_error_message(input.as_bytes());
9090
for msg in error_messages {
91-
eprintln!("{}", msg);
91+
println!("{}", msg);
9292
}
9393
return;
9494
}

deno.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

deno.lock

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)