Skip to content

Commit dfd43d9

Browse files
Squashed 'src/resources/extension-subtrees/julia-engine/' changes from f591fc4..cb74379
1 parent cc169e5 commit dfd43d9

12 files changed

Lines changed: 77 additions & 5 deletions

File tree

src/resources/extension-subtrees/julia-engine/AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ CI runs on all three platforms (Linux, macOS, Windows) against a pinned quarto-c
5959
3. Runs the full test suite
6060

6161
When bumping `QUARTO_CLI_REV`, use the full commit hash annotated with the version tag for clarity (e.g. `abc123 # v1.9.35`).
62+
63+
## Changelog
64+
65+
Every PR with user-facing or otherwise meaningful changes must include an update to `CHANGELOG.md` (enforced by CI). Add entries under the `## Unreleased` section. Use the `skip-changelog` label to bypass the check for PRs that don't need an entry (e.g. internal cleanups, CI, or docs changes).

src/resources/extension-subtrees/julia-engine/_extensions/julia-engine/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
QuartoNotebookRunner = "4c0109c6-14e9-4c88-93f0-2b974d3468f4"
33

44
[compat]
5-
QuartoNotebookRunner = "=0.17.4"
5+
QuartoNotebookRunner = "=0.18.1"

src/resources/extension-subtrees/julia-engine/_extensions/julia-engine/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
title: Quarto Julia Engine Extension
2-
version: 0.1.0
2+
version: 0.2.0
33
quarto-required: ">=1.9.0"
44
contributes:
55
engines:

src/resources/extension-subtrees/julia-engine/_extensions/julia-engine/julia-engine.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ var kFigFormat = "fig-format";
631631
var kFigPos = "fig-pos";
632632
var kIpynbProduceSourceNotebook = "produce-source-notebook";
633633
var kKeepHidden = "keep-hidden";
634+
var kKeepIpynb = "keep-ipynb";
634635

635636
// src/julia-engine.ts
636637
var isWindows2 = Deno.build.os === "windows";
@@ -749,6 +750,11 @@ var juliaEngineDiscovery = {
749750
language: "julia"
750751
};
751752
const assets = quarto.jupyter.assets(options.target.input, options.format.pandoc.to);
753+
if (options.format.execute[kKeepIpynb]) {
754+
const stem = options.target.source.replace(/\.[^.]+$/, "");
755+
const ipynbPath = stem + ".ipynb";
756+
Deno.writeTextFileSync(ipynbPath, JSON.stringify(nb, null, 2));
757+
}
752758
const result = await quarto.jupyter.toMarkdown(nb, {
753759
executeOptions: options,
754760
language: nb.metadata.kernelspec.language.toLowerCase(),

src/resources/extension-subtrees/julia-engine/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export const kFigFormat = "fig-format";
1313
export const kFigPos = "fig-pos";
1414
export const kIpynbProduceSourceNotebook = "produce-source-notebook";
1515
export const kKeepHidden = "keep-hidden";
16+
export const kKeepIpynb = "keep-ipynb";

src/resources/extension-subtrees/julia-engine/src/julia-engine.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
kIpynbProduceSourceNotebook,
3838
kJuliaEngine,
3939
kKeepHidden,
40+
kKeepIpynb,
4041
} from "./constants.ts";
4142

4243
// Platform detection
@@ -220,6 +221,14 @@ export const juliaEngineDiscovery: ExecutionEngineDiscovery = {
220221
options.format.pandoc.to,
221222
);
222223

224+
// Write notebook to file if keep-ipynb is set (must happen before
225+
// toMarkdown which mutates nb in place)
226+
if (options.format.execute[kKeepIpynb]) {
227+
const stem = options.target.source.replace(/\.[^.]+$/, "");
228+
const ipynbPath = stem + ".ipynb";
229+
Deno.writeTextFileSync(ipynbPath, JSON.stringify(nb, null, 2));
230+
}
231+
223232
// NOTE: for perforance reasons the 'nb' is mutated in place
224233
// by jupyterToMarkdown (we don't want to make a copy of a
225234
// potentially very large notebook) so should not be relied

src/resources/extension-subtrees/julia-engine/tests/docs/julia-engine/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# Allow only source files
55
!*/*.qmd
66
!*/_quarto.yml
7+
!*/_metadata.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engines: ["julia"]

src/resources/extension-subtrees/julia-engine/tests/docs/julia-engine/engine-reordering/_quarto.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/resources/extension-subtrees/julia-engine/tests/smoke/julia-engine/render.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,40 @@ Deno.test("source ranges with includes", async () => {
4444
try { Deno.removeSync(outputFile); } catch { /* ok */ }
4545
});
4646

47+
Deno.test("keep-ipynb", async () => {
48+
const dir = docs("julia-engine/keep-ipynb");
49+
const input = join(dir, "keep-ipynb.qmd");
50+
renderQmd(input, ["--to", "html"]);
51+
52+
const outputHtml = join(dir, "keep-ipynb.html");
53+
assert(existsSync(outputHtml), `Output file ${outputHtml} should exist`);
54+
55+
const ipynbFile = join(dir, "keep-ipynb.ipynb");
56+
assert(existsSync(ipynbFile), `keep-ipynb file ${ipynbFile} should exist`);
57+
58+
const content = await Deno.readTextFile(ipynbFile);
59+
const nb = JSON.parse(content);
60+
assert(nb.cells, "Notebook should have cells");
61+
assert(nb.metadata, "Notebook should have metadata");
62+
63+
try { Deno.removeSync(outputHtml); } catch { /* ok */ }
64+
try { Deno.removeSync(ipynbFile); } catch { /* ok */ }
65+
});
66+
67+
Deno.test("no keep-ipynb by default", () => {
68+
const dir = docs("julia-engine/keep-ipynb");
69+
const input = join(dir, "no-keep-ipynb.qmd");
70+
renderQmd(input, ["--to", "html"]);
71+
72+
const outputHtml = join(dir, "no-keep-ipynb.html");
73+
assert(existsSync(outputHtml), `Output file ${outputHtml} should exist`);
74+
75+
const ipynbFile = join(dir, "no-keep-ipynb.ipynb");
76+
assert(!existsSync(ipynbFile), `ipynb file ${ipynbFile} should NOT exist without keep-ipynb`);
77+
78+
try { Deno.removeSync(outputHtml); } catch { /* ok */ }
79+
});
80+
4781
Deno.test("engine reordering", () => {
4882
const dir = docs("julia-engine/engine-reordering");
4983
renderQmd("notebook.qmd", ["--to", "html"], dir);

0 commit comments

Comments
 (0)