mystmd 1.1.52__py3-none-any.whl → 1.1.54__py3-none-any.whl
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.1.52.dist-info → mystmd-1.1.54.dist-info}/METADATA +1 -1
- mystmd-1.1.54.dist-info/RECORD +8 -0
- {mystmd-1.1.52.dist-info → mystmd-1.1.54.dist-info}/WHEEL +1 -1
- mystmd_py/myst.cjs +514 -302
- mystmd-1.1.52.dist-info/RECORD +0 -8
- {mystmd-1.1.52.dist-info → mystmd-1.1.54.dist-info}/entry_points.txt +0 -0
- {mystmd-1.1.52.dist-info → mystmd-1.1.54.dist-info}/licenses/LICENSE +0 -0
mystmd_py/myst.cjs
CHANGED
@@ -100662,14 +100662,14 @@ var require_node_domexception = __commonJS({
|
|
100662
100662
|
});
|
100663
100663
|
|
100664
100664
|
// ../../node_modules/fetch-blob/from.js
|
100665
|
-
var
|
100665
|
+
var import_node_fs19, import_node_domexception, stat, _path2, _start, _BlobDataItem, BlobDataItem;
|
100666
100666
|
var init_from = __esm({
|
100667
100667
|
"../../node_modules/fetch-blob/from.js"() {
|
100668
|
-
|
100668
|
+
import_node_fs19 = require("fs");
|
100669
100669
|
import_node_domexception = __toESM(require_node_domexception(), 1);
|
100670
100670
|
init_file();
|
100671
100671
|
init_fetch_blob();
|
100672
|
-
({ stat } =
|
100672
|
+
({ stat } = import_node_fs19.promises);
|
100673
100673
|
_BlobDataItem = class {
|
100674
100674
|
constructor(options) {
|
100675
100675
|
__privateAdd(this, _path2, void 0);
|
@@ -100696,7 +100696,7 @@ var init_from = __esm({
|
|
100696
100696
|
if (mtimeMs > this.lastModified) {
|
100697
100697
|
throw new import_node_domexception.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.", "NotReadableError");
|
100698
100698
|
}
|
100699
|
-
yield* (0,
|
100699
|
+
yield* (0, import_node_fs19.createReadStream)(__privateGet(this, _path2), {
|
100700
100700
|
start: __privateGet(this, _start),
|
100701
100701
|
end: __privateGet(this, _start) + this.size - 1
|
100702
100702
|
});
|
@@ -193279,7 +193279,7 @@ var {
|
|
193279
193279
|
} = import_index.default;
|
193280
193280
|
|
193281
193281
|
// src/version.ts
|
193282
|
-
var version = "1.1.
|
193282
|
+
var version = "1.1.54";
|
193283
193283
|
var version_default = version;
|
193284
193284
|
|
193285
193285
|
// ../myst-cli/dist/build/build.js
|
@@ -194861,6 +194861,8 @@ var FRONTMATTER_ALIASES = {
|
|
194861
194861
|
part: "parts",
|
194862
194862
|
ack: "acknowledgments",
|
194863
194863
|
acknowledgements: "acknowledgments",
|
194864
|
+
acknowledgment: "acknowledgments",
|
194865
|
+
acknowledgement: "acknowledgments",
|
194864
194866
|
availability: "data_availability",
|
194865
194867
|
dataAvailability: "data_availability",
|
194866
194868
|
"data-availability": "data_availability",
|
@@ -198266,7 +198268,7 @@ function validatePageFrontmatterKeys(value, opts) {
|
|
198266
198268
|
const partsOptions = incrementOptions("parts", opts);
|
198267
198269
|
let parts;
|
198268
198270
|
if (defined(value.parts)) {
|
198269
|
-
parts =
|
198271
|
+
parts = validateObjectKeys(value.parts, { optional: PAGE_KNOWN_PARTS, alias: FRONTMATTER_ALIASES }, { keepExtraKeys: true, suppressWarnings: true, ...partsOptions });
|
198270
198272
|
}
|
198271
198273
|
PAGE_KNOWN_PARTS.forEach((partKey) => {
|
198272
198274
|
if (defined(value[partKey])) {
|
@@ -198434,8 +198436,8 @@ function unnestKernelSpec(pageFrontmatter) {
|
|
198434
198436
|
}
|
198435
198437
|
|
198436
198438
|
// ../myst-cli/dist/project/load.js
|
198437
|
-
var
|
198438
|
-
var
|
198439
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
198440
|
+
var import_node_path22 = require("path");
|
198439
198441
|
|
198440
198442
|
// ../myst-cli-utils/node_modules/chalk/source/vendor/ansi-styles/index.js
|
198441
198443
|
var ANSI_BACKGROUND_OFFSET2 = 10;
|
@@ -199958,7 +199960,21 @@ function coercePart(part) {
|
|
199958
199960
|
if (!part) {
|
199959
199961
|
return [];
|
199960
199962
|
}
|
199961
|
-
|
199963
|
+
if (typeof part === "string")
|
199964
|
+
return coercePart([part]);
|
199965
|
+
const parts = [];
|
199966
|
+
part.map((p5) => p5.toLowerCase()).forEach((p5) => {
|
199967
|
+
parts.push(p5);
|
199968
|
+
Object.entries(FRONTMATTER_ALIASES).forEach(([alias, value]) => {
|
199969
|
+
if (p5 === alias || p5 === value) {
|
199970
|
+
if (!parts.includes(value))
|
199971
|
+
parts.unshift(value);
|
199972
|
+
if (!parts.includes(alias))
|
199973
|
+
parts.push(alias);
|
199974
|
+
}
|
199975
|
+
});
|
199976
|
+
});
|
199977
|
+
return parts;
|
199962
199978
|
}
|
199963
199979
|
function selectBlockParts(tree, part) {
|
199964
199980
|
const parts = coercePart(part);
|
@@ -202921,9 +202937,55 @@ var jsYaml = {
|
|
202921
202937
|
};
|
202922
202938
|
var js_yaml_default = jsYaml;
|
202923
202939
|
|
202940
|
+
// ../myst-config/dist/errorRules/validators.js
|
202941
|
+
var ERROR_RULE_KEY_OBJECT = {
|
202942
|
+
required: ["id"],
|
202943
|
+
optional: ["severity", "keys"],
|
202944
|
+
alias: {
|
202945
|
+
rule: "id",
|
202946
|
+
key: "keys"
|
202947
|
+
}
|
202948
|
+
};
|
202949
|
+
function validateErrorRule(input3, opts) {
|
202950
|
+
if (typeof input3 === "string") {
|
202951
|
+
input3 = { id: input3 };
|
202952
|
+
}
|
202953
|
+
const value = validateObjectKeys(input3, ERROR_RULE_KEY_OBJECT, {
|
202954
|
+
...opts
|
202955
|
+
});
|
202956
|
+
if (value === void 0)
|
202957
|
+
return void 0;
|
202958
|
+
const id = validateString(value.id, incrementOptions("id", opts));
|
202959
|
+
const severity = validateChoice(value.severity || "ignore", {
|
202960
|
+
...incrementOptions("severity", opts),
|
202961
|
+
choices: ["ignore", "warn", "error"]
|
202962
|
+
});
|
202963
|
+
if (!id || !severity)
|
202964
|
+
return void 0;
|
202965
|
+
const output2 = { id, severity };
|
202966
|
+
if (!defined(value.keys))
|
202967
|
+
return [output2];
|
202968
|
+
const keyList = validateList(value.keys, { ...incrementOptions("keys", opts), coerce: true }, (key2, ind) => {
|
202969
|
+
return validateString(key2, incrementOptions(`keys.${ind}`, opts));
|
202970
|
+
});
|
202971
|
+
if (!keyList)
|
202972
|
+
return void 0;
|
202973
|
+
return keyList.map((key2) => ({ ...output2, key: key2 }));
|
202974
|
+
}
|
202975
|
+
function validateErrorRuleList(input3, opts) {
|
202976
|
+
if (input3 === void 0)
|
202977
|
+
return void 0;
|
202978
|
+
const output2 = validateList(input3, { coerce: true, ...incrementOptions("error_rules", opts) }, (exp, ind) => {
|
202979
|
+
return validateErrorRule(exp, incrementOptions(`error_rules.${ind}`, opts));
|
202980
|
+
});
|
202981
|
+
if (!output2)
|
202982
|
+
return void 0;
|
202983
|
+
return output2.flat();
|
202984
|
+
}
|
202985
|
+
|
202924
202986
|
// ../myst-config/dist/project/validators.js
|
202925
202987
|
var PROJECT_CONFIG_KEYS = {
|
202926
|
-
optional: ["remote", "index", "exclude", "plugins", ...PROJECT_FRONTMATTER_KEYS],
|
202988
|
+
optional: ["remote", "index", "exclude", "plugins", "error_rules", ...PROJECT_FRONTMATTER_KEYS],
|
202927
202989
|
alias: FRONTMATTER_ALIASES
|
202928
202990
|
};
|
202929
202991
|
function validateProjectConfigKeys(value, opts) {
|
@@ -202944,6 +203006,11 @@ function validateProjectConfigKeys(value, opts) {
|
|
202944
203006
|
return validateString(file, incrementOptions(`plugins.${index4}`, opts));
|
202945
203007
|
});
|
202946
203008
|
}
|
203009
|
+
if (defined(value.error_rules)) {
|
203010
|
+
const error_rules = validateErrorRuleList(value.error_rules, opts);
|
203011
|
+
if (error_rules)
|
203012
|
+
output2.error_rules = error_rules;
|
203013
|
+
}
|
202947
203014
|
return output2;
|
202948
203015
|
}
|
202949
203016
|
function validateProjectConfig(input3, opts) {
|
@@ -235593,6 +235660,9 @@ function codeTransform(mdast2, file, opts) {
|
|
235593
235660
|
if (node3.lang.toLowerCase().includes("python") && (opts === null || opts === void 0 ? void 0 : opts.transformPython) !== false) {
|
235594
235661
|
node3.lang = "python";
|
235595
235662
|
}
|
235663
|
+
if (node3.lang.toLowerCase() === "r" && (opts === null || opts === void 0 ? void 0 : opts.transformR) !== false) {
|
235664
|
+
node3.lang = "r";
|
235665
|
+
}
|
235596
235666
|
});
|
235597
235667
|
}
|
235598
235668
|
var codePlugin = (opts) => (tree, file) => {
|
@@ -236255,10 +236325,23 @@ async function includeDirectiveTransform(tree, vfile2, opts) {
|
|
236255
236325
|
const includeNodes = selectAll("include", tree);
|
236256
236326
|
if (includeNodes.length === 0)
|
236257
236327
|
return;
|
236328
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.stack))
|
236329
|
+
opts.stack = [opts.sourceFile];
|
236258
236330
|
await Promise.all(includeNodes.map(async (node3) => {
|
236331
|
+
var _a6, _b, _c;
|
236259
236332
|
if (node3.children && node3.children.length > 0)
|
236260
236333
|
return;
|
236261
|
-
const
|
236334
|
+
const fullFile = opts.resolveFile(node3.file, opts.sourceFile, vfile2);
|
236335
|
+
if (!fullFile)
|
236336
|
+
return;
|
236337
|
+
if ((_a6 = opts.stack) === null || _a6 === void 0 ? void 0 : _a6.includes(fullFile)) {
|
236338
|
+
fileError(vfile2, `Include Directive: "${fullFile}" depends on itself`, {
|
236339
|
+
ruleId: RuleId.includeContentLoads,
|
236340
|
+
note: [...opts.stack, fullFile].join(" > ")
|
236341
|
+
});
|
236342
|
+
return;
|
236343
|
+
}
|
236344
|
+
const rawContent = await opts.loadFile(fullFile);
|
236262
236345
|
if (rawContent == null)
|
236263
236346
|
return;
|
236264
236347
|
const { content: content3, startingLineNumber } = filterIncludedContent(vfile2, node3.filter, rawContent);
|
@@ -236310,9 +236393,16 @@ async function includeDirectiveTransform(tree, vfile2, opts) {
|
|
236310
236393
|
children = [container4];
|
236311
236394
|
}
|
236312
236395
|
} else {
|
236313
|
-
children = await opts.parseContent(
|
236396
|
+
children = await opts.parseContent(fullFile, content3, vfile2);
|
236314
236397
|
}
|
236315
236398
|
node3.children = children;
|
236399
|
+
if (!((_b = node3.children) === null || _b === void 0 ? void 0 : _b.length))
|
236400
|
+
return;
|
236401
|
+
await includeDirectiveTransform(node3, vfile2, {
|
236402
|
+
...opts,
|
236403
|
+
stack: [...(_c = opts.stack) !== null && _c !== void 0 ? _c : [], fullFile],
|
236404
|
+
sourceFile: fullFile
|
236405
|
+
});
|
236316
236406
|
}));
|
236317
236407
|
}
|
236318
236408
|
function index3(n, total) {
|
@@ -236391,6 +236481,7 @@ var SUBFIGURE_TYPES = [
|
|
236391
236481
|
"block",
|
236392
236482
|
"container",
|
236393
236483
|
"image",
|
236484
|
+
"mermaid",
|
236394
236485
|
"iframe",
|
236395
236486
|
"table",
|
236396
236487
|
"code",
|
@@ -239577,8 +239668,8 @@ var rootReducer = combineReducers({
|
|
239577
239668
|
});
|
239578
239669
|
|
239579
239670
|
// ../myst-cli/dist/utils/addWarningForFile.js
|
239580
|
-
function addWarningForFile(session, file, message,
|
239581
|
-
var _a6, _b, _c;
|
239671
|
+
function addWarningForFile(session, file, message, severity = "warn", opts) {
|
239672
|
+
var _a6, _b, _c, _d2, _e;
|
239582
239673
|
const line2 = ((_a6 = opts === null || opts === void 0 ? void 0 : opts.position) === null || _a6 === void 0 ? void 0 : _a6.start.line) ? `:${opts === null || opts === void 0 ? void 0 : opts.position.start.line}` : "";
|
239583
239674
|
const column = ((_b = opts === null || opts === void 0 ? void 0 : opts.position) === null || _b === void 0 ? void 0 : _b.start.column) && ((_c = opts === null || opts === void 0 ? void 0 : opts.position) === null || _c === void 0 ? void 0 : _c.start.column) > 1 ? `:${opts === null || opts === void 0 ? void 0 : opts.position.start.column}` : "";
|
239584
239675
|
const note = (opts === null || opts === void 0 ? void 0 : opts.note) ? `
|
@@ -239588,7 +239679,23 @@ function addWarningForFile(session, file, message, kind = "warn", opts) {
|
|
239588
239679
|
`) : "";
|
239589
239680
|
const prefix2 = file ? `${file}${line2}${column} ` : "";
|
239590
239681
|
const formatted = `${message}${note}${url}`;
|
239591
|
-
|
239682
|
+
if (opts === null || opts === void 0 ? void 0 : opts.ruleId) {
|
239683
|
+
const config2 = selectCurrentProjectConfig(session.store.getState());
|
239684
|
+
const handler = (_d2 = config2 === null || config2 === void 0 ? void 0 : config2.error_rules) === null || _d2 === void 0 ? void 0 : _d2.find((rule) => {
|
239685
|
+
if (rule.key) {
|
239686
|
+
return rule.id === opts.ruleId && rule.key === opts.key;
|
239687
|
+
}
|
239688
|
+
return rule.id === opts.ruleId;
|
239689
|
+
});
|
239690
|
+
if (handler) {
|
239691
|
+
if (handler.severity === "ignore") {
|
239692
|
+
session.log.debug(`${prefix2}${formatted}`);
|
239693
|
+
return;
|
239694
|
+
}
|
239695
|
+
severity = (_e = handler.severity) !== null && _e !== void 0 ? _e : severity;
|
239696
|
+
}
|
239697
|
+
}
|
239698
|
+
switch (severity) {
|
239592
239699
|
case "info":
|
239593
239700
|
session.log.info(`\u2139\uFE0F ${prefix2}${formatted}`);
|
239594
239701
|
break;
|
@@ -239600,11 +239707,14 @@ function addWarningForFile(session, file, message, kind = "warn", opts) {
|
|
239600
239707
|
session.log.warn(`\u26A0\uFE0F ${prefix2}${formatted}`);
|
239601
239708
|
break;
|
239602
239709
|
}
|
239710
|
+
if (opts === null || opts === void 0 ? void 0 : opts.ruleId) {
|
239711
|
+
session.log.debug(`To suppress this message, add rule: "${opts.ruleId}"${opts.key ? ` with key: "${opts.key}"` : ""} to "error_rules" in your project config`);
|
239712
|
+
}
|
239603
239713
|
if (file) {
|
239604
239714
|
session.store.dispatch(warnings.actions.addWarning({
|
239605
239715
|
file,
|
239606
239716
|
message,
|
239607
|
-
kind,
|
239717
|
+
kind: severity,
|
239608
239718
|
url: opts === null || opts === void 0 ? void 0 : opts.url,
|
239609
239719
|
note: opts === null || opts === void 0 ? void 0 : opts.note,
|
239610
239720
|
position: opts === null || opts === void 0 ? void 0 : opts.position,
|
@@ -240014,6 +240124,7 @@ var import_node_fs3 = __toESM(require("fs"), 1);
|
|
240014
240124
|
|
240015
240125
|
// ../citation-js-utils/dist/index.js
|
240016
240126
|
var import_core4 = __toESM(require_lib6(), 1);
|
240127
|
+
var import_csl = __toESM(require_csl(), 1);
|
240017
240128
|
var import_sanitize_html = __toESM(require_sanitize_html(), 1);
|
240018
240129
|
|
240019
240130
|
// ../citation-js-utils/node_modules/@citation-js/plugin-bibtex/lib/index.js
|
@@ -240077,12 +240188,6 @@ var InlineCite;
|
|
240077
240188
|
InlineCite2["p"] = "p";
|
240078
240189
|
InlineCite2["t"] = "t";
|
240079
240190
|
})(InlineCite || (InlineCite = {}));
|
240080
|
-
var defaultString = {
|
240081
|
-
format: "string",
|
240082
|
-
lang: "en-US",
|
240083
|
-
type: "html",
|
240084
|
-
style: CitationJSStyles.apa
|
240085
|
-
};
|
240086
240191
|
function yearFromCitation(data) {
|
240087
240192
|
var _a6, _b, _c, _d2, _e, _f;
|
240088
240193
|
let year = (_c = (_b = (_a6 = data.issued) === null || _a6 === void 0 ? void 0 : _a6["date-parts"]) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[0];
|
@@ -240094,6 +240199,7 @@ function yearFromCitation(data) {
|
|
240094
240199
|
return "n.d.";
|
240095
240200
|
}
|
240096
240201
|
function getInlineCitation(data, kind, opts) {
|
240202
|
+
var _a6;
|
240097
240203
|
let authors = data.author;
|
240098
240204
|
if (!authors || authors.length === 0) {
|
240099
240205
|
authors = data.editor;
|
@@ -240122,7 +240228,7 @@ function getInlineCitation(data, kind, opts) {
|
|
240122
240228
|
}
|
240123
240229
|
if (authors.length > 2) {
|
240124
240230
|
return [
|
240125
|
-
{ type: "text", value: `${prefix2}${authors[0].family} ` },
|
240231
|
+
{ type: "text", value: `${prefix2}${(_a6 = authors[0].family) !== null && _a6 !== void 0 ? _a6 : authors[0].literal} ` },
|
240126
240232
|
{ type: "emphasis", children: [{ type: "text", value: "et al." }] },
|
240127
240233
|
{ type: "text", value: `${yearPart}` }
|
240128
240234
|
];
|
@@ -240164,10 +240270,22 @@ function firstNonDoiUrl(str2, doi2) {
|
|
240164
240270
|
const matches4 = [...str2.matchAll(URL_REGEX)];
|
240165
240271
|
return matches4.map((match3) => match3[0]).find((match3) => !doi2 || !match3.includes(doi2));
|
240166
240272
|
}
|
240167
|
-
|
240273
|
+
function parseCitationStyle(style3) {
|
240274
|
+
const [styleType, styleFormat] = style3.split("-");
|
240275
|
+
if (styleType !== "citation") {
|
240276
|
+
throw new Error(`unexpected citation style: ${style3}`);
|
240277
|
+
}
|
240278
|
+
return styleFormat;
|
240279
|
+
}
|
240280
|
+
function parseBibTeX(source2) {
|
240281
|
+
return new import_core4.Cite(source2).data;
|
240282
|
+
}
|
240283
|
+
function parseCSLJSON(source2) {
|
240284
|
+
return (0, import_csl.clean)(source2);
|
240285
|
+
}
|
240286
|
+
async function getCitationRenderers(data) {
|
240168
240287
|
const cite3 = new import_core4.Cite();
|
240169
|
-
|
240170
|
-
return Object.fromEntries(p5.data.map((c) => {
|
240288
|
+
return Object.fromEntries(data.map((c) => {
|
240171
240289
|
var _a6, _b, _c;
|
240172
240290
|
const matchDoi = (_b = (_a6 = c.URL) === null || _a6 === void 0 ? void 0 : _a6.match(DOI_IN_TEXT)) !== null && _b !== void 0 ? _b : (_c = c.note) === null || _c === void 0 ? void 0 : _c.match(DOI_IN_TEXT);
|
240173
240291
|
if (!c.DOI && matchDoi) {
|
@@ -240180,16 +240298,32 @@ async function getCitations(bibtex) {
|
|
240180
240298
|
return getInlineCitation(c, kind, opts);
|
240181
240299
|
},
|
240182
240300
|
render(style3) {
|
240183
|
-
return replaceUrlsWithAnchorElement(cleanRef(cite3.set(c).
|
240301
|
+
return replaceUrlsWithAnchorElement(cleanRef(cite3.set(c).format("bibliography", {
|
240302
|
+
template: parseCitationStyle(style3 !== null && style3 !== void 0 ? style3 : CitationJSStyles.apa),
|
240303
|
+
format: "html",
|
240304
|
+
lang: "en-US"
|
240305
|
+
})), c.DOI);
|
240184
240306
|
},
|
240185
240307
|
getDOI() {
|
240186
240308
|
return c.DOI || void 0;
|
240187
240309
|
},
|
240188
240310
|
getURL() {
|
240189
240311
|
var _a7;
|
240190
|
-
return (_a7 = firstNonDoiUrl(cleanRef(cite3.set(c).
|
240312
|
+
return (_a7 = firstNonDoiUrl(cleanRef(cite3.set(c).format("bibliography", {
|
240313
|
+
template: parseCitationStyle(CitationJSStyles.apa),
|
240314
|
+
format: "html",
|
240315
|
+
lang: "en-US"
|
240316
|
+
})), c.DOI)) !== null && _a7 !== void 0 ? _a7 : doiUrl(c.DOI);
|
240317
|
+
},
|
240318
|
+
cite: c,
|
240319
|
+
getLabel() {
|
240320
|
+
var _a7;
|
240321
|
+
const bibtexObjects = cite3.set(c).format("bibtex", { format: "object" });
|
240322
|
+
return (_a7 = bibtexObjects[0]) === null || _a7 === void 0 ? void 0 : _a7.label;
|
240191
240323
|
},
|
240192
|
-
|
240324
|
+
exportBibTeX() {
|
240325
|
+
return cite3.set(c).format("bibtex", { format: "text" });
|
240326
|
+
}
|
240193
240327
|
}
|
240194
240328
|
];
|
240195
240329
|
}));
|
@@ -240221,7 +240355,7 @@ function castSession(session) {
|
|
240221
240355
|
}
|
240222
240356
|
|
240223
240357
|
// ../myst-cli/dist/process/citations.js
|
240224
|
-
async function
|
240358
|
+
async function loadBibTeXCitationRenderers(session, path42) {
|
240225
240359
|
const toc = tic();
|
240226
240360
|
let data;
|
240227
240361
|
if (isUrl(path42)) {
|
@@ -240236,7 +240370,8 @@ async function loadCitations(session, path42) {
|
|
240236
240370
|
session.log.debug(`Loading citations at "${path42}"`);
|
240237
240371
|
data = import_node_fs3.default.readFileSync(path42).toString();
|
240238
240372
|
}
|
240239
|
-
const
|
240373
|
+
const csl = parseBibTeX(data);
|
240374
|
+
const renderer = await getCitationRenderers(csl);
|
240240
240375
|
session.log.debug(toc(`Read ${plural("%s citations(s)", renderer)} from ${path42} in %s.`));
|
240241
240376
|
return renderer;
|
240242
240377
|
}
|
@@ -240265,8 +240400,8 @@ function combineProjectCitationRenderers(session, projectPath) {
|
|
240265
240400
|
}
|
240266
240401
|
|
240267
240402
|
// ../myst-cli/dist/process/file.js
|
240268
|
-
var
|
240269
|
-
var
|
240403
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
240404
|
+
var import_node_path18 = __toESM(require("path"), 1);
|
240270
240405
|
var import_node_crypto2 = require("crypto");
|
240271
240406
|
|
240272
240407
|
// ../tex-to-myst/dist/utils.js
|
@@ -282543,7 +282678,8 @@ var defaultMdast = {
|
|
282543
282678
|
args: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.arg,
|
282544
282679
|
options: (_b = t2.meta) === null || _b === void 0 ? void 0 : _b.options,
|
282545
282680
|
value: t2.content || void 0,
|
282546
|
-
tight: ((_c = t2.meta) === null || _c === void 0 ? void 0 : _c.tight) || void 0
|
282681
|
+
tight: ((_c = t2.meta) === null || _c === void 0 ? void 0 : _c.tight) || void 0,
|
282682
|
+
processed: false
|
282547
282683
|
};
|
282548
282684
|
}
|
282549
282685
|
},
|
@@ -282581,7 +282717,8 @@ var defaultMdast = {
|
|
282581
282717
|
getAttrs(t2) {
|
282582
282718
|
return {
|
282583
282719
|
name: t2.info,
|
282584
|
-
value: t2.content
|
282720
|
+
value: t2.content,
|
282721
|
+
processed: false
|
282585
282722
|
};
|
282586
282723
|
}
|
282587
282724
|
},
|
@@ -282804,8 +282941,9 @@ function applyRoles(tree, specs, vfile2) {
|
|
282804
282941
|
}
|
282805
282942
|
});
|
282806
282943
|
});
|
282807
|
-
const nodes = selectAll("mystRole", tree);
|
282944
|
+
const nodes = selectAll("mystRole[processed=false]", tree);
|
282808
282945
|
nodes.forEach((node3) => {
|
282946
|
+
delete node3.processed;
|
282809
282947
|
const { name: name3 } = node3;
|
282810
282948
|
const spec = specLookup[name3];
|
282811
282949
|
if (!spec) {
|
@@ -282848,7 +282986,7 @@ function applyRoles(tree, specs, vfile2) {
|
|
282848
282986
|
}
|
282849
282987
|
|
282850
282988
|
// ../myst-parser/dist/directives.js
|
282851
|
-
function applyDirectives(tree, specs, vfile2) {
|
282989
|
+
function applyDirectives(tree, specs, vfile2, ctx) {
|
282852
282990
|
const specLookup = {};
|
282853
282991
|
specs.forEach((spec) => {
|
282854
282992
|
const names = [spec.name];
|
@@ -282865,9 +283003,10 @@ function applyDirectives(tree, specs, vfile2) {
|
|
282865
283003
|
}
|
282866
283004
|
});
|
282867
283005
|
});
|
282868
|
-
const nodes = selectAll("mystDirective", tree);
|
283006
|
+
const nodes = selectAll("mystDirective[processed=false]", tree);
|
282869
283007
|
nodes.forEach((node3) => {
|
282870
283008
|
var _a6, _b, _c, _d2;
|
283009
|
+
delete node3.processed;
|
282871
283010
|
const { name: name3 } = node3;
|
282872
283011
|
const spec = specLookup[name3];
|
282873
283012
|
if (!spec) {
|
@@ -282994,7 +283133,10 @@ ${node3.value}` : "";
|
|
282994
283133
|
if (validate5) {
|
282995
283134
|
data = validate5(data, vfile2);
|
282996
283135
|
}
|
282997
|
-
node3.children = run(data, vfile2
|
283136
|
+
node3.children = run(data, vfile2, {
|
283137
|
+
// Implement a parseMyst function that accepts _relative_ line numbers
|
283138
|
+
parseMyst: (source2, offset = 0) => ctx.parseMyst(source2, offset + node3.position.start.line)
|
283139
|
+
});
|
282998
283140
|
});
|
282999
283141
|
}
|
283000
283142
|
|
@@ -283072,7 +283214,18 @@ function mystParse(content3, opts) {
|
|
283072
283214
|
const parsedOpts = parseOptions(opts);
|
283073
283215
|
const tokenizer = createTokenizer(parsedOpts);
|
283074
283216
|
const tree = tokensToMyst(content3, tokenizer.parse(content3, { vfile: vfile2 }), parsedOpts.mdast);
|
283075
|
-
applyDirectives(tree, parsedOpts.directives, parsedOpts.vfile
|
283217
|
+
applyDirectives(tree, parsedOpts.directives, parsedOpts.vfile, {
|
283218
|
+
parseMyst: (source2, offset = 0) => {
|
283219
|
+
const mdast2 = mystParse(source2, opts);
|
283220
|
+
visit(mdast2, (node3) => {
|
283221
|
+
if (node3.position) {
|
283222
|
+
node3.position.start.line += offset;
|
283223
|
+
node3.position.end.line += offset;
|
283224
|
+
}
|
283225
|
+
});
|
283226
|
+
return mdast2;
|
283227
|
+
}
|
283228
|
+
});
|
283076
283229
|
applyRoles(tree, parsedOpts.roles, parsedOpts.vfile);
|
283077
283230
|
return tree;
|
283078
283231
|
}
|
@@ -283620,7 +283773,7 @@ var import_node_path17 = __toESM(require("path"), 1);
|
|
283620
283773
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
283621
283774
|
|
283622
283775
|
// ../myst-cli/dist/version.js
|
283623
|
-
var version2 = "1.1.
|
283776
|
+
var version2 = "1.1.54";
|
283624
283777
|
var version_default2 = version2;
|
283625
283778
|
|
283626
283779
|
// ../myst-cli/dist/utils/headers.js
|
@@ -284765,35 +284918,6 @@ async function processNotebook(session, file, content3) {
|
|
284765
284918
|
return { type: "root", children: items };
|
284766
284919
|
}
|
284767
284920
|
|
284768
|
-
// ../myst-cli/dist/transforms/include.js
|
284769
|
-
var import_node_path18 = __toESM(require("path"), 1);
|
284770
|
-
var import_node_fs11 = __toESM(require("fs"), 1);
|
284771
|
-
var makeFileLoader = (session, vfile2, baseFile) => (filename) => {
|
284772
|
-
const dir = import_node_path18.default.dirname(baseFile);
|
284773
|
-
const fullFile = import_node_path18.default.join(dir, filename);
|
284774
|
-
if (!import_node_fs11.default.existsSync(fullFile)) {
|
284775
|
-
fileError(vfile2, `Include Directive: Could not find "${fullFile}" in "${baseFile}"`, {
|
284776
|
-
ruleId: RuleId.includeContentLoads
|
284777
|
-
});
|
284778
|
-
return;
|
284779
|
-
}
|
284780
|
-
session.store.dispatch(watch.actions.addLocalDependency({
|
284781
|
-
path: baseFile,
|
284782
|
-
dependency: fullFile
|
284783
|
-
}));
|
284784
|
-
return import_node_fs11.default.readFileSync(fullFile).toString();
|
284785
|
-
};
|
284786
|
-
async function includeFilesTransform(session, baseFile, tree, vfile2) {
|
284787
|
-
const parseContent = (filename, content3) => {
|
284788
|
-
if (filename.toLowerCase().endsWith(".html")) {
|
284789
|
-
return [{ type: "html", value: content3 }];
|
284790
|
-
}
|
284791
|
-
return parseMyst(session, content3, filename).children;
|
284792
|
-
};
|
284793
|
-
const loadFile2 = makeFileLoader(session, vfile2, baseFile);
|
284794
|
-
await includeDirectiveTransform(tree, vfile2, { loadFile: loadFile2, parseContent });
|
284795
|
-
}
|
284796
|
-
|
284797
284921
|
// ../myst-cli/dist/process/file.js
|
284798
284922
|
function checkCache(cache, content3, file) {
|
284799
284923
|
const sha256 = (0, import_node_crypto2.createHash)("sha256").update(content3).digest("hex");
|
@@ -284811,16 +284935,16 @@ async function loadFile(session, file, projectPath, extension, opts) {
|
|
284811
284935
|
let success = true;
|
284812
284936
|
let location4 = file;
|
284813
284937
|
if (projectPath) {
|
284814
|
-
location4 = `/${
|
284938
|
+
location4 = `/${import_node_path18.default.relative(projectPath, file)}`;
|
284815
284939
|
}
|
284816
284940
|
location4 = location4.replaceAll("\\", "/");
|
284817
284941
|
const vfile2 = new VFile();
|
284818
284942
|
vfile2.path = file;
|
284819
284943
|
try {
|
284820
|
-
const ext2 = extension ||
|
284944
|
+
const ext2 = extension || import_node_path18.default.extname(file).toLowerCase();
|
284821
284945
|
switch (ext2) {
|
284822
284946
|
case ".md": {
|
284823
|
-
const content3 =
|
284947
|
+
const content3 = import_node_fs11.default.readFileSync(file).toString();
|
284824
284948
|
const { sha256, useCache } = checkCache(cache, content3, file);
|
284825
284949
|
if (useCache)
|
284826
284950
|
break;
|
@@ -284833,7 +284957,7 @@ async function loadFile(session, file, projectPath, extension, opts) {
|
|
284833
284957
|
break;
|
284834
284958
|
}
|
284835
284959
|
case ".ipynb": {
|
284836
|
-
const content3 =
|
284960
|
+
const content3 = import_node_fs11.default.readFileSync(file).toString();
|
284837
284961
|
const { sha256, useCache } = checkCache(cache, content3, file);
|
284838
284962
|
if (useCache)
|
284839
284963
|
break;
|
@@ -284846,24 +284970,16 @@ async function loadFile(session, file, projectPath, extension, opts) {
|
|
284846
284970
|
break;
|
284847
284971
|
}
|
284848
284972
|
case ".bib": {
|
284849
|
-
const renderer = await
|
284973
|
+
const renderer = await loadBibTeXCitationRenderers(session, file);
|
284850
284974
|
cache.$citationRenderers[file] = renderer;
|
284851
284975
|
break;
|
284852
284976
|
}
|
284853
284977
|
case ".tex": {
|
284854
|
-
const content3 =
|
284978
|
+
const content3 = import_node_fs11.default.readFileSync(file).toString();
|
284855
284979
|
const { sha256, useCache } = checkCache(cache, content3, file);
|
284856
284980
|
if (useCache)
|
284857
284981
|
break;
|
284858
284982
|
const tex = new TexParser(content3, vfile2);
|
284859
|
-
await includeDirectiveTransform(tex.ast, vfile2, {
|
284860
|
-
loadFile: makeFileLoader(session, vfile2, file),
|
284861
|
-
parseContent: (filename, input3) => {
|
284862
|
-
var _a7;
|
284863
|
-
const subTex = new TexParser(input3, vfile2);
|
284864
|
-
return (_a7 = subTex.ast.children) !== null && _a7 !== void 0 ? _a7 : [];
|
284865
|
-
}
|
284866
|
-
});
|
284867
284983
|
const frontmatter = validatePageFrontmatter({
|
284868
284984
|
title: toText(tex.data.frontmatter.title),
|
284869
284985
|
short_title: toText(tex.data.frontmatter.short_title),
|
@@ -284910,9 +285026,9 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
284910
285026
|
return (_b = cache.$getMdast(file)) === null || _b === void 0 ? void 0 : _b.pre;
|
284911
285027
|
}
|
284912
285028
|
async function bibFilesInDir(session, dir, load2 = true) {
|
284913
|
-
const bibFiles = await Promise.all(
|
284914
|
-
if (
|
284915
|
-
const bibFile =
|
285029
|
+
const bibFiles = await Promise.all(import_node_fs11.default.readdirSync(dir).map(async (f3) => {
|
285030
|
+
if (import_node_path18.default.extname(f3).toLowerCase() === ".bib") {
|
285031
|
+
const bibFile = import_node_path18.default.join(dir, f3);
|
284916
285032
|
if (load2)
|
284917
285033
|
await loadFile(session, bibFile);
|
284918
285034
|
return bibFile;
|
@@ -284940,7 +285056,7 @@ function selectFile(session, file) {
|
|
284940
285056
|
}
|
284941
285057
|
async function getRawFrontmatterFromFile(session, file, projectPath) {
|
284942
285058
|
const state = session.store.getState();
|
284943
|
-
if (projectPath &&
|
285059
|
+
if (projectPath && import_node_path18.default.resolve(file) === selectors_exports.selectLocalConfigFile(state, projectPath)) {
|
284944
285060
|
return selectors_exports.selectLocalProjectConfig(state, projectPath);
|
284945
285061
|
}
|
284946
285062
|
const cache = castSession(session);
|
@@ -284953,8 +285069,8 @@ async function getRawFrontmatterFromFile(session, file, projectPath) {
|
|
284953
285069
|
}
|
284954
285070
|
|
284955
285071
|
// ../myst-cli/dist/project/fromPath.js
|
284956
|
-
var
|
284957
|
-
var
|
285072
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
285073
|
+
var import_node_path20 = require("path");
|
284958
285074
|
|
284959
285075
|
// ../../node_modules/glob/node_modules/minimatch/dist/mjs/index.js
|
284960
285076
|
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
@@ -285653,11 +285769,11 @@ var qmarksTestNoExtDot = ([$0]) => {
|
|
285653
285769
|
return (f3) => f3.length === len && f3 !== "." && f3 !== "..";
|
285654
285770
|
};
|
285655
285771
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
285656
|
-
var
|
285772
|
+
var path14 = {
|
285657
285773
|
win32: { sep: "\\" },
|
285658
285774
|
posix: { sep: "/" }
|
285659
285775
|
};
|
285660
|
-
var sep2 = defaultPlatform === "win32" ?
|
285776
|
+
var sep2 = defaultPlatform === "win32" ? path14.win32.sep : path14.posix.sep;
|
285661
285777
|
minimatch.sep = sep2;
|
285662
285778
|
var GLOBSTAR = Symbol("globstar **");
|
285663
285779
|
minimatch.GLOBSTAR = GLOBSTAR;
|
@@ -291338,13 +291454,13 @@ var glob = Object.assign(glob_, {
|
|
291338
291454
|
glob.glob = glob;
|
291339
291455
|
|
291340
291456
|
// ../myst-cli/dist/project/fromToc.js
|
291341
|
-
var
|
291342
|
-
var
|
291457
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
291458
|
+
var import_node_path19 = require("path");
|
291343
291459
|
function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pageSlugs) {
|
291344
291460
|
const filename = tocFile(path42);
|
291345
|
-
const { dir } = (0,
|
291461
|
+
const { dir } = (0, import_node_path19.parse)(filename);
|
291346
291462
|
chapters.forEach((chapter) => {
|
291347
|
-
const file = chapter.file ? resolveExtension((0,
|
291463
|
+
const file = chapter.file ? resolveExtension((0, import_node_path19.join)(dir, chapter.file)) : void 0;
|
291348
291464
|
if (file) {
|
291349
291465
|
const { slug } = fileInfo2(file, pageSlugs);
|
291350
291466
|
pages.push({ file, level, slug });
|
@@ -291363,16 +291479,16 @@ function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pag
|
|
291363
291479
|
}
|
291364
291480
|
function projectFromToc(session, path42, level = 1) {
|
291365
291481
|
const filename = tocFile(path42);
|
291366
|
-
if (!
|
291482
|
+
if (!import_node_fs12.default.existsSync(filename)) {
|
291367
291483
|
throw new Error(`Could not find TOC "${filename}". Please create a '_toc.yml'.`);
|
291368
291484
|
}
|
291369
|
-
const { dir, base: base5 } = (0,
|
291485
|
+
const { dir, base: base5 } = (0, import_node_path19.parse)(filename);
|
291370
291486
|
const toc = readTOC(session.log, { filename: base5, path: dir });
|
291371
291487
|
const pageSlugs = {};
|
291372
|
-
const indexFile = resolveExtension((0,
|
291488
|
+
const indexFile = resolveExtension((0, import_node_path19.join)(dir, toc.root));
|
291373
291489
|
if (!indexFile) {
|
291374
291490
|
throw Error(`The table of contents defined in "${tocFile(path42)}" could not find file "${toc.root}" defined as the "root:" page. Please ensure that one of these files is defined:
|
291375
|
-
- ${VALID_FILE_EXTENSIONS.map((ext2) => (0,
|
291491
|
+
- ${VALID_FILE_EXTENSIONS.map((ext2) => (0, import_node_path19.join)(dir, `${toc.root}${ext2}`)).join("\n- ")}
|
291376
291492
|
`);
|
291377
291493
|
}
|
291378
291494
|
const { slug } = fileInfo2(indexFile, pageSlugs);
|
@@ -291415,18 +291531,18 @@ function sortByNumber(a2, b) {
|
|
291415
291531
|
}
|
291416
291532
|
function projectPagesFromPath(session, path42, level, pageSlugs, opts) {
|
291417
291533
|
const { ignore: ignore3, suppressWarnings } = opts || {};
|
291418
|
-
const contents =
|
291419
|
-
if (session.configFiles.filter((file) => contents.includes((0,
|
291534
|
+
const contents = import_node_fs13.default.readdirSync(path42).filter((file) => !shouldIgnoreFile(session, file)).map((file) => (0, import_node_path20.join)(path42, file)).filter((file) => !ignore3 || !ignore3.includes(file)).sort(sortByNumber);
|
291535
|
+
if (session.configFiles.filter((file) => contents.includes((0, import_node_path20.join)(path42, file))).length) {
|
291420
291536
|
session.log.debug(`\u{1F50D} Found config file, ignoring subdirectory: ${path42}`);
|
291421
291537
|
return [];
|
291422
291538
|
}
|
291423
|
-
if (contents.includes((0,
|
291539
|
+
if (contents.includes((0, import_node_path20.join)(path42, "_toc.yml"))) {
|
291424
291540
|
const prevLevel = level < 2 ? 1 : level - 1;
|
291425
291541
|
try {
|
291426
291542
|
return pagesFromToc(session, path42, prevLevel);
|
291427
291543
|
} catch {
|
291428
291544
|
if (!suppressWarnings) {
|
291429
|
-
addWarningForFile(session, (0,
|
291545
|
+
addWarningForFile(session, (0, import_node_path20.join)(path42, "_toc.yml"), `Invalid table of contents ignored`, "warn", { ruleId: RuleId.validToc });
|
291430
291546
|
}
|
291431
291547
|
}
|
291432
291548
|
}
|
@@ -291455,7 +291571,7 @@ function indexFileFromPages(pages, path42) {
|
|
291455
291571
|
const files = pages.filter((page) => "file" in page).map((page) => page.file);
|
291456
291572
|
const matcher = (ext2) => {
|
291457
291573
|
let match3;
|
291458
|
-
DEFAULT_INDEX_FILENAMES.map((index4) => `${index4}${ext2}`).map((index4) => (0,
|
291574
|
+
DEFAULT_INDEX_FILENAMES.map((index4) => `${index4}${ext2}`).map((index4) => (0, import_node_path20.join)(path42, index4).toLowerCase()).forEach((index4) => {
|
291459
291575
|
if (match3)
|
291460
291576
|
return;
|
291461
291577
|
files.forEach((file) => {
|
@@ -291468,7 +291584,7 @@ function indexFileFromPages(pages, path42) {
|
|
291468
291584
|
if (!indexFile)
|
291469
291585
|
indexFile = matcher(".md");
|
291470
291586
|
if (!indexFile)
|
291471
|
-
[indexFile] = files.filter((file) => (0,
|
291587
|
+
[indexFile] = files.filter((file) => (0, import_node_path20.extname)(file) === ".md");
|
291472
291588
|
if (!indexFile)
|
291473
291589
|
indexFile = matcher(".ipynb");
|
291474
291590
|
if (!indexFile)
|
@@ -291481,15 +291597,15 @@ async function projectFromPath(session, path42, indexFile) {
|
|
291481
291597
|
if (indexFile) {
|
291482
291598
|
if (!isValidFile(indexFile))
|
291483
291599
|
throw Error(`Index file ${indexFile} has invalid extension; must be ${ext_string}}`);
|
291484
|
-
if (!
|
291600
|
+
if (!import_node_fs13.default.existsSync(indexFile))
|
291485
291601
|
throw Error(`Index file ${indexFile} not found`);
|
291486
291602
|
}
|
291487
|
-
const rootConfigYamls = session.configFiles.map((file) => (0,
|
291603
|
+
const rootConfigYamls = session.configFiles.map((file) => (0, import_node_path20.join)(path42, file));
|
291488
291604
|
const projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
291489
291605
|
const excludePatterns = (_a6 = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.exclude) !== null && _a6 !== void 0 ? _a6 : [];
|
291490
291606
|
const excludeFiles = (await Promise.all(excludePatterns.map(async (pattern) => {
|
291491
|
-
const matches4 = await glob(pattern.split(
|
291492
|
-
return matches4.map((match3) => match3.split("/").join(
|
291607
|
+
const matches4 = await glob(pattern.split(import_node_path20.sep).join("/"));
|
291608
|
+
return matches4.map((match3) => match3.split("/").join(import_node_path20.sep)).filter((match3) => isValidFile(match3));
|
291493
291609
|
}))).flat();
|
291494
291610
|
const ignoreFiles = [...rootConfigYamls, ...excludeFiles];
|
291495
291611
|
let implicitIndex = false;
|
@@ -291512,12 +291628,12 @@ async function projectFromPath(session, path42, indexFile) {
|
|
291512
291628
|
}
|
291513
291629
|
|
291514
291630
|
// ../myst-cli/dist/project/toToc.js
|
291515
|
-
var
|
291516
|
-
var
|
291631
|
+
var import_node_fs14 = __toESM(require("fs"), 1);
|
291632
|
+
var import_node_path21 = require("path");
|
291517
291633
|
function getRelativeDocumentLink(file, path42) {
|
291518
291634
|
if (path42 === ".")
|
291519
291635
|
return removeExtension(file);
|
291520
|
-
return removeExtension((0,
|
291636
|
+
return removeExtension((0, import_node_path21.relative)(path42, file));
|
291521
291637
|
}
|
291522
291638
|
var GENERATED_TOC_HEADER = `# Table of Contents
|
291523
291639
|
#
|
@@ -291577,21 +291693,21 @@ function tocFromProject(project, path42 = ".") {
|
|
291577
291693
|
return toc;
|
291578
291694
|
}
|
291579
291695
|
function writeTocFromProject(project, path42) {
|
291580
|
-
const filename = (0,
|
291696
|
+
const filename = (0, import_node_path21.join)(path42, "_toc.yml");
|
291581
291697
|
const content3 = `${GENERATED_TOC_HEADER}${js_yaml_default.dump(tocFromProject(project, path42))}`;
|
291582
|
-
|
291698
|
+
import_node_fs14.default.writeFileSync(filename, content3);
|
291583
291699
|
}
|
291584
291700
|
|
291585
291701
|
// ../myst-cli/dist/project/load.js
|
291586
291702
|
async function loadProjectFromDisk(session, path42, opts) {
|
291587
|
-
path42 = path42 || (0,
|
291703
|
+
path42 = path42 || (0, import_node_path22.resolve)(".");
|
291588
291704
|
if (!(opts === null || opts === void 0 ? void 0 : opts.reloadProject)) {
|
291589
291705
|
const cachedProject = selectors_exports.selectLocalProject(session.store.getState(), path42);
|
291590
291706
|
if (cachedProject)
|
291591
291707
|
return cachedProject;
|
291592
291708
|
}
|
291593
291709
|
const projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
291594
|
-
const file = (0,
|
291710
|
+
const file = (0, import_node_path22.join)(path42, session.configFiles[0]);
|
291595
291711
|
if (!projectConfig && (opts === null || opts === void 0 ? void 0 : opts.warnOnNoConfig)) {
|
291596
291712
|
addWarningForFile(session, file, `Loading project from path with no config file: ${path42}
|
291597
291713
|
Consider running "myst init --project" in that directory`, "warn", { ruleId: RuleId.projectConfigExists });
|
@@ -291632,7 +291748,7 @@ Consider running "myst init --project" in that directory`, "warn", { ruleId: Rul
|
|
291632
291748
|
return true;
|
291633
291749
|
if (isUrl(bib))
|
291634
291750
|
return true;
|
291635
|
-
if (
|
291751
|
+
if (import_node_fs15.default.existsSync(bib)) {
|
291636
291752
|
allBibFiles.push(bib);
|
291637
291753
|
return true;
|
291638
291754
|
}
|
@@ -291668,20 +291784,20 @@ var import_fs_extra = __toESM(require_lib16(), 1);
|
|
291668
291784
|
var import_node_path42 = __toESM(require("path"), 1);
|
291669
291785
|
|
291670
291786
|
// ../myst-cli/dist/build/site/manifest.js
|
291671
|
-
var
|
291672
|
-
var
|
291787
|
+
var import_node_fs22 = __toESM(require("fs"), 1);
|
291788
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
291673
291789
|
|
291674
291790
|
// ../myst-cli/dist/build/site/template.js
|
291675
|
-
var
|
291676
|
-
var
|
291791
|
+
var import_node_fs20 = __toESM(require("fs"), 1);
|
291792
|
+
var import_node_path26 = require("path");
|
291677
291793
|
|
291678
291794
|
// ../myst-templates/dist/template.js
|
291679
|
-
var
|
291680
|
-
var
|
291795
|
+
var import_node_fs18 = __toESM(require("fs"), 1);
|
291796
|
+
var import_node_path25 = require("path");
|
291681
291797
|
|
291682
291798
|
// ../myst-templates/dist/download.js
|
291683
|
-
var
|
291684
|
-
var
|
291799
|
+
var import_node_fs16 = __toESM(require("fs"), 1);
|
291800
|
+
var import_node_path23 = require("path");
|
291685
291801
|
var import_node_crypto3 = require("crypto");
|
291686
291802
|
var import_adm_zip = __toESM(require_adm_zip(), 1);
|
291687
291803
|
var TEMPLATE_YML = "template.yml";
|
@@ -291739,19 +291855,19 @@ function defaultPath(template, hash, opts) {
|
|
291739
291855
|
subdirs.push(kind);
|
291740
291856
|
subdirs.push((0, import_node_crypto3.createHash)("sha256").update(template).digest("hex"));
|
291741
291857
|
} else {
|
291742
|
-
subdirs.push((0,
|
291858
|
+
subdirs.push((0, import_node_path23.join)(...template.split("/")));
|
291743
291859
|
}
|
291744
|
-
return (0,
|
291860
|
+
return (0, import_node_path23.join)(...subdirs);
|
291745
291861
|
}
|
291746
291862
|
function resolveInputs(session, opts) {
|
291747
291863
|
let templateUrl;
|
291748
291864
|
let templatePath;
|
291749
|
-
if (opts.template &&
|
291750
|
-
const { base: base5, dir } = (0,
|
291751
|
-
if (base5 === TEMPLATE_YML || Object.values(KIND_TO_EXT).filter(Boolean).includes((0,
|
291865
|
+
if (opts.template && import_node_fs16.default.existsSync(opts.template)) {
|
291866
|
+
const { base: base5, dir } = (0, import_node_path23.parse)(opts.template);
|
291867
|
+
if (base5 === TEMPLATE_YML || Object.values(KIND_TO_EXT).filter(Boolean).includes((0, import_node_path23.extname)(base5))) {
|
291752
291868
|
templatePath = dir;
|
291753
|
-
} else if (
|
291754
|
-
if (
|
291869
|
+
} else if (import_node_fs16.default.lstatSync(opts.template).isDirectory()) {
|
291870
|
+
if (import_node_fs16.default.existsSync((0, import_node_path23.join)(opts.template, TEMPLATE_YML))) {
|
291755
291871
|
templatePath = opts.template;
|
291756
291872
|
}
|
291757
291873
|
}
|
@@ -291774,26 +291890,26 @@ function resolveInputs(session, opts) {
|
|
291774
291890
|
}
|
291775
291891
|
async function unnestTemplate(session, path42) {
|
291776
291892
|
var _a6;
|
291777
|
-
const content3 =
|
291893
|
+
const content3 = import_node_fs16.default.readdirSync(path42);
|
291778
291894
|
if (content3.includes(TEMPLATE_YML))
|
291779
291895
|
return;
|
291780
291896
|
let nestedPath;
|
291781
291897
|
content3.forEach((dir) => {
|
291782
|
-
const templateYmlFile2 = (0,
|
291783
|
-
if (!nestedPath &&
|
291784
|
-
nestedPath = (0,
|
291898
|
+
const templateYmlFile2 = (0, import_node_path23.join)(path42, dir, TEMPLATE_YML);
|
291899
|
+
if (!nestedPath && import_node_fs16.default.existsSync(templateYmlFile2)) {
|
291900
|
+
nestedPath = (0, import_node_path23.join)(path42, dir);
|
291785
291901
|
}
|
291786
291902
|
});
|
291787
291903
|
if (!nestedPath)
|
291788
291904
|
return;
|
291789
|
-
const templateYmlFile = (0,
|
291790
|
-
|
291791
|
-
const templateYml = js_yaml_default.load(
|
291905
|
+
const templateYmlFile = (0, import_node_path23.join)(nestedPath, TEMPLATE_YML);
|
291906
|
+
import_node_fs16.default.copyFileSync(templateYmlFile, (0, import_node_path23.join)(path42, TEMPLATE_YML));
|
291907
|
+
const templateYml = js_yaml_default.load(import_node_fs16.default.readFileSync(templateYmlFile).toString());
|
291792
291908
|
if ((_a6 = templateYml.files) === null || _a6 === void 0 ? void 0 : _a6.length) {
|
291793
291909
|
await Promise.all(templateYml.files.map(async (file) => {
|
291794
|
-
const resolvedEntry = [...nestedPath.split(
|
291910
|
+
const resolvedEntry = [...nestedPath.split(import_node_path23.sep), file].join("/");
|
291795
291911
|
const matches4 = await glob(resolvedEntry);
|
291796
|
-
matches4.map((match3) => match3.split("/").join(
|
291912
|
+
matches4.map((match3) => match3.split("/").join(import_node_path23.sep)).filter((match3) => !isDirectory(match3)).forEach((match3) => {
|
291797
291913
|
copyFileMaintainPath(session, match3, nestedPath, path42);
|
291798
291914
|
});
|
291799
291915
|
}));
|
@@ -291841,9 +291957,9 @@ async function downloadAndUnzipTemplate(session, downloadUrl, opts) {
|
|
291841
291957
|
throw new Error(`Problem downloading template "${downloadUrl}": ${res.status} ${res.statusText}`);
|
291842
291958
|
}
|
291843
291959
|
const { templatePath } = opts;
|
291844
|
-
const zipFile = (0,
|
291845
|
-
(0,
|
291846
|
-
const fileStream = (0,
|
291960
|
+
const zipFile = (0, import_node_path23.join)(templatePath, "template.zip");
|
291961
|
+
(0, import_node_fs16.mkdirSync)(templatePath, { recursive: true });
|
291962
|
+
const fileStream = (0, import_node_fs16.createWriteStream)(zipFile);
|
291847
291963
|
await new Promise((resolve7, reject) => {
|
291848
291964
|
var _a6, _b;
|
291849
291965
|
(_a6 = res.body) === null || _a6 === void 0 ? void 0 : _a6.pipe(fileStream);
|
@@ -291986,19 +292102,19 @@ function debugLogger(session) {
|
|
291986
292102
|
}
|
291987
292103
|
|
291988
292104
|
// ../myst-templates/dist/validators.js
|
291989
|
-
var
|
291990
|
-
var
|
292105
|
+
var import_node_fs17 = __toESM(require("fs"), 1);
|
292106
|
+
var import_node_path24 = __toESM(require("path"), 1);
|
291991
292107
|
function validateFile(session, input3, opts) {
|
291992
292108
|
const filename = validateString(input3, opts);
|
291993
292109
|
if (!filename)
|
291994
292110
|
return;
|
291995
292111
|
let resolvedFile;
|
291996
292112
|
if (opts.file) {
|
291997
|
-
resolvedFile =
|
292113
|
+
resolvedFile = import_node_path24.default.resolve(import_node_path24.default.dirname(opts.file), filename);
|
291998
292114
|
} else {
|
291999
|
-
resolvedFile =
|
292115
|
+
resolvedFile = import_node_path24.default.resolve(filename);
|
292000
292116
|
}
|
292001
|
-
if (!
|
292117
|
+
if (!import_node_fs17.default.existsSync(resolvedFile)) {
|
292002
292118
|
return validationError(`unable to resolve file: ${filename}`, opts);
|
292003
292119
|
}
|
292004
292120
|
const { copyFolder, relativePathFrom } = opts;
|
@@ -292007,10 +292123,10 @@ function validateFile(session, input3, opts) {
|
|
292007
292123
|
if (!hashedFile) {
|
292008
292124
|
return validationError(`unable to copy file: ${resolvedFile} -> ${copyFolder}`, opts);
|
292009
292125
|
}
|
292010
|
-
resolvedFile =
|
292126
|
+
resolvedFile = import_node_path24.default.join(copyFolder, hashedFile);
|
292011
292127
|
}
|
292012
292128
|
if (relativePathFrom) {
|
292013
|
-
return
|
292129
|
+
return import_node_path24.default.relative(relativePathFrom, resolvedFile);
|
292014
292130
|
}
|
292015
292131
|
return resolvedFile;
|
292016
292132
|
}
|
@@ -292477,8 +292593,8 @@ function validateTemplateYml(session, input3, opts) {
|
|
292477
292593
|
const fileOpts = incrementOptions(`files.${ind}`, opts);
|
292478
292594
|
const file = validateString(val, fileOpts);
|
292479
292595
|
if (file && opts.templateDir) {
|
292480
|
-
const filePath = [...opts.templateDir.split(
|
292481
|
-
const matches4 = globSync(filePath).map((match3) => match3.split("/").join(
|
292596
|
+
const filePath = [...opts.templateDir.split(import_node_path24.default.sep), file].join("/");
|
292597
|
+
const matches4 = globSync(filePath).map((match3) => match3.split("/").join(import_node_path24.default.sep));
|
292482
292598
|
const files = matches4.filter((match3) => !isDirectory(match3));
|
292483
292599
|
if (!matches4.length) {
|
292484
292600
|
validationError(`file does not exist: ${filePath}`, fileOpts);
|
@@ -292492,12 +292608,12 @@ function validateTemplateYml(session, input3, opts) {
|
|
292492
292608
|
if (defined(value.template)) {
|
292493
292609
|
const templateOpts = incrementOptions("template", opts);
|
292494
292610
|
const template = validateString(value.template, templateOpts);
|
292495
|
-
if (template && output2.kind &&
|
292496
|
-
validationError(`template extension "${
|
292611
|
+
if (template && output2.kind && import_node_path24.default.extname(template) !== KIND_TO_EXT[output2.kind]) {
|
292612
|
+
validationError(`template extension "${import_node_path24.default.extname(template)}" must match kind "${KIND_TO_EXT[output2.kind]}"`, templateOpts);
|
292497
292613
|
}
|
292498
292614
|
if (template && opts.templateDir) {
|
292499
|
-
const templatePath = [...opts.templateDir.split(
|
292500
|
-
const matches4 = globSync(templatePath).map((match3) => match3.split("/").join(
|
292615
|
+
const templatePath = [...opts.templateDir.split(import_node_path24.default.sep), template].join("/");
|
292616
|
+
const matches4 = globSync(templatePath).map((match3) => match3.split("/").join(import_node_path24.default.sep));
|
292501
292617
|
const files = matches4.filter((match3) => !isDirectory(match3));
|
292502
292618
|
if (!matches4.length) {
|
292503
292619
|
validationError(`template does not exist: ${templatePath}`, templateOpts);
|
@@ -292537,14 +292653,14 @@ var MystTemplate = class {
|
|
292537
292653
|
this.kind = opts.kind;
|
292538
292654
|
}
|
292539
292655
|
getTemplateYmlPath() {
|
292540
|
-
return (0,
|
292656
|
+
return (0, import_node_path25.join)(this.templatePath, TEMPLATE_YML);
|
292541
292657
|
}
|
292542
292658
|
getTemplateYml() {
|
292543
292659
|
const templateYmlPath = this.getTemplateYmlPath();
|
292544
|
-
if (!
|
292660
|
+
if (!import_node_fs18.default.existsSync(templateYmlPath)) {
|
292545
292661
|
throw new Error(`The template yml at "${templateYmlPath}" does not exist`);
|
292546
292662
|
}
|
292547
|
-
const content3 =
|
292663
|
+
const content3 = import_node_fs18.default.readFileSync(templateYmlPath).toString();
|
292548
292664
|
return js_yaml_default.load(content3);
|
292549
292665
|
}
|
292550
292666
|
getValidatedTemplateYml() {
|
@@ -292625,7 +292741,7 @@ var MystTemplate = class {
|
|
292625
292741
|
return validatedDoc;
|
292626
292742
|
}
|
292627
292743
|
async ensureTemplateExistsOnPath(force) {
|
292628
|
-
if (!force &&
|
292744
|
+
if (!force && import_node_fs18.default.existsSync((0, import_node_path25.join)(this.templatePath, TEMPLATE_YML))) {
|
292629
292745
|
this.session.log.debug(`Template found: ${this.templatePath}`);
|
292630
292746
|
} else if (!this.templateUrl) {
|
292631
292747
|
throw new Error(`No template on path and no download URL to fetch from: ${this.templatePath}`);
|
@@ -292648,12 +292764,12 @@ To list valid templates, try the command "myst templates list"`);
|
|
292648
292764
|
}
|
292649
292765
|
}
|
292650
292766
|
prepare(opts) {
|
292651
|
-
if (!
|
292652
|
-
throw new Error(`The template at "${(0,
|
292767
|
+
if (!import_node_fs18.default.existsSync((0, import_node_path25.join)(this.templatePath, TEMPLATE_YML))) {
|
292768
|
+
throw new Error(`The template at "${(0, import_node_path25.join)(this.templatePath, TEMPLATE_YML)}" does not exist`);
|
292653
292769
|
}
|
292654
292770
|
const fileOpts = { copyFolder: opts.filesPath };
|
292655
292771
|
if (opts.outputPath) {
|
292656
|
-
fileOpts.relativePathFrom = (0,
|
292772
|
+
fileOpts.relativePathFrom = (0, import_node_path25.dirname)(opts.outputPath);
|
292657
292773
|
}
|
292658
292774
|
const options = this.validateOptions(opts.options, opts.sourceFile, fileOpts);
|
292659
292775
|
const parts = this.validateParts(opts.parts, options, opts.sourceFile);
|
@@ -292667,17 +292783,17 @@ To list valid templates, try the command "myst templates list"`);
|
|
292667
292783
|
(_a6 = templateYml.files) === null || _a6 === void 0 ? void 0 : _a6.forEach((file) => {
|
292668
292784
|
if (file === this.getTemplateFilename())
|
292669
292785
|
return;
|
292670
|
-
const source2 = (0,
|
292671
|
-
const dest = (0,
|
292672
|
-
if (
|
292786
|
+
const source2 = (0, import_node_path25.join)(this.templatePath, ...file.split("/"));
|
292787
|
+
const dest = (0, import_node_path25.join)(outputDir, ...file.split("/"));
|
292788
|
+
if (import_node_fs18.default.existsSync(dest)) {
|
292673
292789
|
if (!(opts === null || opts === void 0 ? void 0 : opts.force)) {
|
292674
292790
|
this.session.log.debug(`Template files ${file} already exists, not copying.`);
|
292675
292791
|
return;
|
292676
292792
|
}
|
292677
|
-
|
292793
|
+
import_node_fs18.default.rmSync(dest);
|
292678
292794
|
}
|
292679
|
-
|
292680
|
-
|
292795
|
+
import_node_fs18.default.mkdirSync((0, import_node_path25.dirname)(dest), { recursive: true });
|
292796
|
+
import_node_fs18.default.copyFileSync(source2, dest);
|
292681
292797
|
});
|
292682
292798
|
}
|
292683
292799
|
};
|
@@ -294001,7 +294117,7 @@ async function getMystTemplate(session, opts) {
|
|
294001
294117
|
}
|
294002
294118
|
async function installSiteTemplate(session, mystTemplate) {
|
294003
294119
|
var _a6, _b;
|
294004
|
-
if (
|
294120
|
+
if (import_node_fs20.default.existsSync((0, import_node_path26.join)(mystTemplate.templatePath, "node_modules")))
|
294005
294121
|
return;
|
294006
294122
|
const toc = tic();
|
294007
294123
|
session.log.info("\u2935\uFE0F Installing web libraries (can take up to 60 s)");
|
@@ -294012,26 +294128,26 @@ async function installSiteTemplate(session, mystTemplate) {
|
|
294012
294128
|
}
|
294013
294129
|
|
294014
294130
|
// ../myst-cli/dist/build/utils/collectExportOptions.js
|
294015
|
-
var
|
294016
|
-
var
|
294131
|
+
var import_node_fs21 = __toESM(require("fs"), 1);
|
294132
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
294017
294133
|
|
294018
294134
|
// ../myst-cli/dist/build/utils/defaultNames.js
|
294019
|
-
var
|
294135
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
294020
294136
|
function getDefaultExportFilename(session, file, projectPath) {
|
294021
|
-
const { name: name3 } =
|
294137
|
+
const { name: name3 } = import_node_path27.default.parse(file);
|
294022
294138
|
const slugFromProject = projectPath ? selectPageSlug(session.store.getState(), projectPath, file) : void 0;
|
294023
294139
|
const slug = slugFromProject || createSlug(name3);
|
294024
294140
|
return slug;
|
294025
294141
|
}
|
294026
294142
|
function getDefaultExportFolder(session, file, format, projectPath) {
|
294027
|
-
const subpaths = [projectPath ||
|
294143
|
+
const subpaths = [projectPath || import_node_path27.default.parse(file).dir, "_build", "exports"];
|
294028
294144
|
if (format === ExportFormats.tex) {
|
294029
294145
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_tex`);
|
294030
294146
|
}
|
294031
294147
|
if (format === ExportFormats.typst) {
|
294032
294148
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_typst`);
|
294033
294149
|
}
|
294034
|
-
return
|
294150
|
+
return import_node_path27.default.join(...subpaths);
|
294035
294151
|
}
|
294036
294152
|
|
294037
294153
|
// ../myst-cli/dist/build/utils/collectExportOptions.js
|
@@ -294071,8 +294187,8 @@ function resolveTemplate(sourceFile, exp, disableTemplate) {
|
|
294071
294187
|
if (disableTemplate)
|
294072
294188
|
return null;
|
294073
294189
|
if (exp.template) {
|
294074
|
-
const resolvedTemplatePath =
|
294075
|
-
if (
|
294190
|
+
const resolvedTemplatePath = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), exp.template);
|
294191
|
+
if (import_node_fs21.default.existsSync(resolvedTemplatePath)) {
|
294076
294192
|
return resolvedTemplatePath;
|
294077
294193
|
}
|
294078
294194
|
}
|
@@ -294086,7 +294202,7 @@ function resolveFormat(vfile2, exp) {
|
|
294086
294202
|
let suggestedPdfFormat = ExportFormats.pdf;
|
294087
294203
|
let suggestedOutputFormat;
|
294088
294204
|
if (exp.output) {
|
294089
|
-
const ext2 =
|
294205
|
+
const ext2 = import_node_path28.default.extname(exp.output);
|
294090
294206
|
if (!ext2) {
|
294091
294207
|
suggestedPdfFormat = ExportFormats.pdftex;
|
294092
294208
|
} else {
|
@@ -294099,8 +294215,8 @@ function resolveFormat(vfile2, exp) {
|
|
294099
294215
|
return ExportFormats.typst;
|
294100
294216
|
if ((_c = exp.template) === null || _c === void 0 ? void 0 : _c.endsWith("-docx"))
|
294101
294217
|
return ExportFormats.docx;
|
294102
|
-
if (exp.template &&
|
294103
|
-
const templateFiles =
|
294218
|
+
if (exp.template && import_node_fs21.default.existsSync(exp.template)) {
|
294219
|
+
const templateFiles = import_node_fs21.default.readdirSync(exp.template);
|
294104
294220
|
const templateTexFiles = templateFiles.filter((file) => file.endsWith(".tex"));
|
294105
294221
|
const templateTypFiles = templateFiles.filter((file) => file.endsWith(".typ"));
|
294106
294222
|
if (templateTexFiles.length && !templateTypFiles.length)
|
@@ -294117,13 +294233,13 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
294117
294233
|
const { articles, sub_articles } = exp;
|
294118
294234
|
let resolved = { articles, sub_articles };
|
294119
294235
|
if (exp.toc && !resolved.articles && !resolved.sub_articles) {
|
294120
|
-
const resolvedToc =
|
294236
|
+
const resolvedToc = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), exp.toc);
|
294121
294237
|
if (validateTOC(session, resolvedToc)) {
|
294122
294238
|
resolved = resolveArticlesFromTOC(session, exp, resolvedToc, vfile2);
|
294123
294239
|
}
|
294124
294240
|
}
|
294125
|
-
if (!resolved.articles && SOURCE_EXTENSIONS.includes(
|
294126
|
-
resolved.articles = [{ file:
|
294241
|
+
if (!resolved.articles && SOURCE_EXTENSIONS.includes(import_node_path28.default.extname(sourceFile))) {
|
294242
|
+
resolved.articles = [{ file: import_node_path28.default.resolve(sourceFile) }];
|
294127
294243
|
}
|
294128
294244
|
if (((_a6 = resolved.articles) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && resolved.articles[0].level == null) {
|
294129
294245
|
resolved.articles[0].level = 0;
|
@@ -294147,8 +294263,8 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
294147
294263
|
resolved.articles = (_c = resolved.articles) === null || _c === void 0 ? void 0 : _c.map((article) => {
|
294148
294264
|
if (!article.file)
|
294149
294265
|
return article;
|
294150
|
-
const resolvedFile =
|
294151
|
-
if (!
|
294266
|
+
const resolvedFile = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), article.file);
|
294267
|
+
if (!import_node_fs21.default.existsSync(resolvedFile)) {
|
294152
294268
|
fileError(vfile2, `Invalid export article - '${article.file}' does not exist`, {
|
294153
294269
|
ruleId: RuleId.exportArticleExists
|
294154
294270
|
});
|
@@ -294157,8 +294273,8 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
294157
294273
|
return { ...article, file: resolvedFile };
|
294158
294274
|
}).filter((article) => !!article);
|
294159
294275
|
resolved.sub_articles = (_d2 = resolved.sub_articles) === null || _d2 === void 0 ? void 0 : _d2.map((file) => {
|
294160
|
-
const resolvedFile =
|
294161
|
-
if (!
|
294276
|
+
const resolvedFile = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), file);
|
294277
|
+
if (!import_node_fs21.default.existsSync(resolvedFile)) {
|
294162
294278
|
fileError(vfile2, `Invalid export sub_article - '${file}' does not exist`, {
|
294163
294279
|
ruleId: RuleId.exportArticleExists
|
294164
294280
|
});
|
@@ -294183,7 +294299,7 @@ function resolveOutput(session, sourceFile, vfile2, exp, projectPath) {
|
|
294183
294299
|
var _a6, _b, _c, _d2, _e;
|
294184
294300
|
let output2;
|
294185
294301
|
if (exp.output) {
|
294186
|
-
output2 =
|
294302
|
+
output2 = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), exp.output);
|
294187
294303
|
} else {
|
294188
294304
|
output2 = getDefaultExportFolder(session, sourceFile, exp.format, projectPath);
|
294189
294305
|
}
|
@@ -294194,16 +294310,16 @@ function resolveOutput(session, sourceFile, vfile2, exp, projectPath) {
|
|
294194
294310
|
fileWarn(vfile2, `ignoring "zip: true" for export of format "${exp.format}"`);
|
294195
294311
|
exp.zip = false;
|
294196
294312
|
}
|
294197
|
-
if (!
|
294313
|
+
if (!import_node_path28.default.extname(output2)) {
|
294198
294314
|
const basename3 = getDefaultExportFilename(session, (_c = (_b = singleArticleWithFile(exp.articles)) === null || _b === void 0 ? void 0 : _b.file) !== null && _c !== void 0 ? _c : sourceFile, projectPath);
|
294199
294315
|
const ext2 = exp.zip ? ".zip" : (_d2 = ALLOWED_EXTENSIONS[exp.format]) === null || _d2 === void 0 ? void 0 : _d2[0];
|
294200
|
-
output2 =
|
294316
|
+
output2 = import_node_path28.default.join(output2, `${basename3}${ext2 !== null && ext2 !== void 0 ? ext2 : ""}`);
|
294201
294317
|
}
|
294202
|
-
if (!((_e = ALLOWED_EXTENSIONS[exp.format]) === null || _e === void 0 ? void 0 : _e.includes(
|
294318
|
+
if (!((_e = ALLOWED_EXTENSIONS[exp.format]) === null || _e === void 0 ? void 0 : _e.includes(import_node_path28.default.extname(output2)))) {
|
294203
294319
|
fileError(vfile2, `Output file "${output2}" has invalid extension for export format of "${exp.format}"`, { ruleId: RuleId.exportExtensionCorrect });
|
294204
294320
|
return void 0;
|
294205
294321
|
}
|
294206
|
-
if (exp.zip &&
|
294322
|
+
if (exp.zip && import_node_path28.default.extname(output2) !== ".zip") {
|
294207
294323
|
fileWarn(vfile2, `Output file "${output2}" has non-zip extension but "zip: true" is specified; ignoring "zip: true"`, { ruleId: RuleId.exportExtensionCorrect });
|
294208
294324
|
}
|
294209
294325
|
return output2;
|
@@ -294252,10 +294368,10 @@ function filterAndMakeUnique(exports2) {
|
|
294252
294368
|
const nMatch = (a2) => a2.filter((e2) => e2.output === exp.output).length;
|
294253
294369
|
if (nMatch(arr) === 1)
|
294254
294370
|
return { ...exp };
|
294255
|
-
const { dir, name: name3, ext: ext2 } =
|
294371
|
+
const { dir, name: name3, ext: ext2 } = import_node_path28.default.parse(exp.output);
|
294256
294372
|
return {
|
294257
294373
|
...exp,
|
294258
|
-
output:
|
294374
|
+
output: import_node_path28.default.join(dir, `${name3}_${nMatch(arr.slice(0, ind))}${ext2}`)
|
294259
294375
|
};
|
294260
294376
|
});
|
294261
294377
|
}
|
@@ -294272,7 +294388,7 @@ async function collectExportOptions(session, files, formats, opts) {
|
|
294272
294388
|
await Promise.all(sourceFiles.map(async (file) => {
|
294273
294389
|
let fileProjectPath;
|
294274
294390
|
if (!projectPath) {
|
294275
|
-
fileProjectPath = findCurrentProjectAndLoad(session,
|
294391
|
+
fileProjectPath = findCurrentProjectAndLoad(session, import_node_path28.default.dirname(file));
|
294276
294392
|
if (fileProjectPath)
|
294277
294393
|
await loadProjectFromDisk(session, fileProjectPath);
|
294278
294394
|
} else {
|
@@ -294298,9 +294414,9 @@ async function resolvePageExports(session, file) {
|
|
294298
294414
|
ExportFormats.xml,
|
294299
294415
|
ExportFormats.meca
|
294300
294416
|
], {})).filter((exp) => {
|
294301
|
-
return [".docx", ".pdf", ".zip", ".xml"].includes(
|
294417
|
+
return [".docx", ".pdf", ".zip", ".xml"].includes(import_node_path29.default.extname(exp.output));
|
294302
294418
|
}).filter((exp) => {
|
294303
|
-
return
|
294419
|
+
return import_node_fs22.default.existsSync(exp.output);
|
294304
294420
|
});
|
294305
294421
|
const exportsAsDownloads = exports2.map((exp) => {
|
294306
294422
|
const { format, output: output2 } = exp;
|
@@ -294309,7 +294425,7 @@ async function resolvePageExports(session, file) {
|
|
294309
294425
|
ruleId: RuleId.exportFileCopied
|
294310
294426
|
});
|
294311
294427
|
});
|
294312
|
-
return { format, filename:
|
294428
|
+
return { format, filename: import_node_path29.default.basename(output2), url: `/${fileHash}` };
|
294313
294429
|
});
|
294314
294430
|
return exportsAsDownloads;
|
294315
294431
|
}
|
@@ -294333,7 +294449,7 @@ async function resolvePageDownloads(session, file, projectPath) {
|
|
294333
294449
|
const resolvedDownloads = (_a6 = pageFrontmatter === null || pageFrontmatter === void 0 ? void 0 : pageFrontmatter.downloads) === null || _a6 === void 0 ? void 0 : _a6.map((download) => {
|
294334
294450
|
var _a7;
|
294335
294451
|
if (download.id && !expLookup[download.id]) {
|
294336
|
-
addWarningForFile(session, file, `
|
294452
|
+
addWarningForFile(session, file, `Unable to locate download file by export id "${download.id}"`, "error", {
|
294337
294453
|
ruleId: RuleId.exportFileCopied
|
294338
294454
|
});
|
294339
294455
|
return void 0;
|
@@ -294399,8 +294515,8 @@ async function localToManifestProject(session, projectPath, projectSlug) {
|
|
294399
294515
|
const projConfigFile = selectors_exports.selectLocalConfigFile(state, projectPath);
|
294400
294516
|
const exports2 = projConfigFile ? await resolvePageExports(session, projConfigFile) : [];
|
294401
294517
|
const downloads = projConfigFile ? await resolvePageDownloads(session, projConfigFile, projectPath) : void 0;
|
294402
|
-
const banner = await transformBanner(session,
|
294403
|
-
const thumbnail = await transformThumbnail(session, null,
|
294518
|
+
const banner = await transformBanner(session, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/" });
|
294519
|
+
const thumbnail = await transformThumbnail(session, null, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/" });
|
294404
294520
|
return {
|
294405
294521
|
...projFrontmatter,
|
294406
294522
|
// TODO: a null in the project frontmatter should not fall back to index page
|
@@ -294464,8 +294580,8 @@ function resolveSiteAction(session, action, file, property) {
|
|
294464
294580
|
static: false
|
294465
294581
|
};
|
294466
294582
|
}
|
294467
|
-
const resolvedFile =
|
294468
|
-
if (!
|
294583
|
+
const resolvedFile = import_node_path29.default.resolve(import_node_path29.default.dirname(file), action.url);
|
294584
|
+
if (!import_node_fs22.default.existsSync(resolvedFile)) {
|
294469
294585
|
if (action.static) {
|
294470
294586
|
addWarningForFile(session, file, `Could not find static resource at "${action.url}" in ${property}`, "error", { ruleId: RuleId.staticActionFileCopied });
|
294471
294587
|
return void 0;
|
@@ -294498,12 +294614,12 @@ function resolveSiteAction(session, action, file, property) {
|
|
294498
294614
|
if (!title) {
|
294499
294615
|
addWarningForFile(session, file, `using filename for title of resource "${action.url}" in ${property}`);
|
294500
294616
|
}
|
294501
|
-
const filename = (_a6 = action.filename) !== null && _a6 !== void 0 ? _a6 :
|
294617
|
+
const filename = (_a6 = action.filename) !== null && _a6 !== void 0 ? _a6 : import_node_path29.default.basename(resolvedFile);
|
294502
294618
|
return {
|
294503
294619
|
title: (_b = action.title) !== null && _b !== void 0 ? _b : filename,
|
294504
294620
|
url: `/${fileHash}`,
|
294505
294621
|
filename,
|
294506
|
-
format: (_c = action.format) !== null && _c !== void 0 ? _c : EXT_TO_FORMAT[
|
294622
|
+
format: (_c = action.format) !== null && _c !== void 0 ? _c : EXT_TO_FORMAT[import_node_path29.default.extname(resolvedFile)],
|
294507
294623
|
static: true
|
294508
294624
|
};
|
294509
294625
|
}
|
@@ -294907,15 +295023,15 @@ var Domains;
|
|
294907
295023
|
})(Domains || (Domains = {}));
|
294908
295024
|
|
294909
295025
|
// ../myst-cli/dist/process/loadIntersphinx.js
|
294910
|
-
var
|
294911
|
-
var
|
295026
|
+
var import_node_fs23 = __toESM(require("fs"), 1);
|
295027
|
+
var import_node_path30 = require("path");
|
294912
295028
|
function inventoryCacheFile(session, id, path42) {
|
294913
295029
|
const hashcontent = `${id}${path42}`;
|
294914
295030
|
const filename = `intersphinx-${computeHash(hashcontent)}.inv`;
|
294915
|
-
const cacheFolder = (0,
|
294916
|
-
if (!
|
294917
|
-
|
294918
|
-
return (0,
|
295031
|
+
const cacheFolder = (0, import_node_path30.join)(session.buildPath(), "cache");
|
295032
|
+
if (!import_node_fs23.default.existsSync(cacheFolder))
|
295033
|
+
import_node_fs23.default.mkdirSync(cacheFolder, { recursive: true });
|
295034
|
+
return (0, import_node_path30.join)(cacheFolder, filename);
|
294919
295035
|
}
|
294920
295036
|
async function loadIntersphinx(session, opts) {
|
294921
295037
|
const state = session.store.getState();
|
@@ -294937,7 +295053,7 @@ async function loadIntersphinx(session, opts) {
|
|
294937
295053
|
if (!cache.$externalReferences[key2] || opts.force) {
|
294938
295054
|
const inventory = new Inventory({ id: key2, path: object.url });
|
294939
295055
|
const cachePath = inventoryCacheFile(session, key2, inventory.path);
|
294940
|
-
if (
|
295056
|
+
if (import_node_fs23.default.existsSync(cachePath) && !opts.force) {
|
294941
295057
|
const localInventory = new Inventory({ id: key2, path: cachePath });
|
294942
295058
|
session.log.debug(`Loading cached inventory file for ${inventory.path}: ${cachePath}`);
|
294943
295059
|
const toc = tic();
|
@@ -294971,7 +295087,7 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
294971
295087
|
return null;
|
294972
295088
|
}
|
294973
295089
|
const cachePath = inventoryCacheFile(session, loader2.id, loader2.path);
|
294974
|
-
if (!
|
295090
|
+
if (!import_node_fs23.default.existsSync(cachePath) && isUrl(loader2.path)) {
|
294975
295091
|
session.log.debug(`Saving remote inventory file to cache ${loader2.path}: ${cachePath}`);
|
294976
295092
|
loader2.write(cachePath);
|
294977
295093
|
}
|
@@ -295237,58 +295353,102 @@ function transformLiftCodeBlocksInJupytext(mdast2) {
|
|
295237
295353
|
}
|
295238
295354
|
|
295239
295355
|
// ../myst-cli/dist/transforms/dois.js
|
295240
|
-
var
|
295241
|
-
var
|
295242
|
-
|
295243
|
-
|
295244
|
-
|
295245
|
-
|
295246
|
-
|
295247
|
-
|
295356
|
+
var import_node_fs24 = __toESM(require("fs"), 1);
|
295357
|
+
var import_node_path31 = require("path");
|
295358
|
+
var CSL_JSON_MIMETYPE = "application/vnd.citationstyles.csl+json";
|
295359
|
+
var BIBTEX_MIMETYPE = "application/x-bibtex";
|
295360
|
+
function doiCSLJSONCacheFile(session, normalizedDoi) {
|
295361
|
+
const filename = `doi-${computeHash(normalizedDoi)}.csl.json`;
|
295362
|
+
const cacheFolder = (0, import_node_path31.join)(session.buildPath(), "cache");
|
295363
|
+
if (!import_node_fs24.default.existsSync(cacheFolder))
|
295364
|
+
import_node_fs24.default.mkdirSync(cacheFolder, { recursive: true });
|
295365
|
+
return (0, import_node_path31.join)(cacheFolder, filename);
|
295248
295366
|
}
|
295249
295367
|
function doiResolvesCacheFile(session, normalizedDoi) {
|
295250
295368
|
const filename = `doi-${computeHash(normalizedDoi)}.txt`;
|
295251
|
-
const cacheFolder = (0,
|
295252
|
-
if (!
|
295253
|
-
|
295254
|
-
return (0,
|
295369
|
+
const cacheFolder = (0, import_node_path31.join)(session.buildPath(), "cache");
|
295370
|
+
if (!import_node_fs24.default.existsSync(cacheFolder))
|
295371
|
+
import_node_fs24.default.mkdirSync(cacheFolder, { recursive: true });
|
295372
|
+
return (0, import_node_path31.join)(cacheFolder, filename);
|
295255
295373
|
}
|
295256
|
-
async function
|
295257
|
-
|
295258
|
-
const
|
295259
|
-
|
295260
|
-
|
295261
|
-
|
295262
|
-
|
295263
|
-
|
295264
|
-
|
295265
|
-
|
295374
|
+
async function resolveDOIAsBibTeX(session, url) {
|
295375
|
+
session.log.debug("Fetching DOI BibTeX from doi.org");
|
295376
|
+
const response = await session.fetch(url, {
|
295377
|
+
headers: [["Accept", BIBTEX_MIMETYPE]]
|
295378
|
+
}).catch(() => {
|
295379
|
+
session.log.debug(`Request to ${url} failed.`);
|
295380
|
+
return void 0;
|
295381
|
+
});
|
295382
|
+
if (!response || !response.ok) {
|
295383
|
+
session.log.debug(`doi.org fetch failed for ${url}`);
|
295384
|
+
return void 0;
|
295266
295385
|
}
|
295267
|
-
const
|
295268
|
-
|
295386
|
+
const data = await response.text();
|
295387
|
+
return parseBibTeX(data);
|
295388
|
+
}
|
295389
|
+
async function resolveDOIAsCSLJSON(session, url) {
|
295390
|
+
session.log.debug("Fetching DOI CSL JSON from doi.org");
|
295269
295391
|
const response = await session.fetch(url, {
|
295270
|
-
headers: [["Accept",
|
295392
|
+
headers: [["Accept", CSL_JSON_MIMETYPE]]
|
295271
295393
|
}).catch(() => {
|
295272
295394
|
session.log.debug(`Request to ${url} failed.`);
|
295273
|
-
return
|
295395
|
+
return void 0;
|
295274
295396
|
});
|
295275
295397
|
if (!response || !response.ok) {
|
295276
|
-
session.log.debug(`doi.org fetch failed for ${
|
295277
|
-
return
|
295398
|
+
session.log.debug(`doi.org fetch failed for ${url}`);
|
295399
|
+
return void 0;
|
295278
295400
|
}
|
295279
|
-
const
|
295280
|
-
|
295281
|
-
|
295282
|
-
|
295283
|
-
|
295401
|
+
const data = await response.json();
|
295402
|
+
return parseCSLJSON([data]);
|
295403
|
+
}
|
295404
|
+
async function resolveDoiOrg(session, doiString) {
|
295405
|
+
const normalizedDoi = doi.normalize(doiString);
|
295406
|
+
const url = doi.buildUrl(doiString);
|
295407
|
+
if (!doi.validate(doiString) || !normalizedDoi || !url)
|
295408
|
+
return void 0;
|
295409
|
+
const cachePath = doiCSLJSONCacheFile(session, normalizedDoi);
|
295410
|
+
if (import_node_fs24.default.existsSync(cachePath)) {
|
295411
|
+
const cached = import_node_fs24.default.readFileSync(cachePath).toString();
|
295412
|
+
session.log.debug(`Loaded cached reference CSL-JSON for doi:${normalizedDoi}`);
|
295413
|
+
return JSON.parse(cached);
|
295414
|
+
}
|
295415
|
+
const toc = tic();
|
295416
|
+
let data;
|
295417
|
+
try {
|
295418
|
+
data = await resolveDOIAsBibTeX(session, url);
|
295419
|
+
if (data) {
|
295420
|
+
session.log.debug(toc(`Fetched reference BibTeX for doi:${normalizedDoi} in %s`));
|
295421
|
+
} else {
|
295422
|
+
session.log.debug(`BibTeX not available from doi.org for doi:${normalizedDoi}, trying CSL-JSON`);
|
295423
|
+
}
|
295424
|
+
} catch (error) {
|
295425
|
+
session.log.debug(`BibTeX from doi.org was malformed for doi:${normalizedDoi}, trying CSL-JSON`);
|
295426
|
+
}
|
295427
|
+
if (!data) {
|
295428
|
+
try {
|
295429
|
+
data = await resolveDOIAsCSLJSON(session, url);
|
295430
|
+
if (data) {
|
295431
|
+
session.log.debug(toc(`Fetched reference CSL-JSON for doi:${normalizedDoi} in %s`));
|
295432
|
+
} else {
|
295433
|
+
session.log.debug(`CSL-JSON not available from doi.org for doi:${normalizedDoi}`);
|
295434
|
+
}
|
295435
|
+
} catch (error) {
|
295436
|
+
session.log.debug(`CSL-JSON from doi.org was malformed for doi:${normalizedDoi}`);
|
295437
|
+
}
|
295438
|
+
}
|
295439
|
+
if (!data)
|
295440
|
+
return void 0;
|
295441
|
+
session.log.debug(`Saving DOI CSL-JSON to cache ${cachePath}`);
|
295442
|
+
import_node_fs24.default.writeFileSync(cachePath, JSON.stringify(data));
|
295443
|
+
return data;
|
295284
295444
|
}
|
295285
295445
|
async function doiOrgResolves(session, doiString) {
|
295286
295446
|
const normalizedDoi = doi.normalize(doiString);
|
295287
|
-
const url = doi.buildUrl(
|
295447
|
+
const url = doi.buildUrl(doiString);
|
295288
295448
|
if (!doi.validate(doiString) || !normalizedDoi || !url)
|
295289
295449
|
return false;
|
295290
295450
|
const cachePath = doiResolvesCacheFile(session, normalizedDoi);
|
295291
|
-
if (
|
295451
|
+
if (import_node_fs24.default.existsSync(cachePath)) {
|
295292
295452
|
session.log.debug(`Loaded cached resolution result for doi:${normalizedDoi}`);
|
295293
295453
|
return true;
|
295294
295454
|
}
|
@@ -295304,35 +295464,48 @@ async function doiOrgResolves(session, doiString) {
|
|
295304
295464
|
}
|
295305
295465
|
session.log.debug(toc(`Resolved doi existence for doi:${normalizedDoi} in %s`));
|
295306
295466
|
session.log.debug(`Saving resolution result to cache ${cachePath}`);
|
295307
|
-
|
295467
|
+
import_node_fs24.default.writeFileSync(cachePath, "ok");
|
295308
295468
|
return true;
|
295309
295469
|
}
|
295310
295470
|
async function getCitation(session, vfile2, doiString, node3) {
|
295311
295471
|
if (!doi.validate(doiString))
|
295312
295472
|
return null;
|
295313
|
-
const
|
295314
|
-
if (!
|
295473
|
+
const data = await resolveDoiOrg(session, doiString);
|
295474
|
+
if (!data) {
|
295315
295475
|
const resolves = await doiOrgResolves(session, doiString);
|
295316
295476
|
const normalizedDoi = doi.normalize(doiString);
|
295317
295477
|
let message;
|
295318
295478
|
let note;
|
295319
295479
|
if (resolves) {
|
295320
|
-
message = `
|
295321
|
-
note = `To resolve this error, visit ${doi.buildUrl(
|
295480
|
+
message = `Citation data from doi.org was not available or malformed for doi:${normalizedDoi}`;
|
295481
|
+
note = `To resolve this error, visit ${doi.buildUrl(doiString)} and add citation info to local BibTeX file`;
|
295322
295482
|
} else {
|
295323
|
-
message = `Could not find DOI
|
295483
|
+
message = `Could not find DOI "${doiString}" from doi.org as doi:${normalizedDoi}`;
|
295484
|
+
note = "Please check the DOI and, if correct, add citation info to local BibTeX file";
|
295324
295485
|
}
|
295325
|
-
|
295486
|
+
fileError(vfile2, message, {
|
295326
295487
|
node: node3,
|
295327
295488
|
ruleId: RuleId.doiLinkValid,
|
295328
295489
|
note
|
295329
295490
|
});
|
295330
295491
|
return null;
|
295331
295492
|
}
|
295332
|
-
|
295333
|
-
|
295334
|
-
|
295335
|
-
|
295493
|
+
try {
|
295494
|
+
const renderer = await getCitationRenderers(data);
|
295495
|
+
const id = Object.keys(renderer)[0];
|
295496
|
+
const render3 = renderer[id];
|
295497
|
+
return { id, render: render3 };
|
295498
|
+
} catch (error) {
|
295499
|
+
fileError(vfile2, `Citation data from doi.org was malformed, please edit and add to your local references`, {
|
295500
|
+
node: node3,
|
295501
|
+
ruleId: RuleId.doiLinkValid,
|
295502
|
+
note: `Citation data from ${doiString}:
|
295503
|
+
|
295504
|
+
${JSON.stringify(data)}
|
295505
|
+
`
|
295506
|
+
});
|
295507
|
+
return null;
|
295508
|
+
}
|
295336
295509
|
}
|
295337
295510
|
async function transformLinkedDOIs(session, vfile2, mdast2, doiRenderer, path42) {
|
295338
295511
|
const toc = tic();
|
@@ -295366,11 +295539,12 @@ async function transformLinkedDOIs(session, vfile2, mdast2, doiRenderer, path42)
|
|
295366
295539
|
return false;
|
295367
295540
|
}
|
295368
295541
|
doiRenderer[node3.url] = cite3;
|
295369
|
-
|
295542
|
+
const label = cite3.render.getLabel();
|
295543
|
+
renderer[label] = cite3.render;
|
295370
295544
|
const citeNode = node3;
|
295371
295545
|
citeNode.type = "cite";
|
295372
295546
|
citeNode.kind = "narrative";
|
295373
|
-
citeNode.label =
|
295547
|
+
citeNode.label = label;
|
295374
295548
|
if (doi.validate(toText(citeNode.children))) {
|
295375
295549
|
citeNode.children = [];
|
295376
295550
|
}
|
@@ -295386,8 +295560,9 @@ async function transformLinkedDOIs(session, vfile2, mdast2, doiRenderer, path42)
|
|
295386
295560
|
return false;
|
295387
295561
|
}
|
295388
295562
|
doiRenderer[node3.label] = cite3;
|
295389
|
-
|
295390
|
-
|
295563
|
+
const label = cite3.render.getLabel();
|
295564
|
+
renderer[label] = cite3.render;
|
295565
|
+
node3.label = label;
|
295391
295566
|
return true;
|
295392
295567
|
})
|
295393
295568
|
]);
|
@@ -295537,6 +295712,54 @@ function embedTransform(session, mdast2, file, dependencies, state) {
|
|
295537
295712
|
liftChildren(mdast2, "_lift");
|
295538
295713
|
}
|
295539
295714
|
|
295715
|
+
// ../myst-cli/dist/transforms/include.js
|
295716
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
295717
|
+
var import_node_fs25 = __toESM(require("fs"), 1);
|
295718
|
+
var makeFileResolver = (baseFile) => (relativeFile, sourceFile, vfile2) => {
|
295719
|
+
const base5 = sourceFile.toLowerCase().endsWith(".tex") ? baseFile : sourceFile;
|
295720
|
+
const fullFile = import_node_path32.default.resolve(import_node_path32.default.dirname(base5), relativeFile);
|
295721
|
+
if (!import_node_fs25.default.existsSync(fullFile)) {
|
295722
|
+
fileError(vfile2, `Include Directive: Could not find "${relativeFile}" relative to "${base5}"`, {
|
295723
|
+
ruleId: RuleId.includeContentLoads
|
295724
|
+
});
|
295725
|
+
return;
|
295726
|
+
}
|
295727
|
+
return fullFile;
|
295728
|
+
};
|
295729
|
+
var makeFileLoader = (session, baseFile) => (fullFile) => {
|
295730
|
+
session.store.dispatch(watch.actions.addLocalDependency({
|
295731
|
+
path: baseFile,
|
295732
|
+
dependency: fullFile
|
295733
|
+
}));
|
295734
|
+
return import_node_fs25.default.readFileSync(fullFile).toString();
|
295735
|
+
};
|
295736
|
+
var makeContentParser = (session) => async (filename, content3, vfile2) => {
|
295737
|
+
var _a6;
|
295738
|
+
if (filename.toLowerCase().endsWith(".html")) {
|
295739
|
+
return [{ type: "html", value: content3 }];
|
295740
|
+
}
|
295741
|
+
if (filename.toLowerCase().endsWith(".tex")) {
|
295742
|
+
const subTex = new TexParser(content3, vfile2);
|
295743
|
+
return (_a6 = subTex.ast.children) !== null && _a6 !== void 0 ? _a6 : [];
|
295744
|
+
}
|
295745
|
+
if (filename.toLowerCase().endsWith(".ipynb")) {
|
295746
|
+
const mdast2 = await processNotebook(session, filename, content3);
|
295747
|
+
return mdast2.children;
|
295748
|
+
}
|
295749
|
+
return parseMyst(session, content3, filename).children;
|
295750
|
+
};
|
295751
|
+
async function includeFilesTransform(session, baseFile, tree, vfile2) {
|
295752
|
+
const parseContent = makeContentParser(session);
|
295753
|
+
const loadFile2 = makeFileLoader(session, baseFile);
|
295754
|
+
const resolveFile = makeFileResolver(baseFile);
|
295755
|
+
await includeDirectiveTransform(tree, vfile2, {
|
295756
|
+
resolveFile,
|
295757
|
+
loadFile: loadFile2,
|
295758
|
+
parseContent,
|
295759
|
+
sourceFile: baseFile
|
295760
|
+
});
|
295761
|
+
}
|
295762
|
+
|
295540
295763
|
// ../myst-cli/dist/transforms/links.js
|
295541
295764
|
var import_node_fs26 = __toESM(require("fs"), 1);
|
295542
295765
|
var import_node_path33 = __toESM(require("path"), 1);
|
@@ -295685,7 +295908,8 @@ async function checkLinksTransform(session, file, mdast2) {
|
|
295685
295908
|
const status = check2.status ? ` (${check2.status}, ${check2.statusText})` : "";
|
295686
295909
|
addWarningForFile(session, file, `Link for "${url}" did not resolve.${status}`, "error", {
|
295687
295910
|
position: position6,
|
295688
|
-
ruleId: RuleId.linkResolves
|
295911
|
+
ruleId: RuleId.linkResolves,
|
295912
|
+
key: url
|
295689
295913
|
});
|
295690
295914
|
return url;
|
295691
295915
|
})));
|
@@ -296129,7 +296353,7 @@ async function kernelExecutionTransform(tree, vfile2, opts) {
|
|
296129
296353
|
} else {
|
296130
296354
|
let sessionConnection;
|
296131
296355
|
const sessionOpts = {
|
296132
|
-
path: vfile2.path,
|
296356
|
+
path: import_node_path36.default.relative(opts.basePath, vfile2.path),
|
296133
296357
|
type: "notebook",
|
296134
296358
|
name: import_node_path36.default.basename(vfile2.path),
|
296135
296359
|
kernel: {
|
@@ -296694,12 +296918,16 @@ async function launchJupyterServer(contentPath, log) {
|
|
296694
296918
|
const pythonPath = import_which3.default.sync("python");
|
296695
296919
|
const proc2 = (0, import_node_child_process.spawn)(pythonPath, ["-m", "jupyter_server", "--ServerApp.root_dir", contentPath]);
|
296696
296920
|
const reader = proc2.stderr;
|
296921
|
+
let timerID;
|
296697
296922
|
const settings = await new Promise((resolve7, reject) => {
|
296698
|
-
|
296699
|
-
log.error(`\u{1FA90} ${source_default3.redBright("Jupyter server did not respond")}
|
296700
|
-
${source_default3.dim(url)}`);
|
296923
|
+
timerID = setTimeout(() => {
|
296924
|
+
log.error(`\u{1FA90} ${source_default3.redBright("Jupyter server did not respond")}`);
|
296701
296925
|
reject();
|
296702
296926
|
}, 2e4);
|
296927
|
+
proc2.on("exit", () => {
|
296928
|
+
log.error(`\u{1FA90} ${source_default3.redBright("Jupyter server did not start")}`);
|
296929
|
+
reject();
|
296930
|
+
});
|
296703
296931
|
reader.on("data", (buf) => {
|
296704
296932
|
const data = buf.toString();
|
296705
296933
|
const match3 = data.match(/([^\s]*?)\?token=([^\s]*)/);
|
@@ -296707,7 +296935,6 @@ async function launchJupyterServer(contentPath, log) {
|
|
296707
296935
|
return;
|
296708
296936
|
}
|
296709
296937
|
const [, addr, token] = match3;
|
296710
|
-
clearTimeout(id);
|
296711
296938
|
resolve7({
|
296712
296939
|
baseUrl: addr,
|
296713
296940
|
token
|
@@ -296715,7 +296942,13 @@ async function launchJupyterServer(contentPath, log) {
|
|
296715
296942
|
});
|
296716
296943
|
}).finally(
|
296717
296944
|
// Don't keep listening to messages
|
296718
|
-
() =>
|
296945
|
+
() => {
|
296946
|
+
reader.removeAllListeners("data");
|
296947
|
+
proc2.removeAllListeners("exit");
|
296948
|
+
if (timerID !== void 0) {
|
296949
|
+
clearTimeout(timerID);
|
296950
|
+
}
|
296951
|
+
}
|
296719
296952
|
);
|
296720
296953
|
const url = `${settings.baseUrl}?token=${settings.token}`;
|
296721
296954
|
log.info(`\u{1FA90} ${source_default3.greenBright("Jupyter server started")}
|
@@ -296851,6 +297084,7 @@ async function transformMdast(session, opts) {
|
|
296851
297084
|
if (execute) {
|
296852
297085
|
const cachePath = import_node_path38.default.join(session.buildPath(), "execute");
|
296853
297086
|
await kernelExecutionTransform(mdast2, vfile2, {
|
297087
|
+
basePath: session.sourcePath(),
|
296854
297088
|
cache: new LocalDiskCache(cachePath),
|
296855
297089
|
sessionFactory: () => session.jupyterSessionManager(),
|
296856
297090
|
frontmatter,
|
@@ -297262,7 +297496,8 @@ ${page.file}
|
|
297262
297496
|
if (hasWarnings[0] > 0) {
|
297263
297497
|
const pluralE = hasWarnings[0] > 1 ? "s" : "";
|
297264
297498
|
const pluralW = hasWarnings[1] > 1 ? "s" : "";
|
297265
|
-
|
297499
|
+
session.log.error(`Site has ${hasWarnings[0]} error${pluralE} and ${hasWarnings[1]} warning${pluralW}, stopping build.`);
|
297500
|
+
process.exit(1);
|
297266
297501
|
}
|
297267
297502
|
}
|
297268
297503
|
if ((_b = opts === null || opts === void 0 ? void 0 : opts.writeFiles) !== null && _b !== void 0 ? _b : true) {
|
@@ -297596,7 +297831,7 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
|
|
297596
297831
|
};
|
297597
297832
|
}),
|
297598
297833
|
// Download other assets
|
297599
|
-
...["
|
297834
|
+
...["favicon.ico", "robots.txt"].map((asset) => ({
|
297600
297835
|
url: `${host}/${asset}`,
|
297601
297836
|
path: asset
|
297602
297837
|
}))
|
@@ -299279,24 +299514,6 @@ function cleanOutput(session, output2) {
|
|
299279
299514
|
// ../myst-cli/dist/build/utils/bibtex.js
|
299280
299515
|
var import_node_fs33 = __toESM(require("fs"), 1);
|
299281
299516
|
var import_node_path47 = __toESM(require("path"), 1);
|
299282
|
-
function extractBibtex(key2, bibtex) {
|
299283
|
-
const match3 = bibtex.match(new RegExp(`@[a-zA-Z]*{${key2}`, "g"));
|
299284
|
-
if (!match3)
|
299285
|
-
return;
|
299286
|
-
const start = bibtex.indexOf(match3[0]);
|
299287
|
-
let bracketCount = 0;
|
299288
|
-
let ind = start + match3[0].length;
|
299289
|
-
while (bibtex[ind] && (bibtex[ind] !== "}" || bracketCount !== 0)) {
|
299290
|
-
if (bibtex[ind - 1] && bibtex[ind - 1] !== "\\") {
|
299291
|
-
if (bibtex[ind] === "{")
|
299292
|
-
bracketCount++;
|
299293
|
-
if (bibtex[ind] === "}")
|
299294
|
-
bracketCount--;
|
299295
|
-
}
|
299296
|
-
ind++;
|
299297
|
-
}
|
299298
|
-
return bibtex[ind] ? bibtex.substring(start, ind + 1) : void 0;
|
299299
|
-
}
|
299300
299517
|
function writeBibtexFromCitationRenderers(session, output2, content3) {
|
299301
299518
|
const order3 = content3.map(({ references }) => {
|
299302
299519
|
var _a6, _b;
|
@@ -299308,13 +299525,7 @@ function writeBibtexFromCitationRenderers(session, output2, content3) {
|
|
299308
299525
|
const citationLookup = {};
|
299309
299526
|
Object.values(cache.$citationRenderers).forEach((renderers) => {
|
299310
299527
|
Object.entries(renderers).forEach(([key2, renderer]) => {
|
299311
|
-
|
299312
|
-
const bibtexContent2 = renderer.cite._graph.find((item) => {
|
299313
|
-
return item.type === "@biblatex/text";
|
299314
|
-
});
|
299315
|
-
if (bibtexContent2 === null || bibtexContent2 === void 0 ? void 0 : bibtexContent2.data) {
|
299316
|
-
citationLookup[key2] = (_a6 = extractBibtex(key2, bibtexContent2.data)) !== null && _a6 !== void 0 ? _a6 : bibtexContent2.data;
|
299317
|
-
}
|
299528
|
+
citationLookup[key2] = renderer.exportBibTeX();
|
299318
299529
|
});
|
299319
299530
|
});
|
299320
299531
|
const bibtexContent = [];
|
@@ -300642,10 +300853,10 @@ ${node3.value}
|
|
300642
300853
|
state.write(`)`);
|
300643
300854
|
},
|
300644
300855
|
embed(node3, state) {
|
300645
|
-
state.renderChildren(node3);
|
300856
|
+
state.renderChildren(node3, 2);
|
300646
300857
|
},
|
300647
300858
|
include(node3, state) {
|
300648
|
-
state.renderChildren(node3);
|
300859
|
+
state.renderChildren(node3, 2);
|
300649
300860
|
},
|
300650
300861
|
footnoteReference(node3, state) {
|
300651
300862
|
if (!node3.identifier)
|
@@ -312324,6 +312535,7 @@ var SITE_CONFIG = `site:
|
|
312324
312535
|
template: book-theme
|
312325
312536
|
# title:
|
312326
312537
|
# options:
|
312538
|
+
# favicon: favicon.ico
|
312327
312539
|
# logo: site_logo.png
|
312328
312540
|
nav: []
|
312329
312541
|
actions:
|