mystmd 1.2.0__py3-none-any.whl → 1.2.1__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.2.0.dist-info → mystmd-1.2.1.dist-info}/METADATA +1 -1
- mystmd-1.2.1.dist-info/RECORD +8 -0
- mystmd_py/myst.cjs +528 -185
- mystmd-1.2.0.dist-info/RECORD +0 -8
- {mystmd-1.2.0.dist-info → mystmd-1.2.1.dist-info}/WHEEL +0 -0
- {mystmd-1.2.0.dist-info → mystmd-1.2.1.dist-info}/entry_points.txt +0 -0
- {mystmd-1.2.0.dist-info → mystmd-1.2.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
mystmd_py/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
mystmd_py/main.py,sha256=AAcX3rJdJgYboCxwjHoCi1TdHSfBjNstbr562tjey44,1470
|
3
|
+
mystmd_py/myst.cjs,sha256=8oRyhO0eAclfpOw-5ToGz_jXOCoeDFf4FJZ0Gxa7Fd8,12845697
|
4
|
+
mystmd-1.2.1.dist-info/METADATA,sha256=HSvvsGSIStgFUDjAPv1K9Cyu8NuwzX2SLycpD_nL9X8,2968
|
5
|
+
mystmd-1.2.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
6
|
+
mystmd-1.2.1.dist-info/entry_points.txt,sha256=eC2ol2gqS2q5E-ktkMrBSvV0tckGUcNGS-c4hEQ-_V4,45
|
7
|
+
mystmd-1.2.1.dist-info/licenses/LICENSE,sha256=vgXlcTOVbxYpGiMuE9NqgguIBXAH0hJAktlaxiyZ2wg,1088
|
8
|
+
mystmd-1.2.1.dist-info/RECORD,,
|
mystmd_py/myst.cjs
CHANGED
@@ -193279,7 +193279,7 @@ var {
|
|
193279
193279
|
} = import_index.default;
|
193280
193280
|
|
193281
193281
|
// src/version.ts
|
193282
|
-
var version = "1.2.
|
193282
|
+
var version = "1.2.1";
|
193283
193283
|
var version_default = version;
|
193284
193284
|
|
193285
193285
|
// ../myst-cli/dist/build/build.js
|
@@ -194883,7 +194883,6 @@ var FRONTMATTER_ALIASES = {
|
|
194883
194883
|
// ../myst-frontmatter/dist/project/types.js
|
194884
194884
|
var PROJECT_AND_PAGE_FRONTMATTER_KEYS = [
|
194885
194885
|
"date",
|
194886
|
-
"name",
|
194887
194886
|
"doi",
|
194888
194887
|
"arxiv",
|
194889
194888
|
"open_access",
|
@@ -194927,6 +194926,7 @@ var PAGE_KNOWN_PARTS = [
|
|
194927
194926
|
var PAGE_FRONTMATTER_KEYS = [
|
194928
194927
|
...PROJECT_AND_PAGE_FRONTMATTER_KEYS,
|
194929
194928
|
// These keys only exist on the page
|
194929
|
+
"label",
|
194930
194930
|
"kernelspec",
|
194931
194931
|
"jupytext",
|
194932
194932
|
"tags",
|
@@ -197752,6 +197752,54 @@ function fillNumbering(base5, filler) {
|
|
197752
197752
|
return output2;
|
197753
197753
|
}
|
197754
197754
|
|
197755
|
+
// ../myst-frontmatter/dist/references/types.js
|
197756
|
+
var KNOWN_REFERENCE_KINDS = ["myst", "intersphinx"];
|
197757
|
+
|
197758
|
+
// ../myst-frontmatter/dist/references/validators.js
|
197759
|
+
function validateExternalReference(input3, opts) {
|
197760
|
+
var _a6;
|
197761
|
+
if (typeof input3 === "string") {
|
197762
|
+
input3 = { url: input3 };
|
197763
|
+
}
|
197764
|
+
const value = validateObjectKeys(input3, { required: ["url"], optional: ["kind"] }, opts);
|
197765
|
+
if (!value)
|
197766
|
+
return void 0;
|
197767
|
+
let url = validateUrl(value.url, incrementOptions("url", opts));
|
197768
|
+
if (!url)
|
197769
|
+
return void 0;
|
197770
|
+
if (url.endsWith("/")) {
|
197771
|
+
url = url.slice(0, url.length - 1);
|
197772
|
+
}
|
197773
|
+
const output2 = { url };
|
197774
|
+
if (defined(value.kind)) {
|
197775
|
+
const kindOpts = incrementOptions(value.kind, opts);
|
197776
|
+
let kind = (_a6 = validateString(value.kind, kindOpts)) === null || _a6 === void 0 ? void 0 : _a6.toLowerCase();
|
197777
|
+
if (kind === "sphinx" || kind === "inv")
|
197778
|
+
kind = "intersphinx";
|
197779
|
+
if (kind && !KNOWN_REFERENCE_KINDS.includes(kind)) {
|
197780
|
+
validationWarning(`Unknown external reference kind "${kind}"`, kindOpts);
|
197781
|
+
}
|
197782
|
+
if (kind)
|
197783
|
+
output2.kind = kind;
|
197784
|
+
}
|
197785
|
+
return output2;
|
197786
|
+
}
|
197787
|
+
function validateExternalReferences(input3, opts) {
|
197788
|
+
const value = validateObject(input3, opts);
|
197789
|
+
if (!value)
|
197790
|
+
return void 0;
|
197791
|
+
const output2 = Object.fromEntries(Object.entries(value).map(([key2, ref]) => {
|
197792
|
+
const outputKey = validateString(key2, { ...opts, regex: "^[a-zA-Z0-9_-]*$" });
|
197793
|
+
if (!outputKey)
|
197794
|
+
return void 0;
|
197795
|
+
const outputRef = validateExternalReference(ref, incrementOptions(key2, opts));
|
197796
|
+
if (!outputRef)
|
197797
|
+
return void 0;
|
197798
|
+
return [outputKey, outputRef];
|
197799
|
+
}).filter((exists2) => !!exists2));
|
197800
|
+
return Object.keys(output2).length ? output2 : void 0;
|
197801
|
+
}
|
197802
|
+
|
197755
197803
|
// ../myst-frontmatter/dist/venues/validators.js
|
197756
197804
|
function validateVenue(input3, opts) {
|
197757
197805
|
let titleOpts;
|
@@ -198094,9 +198142,6 @@ function validateProjectAndPageFrontmatterKeys(value, opts) {
|
|
198094
198142
|
if (defined(value.date)) {
|
198095
198143
|
output2.date = validateDate(value.date, incrementOptions("date", opts));
|
198096
198144
|
}
|
198097
|
-
if (defined(value.name)) {
|
198098
|
-
output2.name = validateString(value.name, incrementOptions("name", opts));
|
198099
|
-
}
|
198100
198145
|
if (defined(value.doi)) {
|
198101
198146
|
output2.doi = validateDoi(value.doi, incrementOptions("doi", opts));
|
198102
198147
|
}
|
@@ -198197,16 +198242,7 @@ function validateProjectFrontmatterKeys(value, opts) {
|
|
198197
198242
|
output2.id = validateString(value.id, incrementOptions("id", opts));
|
198198
198243
|
}
|
198199
198244
|
if (defined(value.references)) {
|
198200
|
-
|
198201
|
-
const references = validateObject(value.references, referencesOpts);
|
198202
|
-
if (references) {
|
198203
|
-
output2.references = Object.fromEntries(Object.keys(references).map((key2) => {
|
198204
|
-
const url = validateUrl(references[key2], incrementOptions(key2, referencesOpts));
|
198205
|
-
if (!url)
|
198206
|
-
return void 0;
|
198207
|
-
return [key2, { url }];
|
198208
|
-
}).filter((exists2) => !!exists2));
|
198209
|
-
}
|
198245
|
+
output2.references = validateExternalReferences(value.references, incrementOptions("references", opts));
|
198210
198246
|
}
|
198211
198247
|
if (defined(value.thebe)) {
|
198212
198248
|
const result = validateThebe(value.thebe, output2.github, incrementOptions("thebe", opts));
|
@@ -198229,7 +198265,7 @@ function validateProjectFrontmatterKeys(value, opts) {
|
|
198229
198265
|
return output2;
|
198230
198266
|
}
|
198231
198267
|
function validateProjectFrontmatter(input3, opts) {
|
198232
|
-
const value = validateObjectKeys(input3, { optional: PROJECT_FRONTMATTER_KEYS, alias: FRONTMATTER_ALIASES }, opts) || {};
|
198268
|
+
const value = validateObjectKeys(input3, { optional: PROJECT_FRONTMATTER_KEYS, alias: { ...FRONTMATTER_ALIASES, name: "label" } }, opts) || {};
|
198233
198269
|
return validateProjectFrontmatterKeys(value, opts);
|
198234
198270
|
}
|
198235
198271
|
|
@@ -198257,6 +198293,9 @@ var USE_PROJECT_FALLBACK = [
|
|
198257
198293
|
];
|
198258
198294
|
function validatePageFrontmatterKeys(value, opts) {
|
198259
198295
|
const output2 = validateProjectAndPageFrontmatterKeys(value, opts);
|
198296
|
+
if (defined(value.label)) {
|
198297
|
+
output2.label = validateString(value.label, incrementOptions("label", opts));
|
198298
|
+
}
|
198260
198299
|
if (defined(value.kernelspec)) {
|
198261
198300
|
output2.kernelspec = validateKernelSpec(value.kernelspec, incrementOptions("kernelspec", opts));
|
198262
198301
|
}
|
@@ -198305,7 +198344,7 @@ function validatePageFrontmatterKeys(value, opts) {
|
|
198305
198344
|
return output2;
|
198306
198345
|
}
|
198307
198346
|
function validatePageFrontmatter(input3, opts) {
|
198308
|
-
const value = validateObjectKeys(input3, { optional: PAGE_FRONTMATTER_KEYS, alias: FRONTMATTER_ALIASES }, opts) || {};
|
198347
|
+
const value = validateObjectKeys(input3, { optional: PAGE_FRONTMATTER_KEYS, alias: { ...FRONTMATTER_ALIASES, name: "label" } }, opts) || {};
|
198309
198348
|
return validatePageFrontmatterKeys(value, opts);
|
198310
198349
|
}
|
198311
198350
|
|
@@ -202832,8 +202871,8 @@ var RuleId;
|
|
202832
202871
|
RuleId2["roleKnown"] = "role-known";
|
202833
202872
|
RuleId2["roleBodyCorrect"] = "role-body-correct";
|
202834
202873
|
RuleId2["tocContentsExist"] = "toc-contents-exist";
|
202835
|
-
RuleId2["
|
202836
|
-
RuleId2["
|
202874
|
+
RuleId2["validTOCStructure"] = "valid-toc-structure";
|
202875
|
+
RuleId2["validTOC"] = "valid-toc";
|
202837
202876
|
RuleId2["tocWritten"] = "toc-written";
|
202838
202877
|
RuleId2["imageDownloads"] = "image-downloads";
|
202839
202878
|
RuleId2["imageExists"] = "image-exists";
|
@@ -202853,10 +202892,12 @@ var RuleId;
|
|
202853
202892
|
RuleId2["footnoteReferencesDefinition"] = "footnote-references-definition";
|
202854
202893
|
RuleId2["intersphinxReferencesResolve"] = "intersphinx-references-resolve";
|
202855
202894
|
RuleId2["mystLinkValid"] = "myst-link-valid";
|
202895
|
+
RuleId2["sphinxLinkValid"] = "sphinx-link-valid";
|
202856
202896
|
RuleId2["rridLinkValid"] = "rrid-link-valid";
|
202857
202897
|
RuleId2["wikipediaLinkValid"] = "wikipedia-link-valid";
|
202858
202898
|
RuleId2["doiLinkValid"] = "doi-link-valid";
|
202859
202899
|
RuleId2["linkResolves"] = "link-resolves";
|
202900
|
+
RuleId2["linkTextExists"] = "link-text-exists";
|
202860
202901
|
RuleId2["notebookAttachmentsResolve"] = "notebook-attachments-resolve";
|
202861
202902
|
RuleId2["notebookOutputCopied"] = "notebook-output-copied";
|
202862
202903
|
RuleId2["mdastSnippetImports"] = "mdast-snippet-imports";
|
@@ -235853,6 +235894,107 @@ function linksTransform(mdast2, file, opts) {
|
|
235853
235894
|
});
|
235854
235895
|
}
|
235855
235896
|
|
235897
|
+
// ../myst-transforms/dist/links/myst.js
|
235898
|
+
var TRANSFORM_SOURCE3 = "LinkTransform:MystTransformer";
|
235899
|
+
function removeMystPrefix(uri, vfile2, link4, source2) {
|
235900
|
+
if (uri.startsWith("myst:")) {
|
235901
|
+
const normalized = uri.replace(/^myst/, "xref");
|
235902
|
+
if (vfile2) {
|
235903
|
+
fileWarn(vfile2, `"myst:" prefix is deprecated for external reference "${uri}"`, {
|
235904
|
+
note: `Use "${normalized}" instead.`,
|
235905
|
+
node: link4,
|
235906
|
+
source: source2,
|
235907
|
+
ruleId: RuleId.mystLinkValid
|
235908
|
+
});
|
235909
|
+
}
|
235910
|
+
return normalized;
|
235911
|
+
}
|
235912
|
+
return uri;
|
235913
|
+
}
|
235914
|
+
var MystTransformer = class {
|
235915
|
+
constructor(references) {
|
235916
|
+
this.protocol = "xref:myst";
|
235917
|
+
this.mystXRefsList = references.filter((ref) => {
|
235918
|
+
return ref.kind === "myst";
|
235919
|
+
}).filter((ref) => {
|
235920
|
+
return !!ref.value;
|
235921
|
+
});
|
235922
|
+
}
|
235923
|
+
test(uri) {
|
235924
|
+
if (!uri)
|
235925
|
+
return false;
|
235926
|
+
const normalizedUri = removeMystPrefix(uri);
|
235927
|
+
return !!this.mystXRefsList.find((m2) => m2.key && normalizedUri.startsWith(`xref:${m2.key}`));
|
235928
|
+
}
|
235929
|
+
transform(link4, file) {
|
235930
|
+
var _a6;
|
235931
|
+
const urlSource = removeMystPrefix(link4.urlSource || link4.url, file, link4, TRANSFORM_SOURCE3);
|
235932
|
+
let url;
|
235933
|
+
try {
|
235934
|
+
url = new URL(urlSource);
|
235935
|
+
} catch (err) {
|
235936
|
+
fileError(file, `Could not parse url for "${urlSource}"`, {
|
235937
|
+
node: link4,
|
235938
|
+
source: TRANSFORM_SOURCE3,
|
235939
|
+
ruleId: RuleId.mystLinkValid
|
235940
|
+
});
|
235941
|
+
return false;
|
235942
|
+
}
|
235943
|
+
const key2 = url.pathname.split("/")[0];
|
235944
|
+
const page = url.pathname.slice(key2.length);
|
235945
|
+
const identifier = (_a6 = url.hash) === null || _a6 === void 0 ? void 0 : _a6.replace(/^#/, "");
|
235946
|
+
const mystXRefs = this.mystXRefsList.find((m2) => m2.key === key2);
|
235947
|
+
if (!mystXRefs || !mystXRefs.value) {
|
235948
|
+
fileError(file, `Unknown project "${key2}" for link: ${urlSource}`, {
|
235949
|
+
node: link4,
|
235950
|
+
source: TRANSFORM_SOURCE3,
|
235951
|
+
ruleId: RuleId.mystLinkValid
|
235952
|
+
});
|
235953
|
+
return false;
|
235954
|
+
}
|
235955
|
+
let match3;
|
235956
|
+
if (identifier) {
|
235957
|
+
match3 = mystXRefs.value.references.find((ref) => {
|
235958
|
+
if (page && ref.url !== page)
|
235959
|
+
return false;
|
235960
|
+
if (!page && ref.implicit)
|
235961
|
+
return false;
|
235962
|
+
return ref.identifier === identifier || ref.html_id === identifier;
|
235963
|
+
});
|
235964
|
+
} else {
|
235965
|
+
match3 = mystXRefs.value.references.find((ref) => {
|
235966
|
+
if (ref.kind !== "page")
|
235967
|
+
return false;
|
235968
|
+
if (!page && ref.url === "/")
|
235969
|
+
return true;
|
235970
|
+
return ref.url === page;
|
235971
|
+
});
|
235972
|
+
}
|
235973
|
+
if (!match3) {
|
235974
|
+
fileError(file, `"${urlSource}" not found in MyST project ${mystXRefs.key} (${mystXRefs.url})`, {
|
235975
|
+
node: link4,
|
235976
|
+
source: TRANSFORM_SOURCE3,
|
235977
|
+
ruleId: RuleId.mystLinkValid
|
235978
|
+
});
|
235979
|
+
return false;
|
235980
|
+
}
|
235981
|
+
link4.internal = false;
|
235982
|
+
link4.url = `${mystXRefs.url}${match3.url}`;
|
235983
|
+
link4.dataUrl = `${mystXRefs.url}${match3.data}`;
|
235984
|
+
if (match3.kind === "page") {
|
235985
|
+
link4.protocol = "file";
|
235986
|
+
} else {
|
235987
|
+
const xref = link4;
|
235988
|
+
xref.type = "crossReference";
|
235989
|
+
xref.remote = true;
|
235990
|
+
xref.identifier = match3.identifier;
|
235991
|
+
xref.label = match3.identifier;
|
235992
|
+
xref.html_id = match3.html_id;
|
235993
|
+
}
|
235994
|
+
return true;
|
235995
|
+
}
|
235996
|
+
};
|
235997
|
+
|
235856
235998
|
// ../myst-transforms/dist/links/utils.js
|
235857
235999
|
function withoutHttp(url) {
|
235858
236000
|
return url === null || url === void 0 ? void 0 : url.replace(/https?:\/\//, "");
|
@@ -235872,58 +236014,61 @@ function updateLinkTextIfEmpty(link4, title) {
|
|
235872
236014
|
}
|
235873
236015
|
}
|
235874
236016
|
|
235875
|
-
// ../myst-transforms/dist/links/
|
235876
|
-
var
|
235877
|
-
var
|
235878
|
-
constructor(
|
235879
|
-
this.protocol = "
|
235880
|
-
this.intersphinx =
|
236017
|
+
// ../myst-transforms/dist/links/sphinx.js
|
236018
|
+
var TRANSFORM_SOURCE4 = "LinkTransform:SphinxTransformer";
|
236019
|
+
var SphinxTransformer = class {
|
236020
|
+
constructor(references) {
|
236021
|
+
this.protocol = "xref:sphinx";
|
236022
|
+
this.intersphinx = references.filter((ref) => {
|
236023
|
+
return ref.kind === "intersphinx";
|
236024
|
+
}).filter((ref) => {
|
236025
|
+
var _a6;
|
236026
|
+
return !!((_a6 = ref.value) === null || _a6 === void 0 ? void 0 : _a6._loaded);
|
236027
|
+
}).map((ref) => ref.value);
|
235881
236028
|
}
|
235882
236029
|
test(uri) {
|
235883
|
-
|
236030
|
+
if (!uri)
|
236031
|
+
return false;
|
236032
|
+
const normalizedUri = removeMystPrefix(uri);
|
236033
|
+
return !!this.intersphinx.find((i2) => i2.id && normalizedUri.startsWith(`xref:${i2.id}`));
|
235884
236034
|
}
|
235885
236035
|
transform(link4, file) {
|
235886
236036
|
var _a6, _b;
|
235887
|
-
const urlSource = link4.urlSource || link4.url;
|
236037
|
+
const urlSource = removeMystPrefix(link4.urlSource || link4.url, file, link4, TRANSFORM_SOURCE4);
|
235888
236038
|
let url;
|
235889
236039
|
try {
|
235890
236040
|
url = new URL(urlSource);
|
235891
236041
|
} catch (err) {
|
235892
236042
|
fileError(file, `Could not parse url for "${urlSource}"`, {
|
235893
236043
|
node: link4,
|
235894
|
-
source:
|
235895
|
-
ruleId: RuleId.
|
236044
|
+
source: TRANSFORM_SOURCE4,
|
236045
|
+
ruleId: RuleId.sphinxLinkValid
|
235896
236046
|
});
|
235897
236047
|
return false;
|
235898
236048
|
}
|
236049
|
+
const id = url.pathname;
|
235899
236050
|
const target = (_b = (_a6 = url.hash) === null || _a6 === void 0 ? void 0 : _a6.replace(/^#/, "")) !== null && _b !== void 0 ? _b : "";
|
235900
|
-
const project = this.intersphinx.find((i2) =>
|
235901
|
-
if (url.pathname)
|
235902
|
-
return i2.id === url.pathname;
|
235903
|
-
if (target)
|
235904
|
-
return !!i2.getEntry({ name: target });
|
235905
|
-
return false;
|
235906
|
-
});
|
236051
|
+
const project = this.intersphinx.find((i2) => i2.id === id);
|
235907
236052
|
if (!project || !project.path) {
|
235908
|
-
|
236053
|
+
fileError(file, `Unknown project "${id}" for link: ${urlSource}`, {
|
235909
236054
|
node: link4,
|
235910
|
-
source:
|
235911
|
-
ruleId: RuleId.
|
236055
|
+
source: TRANSFORM_SOURCE4,
|
236056
|
+
ruleId: RuleId.sphinxLinkValid
|
235912
236057
|
});
|
235913
236058
|
return false;
|
235914
236059
|
}
|
235915
|
-
if (!
|
236060
|
+
if (!target) {
|
235916
236061
|
link4.internal = false;
|
235917
236062
|
link4.url = project.path;
|
235918
236063
|
updateLinkTextIfEmpty(link4, project.id || "(see documentation)");
|
235919
|
-
return
|
236064
|
+
return true;
|
235920
236065
|
}
|
235921
236066
|
const entry = project.getEntry({ name: target });
|
235922
236067
|
if (!entry) {
|
235923
|
-
|
236068
|
+
fileError(file, `"${urlSource}" not found in intersphinx ${project.id} (${project.path})`, {
|
235924
236069
|
node: link4,
|
235925
|
-
source:
|
235926
|
-
ruleId: RuleId.
|
236070
|
+
source: TRANSFORM_SOURCE4,
|
236071
|
+
ruleId: RuleId.sphinxLinkValid
|
235927
236072
|
});
|
235928
236073
|
return false;
|
235929
236074
|
}
|
@@ -235937,7 +236082,7 @@ var MystTransformer = class {
|
|
235937
236082
|
// ../myst-transforms/dist/links/wiki.js
|
235938
236083
|
var DEFAULT_LANGUAGE = "en";
|
235939
236084
|
var ANY_WIKIPEDIA_ORG = /^(?:https?:\/\/)?(?:([a-z]+)\.)?wikipedia\.org\/wiki\/(.+)$/;
|
235940
|
-
var
|
236085
|
+
var TRANSFORM_SOURCE5 = "LinkTransform:WikiTransformer";
|
235941
236086
|
function removeWiki(url, replace = "") {
|
235942
236087
|
return url.replace(/\/?(wiki\/?)?$/, replace).replace(/^\/?(wiki\/)/, "");
|
235943
236088
|
}
|
@@ -235980,7 +236125,7 @@ var WikiTransformer = class {
|
|
235980
236125
|
fileWarn(file, `Wikipedia pagenames should not contain spaces in link: ${urlSource}`, {
|
235981
236126
|
node: link4,
|
235982
236127
|
note: "Replace spaces with underscores",
|
235983
|
-
source:
|
236128
|
+
source: TRANSFORM_SOURCE5,
|
235984
236129
|
ruleId: RuleId.wikipediaLinkValid
|
235985
236130
|
});
|
235986
236131
|
return false;
|
@@ -235990,7 +236135,7 @@ var WikiTransformer = class {
|
|
235990
236135
|
fileWarn(file, `Wikipedia pagenames should not contain spaces in link: ${urlSource}`, {
|
235991
236136
|
node: link4,
|
235992
236137
|
note: "Replace spaces with underscores",
|
235993
|
-
source:
|
236138
|
+
source: TRANSFORM_SOURCE5,
|
235994
236139
|
ruleId: RuleId.wikipediaLinkValid
|
235995
236140
|
});
|
235996
236141
|
}
|
@@ -235998,7 +236143,7 @@ var WikiTransformer = class {
|
|
235998
236143
|
fileError(file, `Wikipedia pagenames should not contain "/" in link: ${urlSource}`, {
|
235999
236144
|
node: link4,
|
236000
236145
|
note: "Only point to the final page name, do not include any other parts of the Wikipedia URL.",
|
236001
|
-
source:
|
236146
|
+
source: TRANSFORM_SOURCE5,
|
236002
236147
|
ruleId: RuleId.wikipediaLinkValid
|
236003
236148
|
});
|
236004
236149
|
return false;
|
@@ -236019,7 +236164,7 @@ var WikiTransformer = class {
|
|
236019
236164
|
|
236020
236165
|
// ../myst-transforms/dist/links/rrid.js
|
236021
236166
|
var RESOLVER = "https://scicrunch.org/resolver/";
|
236022
|
-
var
|
236167
|
+
var TRANSFORM_SOURCE6 = "LinkTransform:RRIDTransformer";
|
236023
236168
|
function isValid(rrid) {
|
236024
236169
|
return !!rrid;
|
236025
236170
|
}
|
@@ -236049,7 +236194,7 @@ var RRIDTransformer = class {
|
|
236049
236194
|
if (!isValid(rrid)) {
|
236050
236195
|
fileWarn(file, `RRID is not valid: ${urlSource}`, {
|
236051
236196
|
node: link4,
|
236052
|
-
source:
|
236197
|
+
source: TRANSFORM_SOURCE6,
|
236053
236198
|
ruleId: RuleId.rridLinkValid
|
236054
236199
|
});
|
236055
236200
|
return false;
|
@@ -236063,7 +236208,7 @@ var RRIDTransformer = class {
|
|
236063
236208
|
};
|
236064
236209
|
|
236065
236210
|
// ../myst-transforms/dist/links/doi.js
|
236066
|
-
var
|
236211
|
+
var TRANSFORM_SOURCE7 = "LinkTransform:DOITransformer";
|
236067
236212
|
var DOITransformer = class {
|
236068
236213
|
constructor() {
|
236069
236214
|
this.protocol = "doi";
|
@@ -236082,7 +236227,7 @@ var DOITransformer = class {
|
|
236082
236227
|
if (!doiUrl2) {
|
236083
236228
|
fileError(file, `DOI is not valid: ${urlSource}`, {
|
236084
236229
|
node: link4,
|
236085
|
-
source:
|
236230
|
+
source: TRANSFORM_SOURCE7,
|
236086
236231
|
ruleId: RuleId.doiLinkValid
|
236087
236232
|
});
|
236088
236233
|
return false;
|
@@ -236171,6 +236316,22 @@ var GithubTransformer = class {
|
|
236171
236316
|
}
|
236172
236317
|
};
|
236173
236318
|
|
236319
|
+
// ../myst-transforms/dist/links/check.js
|
236320
|
+
function checkLinkTextTransform(mdast2, vfile2) {
|
236321
|
+
const linkNodes = selectAll("link,linkBlock,card,crossReference", mdast2);
|
236322
|
+
if (linkNodes.length === 0)
|
236323
|
+
return;
|
236324
|
+
linkNodes.forEach((node3) => {
|
236325
|
+
var _a6;
|
236326
|
+
if (!toText(node3.children) && !select("image", node3)) {
|
236327
|
+
fileWarn(vfile2, `Link text is empty for <${(_a6 = node3.urlSource) !== null && _a6 !== void 0 ? _a6 : node3.url}>`, {
|
236328
|
+
node: node3,
|
236329
|
+
ruleId: RuleId.linkTextExists
|
236330
|
+
});
|
236331
|
+
}
|
236332
|
+
});
|
236333
|
+
}
|
236334
|
+
|
236174
236335
|
// ../myst-transforms/dist/targets.js
|
236175
236336
|
function mystTargetsTransform(tree) {
|
236176
236337
|
visit(tree, "mystTarget", (node3, index4, parent2) => {
|
@@ -236917,7 +237078,7 @@ var ReferenceState = class {
|
|
236917
237078
|
return;
|
236918
237079
|
if (node3.implicit)
|
236919
237080
|
return;
|
236920
|
-
fileWarn(this.vfile, `Duplicate identifier "${node3.identifier}"
|
237081
|
+
fileWarn(this.vfile, `Duplicate identifier in file "${node3.identifier}"`, {
|
236921
237082
|
node: node3,
|
236922
237083
|
source: TRANSFORM_NAME2,
|
236923
237084
|
ruleId: RuleId.identifierIsUnique
|
@@ -236973,6 +237134,9 @@ var ReferenceState = class {
|
|
236973
237134
|
node3.enumerator = enumerator;
|
236974
237135
|
return enumerator;
|
236975
237136
|
}
|
237137
|
+
getIdentifiers() {
|
237138
|
+
return [...this.identifiers, ...Object.keys(this.targets)];
|
237139
|
+
}
|
236976
237140
|
getTarget(identifier) {
|
236977
237141
|
if (!identifier)
|
236978
237142
|
return void 0;
|
@@ -236985,7 +237149,6 @@ var ReferenceState = class {
|
|
236985
237149
|
return this;
|
236986
237150
|
}
|
236987
237151
|
resolveReferenceContent(node3) {
|
236988
|
-
var _a6, _b, _c;
|
236989
237152
|
const fileTarget = this.getFileTarget(node3.identifier);
|
236990
237153
|
if (fileTarget) {
|
236991
237154
|
const { url, title, dataUrl } = fileTarget;
|
@@ -237006,26 +237169,32 @@ var ReferenceState = class {
|
|
237006
237169
|
return;
|
237007
237170
|
}
|
237008
237171
|
node3.kind = target.kind;
|
237009
|
-
|
237010
|
-
if (target.kind === TargetKind.heading) {
|
237011
|
-
const numberHeading = shouldEnumerate(target.node, TargetKind.heading, this.numbering);
|
237012
|
-
const template = getReferenceTemplate(target, this.numbering, numberHeading, true);
|
237013
|
-
fillReferenceEnumerators2(this.vfile, node3, template, target.node, copyNode(target.node).children);
|
237014
|
-
} else {
|
237015
|
-
const caption3 = select("caption", target.node) || select("admonitionTitle", target.node) || select("definitionTerm", target.node);
|
237016
|
-
const captionParagraph = caption3 ? (_b = select("paragraph", caption3)) !== null && _b !== void 0 ? _b : caption3 : caption3;
|
237017
|
-
const title = captionParagraph ? (_c = copyNode(captionParagraph)) === null || _c === void 0 ? void 0 : _c.children : void 0;
|
237018
|
-
if (title && node3.kind === ReferenceKind2.ref && noNodeChildren) {
|
237019
|
-
node3.children = title;
|
237020
|
-
}
|
237021
|
-
const template = getReferenceTemplate(target, this.numbering, !!target.node.enumerator, !!title);
|
237022
|
-
fillReferenceEnumerators2(this.vfile, node3, template, target.node, title);
|
237023
|
-
}
|
237024
|
-
node3.resolved = true;
|
237025
|
-
node3.identifier = target.node.identifier;
|
237026
|
-
node3.html_id = target.node.html_id;
|
237172
|
+
addChildrenFromTargetNode(node3, target.node, this.numbering, this.vfile);
|
237027
237173
|
}
|
237028
237174
|
};
|
237175
|
+
function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
|
237176
|
+
var _a6, _b, _c;
|
237177
|
+
numbering = fillNumbering(numbering, DEFAULT_NUMBERING);
|
237178
|
+
const kind = kindFromNode2(targetNode);
|
237179
|
+
const noNodeChildren = !((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length);
|
237180
|
+
if (kind === TargetKind.heading) {
|
237181
|
+
const numberHeading = shouldEnumerate(targetNode, TargetKind.heading, numbering);
|
237182
|
+
const template = getReferenceTemplate({ node: targetNode, kind }, numbering, numberHeading, true);
|
237183
|
+
fillReferenceEnumerators2(vfile2, node3, template, targetNode, copyNode(targetNode).children);
|
237184
|
+
} else {
|
237185
|
+
const caption3 = select("caption", targetNode) || select("admonitionTitle", targetNode) || select("definitionTerm", targetNode);
|
237186
|
+
const captionParagraph = caption3 ? (_b = select("paragraph", caption3)) !== null && _b !== void 0 ? _b : caption3 : caption3;
|
237187
|
+
const title = captionParagraph ? (_c = copyNode(captionParagraph)) === null || _c === void 0 ? void 0 : _c.children : void 0;
|
237188
|
+
if (title && node3.kind === ReferenceKind2.ref && noNodeChildren) {
|
237189
|
+
node3.children = title;
|
237190
|
+
}
|
237191
|
+
const template = getReferenceTemplate({ node: targetNode, kind }, numbering, !!targetNode.enumerator, !!title);
|
237192
|
+
fillReferenceEnumerators2(vfile2, node3, template, targetNode, title);
|
237193
|
+
}
|
237194
|
+
node3.resolved = true;
|
237195
|
+
node3.identifier = targetNode.identifier;
|
237196
|
+
node3.html_id = targetNode.html_id;
|
237197
|
+
}
|
237029
237198
|
function warnNodeTargetNotFound(node3, vfile2) {
|
237030
237199
|
if (!vfile2)
|
237031
237200
|
return;
|
@@ -237051,6 +237220,9 @@ var MultiPageReferenceResolver = class {
|
|
237051
237220
|
});
|
237052
237221
|
return pageXRefs;
|
237053
237222
|
}
|
237223
|
+
getIdentifiers() {
|
237224
|
+
return this.states.map((state) => state.getIdentifiers()).flat();
|
237225
|
+
}
|
237054
237226
|
getTarget(identifier, page) {
|
237055
237227
|
const pageXRefs = this.resolveStateProvider(identifier, page);
|
237056
237228
|
return pageXRefs === null || pageXRefs === void 0 ? void 0 : pageXRefs.getTarget(identifier);
|
@@ -237231,6 +237403,8 @@ function unnestCrossReferencesTransform(tree) {
|
|
237231
237403
|
}
|
237232
237404
|
var resolveCrossReferencesTransform = (tree, opts) => {
|
237233
237405
|
visit(tree, "crossReference", (node3) => {
|
237406
|
+
if (node3.protocol)
|
237407
|
+
return;
|
237234
237408
|
opts.state.resolveReferenceContent(node3);
|
237235
237409
|
});
|
237236
237410
|
};
|
@@ -239800,6 +239974,7 @@ function frontmatterValidationOpts(vfile2, opts) {
|
|
239800
239974
|
};
|
239801
239975
|
}
|
239802
239976
|
function getPageFrontmatter(session, tree, vfile2, preFrontmatter, keepTitleNode) {
|
239977
|
+
var _a6;
|
239803
239978
|
const { frontmatter: rawPageFrontmatter, identifiers } = getFrontmatter(vfile2, tree, {
|
239804
239979
|
propagateTargets: true,
|
239805
239980
|
preFrontmatter,
|
@@ -239807,6 +239982,11 @@ function getPageFrontmatter(session, tree, vfile2, preFrontmatter, keepTitleNode
|
|
239807
239982
|
});
|
239808
239983
|
unnestKernelSpec(rawPageFrontmatter);
|
239809
239984
|
const pageFrontmatter = validatePageFrontmatter(rawPageFrontmatter, frontmatterValidationOpts(vfile2));
|
239985
|
+
if (pageFrontmatter.label) {
|
239986
|
+
const { identifier } = (_a6 = normalizeLabel(pageFrontmatter.label)) !== null && _a6 !== void 0 ? _a6 : {};
|
239987
|
+
if (identifier)
|
239988
|
+
identifiers.push(identifier);
|
239989
|
+
}
|
239810
239990
|
logMessagesFromVFile(session, vfile2);
|
239811
239991
|
return { frontmatter: pageFrontmatter, identifiers };
|
239812
239992
|
}
|
@@ -287050,7 +287230,7 @@ var import_node_path17 = __toESM(require("path"), 1);
|
|
287050
287230
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
287051
287231
|
|
287052
287232
|
// ../myst-cli/dist/version.js
|
287053
|
-
var version2 = "1.2.
|
287233
|
+
var version2 = "1.2.1";
|
287054
287234
|
var version_default2 = version2;
|
287055
287235
|
|
287056
287236
|
// ../myst-cli/dist/utils/headers.js
|
@@ -287271,8 +287451,8 @@ var tocFile = (filename) => {
|
|
287271
287451
|
return filename;
|
287272
287452
|
return (0, import_node_path14.join)(filename, "_toc.yml");
|
287273
287453
|
};
|
287274
|
-
function
|
287275
|
-
const [root6, ...parts] =
|
287454
|
+
function upgradeOldJupyterBookTOC(oldTOC) {
|
287455
|
+
const [root6, ...parts] = oldTOC;
|
287276
287456
|
const toc = {
|
287277
287457
|
root: root6.file,
|
287278
287458
|
format: TOC_FORMAT,
|
@@ -287288,7 +287468,7 @@ function readTOC(log, opts) {
|
|
287288
287468
|
const toc = js_yaml_default.load(import_node_fs7.default.readFileSync(filename).toString());
|
287289
287469
|
if (Array.isArray(toc)) {
|
287290
287470
|
try {
|
287291
|
-
const old =
|
287471
|
+
const old = upgradeOldJupyterBookTOC(toc);
|
287292
287472
|
log.warn(`${filename} is out of date: see https://executablebooks.org/en/latest/blog/2021-06-18-update-toc`);
|
287293
287473
|
return old;
|
287294
287474
|
} catch (error) {
|
@@ -287319,7 +287499,7 @@ function validateTOC(session, path42) {
|
|
287319
287499
|
addWarningForFile(session, filename, `Table of Contents (ToC) file did not pass validation:
|
287320
287500
|
- ${message}
|
287321
287501
|
- An implicit ToC will be used instead
|
287322
|
-
`, "error", { ruleId: RuleId.
|
287502
|
+
`, "error", { ruleId: RuleId.validTOCStructure });
|
287323
287503
|
return false;
|
287324
287504
|
}
|
287325
287505
|
}
|
@@ -294730,7 +294910,7 @@ var glob = Object.assign(glob_, {
|
|
294730
294910
|
});
|
294731
294911
|
glob.glob = glob;
|
294732
294912
|
|
294733
|
-
// ../myst-cli/dist/project/
|
294913
|
+
// ../myst-cli/dist/project/fromTOC.js
|
294734
294914
|
var import_node_fs12 = __toESM(require("fs"), 1);
|
294735
294915
|
var import_node_path19 = require("path");
|
294736
294916
|
function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pageSlugs) {
|
@@ -294754,7 +294934,7 @@ function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pag
|
|
294754
294934
|
});
|
294755
294935
|
return pages;
|
294756
294936
|
}
|
294757
|
-
function
|
294937
|
+
function projectFromTOC(session, path42, level = 1) {
|
294758
294938
|
const filename = tocFile(path42);
|
294759
294939
|
if (!import_node_fs12.default.existsSync(filename)) {
|
294760
294940
|
throw new Error(`Could not find TOC "${filename}". Please create a '_toc.yml'.`);
|
@@ -294792,8 +294972,8 @@ function projectFromToc(session, path42, level = 1) {
|
|
294792
294972
|
}
|
294793
294973
|
return { path: dir || ".", file: indexFile, index: slug, pages };
|
294794
294974
|
}
|
294795
|
-
function
|
294796
|
-
const { file, index: index4, pages } =
|
294975
|
+
function pagesFromTOC(session, path42, level) {
|
294976
|
+
const { file, index: index4, pages } = projectFromTOC(session, path42, nextLevel(level));
|
294797
294977
|
pages.unshift({ file, slug: index4, level });
|
294798
294978
|
return pages;
|
294799
294979
|
}
|
@@ -294816,10 +294996,10 @@ function projectPagesFromPath(session, path42, level, pageSlugs, opts) {
|
|
294816
294996
|
if (contents.includes((0, import_node_path20.join)(path42, "_toc.yml"))) {
|
294817
294997
|
const prevLevel = level < 2 ? 1 : level - 1;
|
294818
294998
|
try {
|
294819
|
-
return
|
294999
|
+
return pagesFromTOC(session, path42, prevLevel);
|
294820
295000
|
} catch {
|
294821
295001
|
if (!suppressWarnings) {
|
294822
|
-
addWarningForFile(session, (0, import_node_path20.join)(path42, "_toc.yml"), `Invalid table of contents ignored`, "warn", { ruleId: RuleId.
|
295002
|
+
addWarningForFile(session, (0, import_node_path20.join)(path42, "_toc.yml"), `Invalid table of contents ignored`, "warn", { ruleId: RuleId.validTOC });
|
294823
295003
|
}
|
294824
295004
|
}
|
294825
295005
|
}
|
@@ -294904,7 +295084,7 @@ async function projectFromPath(session, path42, indexFile) {
|
|
294904
295084
|
return { file: indexFile, index: slug, path: path42, pages, implicitIndex };
|
294905
295085
|
}
|
294906
295086
|
|
294907
|
-
// ../myst-cli/dist/project/
|
295087
|
+
// ../myst-cli/dist/project/toTOC.js
|
294908
295088
|
var import_node_fs14 = __toESM(require("fs"), 1);
|
294909
295089
|
var import_node_path21 = require("path");
|
294910
295090
|
function getRelativeDocumentLink(file, path42) {
|
@@ -294969,7 +295149,7 @@ function tocFromProject(project, path42 = ".") {
|
|
294969
295149
|
};
|
294970
295150
|
return toc;
|
294971
295151
|
}
|
294972
|
-
function
|
295152
|
+
function writeTOCFromProject(project, path42) {
|
294973
295153
|
const filename = (0, import_node_path21.join)(path42, "_toc.yml");
|
294974
295154
|
const content3 = `${GENERATED_TOC_HEADER}${js_yaml_default.dump(tocFromProject(project, path42))}`;
|
294975
295155
|
import_node_fs14.default.writeFileSync(filename, content3);
|
@@ -294990,13 +295170,13 @@ async function loadProjectFromDisk(session, path42, opts) {
|
|
294990
295170
|
Consider running "myst init --project" in that directory`, "warn", { ruleId: RuleId.projectConfigExists });
|
294991
295171
|
}
|
294992
295172
|
let newProject;
|
294993
|
-
let { index: index4,
|
295173
|
+
let { index: index4, writeTOC } = opts || {};
|
294994
295174
|
const projectConfigFile = selectors_exports.selectLocalConfigFile(session.store.getState(), path42);
|
294995
295175
|
if (validateTOC(session, path42)) {
|
294996
|
-
newProject =
|
294997
|
-
if (
|
295176
|
+
newProject = projectFromTOC(session, path42);
|
295177
|
+
if (writeTOC)
|
294998
295178
|
session.log.warn("Not writing the table of contents, it already exists!");
|
294999
|
-
|
295179
|
+
writeTOC = false;
|
295000
295180
|
} else {
|
295001
295181
|
const project2 = selectors_exports.selectLocalProject(session.store.getState(), path42);
|
295002
295182
|
if (!index4 && !(project2 === null || project2 === void 0 ? void 0 : project2.implicitIndex) && (project2 === null || project2 === void 0 ? void 0 : project2.file)) {
|
@@ -295007,11 +295187,11 @@ Consider running "myst init --project" in that directory`, "warn", { ruleId: Rul
|
|
295007
295187
|
if (!newProject) {
|
295008
295188
|
throw new Error(`Could not load project from ${path42}`);
|
295009
295189
|
}
|
295010
|
-
if (
|
295190
|
+
if (writeTOC) {
|
295011
295191
|
try {
|
295012
295192
|
session.log.info(`\u{1F4D3} Writing '_toc.yml' file to ${path42 === "." ? "the current directory" : path42}`);
|
295013
|
-
|
295014
|
-
newProject =
|
295193
|
+
writeTOCFromProject(newProject, path42);
|
295194
|
+
newProject = projectFromTOC(session, path42);
|
295015
295195
|
} catch {
|
295016
295196
|
addWarningForFile(session, projectConfigFile, `Error writing '_toc.yml' file to ${path42}`, "error", { ruleId: RuleId.tocWritten });
|
295017
295197
|
}
|
@@ -297629,7 +297809,7 @@ function resolveArticlesFromTOC(session, exp, tocPath, vfile2) {
|
|
297629
297809
|
ExportFormats.pdf,
|
297630
297810
|
ExportFormats.pdftex
|
297631
297811
|
].includes(exp.format);
|
297632
|
-
const proj =
|
297812
|
+
const proj = projectFromTOC(session, tocPath, allowLevelLessThanOne ? -1 : 1);
|
297633
297813
|
return resolveArticlesFromProject(exp, proj, vfile2);
|
297634
297814
|
}
|
297635
297815
|
function resolveTemplate(sourceFile, exp, disableTemplate) {
|
@@ -297682,9 +297862,9 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
297682
297862
|
const { articles, sub_articles } = exp;
|
297683
297863
|
let resolved = { articles, sub_articles };
|
297684
297864
|
if (exp.toc && !resolved.articles && !resolved.sub_articles) {
|
297685
|
-
const
|
297686
|
-
if (validateTOC(session,
|
297687
|
-
resolved = resolveArticlesFromTOC(session, exp,
|
297865
|
+
const resolvedTOC = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), exp.toc);
|
297866
|
+
if (validateTOC(session, resolvedTOC)) {
|
297867
|
+
resolved = resolveArticlesFromTOC(session, exp, resolvedTOC, vfile2);
|
297688
297868
|
}
|
297689
297869
|
}
|
297690
297870
|
if (!resolved.articles && SOURCE_EXTENSIONS.includes(import_node_path28.default.extname(sourceFile))) {
|
@@ -298098,79 +298278,127 @@ async function getSiteManifest(session, opts) {
|
|
298098
298278
|
return manifest;
|
298099
298279
|
}
|
298100
298280
|
|
298101
|
-
// ../myst-cli/dist/process/
|
298281
|
+
// ../myst-cli/dist/process/loadReferences.js
|
298102
298282
|
var import_node_fs23 = __toESM(require("fs"), 1);
|
298103
298283
|
var import_node_path30 = require("path");
|
298104
|
-
function inventoryCacheFile(session, id, path42) {
|
298284
|
+
function inventoryCacheFile(session, refKind, id, path42) {
|
298105
298285
|
const hashcontent = `${id}${path42}`;
|
298106
|
-
const
|
298286
|
+
const ext2 = refKind === "intersphinx" ? "inv" : "json";
|
298287
|
+
const filename = `${refKind}-${computeHash(hashcontent)}.${ext2}`;
|
298107
298288
|
const cacheFolder = (0, import_node_path30.join)(session.buildPath(), "cache");
|
298108
298289
|
if (!import_node_fs23.default.existsSync(cacheFolder))
|
298109
298290
|
import_node_fs23.default.mkdirSync(cacheFolder, { recursive: true });
|
298110
298291
|
return (0, import_node_path30.join)(cacheFolder, filename);
|
298111
298292
|
}
|
298112
|
-
async function
|
298113
|
-
const
|
298114
|
-
|
298115
|
-
|
298116
|
-
|
298117
|
-
|
298118
|
-
const
|
298119
|
-
|
298120
|
-
|
298121
|
-
|
298122
|
-
|
298123
|
-
|
298124
|
-
|
298125
|
-
|
298126
|
-
|
298127
|
-
|
298128
|
-
|
298129
|
-
|
298130
|
-
|
298131
|
-
|
298132
|
-
|
298133
|
-
|
298134
|
-
|
298135
|
-
|
298136
|
-
|
298137
|
-
|
298138
|
-
|
298139
|
-
|
298140
|
-
|
298141
|
-
|
298142
|
-
|
298143
|
-
|
298144
|
-
|
298145
|
-
|
298146
|
-
|
298147
|
-
|
298148
|
-
|
298293
|
+
async function preloadReference(session, key2, reference) {
|
298294
|
+
const ref = {
|
298295
|
+
key: key2,
|
298296
|
+
url: reference.url,
|
298297
|
+
kind: reference.kind
|
298298
|
+
};
|
298299
|
+
const mystCachePath = inventoryCacheFile(session, "myst", key2, reference.url);
|
298300
|
+
const intersphinxCachePath = inventoryCacheFile(session, "intersphinx", key2, reference.url);
|
298301
|
+
if ((!ref.kind || ref.kind === "myst") && import_node_fs23.default.existsSync(mystCachePath)) {
|
298302
|
+
const toc = tic();
|
298303
|
+
const xrefs = JSON.parse(import_node_fs23.default.readFileSync(mystCachePath).toString());
|
298304
|
+
session.log.debug(`Loading cached inventory file for ${reference.url}: ${mystCachePath}`);
|
298305
|
+
session.log.info(toc(`\u{1F3EB} Read ${xrefs.references.length} references links for "${key2}" in %s.`));
|
298306
|
+
ref.kind = "myst";
|
298307
|
+
ref.value = xrefs;
|
298308
|
+
} else if ((!ref.kind || ref.kind === "intersphinx") && import_node_fs23.default.existsSync(intersphinxCachePath)) {
|
298309
|
+
const inventory = new Inventory({ id: key2, path: reference.url });
|
298310
|
+
const localInventory = new Inventory({ id: key2, path: intersphinxCachePath });
|
298311
|
+
session.log.debug(`Loading cached inventory file for ${reference.url}: ${intersphinxCachePath}`);
|
298312
|
+
const toc = tic();
|
298313
|
+
await localInventory.load();
|
298314
|
+
inventory.project = localInventory.project;
|
298315
|
+
inventory.version = localInventory.version;
|
298316
|
+
inventory.data = localInventory.data;
|
298317
|
+
inventory._loaded = true;
|
298318
|
+
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} references links for "${key2}" in %s.`));
|
298319
|
+
ref.kind = "intersphinx";
|
298320
|
+
ref.value = inventory;
|
298321
|
+
}
|
298322
|
+
return ref;
|
298323
|
+
}
|
298324
|
+
async function loadReference(session, vfile2, reference) {
|
298325
|
+
var _a6;
|
298326
|
+
if (reference.kind === "myst" && reference.value) {
|
298327
|
+
return reference;
|
298328
|
+
}
|
298329
|
+
if (reference.kind === "intersphinx" && ((_a6 = reference.value) === null || _a6 === void 0 ? void 0 : _a6._loaded)) {
|
298330
|
+
return reference;
|
298331
|
+
}
|
298332
|
+
if (!reference.kind || reference.kind === "myst") {
|
298333
|
+
const mystXRefsUrl = `${reference.url}/myst.xref.json`;
|
298334
|
+
session.log.debug(`Attempting to load MyST xref file: ${mystXRefsUrl}`);
|
298335
|
+
const toc = tic();
|
298336
|
+
const mystXRefsResp = await fetch2(mystXRefsUrl);
|
298337
|
+
if (mystXRefsResp.status === 200) {
|
298338
|
+
reference.kind = "myst";
|
298339
|
+
const mystXRefs = await mystXRefsResp.json();
|
298340
|
+
reference.value = mystXRefs;
|
298341
|
+
const cachePath = inventoryCacheFile(session, "myst", reference.key, reference.url);
|
298342
|
+
session.log.debug(`Saving remote myst xref file to cache ${reference.url}: ${cachePath}`);
|
298343
|
+
writeFileToFolder(cachePath, JSON.stringify(mystXRefs));
|
298344
|
+
session.log.info(toc(`\u{1F3EB} Read ${mystXRefs.references.length} references for "${reference.key}" in %s.`));
|
298345
|
+
return reference;
|
298346
|
+
} else if (reference.kind === "myst") {
|
298347
|
+
fileError(vfile2, `Problem fetching references entry: ${reference.key} (${mystXRefsUrl})`, {
|
298348
|
+
ruleId: RuleId.intersphinxReferencesResolve
|
298349
|
+
});
|
298149
298350
|
return;
|
298351
|
+
} else {
|
298352
|
+
session.log.debug(`Unable to load reference "${reference.key}" as MyST cross-references`);
|
298353
|
+
}
|
298354
|
+
}
|
298355
|
+
if (!reference.kind || reference.kind === "intersphinx") {
|
298356
|
+
const inventory = new Inventory({ id: reference.key, path: reference.url });
|
298150
298357
|
const toc = tic();
|
298151
298358
|
try {
|
298152
|
-
session.log.debug(`
|
298153
|
-
await
|
298359
|
+
session.log.debug(`Attempting to load inventory file ${inventory.path}/objects.inv`);
|
298360
|
+
await inventory.load();
|
298154
298361
|
} catch (error) {
|
298155
|
-
|
298362
|
+
if (reference.kind === "intersphinx") {
|
298363
|
+
session.log.debug(`
|
298156
298364
|
|
298157
298365
|
${error === null || error === void 0 ? void 0 : error.stack}
|
298158
298366
|
|
298159
298367
|
`);
|
298160
|
-
|
298161
|
-
|
298162
|
-
|
298368
|
+
fileError(vfile2, `Problem fetching references entry: ${inventory.id} (${inventory.path})`, {
|
298369
|
+
ruleId: RuleId.intersphinxReferencesResolve
|
298370
|
+
});
|
298371
|
+
} else {
|
298372
|
+
session.log.debug(`Unable to load reference "${reference.key}" as intersphinx`);
|
298373
|
+
}
|
298163
298374
|
return null;
|
298164
298375
|
}
|
298165
|
-
const cachePath = inventoryCacheFile(session,
|
298166
|
-
if (!import_node_fs23.default.existsSync(cachePath) && isUrl(
|
298167
|
-
session.log.debug(`Saving remote inventory file to cache ${
|
298168
|
-
|
298376
|
+
const cachePath = inventoryCacheFile(session, "intersphinx", inventory.id, inventory.path);
|
298377
|
+
if (!import_node_fs23.default.existsSync(cachePath) && isUrl(inventory.path)) {
|
298378
|
+
session.log.debug(`Saving remote inventory file to cache ${inventory.path}: ${cachePath}`);
|
298379
|
+
inventory.write(cachePath);
|
298380
|
+
}
|
298381
|
+
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} references for "${inventory.id}" in %s.`));
|
298382
|
+
}
|
298383
|
+
}
|
298384
|
+
async function loadReferences(session, opts) {
|
298385
|
+
const state = session.store.getState();
|
298386
|
+
const projectConfig = selectors_exports.selectLocalProjectConfig(state, opts.projectPath);
|
298387
|
+
const configFile = selectors_exports.selectLocalConfigFile(state, opts.projectPath);
|
298388
|
+
if (!(projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.references) || !configFile)
|
298389
|
+
return [];
|
298390
|
+
const vfile2 = new VFile();
|
298391
|
+
vfile2.path = configFile;
|
298392
|
+
const cache = castSession(session);
|
298393
|
+
const references = await Promise.all(Object.entries(projectConfig.references).map(async ([key2, val]) => {
|
298394
|
+
if (!cache.$externalReferences[key2]) {
|
298395
|
+
cache.$externalReferences[key2] = await preloadReference(session, key2, val);
|
298169
298396
|
}
|
298170
|
-
|
298397
|
+
return cache.$externalReferences[key2];
|
298398
|
+
}).filter((exists2) => !!exists2));
|
298399
|
+
return Promise.all(references.map(async (ref) => {
|
298400
|
+
await loadReference(session, vfile2, ref);
|
298171
298401
|
}));
|
298172
|
-
logMessagesFromVFile(session, vfile2);
|
298173
|
-
return references;
|
298174
298402
|
}
|
298175
298403
|
|
298176
298404
|
// ../myst-cli/dist/process/mdast.js
|
@@ -298428,6 +298656,59 @@ function transformLiftCodeBlocksInJupytext(mdast2) {
|
|
298428
298656
|
mdast2.children = flattened;
|
298429
298657
|
}
|
298430
298658
|
|
298659
|
+
// ../myst-cli/dist/transforms/crossReferences.js
|
298660
|
+
async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
|
298661
|
+
const toc = tic();
|
298662
|
+
const nodes = selectAll("link,crossReference", mdast2).filter((node3) => {
|
298663
|
+
return node3.protocol === "xref:myst" && node3.dataUrl;
|
298664
|
+
}).filter((node3) => {
|
298665
|
+
var _a6;
|
298666
|
+
if (!((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length))
|
298667
|
+
return true;
|
298668
|
+
return !!node3.identifier;
|
298669
|
+
});
|
298670
|
+
if (nodes.length === 0)
|
298671
|
+
return;
|
298672
|
+
session.log.debug(`Updating link text for ${plural("%s external MyST reference(s)", nodes)}`);
|
298673
|
+
let number2 = 0;
|
298674
|
+
let data;
|
298675
|
+
await Promise.all([
|
298676
|
+
...nodes.map(async (node3) => {
|
298677
|
+
var _a6, _b, _c;
|
298678
|
+
try {
|
298679
|
+
const resp = await fetch(node3.dataUrl);
|
298680
|
+
if (resp.ok) {
|
298681
|
+
data = await resp.json();
|
298682
|
+
}
|
298683
|
+
} catch {
|
298684
|
+
}
|
298685
|
+
if (!data) {
|
298686
|
+
fileWarn(vfile2, `Unable to resolve link text from external MyST reference: ${node3.urlSource}`, { ruleId: RuleId.mystLinkValid, note: "Could not load data from external project" });
|
298687
|
+
return;
|
298688
|
+
}
|
298689
|
+
if (!node3.identifier) {
|
298690
|
+
node3.children = [{ type: "text", value: (_c = (_b = (_a6 = data.frontmatter) === null || _a6 === void 0 ? void 0 : _a6.title) !== null && _b !== void 0 ? _b : data.slug) !== null && _c !== void 0 ? _c : "" }];
|
298691
|
+
} else {
|
298692
|
+
const targets = selectAll(`[identifier=${node3.identifier}]`, data.mdast);
|
298693
|
+
const target = targets.find((t2) => {
|
298694
|
+
return !["crossReference", "cite", "footnoteDefinition", "footnoteReference"].includes(t2.type);
|
298695
|
+
});
|
298696
|
+
if (!target) {
|
298697
|
+
fileWarn(vfile2, `Unable to resolve link text from external MyST reference: ${node3.urlSource}`, {
|
298698
|
+
ruleId: RuleId.mystLinkValid,
|
298699
|
+
note: `Could not locate identifier ${node3.identifier} in page content`
|
298700
|
+
});
|
298701
|
+
return;
|
298702
|
+
}
|
298703
|
+
addChildrenFromTargetNode(node3, target, frontmatter.numbering, vfile2);
|
298704
|
+
}
|
298705
|
+
number2 += 1;
|
298706
|
+
})
|
298707
|
+
]);
|
298708
|
+
const denominator = number2 === nodes.length ? "" : `/${nodes.length}`;
|
298709
|
+
session.log.info(toc(`\u{1FA84} Updated link text for ${plural(`%s${denominator} external MyST reference(s)`, number2)} in %s seconds`));
|
298710
|
+
}
|
298711
|
+
|
298431
298712
|
// ../myst-cli/dist/transforms/dois.js
|
298432
298713
|
var import_node_fs24 = __toESM(require("fs"), 1);
|
298433
298714
|
var import_node_path31 = require("path");
|
@@ -300138,16 +300419,17 @@ async function transformMdast(session, opts) {
|
|
300138
300419
|
});
|
300139
300420
|
await pipe.run(mdast2, vfile2);
|
300140
300421
|
propagateBlockDataToCode(session, vfile2, mdast2);
|
300141
|
-
const intersphinx = projectPath ? await loadIntersphinx(session, { projectPath }) : [];
|
300142
300422
|
const transformers = [
|
300143
300423
|
new WikiTransformer(),
|
300144
300424
|
new GithubTransformer(),
|
300145
300425
|
new RRIDTransformer(),
|
300146
300426
|
new DOITransformer(),
|
300147
300427
|
// This also is picked up in the next transform
|
300148
|
-
new MystTransformer(
|
300428
|
+
new MystTransformer(Object.values(cache.$externalReferences)),
|
300429
|
+
new SphinxTransformer(Object.values(cache.$externalReferences))
|
300149
300430
|
];
|
300150
300431
|
linksTransform(mdast2, vfile2, { transformers, selector: LINKS_SELECTOR });
|
300432
|
+
await transformMystXRefs(session, vfile2, mdast2, frontmatter);
|
300151
300433
|
cache.$citationRenderers[file] = await transformLinkedDOIs(session, vfile2, mdast2, cache.$doiRenderers, file);
|
300152
300434
|
const rendererFiles = [file];
|
300153
300435
|
if (projectPath) {
|
@@ -300239,11 +300521,12 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300239
300521
|
});
|
300240
300522
|
await pipe.run(mdast2, vfile2);
|
300241
300523
|
keysTransform(mdast2);
|
300524
|
+
checkLinkTextTransform(mdast2, vfile2);
|
300242
300525
|
logMessagesFromVFile(session, fileState.vfile);
|
300243
300526
|
logMessagesFromVFile(session, vfile2);
|
300244
300527
|
log.debug(toc(`Transformed mdast cross references and links for "${file}" in %s`));
|
300245
300528
|
if (checkLinks)
|
300246
|
-
await checkLinksTransform(session, file,
|
300529
|
+
await checkLinksTransform(session, file, mdast2);
|
300247
300530
|
}
|
300248
300531
|
async function finalizeMdast(session, mdast2, frontmatter, file, { imageWriteFolder, useExistingImages, imageAltOutputFolder, imageExtensions, optimizeWebp, simplifyFigures, processThumbnail, maxSizeWebp }) {
|
300249
300532
|
var _a6;
|
@@ -300328,10 +300611,45 @@ function getReferenceTitleAsText(targetNode) {
|
|
300328
300611
|
if (caption3)
|
300329
300612
|
return toText(caption3);
|
300330
300613
|
}
|
300331
|
-
async function
|
300332
|
-
const
|
300333
|
-
|
300334
|
-
|
300614
|
+
async function writeMystXRefJson(session, states) {
|
300615
|
+
const mystXRefs = {
|
300616
|
+
version: "1",
|
300617
|
+
myst: version_default2,
|
300618
|
+
references: states.filter((state) => {
|
300619
|
+
return !!state.url && !!state.dataUrl;
|
300620
|
+
}).map((state) => {
|
300621
|
+
const { url, dataUrl } = state;
|
300622
|
+
const data = `/content${dataUrl}`;
|
300623
|
+
const pageRef = { kind: "page", data, url };
|
300624
|
+
const pageIdRefs = state.identifiers.map((identifier) => {
|
300625
|
+
return { identifier, kind: "page", data, url };
|
300626
|
+
});
|
300627
|
+
const targetRefs = Object.values(state.targets).map((target) => {
|
300628
|
+
var _a6;
|
300629
|
+
const { identifier, html_id } = (_a6 = target.node) !== null && _a6 !== void 0 ? _a6 : {};
|
300630
|
+
return {
|
300631
|
+
identifier,
|
300632
|
+
html_id: html_id !== identifier ? html_id : void 0,
|
300633
|
+
kind: target.kind,
|
300634
|
+
data,
|
300635
|
+
url,
|
300636
|
+
implicit: target.node.implicit
|
300637
|
+
};
|
300638
|
+
});
|
300639
|
+
return [pageRef, ...pageIdRefs, ...targetRefs];
|
300640
|
+
}).flat()
|
300641
|
+
};
|
300642
|
+
const filename = (0, import_node_path39.join)(session.sitePath(), "myst.xref.json");
|
300643
|
+
session.log.debug(`Writing myst.xref.json file: ${filename}`);
|
300644
|
+
writeFileToFolder(filename, JSON.stringify(mystXRefs));
|
300645
|
+
}
|
300646
|
+
async function writeObjectsInv(session, states, siteConfig) {
|
300647
|
+
const inv = new Inventory({
|
300648
|
+
project: siteConfig === null || siteConfig === void 0 ? void 0 : siteConfig.title,
|
300649
|
+
// TODO: allow a version on the project?!
|
300650
|
+
version: String(siteConfig === null || siteConfig === void 0 ? void 0 : siteConfig.version)
|
300651
|
+
});
|
300652
|
+
states.forEach((state) => {
|
300335
300653
|
var _a6;
|
300336
300654
|
inv.setEntry({
|
300337
300655
|
type: Domains.stdDoc,
|
@@ -300352,7 +300670,9 @@ async function addProjectReferencesToObjectsInv(session, inv, opts) {
|
|
300352
300670
|
});
|
300353
300671
|
});
|
300354
300672
|
});
|
300355
|
-
|
300673
|
+
const filename = (0, import_node_path39.join)(session.sitePath(), "objects.inv");
|
300674
|
+
session.log.debug(`Writing objects.inv file: ${filename}`);
|
300675
|
+
inv.write(filename);
|
300356
300676
|
}
|
300357
300677
|
async function loadProject(session, projectPath, opts) {
|
300358
300678
|
const project = await loadProjectFromDisk(session, projectPath, {
|
@@ -300362,7 +300682,28 @@ async function loadProject(session, projectPath, opts) {
|
|
300362
300682
|
const pages = filterPages(project);
|
300363
300683
|
return { project, pages };
|
300364
300684
|
}
|
300365
|
-
function
|
300685
|
+
function warnOnDuplicateIdentifiers(session, states) {
|
300686
|
+
const collisions = {};
|
300687
|
+
states.forEach((state) => {
|
300688
|
+
state.getIdentifiers().forEach((identifier) => {
|
300689
|
+
var _a6, _b;
|
300690
|
+
const target = state.getTarget(identifier);
|
300691
|
+
if ((_a6 = target === null || target === void 0 ? void 0 : target.node) === null || _a6 === void 0 ? void 0 : _a6.implicit)
|
300692
|
+
return;
|
300693
|
+
(_b = collisions[identifier]) !== null && _b !== void 0 ? _b : collisions[identifier] = [];
|
300694
|
+
collisions[identifier].push(state.filePath);
|
300695
|
+
});
|
300696
|
+
});
|
300697
|
+
Object.entries(collisions).forEach(([identifier, files]) => {
|
300698
|
+
if (files.length <= 1)
|
300699
|
+
return;
|
300700
|
+
addWarningForFile(session, files[0], `Duplicate identifier in project "${identifier}"`, "warn", {
|
300701
|
+
note: `In files: ${files.join(", ")}`,
|
300702
|
+
ruleId: RuleId.identifierIsUnique
|
300703
|
+
});
|
300704
|
+
});
|
300705
|
+
}
|
300706
|
+
function selectPageReferenceStates(session, pages, opts) {
|
300366
300707
|
const cache = castSession(session);
|
300367
300708
|
const pageReferenceStates = pages.map((page) => {
|
300368
300709
|
const state = cache.$internalReferences[page.file];
|
@@ -300378,6 +300719,8 @@ function selectPageReferenceStates(session, pages) {
|
|
300378
300719
|
}
|
300379
300720
|
return void 0;
|
300380
300721
|
}).filter((state) => !!state);
|
300722
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.suppressWarnings))
|
300723
|
+
warnOnDuplicateIdentifiers(session, pageReferenceStates);
|
300381
300724
|
return pageReferenceStates;
|
300382
300725
|
}
|
300383
300726
|
async function resolvePageSource(session, file) {
|
@@ -300457,7 +300800,7 @@ async function processProject(session, siteProject, opts) {
|
|
300457
300800
|
var _a6;
|
300458
300801
|
const toc = tic();
|
300459
300802
|
const { log } = session;
|
300460
|
-
const { imageWriteFolder, imageAltOutputFolder, imageExtensions, extraLinkTransformers, extraTransforms, watchMode,
|
300803
|
+
const { imageWriteFolder, imageAltOutputFolder, imageExtensions, extraLinkTransformers, extraTransforms, watchMode, writeTOC, writeFiles = true, reloadProject, execute, maxSizeWebp, checkLinks, strict } = opts || {};
|
300461
300804
|
if (!siteProject.path) {
|
300462
300805
|
const slugSuffix = siteProject.slug ? `: ${siteProject.slug}` : "";
|
300463
300806
|
log.error(`No local path for site project${slugSuffix}`);
|
@@ -300466,7 +300809,7 @@ async function processProject(session, siteProject, opts) {
|
|
300466
300809
|
throw Error("Unable to process project");
|
300467
300810
|
}
|
300468
300811
|
const { project, pages } = await loadProject(session, siteProject.path, {
|
300469
|
-
|
300812
|
+
writeTOC: writeFiles && writeTOC,
|
300470
300813
|
reloadProject
|
300471
300814
|
});
|
300472
300815
|
if (!watchMode) {
|
@@ -300476,7 +300819,7 @@ async function processProject(session, siteProject, opts) {
|
|
300476
300819
|
// Load all content (.md and .ipynb)
|
300477
300820
|
...pages.map((page) => loadFile(session, page.file, siteProject.path, void 0)),
|
300478
300821
|
// Load up all the intersphinx references
|
300479
|
-
|
300822
|
+
loadReferences(session, { projectPath: siteProject.path })
|
300480
300823
|
]);
|
300481
300824
|
}
|
300482
300825
|
combineProjectCitationRenderers(session, siteProject.path);
|
@@ -300525,7 +300868,7 @@ async function processProject(session, siteProject, opts) {
|
|
300525
300868
|
return project;
|
300526
300869
|
}
|
300527
300870
|
async function processSite(session, opts) {
|
300528
|
-
var _a6, _b
|
300871
|
+
var _a6, _b;
|
300529
300872
|
try {
|
300530
300873
|
reloadAllConfigsForCurrentSite(session);
|
300531
300874
|
} catch (error) {
|
@@ -300578,20 +300921,17 @@ ${page.file}
|
|
300578
300921
|
}
|
300579
300922
|
if ((_b = opts === null || opts === void 0 ? void 0 : opts.writeFiles) !== null && _b !== void 0 ? _b : true) {
|
300580
300923
|
await writeSiteManifest(session, opts);
|
300581
|
-
const
|
300582
|
-
project: siteConfig === null || siteConfig === void 0 ? void 0 : siteConfig.title,
|
300583
|
-
// TODO: allow a version on the project?!
|
300584
|
-
version: String((_c = siteConfig === null || siteConfig === void 0 ? void 0 : siteConfig.version) !== null && _c !== void 0 ? _c : "1")
|
300585
|
-
});
|
300924
|
+
const states = [];
|
300586
300925
|
await Promise.all(siteConfig.projects.map(async (project) => {
|
300587
300926
|
if (!project.path)
|
300588
300927
|
return;
|
300589
|
-
await
|
300590
|
-
|
300591
|
-
|
300928
|
+
const { pages } = await loadProject(session, project.path);
|
300929
|
+
states.push(...selectPageReferenceStates(session, pages, {
|
300930
|
+
suppressWarnings: true
|
300931
|
+
}));
|
300592
300932
|
}));
|
300593
|
-
|
300594
|
-
|
300933
|
+
await writeObjectsInv(session, states, siteConfig);
|
300934
|
+
await writeMystXRefJson(session, states);
|
300595
300935
|
}
|
300596
300936
|
return true;
|
300597
300937
|
}
|
@@ -302206,7 +302546,7 @@ async function getFileContent(session, files, { projectPath, imageExtensions, ex
|
|
302206
302546
|
});
|
302207
302547
|
}),
|
302208
302548
|
// Load up all the intersphinx references
|
302209
|
-
|
302549
|
+
loadReferences(session, { projectPath })
|
302210
302550
|
]);
|
302211
302551
|
combineProjectCitationRenderers(session, projectPath);
|
302212
302552
|
await Promise.all(allFiles.map(async (file, ind) => {
|
@@ -307825,7 +308165,7 @@ To resolve this, run: myst build --all`, {
|
|
307825
308165
|
if (import_node_fs38.default.existsSync(import_node_path51.default.join(projectPath, "_toc.yml"))) {
|
307826
308166
|
copyFileToFolder(session, import_node_path51.default.join(projectPath, "_toc.yml"), bundle, fileCopyErrorLogFn);
|
307827
308167
|
} else {
|
307828
|
-
|
308168
|
+
writeTOCFromProject(project, bundle);
|
307829
308169
|
}
|
307830
308170
|
addManifestItem(manifestItems, "article-source", mecaFolder, import_node_path51.default.join(bundle, "_toc.yml"));
|
307831
308171
|
const projectPages = [
|
@@ -312705,6 +313045,7 @@ async function startContentServer(session, opts) {
|
|
312705
313045
|
app.use("/content", import_express.default.static(session.contentPath()));
|
312706
313046
|
app.use("/config.json", import_express.default.static((0, import_node_path55.join)(session.sitePath(), "config.json")));
|
312707
313047
|
app.use("/objects.inv", import_express.default.static((0, import_node_path55.join)(session.sitePath(), "objects.inv")));
|
313048
|
+
app.use("/myst.xref.json", import_express.default.static((0, import_node_path55.join)(session.sitePath(), "myst.xref.json")));
|
312708
313049
|
const server = app.listen(port, () => {
|
312709
313050
|
session.log.debug(`Content server listening on port ${port}`);
|
312710
313051
|
});
|
@@ -312817,9 +313158,10 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
|
|
312817
313158
|
var _a7, _b2;
|
312818
313159
|
const projSlug = proj.slug ? `/${proj.slug}` : "";
|
312819
313160
|
const siteIndex = baseurl ? `/${proj.index}` : "";
|
313161
|
+
const pages = proj.pages.filter((page) => !!page.slug);
|
312820
313162
|
return [
|
312821
313163
|
{ url: `${host}${projSlug}${siteIndex}`, path: import_node_path56.default.join((_a7 = proj.slug) !== null && _a7 !== void 0 ? _a7 : "", "index.html") },
|
312822
|
-
...
|
313164
|
+
...pages.map((page) => {
|
312823
313165
|
var _a8;
|
312824
313166
|
return {
|
312825
313167
|
url: `${host}${projSlug}/${page.slug}`,
|
@@ -312831,7 +313173,7 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
|
|
312831
313173
|
url: `${host}${projSlug}/${proj.index}.json`,
|
312832
313174
|
path: import_node_path56.default.join((_b2 = proj.slug) !== null && _b2 !== void 0 ? _b2 : "", `${proj.index}.json`)
|
312833
313175
|
},
|
312834
|
-
...
|
313176
|
+
...pages.map((page) => {
|
312835
313177
|
var _a8;
|
312836
313178
|
return {
|
312837
313179
|
url: `${host}${projSlug}/${page.slug}.json`,
|
@@ -312904,8 +313246,9 @@ async function buildHtml(session, opts) {
|
|
312904
313246
|
const templateBuildDir = import_node_path56.default.join(template.templatePath, "public");
|
312905
313247
|
import_fs_extra.default.copySync(templateBuildDir, htmlDir);
|
312906
313248
|
import_fs_extra.default.copySync(session.publicPath(), import_node_path56.default.join(htmlDir, "build"));
|
312907
|
-
import_fs_extra.default.copySync(import_node_path56.default.join(session.sitePath(), "objects.inv"), import_node_path56.default.join(htmlDir, "objects.inv"));
|
312908
313249
|
import_fs_extra.default.copySync(import_node_path56.default.join(session.sitePath(), "config.json"), import_node_path56.default.join(htmlDir, "config.json"));
|
313250
|
+
import_fs_extra.default.copySync(import_node_path56.default.join(session.sitePath(), "objects.inv"), import_node_path56.default.join(htmlDir, "objects.inv"));
|
313251
|
+
import_fs_extra.default.copySync(import_node_path56.default.join(session.sitePath(), "myst.xref.json"), import_node_path56.default.join(htmlDir, "myst.xref.json"));
|
312909
313252
|
rewriteAssetsFolder(htmlDir, baseurl);
|
312910
313253
|
process.exit(0);
|
312911
313254
|
}
|
@@ -315876,12 +316219,12 @@ Learn more about this CLI and MyST Markdown at: ${source_default.bold("https://m
|
|
315876
316219
|
|
315877
316220
|
`;
|
315878
316221
|
async function init2(session, opts) {
|
315879
|
-
const { project, site,
|
316222
|
+
const { project, site, writeTOC, ghPages, ghCurvenote } = opts;
|
315880
316223
|
if (ghPages)
|
315881
316224
|
return githubPagesAction(session);
|
315882
316225
|
if (ghCurvenote)
|
315883
316226
|
return githubCurvenoteAction(session);
|
315884
|
-
if (!project && !site && !
|
316227
|
+
if (!project && !site && !writeTOC) {
|
315885
316228
|
session.log.info(WELCOME());
|
315886
316229
|
}
|
315887
316230
|
loadConfig(session, ".");
|
@@ -315929,11 +316272,11 @@ async function init2(session, opts) {
|
|
315929
316272
|
session.log.info(`\u{1F4BE} Writing new ${configDoc} config file: ${source_default.blue(import_node_path60.default.resolve(configFile))}`);
|
315930
316273
|
import_node_fs41.default.writeFileSync(configFile, configData2);
|
315931
316274
|
}
|
315932
|
-
if (
|
316275
|
+
if (writeTOC) {
|
315933
316276
|
loadConfig(session, ".");
|
315934
|
-
await loadProjectFromDisk(session, ".", {
|
316277
|
+
await loadProjectFromDisk(session, ".", { writeTOC });
|
315935
316278
|
}
|
315936
|
-
if (
|
316279
|
+
if (writeTOC || project || site)
|
315937
316280
|
return;
|
315938
316281
|
session.log.info("");
|
315939
316282
|
const promptStart = await inquirer_default.prompt([
|
@@ -323417,11 +323760,11 @@ var source_default8 = chalk6;
|
|
323417
323760
|
function makeProjectOption(description) {
|
323418
323761
|
return new Option("--project", description).default(false);
|
323419
323762
|
}
|
323420
|
-
function
|
323763
|
+
function makeWriteTOCOption() {
|
323421
323764
|
return new Option(
|
323422
323765
|
"--write-toc",
|
323423
323766
|
"Generate editable _toc.yml file for project if it does not exist"
|
323424
|
-
).default(false);
|
323767
|
+
).default(false).implies({ writeTOC: true });
|
323425
323768
|
}
|
323426
323769
|
function makeGithubPagesOption() {
|
323427
323770
|
return new Option(
|
@@ -323438,7 +323781,7 @@ function makeGithubCurvenoteOption() {
|
|
323438
323781
|
|
323439
323782
|
// src/init.ts
|
323440
323783
|
function makeInitCLI(program3) {
|
323441
|
-
const command = new Command("init").description("Initialize a MyST project in the current directory").addOption(makeProjectOption("Initialize config for MyST project content")).addOption(makeSiteOption("Initialize config for MyST site")).addOption(
|
323784
|
+
const command = new Command("init").description("Initialize a MyST project in the current directory").addOption(makeProjectOption("Initialize config for MyST project content")).addOption(makeSiteOption("Initialize config for MyST site")).addOption(makeWriteTOCOption()).addOption(makeGithubPagesOption()).addOption(makeGithubCurvenoteOption()).action(clirun2(Session, init2, program3));
|
323442
323785
|
return command;
|
323443
323786
|
}
|
323444
323787
|
function addDefaultCommand(program3) {
|
mystmd-1.2.0.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
mystmd_py/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
mystmd_py/main.py,sha256=AAcX3rJdJgYboCxwjHoCi1TdHSfBjNstbr562tjey44,1470
|
3
|
-
mystmd_py/myst.cjs,sha256=ceAHu1BOZFwIxJKLhpe_B-tVajtbrZSQaeozjADlQfg,12832298
|
4
|
-
mystmd-1.2.0.dist-info/METADATA,sha256=2ig9xX1IAEUUrOH8tgzf_tglNWdZoYJGSgDxDYbmHzg,2968
|
5
|
-
mystmd-1.2.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
6
|
-
mystmd-1.2.0.dist-info/entry_points.txt,sha256=eC2ol2gqS2q5E-ktkMrBSvV0tckGUcNGS-c4hEQ-_V4,45
|
7
|
-
mystmd-1.2.0.dist-info/licenses/LICENSE,sha256=vgXlcTOVbxYpGiMuE9NqgguIBXAH0hJAktlaxiyZ2wg,1088
|
8
|
-
mystmd-1.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|