mystmd 1.3.7__tar.gz → 1.3.9__tar.gz
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.
- {mystmd-1.3.7 → mystmd-1.3.9}/PKG-INFO +1 -1
- {mystmd-1.3.7 → mystmd-1.3.9}/_package.json +2 -2
- {mystmd-1.3.7 → mystmd-1.3.9}/src/mystmd_py/myst.cjs +358 -280
- {mystmd-1.3.7 → mystmd-1.3.9}/.gitignore +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/LICENSE +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/README.md +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/pyproject.toml +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/src/mystmd_py/__init__.py +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/src/mystmd_py/main.py +0 -0
- {mystmd-1.3.7 → mystmd-1.3.9}/src/mystmd_py/nodeenv.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mystmd",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.9",
|
4
4
|
"description": "Command line tools for MyST Markdown",
|
5
5
|
"author": "Rowan Cockett <rowan@curvenote.com>",
|
6
6
|
"license": "MIT",
|
@@ -45,6 +45,6 @@
|
|
45
45
|
"commander": "^10.0.1",
|
46
46
|
"core-js": "^3.31.1",
|
47
47
|
"js-yaml": "^4.1.0",
|
48
|
-
"myst-cli": "^1.3.
|
48
|
+
"myst-cli": "^1.3.9"
|
49
49
|
}
|
50
50
|
}
|
@@ -193562,7 +193562,7 @@ var {
|
|
193562
193562
|
} = import_index.default;
|
193563
193563
|
|
193564
193564
|
// src/version.ts
|
193565
|
-
var version = "1.3.
|
193565
|
+
var version = "1.3.9";
|
193566
193566
|
var version_default = version;
|
193567
193567
|
|
193568
193568
|
// ../myst-cli/dist/build/build.js
|
@@ -195262,7 +195262,8 @@ var PAGE_FRONTMATTER_KEYS = [
|
|
195262
195262
|
"kernelspec",
|
195263
195263
|
"jupytext",
|
195264
195264
|
"tags",
|
195265
|
-
"content_includes_title"
|
195265
|
+
"content_includes_title",
|
195266
|
+
"site"
|
195266
195267
|
];
|
195267
195268
|
|
195268
195269
|
// ../myst-frontmatter/dist/exports/types.js
|
@@ -198972,6 +198973,9 @@ function validatePageFrontmatterKeys(value, opts) {
|
|
198972
198973
|
if (defined(value.content_includes_title)) {
|
198973
198974
|
output2.content_includes_title = validateBoolean(value.content_includes_title, incrementOptions("content_includes_title", opts));
|
198974
198975
|
}
|
198976
|
+
if (defined(value.site)) {
|
198977
|
+
output2.site = validateObject(value.site, incrementOptions("site", opts));
|
198978
|
+
}
|
198975
198979
|
return output2;
|
198976
198980
|
}
|
198977
198981
|
function validatePageFrontmatter(input3, opts) {
|
@@ -241280,6 +241284,61 @@ function writeJsonLogs(session, name3, logData) {
|
|
241280
241284
|
writeFileToFolder((0, import_node_path6.join)(session.buildPath(), "logs", name3), JSON.stringify(logData, null, 2));
|
241281
241285
|
}
|
241282
241286
|
|
241287
|
+
// ../myst-cli/dist/session/cache.js
|
241288
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
241289
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
241290
|
+
function castSession(session) {
|
241291
|
+
const cache = session;
|
241292
|
+
if (!cache.$citationRenderers)
|
241293
|
+
cache.$citationRenderers = {};
|
241294
|
+
if (!cache.$doiRenderers)
|
241295
|
+
cache.$doiRenderers = {};
|
241296
|
+
if (!cache.$internalReferences)
|
241297
|
+
cache.$internalReferences = {};
|
241298
|
+
if (!cache.$externalReferences)
|
241299
|
+
cache.$externalReferences = {};
|
241300
|
+
if (!cache.$mdast)
|
241301
|
+
cache.$mdast = {};
|
241302
|
+
if (!cache.$outputs)
|
241303
|
+
cache.$outputs = {};
|
241304
|
+
cache.$setMdast = (file, data) => {
|
241305
|
+
cache.$mdast[import_node_path7.default.resolve(file)] = data;
|
241306
|
+
};
|
241307
|
+
cache.$getMdast = (file) => {
|
241308
|
+
return cache.$mdast[import_node_path7.default.resolve(file)];
|
241309
|
+
};
|
241310
|
+
return cache;
|
241311
|
+
}
|
241312
|
+
function cachePath(session, filename) {
|
241313
|
+
return import_node_path7.default.join(session.buildPath(), "cache", filename);
|
241314
|
+
}
|
241315
|
+
function writeToCache(session, filename, data) {
|
241316
|
+
const file = cachePath(session, filename);
|
241317
|
+
session.log.debug(`Writing cache file: ${file}`);
|
241318
|
+
writeFileToFolder(file, data);
|
241319
|
+
}
|
241320
|
+
function checkCache(session, filename, opts) {
|
241321
|
+
const file = cachePath(session, filename);
|
241322
|
+
if (!import_node_fs2.default.existsSync(file)) {
|
241323
|
+
session.log.debug(`Cache file not found: ${file}`);
|
241324
|
+
return false;
|
241325
|
+
}
|
241326
|
+
const { ctimeMs } = import_node_fs2.default.lstatSync(file);
|
241327
|
+
const age = (Date.now() - ctimeMs) / (1e3 * 60 * 60 * 24);
|
241328
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.maxAge) != null && age > opts.maxAge) {
|
241329
|
+
session.log.debug(`Cache file has expired (age: ${age.toFixed(3)} days, max: ${opts.maxAge} days): ${file}`);
|
241330
|
+
return false;
|
241331
|
+
}
|
241332
|
+
return true;
|
241333
|
+
}
|
241334
|
+
function loadFromCache(session, filename, opts) {
|
241335
|
+
if (!checkCache(session, filename, opts))
|
241336
|
+
return;
|
241337
|
+
const file = cachePath(session, filename);
|
241338
|
+
session.log.debug(`Loading cache file: ${file}`);
|
241339
|
+
return import_node_fs2.default.readFileSync(file).toString();
|
241340
|
+
}
|
241341
|
+
|
241283
241342
|
// ../myst-cli/dist/frontmatter.js
|
241284
241343
|
function frontmatterValidationOpts(vfile2, opts) {
|
241285
241344
|
var _a6;
|
@@ -241315,12 +241374,27 @@ function getPageFrontmatter(session, tree, vfile2, preFrontmatter, keepTitleNode
|
|
241315
241374
|
return { frontmatter: pageFrontmatter, identifiers };
|
241316
241375
|
}
|
241317
241376
|
function processPageFrontmatter(session, pageFrontmatter, validationOpts, path41) {
|
241318
|
-
var _a6, _b, _c, _d2, _e;
|
241377
|
+
var _a6, _b, _c, _d2, _e, _f;
|
241378
|
+
const cache = castSession(session);
|
241319
241379
|
const state = session.store.getState();
|
241320
241380
|
const siteFrontmatter = (_a6 = selectors_exports.selectCurrentSiteConfig(state)) !== null && _a6 !== void 0 ? _a6 : {};
|
241321
241381
|
const projectFrontmatter = path41 ? (_b = selectors_exports.selectLocalProjectConfig(state, path41)) !== null && _b !== void 0 ? _b : {} : {};
|
241322
241382
|
const frontmatter = fillPageFrontmatter(pageFrontmatter, projectFrontmatter, validationOpts);
|
241323
|
-
|
241383
|
+
const siteTemplate = cache.$siteTemplate;
|
241384
|
+
if (siteTemplate) {
|
241385
|
+
const siteOptions = siteTemplate.validateOptions((_c = pageFrontmatter.site) !== null && _c !== void 0 ? _c : {}, path41, {
|
241386
|
+
// The property is different on the page vs the myst.yml
|
241387
|
+
property: "site",
|
241388
|
+
// Passing in the log files ensures this isn't prefixed with `myst.yml`.
|
241389
|
+
warningLogFn: session.log.warn,
|
241390
|
+
errorLogFn: session.log.error
|
241391
|
+
});
|
241392
|
+
if (siteOptions && Object.keys(siteOptions).length > 0)
|
241393
|
+
frontmatter.site = siteOptions;
|
241394
|
+
} else {
|
241395
|
+
session.log.debug(`Site template not available to validate site frontmatter in ${path41}`);
|
241396
|
+
}
|
241397
|
+
if (((_d2 = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _d2 === void 0 ? void 0 : _d2.hide_authors) || ((_f = (_e = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _e === void 0 ? void 0 : _e.design) === null || _f === void 0 ? void 0 : _f.hide_authors)) {
|
241324
241398
|
delete frontmatter.authors;
|
241325
241399
|
}
|
241326
241400
|
return frontmatter;
|
@@ -241358,61 +241432,6 @@ function updateFileInfoFromFrontmatter(session, file, frontmatter, url, dataUrl)
|
|
241358
241432
|
}));
|
241359
241433
|
}
|
241360
241434
|
|
241361
|
-
// ../myst-cli/dist/session/cache.js
|
241362
|
-
var import_node_fs2 = __toESM(require("fs"), 1);
|
241363
|
-
var import_node_path7 = __toESM(require("path"), 1);
|
241364
|
-
function castSession(session) {
|
241365
|
-
const cache = session;
|
241366
|
-
if (!cache.$citationRenderers)
|
241367
|
-
cache.$citationRenderers = {};
|
241368
|
-
if (!cache.$doiRenderers)
|
241369
|
-
cache.$doiRenderers = {};
|
241370
|
-
if (!cache.$internalReferences)
|
241371
|
-
cache.$internalReferences = {};
|
241372
|
-
if (!cache.$externalReferences)
|
241373
|
-
cache.$externalReferences = {};
|
241374
|
-
if (!cache.$mdast)
|
241375
|
-
cache.$mdast = {};
|
241376
|
-
if (!cache.$outputs)
|
241377
|
-
cache.$outputs = {};
|
241378
|
-
cache.$setMdast = (file, data) => {
|
241379
|
-
cache.$mdast[import_node_path7.default.resolve(file)] = data;
|
241380
|
-
};
|
241381
|
-
cache.$getMdast = (file) => {
|
241382
|
-
return cache.$mdast[import_node_path7.default.resolve(file)];
|
241383
|
-
};
|
241384
|
-
return cache;
|
241385
|
-
}
|
241386
|
-
function cachePath(session, filename) {
|
241387
|
-
return import_node_path7.default.join(session.buildPath(), "cache", filename);
|
241388
|
-
}
|
241389
|
-
function writeToCache(session, filename, data) {
|
241390
|
-
const file = cachePath(session, filename);
|
241391
|
-
session.log.debug(`Writing cache file: ${file}`);
|
241392
|
-
writeFileToFolder(file, data);
|
241393
|
-
}
|
241394
|
-
function checkCache(session, filename, opts) {
|
241395
|
-
const file = cachePath(session, filename);
|
241396
|
-
if (!import_node_fs2.default.existsSync(file)) {
|
241397
|
-
session.log.debug(`Cache file not found: ${file}`);
|
241398
|
-
return false;
|
241399
|
-
}
|
241400
|
-
const { ctimeMs } = import_node_fs2.default.lstatSync(file);
|
241401
|
-
const age = (Date.now() - ctimeMs) / (1e3 * 60 * 60 * 24);
|
241402
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.maxAge) != null && age > opts.maxAge) {
|
241403
|
-
session.log.debug(`Cache file has expired (age: ${age.toFixed(3)} days, max: ${opts.maxAge} days): ${file}`);
|
241404
|
-
return false;
|
241405
|
-
}
|
241406
|
-
return true;
|
241407
|
-
}
|
241408
|
-
function loadFromCache(session, filename, opts) {
|
241409
|
-
if (!checkCache(session, filename, opts))
|
241410
|
-
return;
|
241411
|
-
const file = cachePath(session, filename);
|
241412
|
-
session.log.debug(`Loading cache file: ${file}`);
|
241413
|
-
return import_node_fs2.default.readFileSync(file).toString();
|
241414
|
-
}
|
241415
|
-
|
241416
241435
|
// ../myst-cli/dist/config.js
|
241417
241436
|
var VERSION = 1;
|
241418
241437
|
function emptyConfig() {
|
@@ -242190,7 +242209,9 @@ var phrasingTypes = /* @__PURE__ */ new Set([
|
|
242190
242209
|
"superscript",
|
242191
242210
|
"smallcaps",
|
242192
242211
|
"link",
|
242193
|
-
"span"
|
242212
|
+
"span",
|
242213
|
+
"delete",
|
242214
|
+
"crossReference"
|
242194
242215
|
]);
|
242195
242216
|
var UNHANDLED_ERROR_TEXT = "Unhandled TEX conversion";
|
242196
242217
|
function originalValue(original, node3) {
|
@@ -242201,6 +242222,15 @@ function originalValue(original, node3) {
|
|
242201
242222
|
return "";
|
242202
242223
|
return original.slice(from4, to);
|
242203
242224
|
}
|
242225
|
+
function hasStar(node3) {
|
242226
|
+
var _a6, _b;
|
242227
|
+
const first2 = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6[0];
|
242228
|
+
if (!first2)
|
242229
|
+
return false;
|
242230
|
+
if (((_b = first2.content) === null || _b === void 0 ? void 0 : _b.length) === 1 && first2.content[0].type === "string" && first2.content[0].content === "*" && first2.openMark === "" && first2.closeMark === "")
|
242231
|
+
return true;
|
242232
|
+
return false;
|
242233
|
+
}
|
242204
242234
|
function getArguments(node3, type2) {
|
242205
242235
|
var _a6, _b;
|
242206
242236
|
return (_b = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.filter((n) => {
|
@@ -242411,8 +242441,11 @@ var marks = {
|
|
242411
242441
|
textsc: "smallcaps",
|
242412
242442
|
textsubscript: "subscript",
|
242413
242443
|
textsuperscript: "superscript",
|
242414
|
-
hl: "strong"
|
242444
|
+
hl: "strong",
|
242415
242445
|
// This needs to be done!
|
242446
|
+
cancel: "delete",
|
242447
|
+
bcancel: "delete",
|
242448
|
+
xcancel: "delete"
|
242416
242449
|
};
|
242417
242450
|
var TEXT_MARKS_HANDLERS = {
|
242418
242451
|
...Object.fromEntries(Object.entries(marks).map(([macro2, kind]) => {
|
@@ -242643,6 +242676,12 @@ var LINK_HANDLERS = {
|
|
242643
242676
|
const url = texToText(urlNode);
|
242644
242677
|
state.renderInline(textNode.content, "link", { url });
|
242645
242678
|
},
|
242679
|
+
macro_hyperlink(node3, state) {
|
242680
|
+
state.openParagraph();
|
242681
|
+
const [urlNode, textNode] = getArguments(node3, "group");
|
242682
|
+
const url = texToText(urlNode);
|
242683
|
+
state.renderInline(textNode.content, "link", { url });
|
242684
|
+
},
|
242646
242685
|
macro_url(node3, state) {
|
242647
242686
|
state.openParagraph();
|
242648
242687
|
const url = texToText(node3);
|
@@ -242652,8 +242691,14 @@ var LINK_HANDLERS = {
|
|
242652
242691
|
state.openParagraph();
|
242653
242692
|
const [urlNode] = getArguments(node3, "argument");
|
242654
242693
|
const [textNode] = getArguments(node3, "group");
|
242655
|
-
const
|
242656
|
-
state.renderInline(textNode.content, "
|
242694
|
+
const label = texToText(urlNode);
|
242695
|
+
state.renderInline(textNode.content, "crossReference", { label });
|
242696
|
+
},
|
242697
|
+
macro_hypertarget(node3, state) {
|
242698
|
+
state.openParagraph();
|
242699
|
+
const [urlNode, content3] = getArguments(node3, "group");
|
242700
|
+
const label = texToText(urlNode);
|
242701
|
+
state.renderInline(content3, "span", { label });
|
242657
242702
|
}
|
242658
242703
|
};
|
242659
242704
|
|
@@ -242665,25 +242710,31 @@ var REF_HANDLERS = {
|
|
242665
242710
|
const label = texToText(node3);
|
242666
242711
|
const parent2 = state.top();
|
242667
242712
|
const last = (_a6 = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _a6 === void 0 ? void 0 : _a6.slice(-1)[0];
|
242668
|
-
|
242713
|
+
const grandparent = state.stack[state.stack.length - 2];
|
242714
|
+
if (!(parent2 === null || parent2 === void 0 ? void 0 : parent2.label) && ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "container" || (parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "proof")) {
|
242669
242715
|
parent2.label = label;
|
242670
|
-
} else if ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "caption" &&
|
242671
|
-
|
242716
|
+
} else if (!(grandparent === null || grandparent === void 0 ? void 0 : grandparent.label) && ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "caption" && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "container" || (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "proof")) {
|
242717
|
+
grandparent.label = label;
|
242672
242718
|
} else {
|
242673
242719
|
if (!last) {
|
242674
|
-
if (parent2)
|
242720
|
+
if (parent2 && !parent2.label)
|
242675
242721
|
parent2.label = label;
|
242676
242722
|
return;
|
242677
242723
|
}
|
242678
242724
|
if (!parent2)
|
242679
242725
|
return;
|
242680
|
-
last
|
242726
|
+
if (!(last === null || last === void 0 ? void 0 : last.label))
|
242727
|
+
last.label = label;
|
242681
242728
|
}
|
242682
242729
|
},
|
242683
242730
|
macro_ref(node3, state) {
|
242684
242731
|
state.openParagraph();
|
242685
242732
|
const label = texToText(getArguments(node3, "group"));
|
242686
|
-
|
242733
|
+
const xref = u2("crossReference", { label }, [u2("text", "%s")]);
|
242734
|
+
if (hasStar(node3)) {
|
242735
|
+
xref.noLink = true;
|
242736
|
+
}
|
242737
|
+
state.pushNode(xref);
|
242687
242738
|
},
|
242688
242739
|
macro_subref(node3, state) {
|
242689
242740
|
state.openParagraph();
|
@@ -278005,7 +278056,11 @@ var macros17 = {
|
|
278005
278056
|
AA: 1,
|
278006
278057
|
t: 1,
|
278007
278058
|
u: 1,
|
278008
|
-
v: 1
|
278059
|
+
v: 1,
|
278060
|
+
// Cancel
|
278061
|
+
cancel: 1,
|
278062
|
+
bcancel: 1,
|
278063
|
+
xcancel: 1
|
278009
278064
|
};
|
278010
278065
|
var mixed_arg_macros = ["multirow"];
|
278011
278066
|
function patchOpenArgument(args) {
|
@@ -278982,7 +279037,10 @@ var MISC_HANDLERS = {
|
|
278982
279037
|
state.closeParagraph();
|
278983
279038
|
const top = state.top();
|
278984
279039
|
if ((top === null || top === void 0 ? void 0 : top.type) === "container" && (top === null || top === void 0 ? void 0 : top.kind) === "figure" && ((_a6 = top === null || top === void 0 ? void 0 : top.children) === null || _a6 === void 0 ? void 0 : _a6.length)) {
|
278985
|
-
const topCopy = { ...top, children: [] };
|
279040
|
+
const topCopy = copyNode({ ...top, children: [] });
|
279041
|
+
delete topCopy.label;
|
279042
|
+
delete topCopy.identifier;
|
279043
|
+
delete topCopy.html_id;
|
278986
279044
|
state.closeNode();
|
278987
279045
|
state.openNode("container", topCopy);
|
278988
279046
|
}
|
@@ -280389,7 +280447,7 @@ function runDirectives(state) {
|
|
280389
280447
|
directiveOpen.map = map14;
|
280390
280448
|
directiveOpen.meta = {
|
280391
280449
|
arg: arg2,
|
280392
|
-
options:
|
280450
|
+
options: getDirectiveOptions(options),
|
280393
280451
|
// Tightness is computed for all directives (are they separated by a newline before/after)
|
280394
280452
|
tight: computeBlockTightness(state.src, token.map)
|
280395
280453
|
};
|
@@ -280471,7 +280529,7 @@ function parseDirectiveContent(content3, info, state) {
|
|
280471
280529
|
const match3 = COLON_OPTION_REGEX.exec(line2);
|
280472
280530
|
const { option: option3, value } = (_a6 = match3 === null || match3 === void 0 ? void 0 : match3.groups) !== null && _a6 !== void 0 ? _a6 : {};
|
280473
280531
|
if (option3)
|
280474
|
-
options.push([option3, value ||
|
280532
|
+
options.push([option3, value || true]);
|
280475
280533
|
bodyOffset++;
|
280476
280534
|
}
|
280477
280535
|
}
|
@@ -280482,31 +280540,28 @@ function parseDirectiveContent(content3, info, state) {
|
|
280482
280540
|
function directiveArgToTokens(arg2, lineNumber, state) {
|
280483
280541
|
return nestedPartToTokens("directive_arg", arg2, lineNumber, state, "run_directives", true);
|
280484
280542
|
}
|
280485
|
-
function
|
280543
|
+
function getDirectiveOptions(options) {
|
280486
280544
|
if (!options)
|
280487
280545
|
return void 0;
|
280488
280546
|
const simplified = {};
|
280489
280547
|
options.forEach(([key2, val]) => {
|
280490
280548
|
if (simplified[key2] !== void 0) {
|
280491
280549
|
return;
|
280492
|
-
} else if (!isNaN(Number(val))) {
|
280493
|
-
simplified[key2] = Number(val);
|
280494
|
-
} else if (typeof val === "string" && val.toLowerCase() === "true") {
|
280495
|
-
simplified[key2] = true;
|
280496
|
-
} else if (typeof val === "string" && val.toLowerCase() === "false") {
|
280497
|
-
simplified[key2] = false;
|
280498
|
-
} else {
|
280499
|
-
simplified[key2] = val;
|
280500
280550
|
}
|
280551
|
+
simplified[key2] = val;
|
280501
280552
|
});
|
280502
280553
|
return simplified;
|
280503
280554
|
}
|
280504
280555
|
function directiveOptionsToTokens(options, lineNumber, state) {
|
280505
280556
|
const tokens = options.map(([key2, value], index4) => {
|
280506
|
-
const optTokens = nestedPartToTokens("directive_option",
|
280557
|
+
const optTokens = typeof value === "string" ? nestedPartToTokens("directive_option", value, lineNumber + index4, state, "run_directives", true) : [
|
280558
|
+
new state.Token("directive_option_open", "", 1),
|
280559
|
+
new state.Token("directive_option_close", "", -1)
|
280560
|
+
];
|
280507
280561
|
if (optTokens.length) {
|
280508
280562
|
optTokens[0].info = key2;
|
280509
|
-
optTokens[0].content = value;
|
280563
|
+
optTokens[0].content = typeof value === "string" ? value : "";
|
280564
|
+
optTokens[0].meta = { value };
|
280510
280565
|
}
|
280511
280566
|
return optTokens;
|
280512
280567
|
});
|
@@ -287928,7 +287983,7 @@ var defaultMdast = {
|
|
287928
287983
|
getAttrs(t2) {
|
287929
287984
|
return {
|
287930
287985
|
name: t2.info,
|
287931
|
-
value: t2.
|
287986
|
+
value: t2.meta.value
|
287932
287987
|
};
|
287933
287988
|
}
|
287934
287989
|
},
|
@@ -288129,6 +288184,8 @@ function contentFromNode(node3, spec, vfile2, description, ruleId) {
|
|
288129
288184
|
return void 0;
|
288130
288185
|
}
|
288131
288186
|
if (spec.type === ParseTypesEnum.string || spec.type === String) {
|
288187
|
+
if (value === true)
|
288188
|
+
return "";
|
288132
288189
|
if (typeof value !== "string" && !(value && typeof value === "number" && !isNaN(value))) {
|
288133
288190
|
fileWarn(vfile2, `value is not a string for ${description}`, { node: node3, ruleId });
|
288134
288191
|
}
|
@@ -288136,7 +288193,7 @@ function contentFromNode(node3, spec, vfile2, description, ruleId) {
|
|
288136
288193
|
}
|
288137
288194
|
if (spec.type === ParseTypesEnum.number || spec.type === Number) {
|
288138
288195
|
const valueAsNumber = Number(value);
|
288139
|
-
if (isNaN(valueAsNumber)) {
|
288196
|
+
if (value === true || isNaN(valueAsNumber)) {
|
288140
288197
|
const fileFn = spec.required ? fileError : fileWarn;
|
288141
288198
|
fileFn(vfile2, `number not provided for ${description}`, { node: node3, ruleId });
|
288142
288199
|
return void 0;
|
@@ -288471,17 +288528,22 @@ var cardDirective = {
|
|
288471
288528
|
name: "card",
|
288472
288529
|
alias: ["grid-item-card"],
|
288473
288530
|
arg: {
|
288474
|
-
type: "myst"
|
288531
|
+
type: "myst",
|
288532
|
+
doc: "The title of the card, usually shown as bolded text at the top of the card."
|
288475
288533
|
},
|
288476
288534
|
options: {
|
288477
|
-
|
288478
|
-
type: String
|
288535
|
+
url: {
|
288536
|
+
type: String,
|
288537
|
+
alias: ["link"],
|
288538
|
+
doc: "Turns the card into a link, can be internal or external."
|
288479
288539
|
},
|
288480
288540
|
header: {
|
288481
|
-
type: "myst"
|
288541
|
+
type: "myst",
|
288542
|
+
doc: "Adds a header to the card."
|
288482
288543
|
},
|
288483
288544
|
footer: {
|
288484
|
-
type: "myst"
|
288545
|
+
type: "myst",
|
288546
|
+
doc: "Adds a footer to the card."
|
288485
288547
|
}
|
288486
288548
|
// // https://sphinx-design.readthedocs.io/en/furo-theme/cards.html#card-options
|
288487
288549
|
// width
|
@@ -288512,10 +288574,11 @@ var cardDirective = {
|
|
288512
288574
|
},
|
288513
288575
|
body: {
|
288514
288576
|
type: "myst",
|
288515
|
-
required: true
|
288577
|
+
required: true,
|
288578
|
+
doc: "Main body content of the card."
|
288516
288579
|
},
|
288517
288580
|
run(data) {
|
288518
|
-
const {
|
288581
|
+
const { url, header, footer: footer2 } = data.options || {};
|
288519
288582
|
let headerChildren;
|
288520
288583
|
let bodyChildren;
|
288521
288584
|
let footerChildren;
|
@@ -288552,7 +288615,7 @@ var cardDirective = {
|
|
288552
288615
|
return [
|
288553
288616
|
{
|
288554
288617
|
type: "card",
|
288555
|
-
url
|
288618
|
+
url,
|
288556
288619
|
children
|
288557
288620
|
}
|
288558
288621
|
];
|
@@ -289038,7 +289101,7 @@ var import_node_path15 = __toESM(require("path"), 1);
|
|
289038
289101
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
289039
289102
|
|
289040
289103
|
// ../myst-cli/dist/version.js
|
289041
|
-
var version2 = "1.3.
|
289104
|
+
var version2 = "1.3.9";
|
289042
289105
|
var version_default2 = version2;
|
289043
289106
|
|
289044
289107
|
// ../myst-cli/dist/utils/headers.js
|
@@ -299862,9 +299925,12 @@ var dist_default2 = template_default;
|
|
299862
299925
|
// ../myst-cli/dist/build/site/template.js
|
299863
299926
|
var DEFAULT_TEMPLATE = "book-theme";
|
299864
299927
|
var DEFAULT_INSTALL_COMMAND = "npm install";
|
299865
|
-
async function
|
299928
|
+
async function getSiteTemplate(session, opts) {
|
299866
299929
|
var _a6, _b, _c;
|
299867
|
-
const
|
299930
|
+
const cache = castSession(session);
|
299931
|
+
const state = cache.store.getState();
|
299932
|
+
if (cache.$siteTemplate)
|
299933
|
+
return cache.$siteTemplate;
|
299868
299934
|
const siteConfig = selectors_exports.selectCurrentSiteConfig(state);
|
299869
299935
|
const file = (_a6 = selectors_exports.selectCurrentSiteFile(state)) !== null && _a6 !== void 0 ? _a6 : session.configFiles[0];
|
299870
299936
|
const mystTemplate = new dist_default2(session, {
|
@@ -299883,6 +299949,7 @@ async function getMystTemplate(session, opts) {
|
|
299883
299949
|
}
|
299884
299950
|
});
|
299885
299951
|
await mystTemplate.ensureTemplateExistsOnPath();
|
299952
|
+
cache.$siteTemplate = mystTemplate;
|
299886
299953
|
return mystTemplate;
|
299887
299954
|
}
|
299888
299955
|
async function installSiteTemplate(session, mystTemplate) {
|
@@ -300447,7 +300514,7 @@ async function getSiteManifest(session, opts) {
|
|
300447
300514
|
const { nav } = siteConfig;
|
300448
300515
|
const actions = (_c = siteConfig.actions) === null || _c === void 0 ? void 0 : _c.map((action) => resolveSiteAction(session, action, siteConfigFile, "actions")).filter((action) => !!action);
|
300449
300516
|
const siteFrontmatter = filterKeys(siteConfig, SITE_FRONTMATTER_KEYS);
|
300450
|
-
const mystTemplate = await
|
300517
|
+
const mystTemplate = await getSiteTemplate(session, opts);
|
300451
300518
|
const validatedOptions = mystTemplate.validateOptions((_d2 = siteFrontmatter.options) !== null && _d2 !== void 0 ? _d2 : {}, siteConfigFile, { allowRemote: true });
|
300452
300519
|
const validatedFrontmatter = mystTemplate.validateDoc(siteFrontmatter, validatedOptions, void 0, siteConfigFile);
|
300453
300520
|
const resolvedOptions = await resolveTemplateFileOptions(session, mystTemplate, validatedOptions);
|
@@ -302239,14 +302306,13 @@ async function evaluateExpression(kernel, expr) {
|
|
302239
302306
|
return { status: result.status, result };
|
302240
302307
|
}
|
302241
302308
|
function buildCacheKey(kernelSpec, nodes) {
|
302242
|
-
var _a6, _b, _c;
|
302243
302309
|
const hashableItems = [];
|
302244
302310
|
for (const node3 of nodes) {
|
302245
302311
|
if (isCellBlock(node3)) {
|
302246
302312
|
hashableItems.push({
|
302247
302313
|
kind: node3.type,
|
302248
302314
|
content: select("code", node3).value,
|
302249
|
-
raisesException:
|
302315
|
+
raisesException: codeBlockRaisesException(node3)
|
302250
302316
|
});
|
302251
302317
|
} else {
|
302252
302318
|
(0, import_node_assert.default)(isInlineExpression(node3));
|
@@ -302262,11 +302328,18 @@ function buildCacheKey(kernelSpec, nodes) {
|
|
302262
302328
|
function isCellBlock(node3) {
|
302263
302329
|
return node3.type === "block" && select("code", node3) !== null && select("output", node3) !== null;
|
302264
302330
|
}
|
302331
|
+
function codeBlockRaisesException(node3) {
|
302332
|
+
var _a6, _b, _c;
|
302333
|
+
return !!((_c = (_b = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "raises-exception"));
|
302334
|
+
}
|
302335
|
+
function codeBlockSkipsExecution(node3) {
|
302336
|
+
var _a6, _b, _c;
|
302337
|
+
return !!((_c = (_b = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "skip-execution"));
|
302338
|
+
}
|
302265
302339
|
function isInlineExpression(node3) {
|
302266
302340
|
return node3.type === "inlineExpression";
|
302267
302341
|
}
|
302268
302342
|
async function computeExecutableNodes(kernel, nodes, opts) {
|
302269
|
-
var _a6, _b, _c;
|
302270
302343
|
let errorOccurred = false;
|
302271
302344
|
const results = [];
|
302272
302345
|
for (const matchedNode of nodes) {
|
@@ -302274,7 +302347,7 @@ async function computeExecutableNodes(kernel, nodes, opts) {
|
|
302274
302347
|
const code7 = select("code", matchedNode);
|
302275
302348
|
const { status, outputs } = await executeCode(kernel, code7.value);
|
302276
302349
|
results.push(outputs);
|
302277
|
-
const allowErrors =
|
302350
|
+
const allowErrors = codeBlockRaisesException(matchedNode);
|
302278
302351
|
if (status === "error" && !allowErrors) {
|
302279
302352
|
const errorMessage = outputs.map((item) => item.traceback).flat().join("\n");
|
302280
302353
|
fileError(opts.vfile, `An exception occurred during code execution, halting further execution:
|
@@ -302319,13 +302392,13 @@ function applyComputedOutputsToNodes(nodes, computedResult) {
|
|
302319
302392
|
async function kernelExecutionTransform(tree, vfile2, opts) {
|
302320
302393
|
var _a6;
|
302321
302394
|
const log = (_a6 = opts.log) !== null && _a6 !== void 0 ? _a6 : console;
|
302322
|
-
|
302323
|
-
return fileError(vfile2, `Notebook does not declare the necessary 'kernelspec' frontmatter key required for execution`);
|
302324
|
-
}
|
302325
|
-
const executableNodes = selectAll(`block[kind=${NotebookCell.code}],inlineExpression`, tree);
|
302395
|
+
const executableNodes = selectAll(`block[kind=${NotebookCell.code}],inlineExpression`, tree).filter((node3) => !(isCellBlock(node3) && codeBlockSkipsExecution(node3)));
|
302326
302396
|
if (executableNodes.length === 0) {
|
302327
302397
|
return;
|
302328
302398
|
}
|
302399
|
+
if (opts.frontmatter.kernelspec === void 0) {
|
302400
|
+
return fileError(vfile2, `Notebook does not declare the necessary 'kernelspec' frontmatter key required for execution`);
|
302401
|
+
}
|
302329
302402
|
const cacheKey = buildCacheKey(opts.frontmatter.kernelspec, executableNodes);
|
302330
302403
|
let cachedResults = opts.cache.get(cacheKey);
|
302331
302404
|
if (opts.ignoreCache || cachedResults === void 0) {
|
@@ -303790,168 +303863,6 @@ function renderTemplate(template, opts) {
|
|
303790
303863
|
${rendered}`);
|
303791
303864
|
}
|
303792
303865
|
|
303793
|
-
// ../myst-to-tex/dist/tables.js
|
303794
|
-
var TOTAL_TABLE_WIDTH = 886;
|
303795
|
-
function renderPColumn(width) {
|
303796
|
-
if (width === 1)
|
303797
|
-
return `p{\\dimexpr \\linewidth-2\\tabcolsep}`;
|
303798
|
-
return `p{\\dimexpr ${width.toFixed(3)}\\linewidth-2\\tabcolsep}`;
|
303799
|
-
}
|
303800
|
-
function getColumnWidths(node3) {
|
303801
|
-
var _a6, _b, _c;
|
303802
|
-
let bestMaybeWidths = [];
|
303803
|
-
let mostNonNulls = 0;
|
303804
|
-
for (let i2 = 0; i2 < node3.children.length; i2 += 1) {
|
303805
|
-
const row2 = node3.children[i2];
|
303806
|
-
const maybeWidths = row2.children.reduce((acc, cell3) => {
|
303807
|
-
var _a7, _b2;
|
303808
|
-
const colwidth = new Array((_a7 = cell3.colspan) !== null && _a7 !== void 0 ? _a7 : 1).fill(cell3.width ? cell3.width / ((_b2 = cell3.colspan) !== null && _b2 !== void 0 ? _b2 : 1) : null);
|
303809
|
-
return [...acc, ...colwidth];
|
303810
|
-
}, []);
|
303811
|
-
const nonNulls = maybeWidths.filter((maybeWidth) => maybeWidth > 0).length;
|
303812
|
-
if (i2 === 0 || nonNulls >= mostNonNulls) {
|
303813
|
-
mostNonNulls = nonNulls;
|
303814
|
-
bestMaybeWidths = maybeWidths;
|
303815
|
-
if (mostNonNulls === maybeWidths.length) {
|
303816
|
-
break;
|
303817
|
-
}
|
303818
|
-
}
|
303819
|
-
}
|
303820
|
-
let widths;
|
303821
|
-
if (mostNonNulls === bestMaybeWidths.length) {
|
303822
|
-
widths = bestMaybeWidths;
|
303823
|
-
} else {
|
303824
|
-
const totalDefinedWidths = bestMaybeWidths.reduce((acc, cur) => cur == null ? acc : acc + cur, 0);
|
303825
|
-
const remainingSpace = TOTAL_TABLE_WIDTH - totalDefinedWidths;
|
303826
|
-
const nullCells = bestMaybeWidths.length - mostNonNulls;
|
303827
|
-
const defaultWidth = Math.floor(remainingSpace / nullCells);
|
303828
|
-
widths = bestMaybeWidths.map((w) => w == null || w === 0 ? defaultWidth : w);
|
303829
|
-
}
|
303830
|
-
const total = widths.reduce((acc, cur) => acc + cur, 0);
|
303831
|
-
const fractionalWidths = widths.map((w) => w / total);
|
303832
|
-
const columnSpec = fractionalWidths.map((w) => renderPColumn(w)).join("");
|
303833
|
-
const numColumns = widths.length > 0 ? widths.length : (_c = (_b = (_a6 = node3 === null || node3 === void 0 ? void 0 : node3.children[0]) === null || _a6 === void 0 ? void 0 : _a6.children) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
303834
|
-
return { widths: fractionalWidths, columnSpec, numColumns };
|
303835
|
-
}
|
303836
|
-
function renderTableCell(state, cell3, i2, spanIdx, widths, childCount) {
|
303837
|
-
var _a6;
|
303838
|
-
let renderedSpan = 1;
|
303839
|
-
const colspan = (_a6 = cell3.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
|
303840
|
-
if (colspan > 1) {
|
303841
|
-
let width = 0;
|
303842
|
-
for (let j = 0; j < colspan; j += 1) {
|
303843
|
-
width += widths[spanIdx + j];
|
303844
|
-
}
|
303845
|
-
state.write(`\\multicolumn{${colspan}}{${renderPColumn(width)}}{`);
|
303846
|
-
renderedSpan = colspan;
|
303847
|
-
}
|
303848
|
-
if (cell3.children.length === 1 && cell3.children[0].type === "paragraph") {
|
303849
|
-
state.renderChildren(cell3.children[0], true);
|
303850
|
-
} else {
|
303851
|
-
state.renderChildren(cell3, true);
|
303852
|
-
}
|
303853
|
-
if (colspan > 1)
|
303854
|
-
state.write("}");
|
303855
|
-
if (i2 < childCount - 1) {
|
303856
|
-
state.write(" & ");
|
303857
|
-
}
|
303858
|
-
return renderedSpan;
|
303859
|
-
}
|
303860
|
-
function renderNodeToLatex(node3, state) {
|
303861
|
-
state.usePackages("booktabs");
|
303862
|
-
const { widths, columnSpec, numColumns } = getColumnWidths(node3);
|
303863
|
-
if (!numColumns) {
|
303864
|
-
throw new Error("invalid table format, no columns");
|
303865
|
-
}
|
303866
|
-
state.data.isInTable = true;
|
303867
|
-
if (!state.data.isInContainer) {
|
303868
|
-
state.write("\\bigskip\\noindent");
|
303869
|
-
}
|
303870
|
-
state.ensureNewLine();
|
303871
|
-
let numHeaderRowsFound = 0;
|
303872
|
-
if (state.data.longFigure) {
|
303873
|
-
state.ensureNewLine();
|
303874
|
-
state.write("\\hline");
|
303875
|
-
state.ensureNewLine();
|
303876
|
-
let endHeader = false;
|
303877
|
-
node3.children.forEach(({ children: rowContent }) => {
|
303878
|
-
var _a6, _b;
|
303879
|
-
if (endHeader)
|
303880
|
-
return;
|
303881
|
-
if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
|
303882
|
-
numHeaderRowsFound += 1;
|
303883
|
-
let spanIdx = 0;
|
303884
|
-
rowContent.forEach((cell3, i2) => {
|
303885
|
-
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
303886
|
-
});
|
303887
|
-
state.write(" \\\\");
|
303888
|
-
state.ensureNewLine();
|
303889
|
-
}
|
303890
|
-
if (!((_b = rowContent[0]) === null || _b === void 0 ? void 0 : _b.header)) {
|
303891
|
-
endHeader = true;
|
303892
|
-
}
|
303893
|
-
});
|
303894
|
-
if (numHeaderRowsFound > 0) {
|
303895
|
-
state.ensureNewLine();
|
303896
|
-
state.write("\\hline");
|
303897
|
-
state.ensureNewLine();
|
303898
|
-
state.write("\\endfirsthead");
|
303899
|
-
state.ensureNewLine();
|
303900
|
-
state.write("\\hline");
|
303901
|
-
state.ensureNewLine();
|
303902
|
-
state.write(`\\multicolumn{${numColumns}}{c}{\\tablename\\ \\thetable\\ -- \\textit{Continued from previous page}}\\\\`);
|
303903
|
-
state.ensureNewLine();
|
303904
|
-
node3.children.forEach(({ children: rowContent }, index4) => {
|
303905
|
-
if (index4 >= numHeaderRowsFound)
|
303906
|
-
return;
|
303907
|
-
let spanIdx = 0;
|
303908
|
-
rowContent.forEach((cell3, i2) => {
|
303909
|
-
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
303910
|
-
});
|
303911
|
-
state.write(" \\\\");
|
303912
|
-
state.ensureNewLine();
|
303913
|
-
});
|
303914
|
-
state.ensureNewLine();
|
303915
|
-
state.write("\\hline");
|
303916
|
-
state.ensureNewLine();
|
303917
|
-
state.write("\\endhead");
|
303918
|
-
state.ensureNewLine();
|
303919
|
-
}
|
303920
|
-
} else {
|
303921
|
-
state.write(`\\begin{tabular}{${columnSpec}}`);
|
303922
|
-
state.ensureNewLine();
|
303923
|
-
state.write(`\\toprule`);
|
303924
|
-
state.ensureNewLine();
|
303925
|
-
}
|
303926
|
-
node3.children.forEach(({ children: rowContent }, index4) => {
|
303927
|
-
var _a6;
|
303928
|
-
if (index4 < numHeaderRowsFound)
|
303929
|
-
return;
|
303930
|
-
let spanIdx = 0;
|
303931
|
-
rowContent.forEach((cell3, i2) => {
|
303932
|
-
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
303933
|
-
});
|
303934
|
-
state.write(" \\\\");
|
303935
|
-
state.ensureNewLine();
|
303936
|
-
if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
|
303937
|
-
state.write("\\hline");
|
303938
|
-
state.ensureNewLine();
|
303939
|
-
}
|
303940
|
-
});
|
303941
|
-
if (state.data.longFigure) {
|
303942
|
-
state.write("\\hline");
|
303943
|
-
} else {
|
303944
|
-
state.write("\\bottomrule");
|
303945
|
-
state.ensureNewLine();
|
303946
|
-
state.write("\\end{tabular}");
|
303947
|
-
}
|
303948
|
-
state.closeBlock(node3);
|
303949
|
-
state.data.isInTable = false;
|
303950
|
-
if (!state.data.isInContainer) {
|
303951
|
-
state.write("\\bigskip");
|
303952
|
-
}
|
303953
|
-
}
|
303954
|
-
|
303955
303866
|
// ../myst-to-tex/dist/types.js
|
303956
303867
|
var DEFAULT_IMAGE_WIDTH = 0.7;
|
303957
303868
|
var DEFAULT_PAGE_WIDTH_PIXELS = 800;
|
@@ -304249,6 +304160,169 @@ function addIndexEntries(node3, state) {
|
|
304249
304160
|
});
|
304250
304161
|
}
|
304251
304162
|
|
304163
|
+
// ../myst-to-tex/dist/tables.js
|
304164
|
+
var TOTAL_TABLE_WIDTH = 886;
|
304165
|
+
function renderPColumn(width) {
|
304166
|
+
if (width === 1)
|
304167
|
+
return `p{\\dimexpr \\linewidth-2\\tabcolsep}`;
|
304168
|
+
return `p{\\dimexpr ${width.toFixed(3)}\\linewidth-2\\tabcolsep}`;
|
304169
|
+
}
|
304170
|
+
function getColumnWidths(node3) {
|
304171
|
+
var _a6, _b, _c;
|
304172
|
+
let bestMaybeWidths = [];
|
304173
|
+
let mostNonNulls = 0;
|
304174
|
+
for (let i2 = 0; i2 < node3.children.length; i2 += 1) {
|
304175
|
+
const row2 = node3.children[i2];
|
304176
|
+
const maybeWidths = row2.children.reduce((acc, cell3) => {
|
304177
|
+
var _a7, _b2;
|
304178
|
+
const colwidth = new Array((_a7 = cell3.colspan) !== null && _a7 !== void 0 ? _a7 : 1).fill(cell3.width ? cell3.width / ((_b2 = cell3.colspan) !== null && _b2 !== void 0 ? _b2 : 1) : null);
|
304179
|
+
return [...acc, ...colwidth];
|
304180
|
+
}, []);
|
304181
|
+
const nonNulls = maybeWidths.filter((maybeWidth) => maybeWidth > 0).length;
|
304182
|
+
if (i2 === 0 || nonNulls >= mostNonNulls) {
|
304183
|
+
mostNonNulls = nonNulls;
|
304184
|
+
bestMaybeWidths = maybeWidths;
|
304185
|
+
if (mostNonNulls === maybeWidths.length) {
|
304186
|
+
break;
|
304187
|
+
}
|
304188
|
+
}
|
304189
|
+
}
|
304190
|
+
let widths;
|
304191
|
+
if (mostNonNulls === bestMaybeWidths.length) {
|
304192
|
+
widths = bestMaybeWidths;
|
304193
|
+
} else {
|
304194
|
+
const totalDefinedWidths = bestMaybeWidths.reduce((acc, cur) => cur == null ? acc : acc + cur, 0);
|
304195
|
+
const remainingSpace = TOTAL_TABLE_WIDTH - totalDefinedWidths;
|
304196
|
+
const nullCells = bestMaybeWidths.length - mostNonNulls;
|
304197
|
+
const defaultWidth = Math.floor(remainingSpace / nullCells);
|
304198
|
+
widths = bestMaybeWidths.map((w) => w == null || w === 0 ? defaultWidth : w);
|
304199
|
+
}
|
304200
|
+
const total = widths.reduce((acc, cur) => acc + cur, 0);
|
304201
|
+
const fractionalWidths = widths.map((w) => w / total);
|
304202
|
+
const columnSpec = fractionalWidths.map((w) => renderPColumn(w)).join("");
|
304203
|
+
const numColumns = widths.length > 0 ? widths.length : (_c = (_b = (_a6 = node3 === null || node3 === void 0 ? void 0 : node3.children[0]) === null || _a6 === void 0 ? void 0 : _a6.children) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
304204
|
+
return { widths: fractionalWidths, columnSpec, numColumns };
|
304205
|
+
}
|
304206
|
+
function renderTableCell(state, cell3, i2, spanIdx, widths, childCount) {
|
304207
|
+
var _a6;
|
304208
|
+
let renderedSpan = 1;
|
304209
|
+
const colspan = (_a6 = cell3.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
|
304210
|
+
if (colspan > 1) {
|
304211
|
+
let width = 0;
|
304212
|
+
for (let j = 0; j < colspan; j += 1) {
|
304213
|
+
width += widths[spanIdx + j];
|
304214
|
+
}
|
304215
|
+
state.write(`\\multicolumn{${colspan}}{${renderPColumn(width)}}{`);
|
304216
|
+
renderedSpan = colspan;
|
304217
|
+
}
|
304218
|
+
if (cell3.children.length === 1 && cell3.children[0].type === "paragraph") {
|
304219
|
+
state.renderChildren(cell3.children[0], true);
|
304220
|
+
} else {
|
304221
|
+
state.renderChildren(cell3, true);
|
304222
|
+
}
|
304223
|
+
if (colspan > 1)
|
304224
|
+
state.write("}");
|
304225
|
+
if (i2 < childCount - 1) {
|
304226
|
+
state.write(" & ");
|
304227
|
+
}
|
304228
|
+
return renderedSpan;
|
304229
|
+
}
|
304230
|
+
function renderNodeToLatex(node3, state) {
|
304231
|
+
state.usePackages("booktabs");
|
304232
|
+
const { widths, columnSpec, numColumns } = getColumnWidths(node3);
|
304233
|
+
if (!numColumns) {
|
304234
|
+
throw new Error("invalid table format, no columns");
|
304235
|
+
}
|
304236
|
+
addIndexEntries(node3, state);
|
304237
|
+
state.data.isInTable = true;
|
304238
|
+
if (!state.data.isInContainer) {
|
304239
|
+
state.write("\\bigskip\\noindent");
|
304240
|
+
}
|
304241
|
+
state.ensureNewLine();
|
304242
|
+
let numHeaderRowsFound = 0;
|
304243
|
+
if (state.data.longFigure) {
|
304244
|
+
state.ensureNewLine();
|
304245
|
+
state.write("\\hline");
|
304246
|
+
state.ensureNewLine();
|
304247
|
+
let endHeader = false;
|
304248
|
+
node3.children.forEach(({ children: rowContent }) => {
|
304249
|
+
var _a6, _b;
|
304250
|
+
if (endHeader)
|
304251
|
+
return;
|
304252
|
+
if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
|
304253
|
+
numHeaderRowsFound += 1;
|
304254
|
+
let spanIdx = 0;
|
304255
|
+
rowContent.forEach((cell3, i2) => {
|
304256
|
+
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
304257
|
+
});
|
304258
|
+
state.write(" \\\\");
|
304259
|
+
state.ensureNewLine();
|
304260
|
+
}
|
304261
|
+
if (!((_b = rowContent[0]) === null || _b === void 0 ? void 0 : _b.header)) {
|
304262
|
+
endHeader = true;
|
304263
|
+
}
|
304264
|
+
});
|
304265
|
+
if (numHeaderRowsFound > 0) {
|
304266
|
+
state.ensureNewLine();
|
304267
|
+
state.write("\\hline");
|
304268
|
+
state.ensureNewLine();
|
304269
|
+
state.write("\\endfirsthead");
|
304270
|
+
state.ensureNewLine();
|
304271
|
+
state.write("\\hline");
|
304272
|
+
state.ensureNewLine();
|
304273
|
+
state.write(`\\multicolumn{${numColumns}}{c}{\\tablename\\ \\thetable\\ -- \\textit{Continued from previous page}}\\\\`);
|
304274
|
+
state.ensureNewLine();
|
304275
|
+
node3.children.forEach(({ children: rowContent }, index4) => {
|
304276
|
+
if (index4 >= numHeaderRowsFound)
|
304277
|
+
return;
|
304278
|
+
let spanIdx = 0;
|
304279
|
+
rowContent.forEach((cell3, i2) => {
|
304280
|
+
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
304281
|
+
});
|
304282
|
+
state.write(" \\\\");
|
304283
|
+
state.ensureNewLine();
|
304284
|
+
});
|
304285
|
+
state.ensureNewLine();
|
304286
|
+
state.write("\\hline");
|
304287
|
+
state.ensureNewLine();
|
304288
|
+
state.write("\\endhead");
|
304289
|
+
state.ensureNewLine();
|
304290
|
+
}
|
304291
|
+
} else {
|
304292
|
+
state.write(`\\begin{tabular}{${columnSpec}}`);
|
304293
|
+
state.ensureNewLine();
|
304294
|
+
state.write(`\\toprule`);
|
304295
|
+
state.ensureNewLine();
|
304296
|
+
}
|
304297
|
+
node3.children.forEach(({ children: rowContent }, index4) => {
|
304298
|
+
var _a6;
|
304299
|
+
if (index4 < numHeaderRowsFound)
|
304300
|
+
return;
|
304301
|
+
let spanIdx = 0;
|
304302
|
+
rowContent.forEach((cell3, i2) => {
|
304303
|
+
spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
|
304304
|
+
});
|
304305
|
+
state.write(" \\\\");
|
304306
|
+
state.ensureNewLine();
|
304307
|
+
if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
|
304308
|
+
state.write("\\hline");
|
304309
|
+
state.ensureNewLine();
|
304310
|
+
}
|
304311
|
+
});
|
304312
|
+
if (state.data.longFigure) {
|
304313
|
+
state.write("\\hline");
|
304314
|
+
} else {
|
304315
|
+
state.write("\\bottomrule");
|
304316
|
+
state.ensureNewLine();
|
304317
|
+
state.write("\\end{tabular}");
|
304318
|
+
}
|
304319
|
+
state.closeBlock(node3);
|
304320
|
+
state.data.isInTable = false;
|
304321
|
+
if (!state.data.isInContainer) {
|
304322
|
+
state.write("\\bigskip");
|
304323
|
+
}
|
304324
|
+
}
|
304325
|
+
|
304252
304326
|
// ../myst-to-tex/dist/container.js
|
304253
304327
|
var CaptionKind;
|
304254
304328
|
(function(CaptionKind3) {
|
@@ -304383,23 +304457,17 @@ var captionHandler = (node3, state) => {
|
|
304383
304457
|
};
|
304384
304458
|
|
304385
304459
|
// ../myst-to-tex/dist/math.js
|
304386
|
-
var
|
304460
|
+
var TOP_LEVEL_ENVIRONMENTS = [
|
304387
304461
|
"equation",
|
304388
304462
|
"multline",
|
304389
304463
|
"gather",
|
304390
304464
|
"align",
|
304391
304465
|
"alignat",
|
304392
304466
|
"flalign",
|
304393
|
-
"matrix",
|
304394
|
-
"pmatrix",
|
304395
|
-
"bmatrix",
|
304396
|
-
"Bmatrix",
|
304397
|
-
"vmatrix",
|
304398
|
-
"Vmatrix",
|
304399
304467
|
"eqnarray"
|
304400
304468
|
];
|
304401
|
-
var RE_OPEN2 = new RegExp(`^\\\\begin{(${
|
304402
|
-
function
|
304469
|
+
var RE_OPEN2 = new RegExp(`^\\\\begin{(${TOP_LEVEL_ENVIRONMENTS.join("|")})([*]?)}`);
|
304470
|
+
function isTopLevelAmsmathEnvironment(value) {
|
304403
304471
|
const matchOpen = value.trim().match(RE_OPEN2);
|
304404
304472
|
if (!matchOpen)
|
304405
304473
|
return false;
|
@@ -304445,12 +304513,13 @@ var math4 = (node3, state) => {
|
|
304445
304513
|
}
|
304446
304514
|
state.usePackages("amsmath");
|
304447
304515
|
addMacrosToState(node3.value, state);
|
304516
|
+
addIndexEntries(node3, state);
|
304448
304517
|
if (state.data.isInTable) {
|
304449
304518
|
state.write("\\(\\displaystyle ");
|
304450
304519
|
state.write(node3.value);
|
304451
304520
|
state.write(" \\)");
|
304452
304521
|
} else {
|
304453
|
-
const isAmsMath =
|
304522
|
+
const isAmsMath = isTopLevelAmsmathEnvironment(node3.value);
|
304454
304523
|
if (isAmsMath) {
|
304455
304524
|
state.ensureNewLine();
|
304456
304525
|
state.write(node3.value);
|
@@ -304554,6 +304623,7 @@ var proofHandler = (node3, state) => {
|
|
304554
304623
|
t2.type = "__delete__";
|
304555
304624
|
}
|
304556
304625
|
const newNode = remove(node3, "__delete__");
|
304626
|
+
addIndexEntries(node3, state);
|
304557
304627
|
state.write("\\begin{");
|
304558
304628
|
state.write(env7);
|
304559
304629
|
state.write("}");
|
@@ -304776,6 +304846,7 @@ var handlers3 = {
|
|
304776
304846
|
state.text(node3.value);
|
304777
304847
|
},
|
304778
304848
|
paragraph(node3, state) {
|
304849
|
+
addIndexEntries(node3, state);
|
304779
304850
|
state.renderChildren(node3);
|
304780
304851
|
},
|
304781
304852
|
heading(node3, state) {
|
@@ -304844,9 +304915,11 @@ var handlers3 = {
|
|
304844
304915
|
state.write("\\printindex\n");
|
304845
304916
|
return;
|
304846
304917
|
}
|
304918
|
+
addIndexEntries(node3, state);
|
304847
304919
|
state.renderChildren(node3, false);
|
304848
304920
|
},
|
304849
304921
|
blockquote(node3, state) {
|
304922
|
+
addIndexEntries(node3, state);
|
304850
304923
|
state.renderEnvironment(node3, "quote");
|
304851
304924
|
},
|
304852
304925
|
definitionList(node3, state) {
|
@@ -304870,6 +304943,7 @@ var handlers3 = {
|
|
304870
304943
|
if (node3.visibility === "remove") {
|
304871
304944
|
return;
|
304872
304945
|
}
|
304946
|
+
addIndexEntries(node3, state);
|
304873
304947
|
let start = "\\begin{verbatim}\n";
|
304874
304948
|
let end = "\n\\end{verbatim}";
|
304875
304949
|
if (state.options.codeStyle === "listings" || getClasses(node3.class).includes("listings") && node3.lang !== void 0) {
|
@@ -304889,6 +304963,7 @@ var handlers3 = {
|
|
304889
304963
|
state.closeBlock(node3);
|
304890
304964
|
},
|
304891
304965
|
list(node3, state) {
|
304966
|
+
addIndexEntries(node3, state);
|
304892
304967
|
if (state.data.isInTable) {
|
304893
304968
|
node3.children.forEach((child, i2) => {
|
304894
304969
|
state.write(node3.ordered ? `${i2}.~~` : "\\textbullet~~");
|
@@ -304919,6 +304994,7 @@ var handlers3 = {
|
|
304919
304994
|
state.renderChildren(node3, false);
|
304920
304995
|
},
|
304921
304996
|
div(node3, state) {
|
304997
|
+
addIndexEntries(node3, state);
|
304922
304998
|
state.renderChildren(node3, false);
|
304923
304999
|
},
|
304924
305000
|
span(node3, state) {
|
@@ -305001,6 +305077,7 @@ var handlers3 = {
|
|
305001
305077
|
state.write("}");
|
305002
305078
|
},
|
305003
305079
|
admonition(node3, state) {
|
305080
|
+
addIndexEntries(node3, state);
|
305004
305081
|
state.usePackages("framed");
|
305005
305082
|
state.renderEnvironment(node3, "framed");
|
305006
305083
|
},
|
@@ -305010,6 +305087,7 @@ var handlers3 = {
|
|
305010
305087
|
},
|
305011
305088
|
table: renderNodeToLatex,
|
305012
305089
|
image(node3, state) {
|
305090
|
+
addIndexEntries(node3, state);
|
305013
305091
|
state.usePackages("graphicx");
|
305014
305092
|
const { width: nodeWidth, url: nodeSrc, align: nodeAlign } = node3;
|
305015
305093
|
const src = nodeSrc;
|
@@ -316098,7 +316176,7 @@ async function startServer(session, opts) {
|
|
316098
316176
|
var _a6;
|
316099
316177
|
await session.reload();
|
316100
316178
|
warnOnHostEnvironmentVariable(session, opts);
|
316101
|
-
const mystTemplate = await
|
316179
|
+
const mystTemplate = await getSiteTemplate(session, opts);
|
316102
316180
|
if (!opts.headless)
|
316103
316181
|
await installSiteTemplate(session, mystTemplate);
|
316104
316182
|
await buildSite(session, opts);
|
@@ -316227,7 +316305,7 @@ function get_baseurl(session) {
|
|
316227
316305
|
}
|
316228
316306
|
async function buildHtml(session, opts) {
|
316229
316307
|
var _a6;
|
316230
|
-
const template = await
|
316308
|
+
const template = await getSiteTemplate(session, opts);
|
316231
316309
|
const baseurl = get_baseurl(session);
|
316232
316310
|
const htmlDir = import_node_path54.default.join(session.buildPath(), "html");
|
316233
316311
|
import_fs_extra.default.rmSync(htmlDir, { recursive: true, force: true });
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|