mystmd 1.1.48__py3-none-any.whl → 1.1.49__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.48.dist-info → mystmd-1.1.49.dist-info}/METADATA +1 -1
- mystmd-1.1.49.dist-info/RECORD +8 -0
- {mystmd-1.1.48.dist-info → mystmd-1.1.49.dist-info}/WHEEL +1 -1
- mystmd_py/myst.cjs +790 -424
- mystmd-1.1.48.dist-info/RECORD +0 -8
- {mystmd-1.1.48.dist-info → mystmd-1.1.49.dist-info}/entry_points.txt +0 -0
- {mystmd-1.1.48.dist-info → mystmd-1.1.49.dist-info}/licenses/LICENSE +0 -0
mystmd_py/myst.cjs
CHANGED
@@ -129890,7 +129890,7 @@ var require_environment = __commonJS({
|
|
129890
129890
|
}
|
129891
129891
|
return this.tests[name3];
|
129892
129892
|
};
|
129893
|
-
_proto.resolveTemplate = function
|
129893
|
+
_proto.resolveTemplate = function resolveTemplate2(loader2, parentName, filename) {
|
129894
129894
|
var isRelative = loader2.isRelative && parentName ? loader2.isRelative(filename) : false;
|
129895
129895
|
return isRelative && loader2.resolve ? loader2.resolve(parentName, filename) : filename;
|
129896
129896
|
};
|
@@ -195964,7 +195964,7 @@ var {
|
|
195964
195964
|
} = import_index.default;
|
195965
195965
|
|
195966
195966
|
// src/version.ts
|
195967
|
-
var version = "1.1.
|
195967
|
+
var version = "1.1.49";
|
195968
195968
|
var version_default = version;
|
195969
195969
|
|
195970
195970
|
// ../myst-cli/dist/build/build.js
|
@@ -196746,7 +196746,13 @@ function stashPlaceholder(value) {
|
|
196746
196746
|
return { id: value, name: value };
|
196747
196747
|
}
|
196748
196748
|
function isStashPlaceholder(object) {
|
196749
|
-
|
196749
|
+
var _a6;
|
196750
|
+
if (!object.name || !object.id || object.name !== object.id)
|
196751
|
+
return false;
|
196752
|
+
const nKeys = Object.keys(object).length;
|
196753
|
+
if (nKeys === 2)
|
196754
|
+
return true;
|
196755
|
+
return nKeys === 3 && ((_a6 = object.nameParsed) === null || _a6 === void 0 ? void 0 : _a6.literal) === object.id;
|
196750
196756
|
}
|
196751
196757
|
function validateAndStashObject(input3, stash, kind, validateFn, opts) {
|
196752
196758
|
var _a6, _b, _c;
|
@@ -196967,12 +196973,17 @@ function validateAffiliation(input3, opts) {
|
|
196967
196973
|
const value = validateObjectKeys(input3, { optional: AFFILIATION_KEYS, alias: AFFILIATION_ALIASES }, opts);
|
196968
196974
|
if (value === void 0)
|
196969
196975
|
return void 0;
|
196976
|
+
if (Object.keys(value).length === 1 && value.id) {
|
196977
|
+
value.name = value.id;
|
196978
|
+
}
|
196970
196979
|
const output2 = {};
|
196971
196980
|
if (defined(value.id)) {
|
196972
196981
|
output2.id = validateString(value.id, incrementOptions("id", opts));
|
196973
196982
|
}
|
196974
196983
|
if (defined(value.name)) {
|
196975
196984
|
output2.name = validateString(value.name, incrementOptions("name", opts));
|
196985
|
+
} else {
|
196986
|
+
validationWarning("affiliation should include name/institution", opts);
|
196976
196987
|
}
|
196977
196988
|
if (defined(value.department)) {
|
196978
196989
|
output2.department = validateString(value.department, incrementOptions("department", opts));
|
@@ -197026,11 +197037,6 @@ function validateAffiliation(input3, opts) {
|
|
197026
197037
|
if (defined(value.fax)) {
|
197027
197038
|
output2.fax = validateString(value.fax, incrementOptions("fax", opts));
|
197028
197039
|
}
|
197029
|
-
if (Object.keys(output2).length === 1 && output2.id) {
|
197030
|
-
return stashPlaceholder(output2.id);
|
197031
|
-
} else if (!output2.name) {
|
197032
|
-
validationWarning("affiliation should include name/institution", opts);
|
197033
|
-
}
|
197034
197040
|
return output2;
|
197035
197041
|
}
|
197036
197042
|
|
@@ -197140,6 +197146,33 @@ var credit = {
|
|
197140
197146
|
buildUrl: buildUrl2
|
197141
197147
|
};
|
197142
197148
|
|
197149
|
+
// ../../node_modules/orcid/dist/index.js
|
197150
|
+
var ORCID_URL = "https://orcid.org";
|
197151
|
+
var ORCID_REGEX_STRICT = "^([0-9]{4}-){3}[0-9]{3}[0-9X]$";
|
197152
|
+
var ORCID_REGEX = "^((http(s)?://)?(www.)?orcid.org/)?([0-9]{4}-){3}[0-9]{3}[0-9X]$";
|
197153
|
+
function validate3(value, opts) {
|
197154
|
+
const match3 = value === null || value === void 0 ? void 0 : value.match((opts === null || opts === void 0 ? void 0 : opts.strict) ? ORCID_REGEX_STRICT : ORCID_REGEX);
|
197155
|
+
if (!match3)
|
197156
|
+
return false;
|
197157
|
+
return true;
|
197158
|
+
}
|
197159
|
+
function normalize3(value, opts) {
|
197160
|
+
if (!value || !validate3(value, opts))
|
197161
|
+
return void 0;
|
197162
|
+
return value.replace(/^(https?:\/\/)?(www\.)?orcid\.org\//, "");
|
197163
|
+
}
|
197164
|
+
function buildUrl3(value, opts) {
|
197165
|
+
const orcid2 = normalize3(value, opts);
|
197166
|
+
if (!orcid2)
|
197167
|
+
return void 0;
|
197168
|
+
return `${ORCID_URL}/${orcid2}`;
|
197169
|
+
}
|
197170
|
+
var orcid = {
|
197171
|
+
validate: validate3,
|
197172
|
+
normalize: normalize3,
|
197173
|
+
buildUrl: buildUrl3
|
197174
|
+
};
|
197175
|
+
|
197143
197176
|
// ../myst-frontmatter/dist/utils/parseName.js
|
197144
197177
|
function startsWithUpperCase(word) {
|
197145
197178
|
for (const letter of word) {
|
@@ -197248,35 +197281,8 @@ function formatName(name3, alwaysReversed = false) {
|
|
197248
197281
|
return output2;
|
197249
197282
|
}
|
197250
197283
|
|
197251
|
-
// ../../node_modules/orcid/dist/index.js
|
197252
|
-
var ORCID_URL = "https://orcid.org";
|
197253
|
-
var ORCID_REGEX_STRICT = "^([0-9]{4}-){3}[0-9]{3}[0-9X]$";
|
197254
|
-
var ORCID_REGEX = "^((http(s)?://)?(www.)?orcid.org/)?([0-9]{4}-){3}[0-9]{3}[0-9X]$";
|
197255
|
-
function validate3(value, opts) {
|
197256
|
-
const match3 = value === null || value === void 0 ? void 0 : value.match((opts === null || opts === void 0 ? void 0 : opts.strict) ? ORCID_REGEX_STRICT : ORCID_REGEX);
|
197257
|
-
if (!match3)
|
197258
|
-
return false;
|
197259
|
-
return true;
|
197260
|
-
}
|
197261
|
-
function normalize3(value, opts) {
|
197262
|
-
if (!value || !validate3(value, opts))
|
197263
|
-
return void 0;
|
197264
|
-
return value.replace(/^(https?:\/\/)?(www\.)?orcid\.org\//, "");
|
197265
|
-
}
|
197266
|
-
function buildUrl3(value, opts) {
|
197267
|
-
const orcid2 = normalize3(value, opts);
|
197268
|
-
if (!orcid2)
|
197269
|
-
return void 0;
|
197270
|
-
return `${ORCID_URL}/${orcid2}`;
|
197271
|
-
}
|
197272
|
-
var orcid = {
|
197273
|
-
validate: validate3,
|
197274
|
-
normalize: normalize3,
|
197275
|
-
buildUrl: buildUrl3
|
197276
|
-
};
|
197277
|
-
|
197278
197284
|
// ../myst-frontmatter/dist/contributors/validators.js
|
197279
|
-
var
|
197285
|
+
var PERSON_KEYS = [
|
197280
197286
|
"id",
|
197281
197287
|
"userId",
|
197282
197288
|
"name",
|
@@ -197296,7 +197302,8 @@ var CONTRIBUTOR_KEYS = [
|
|
197296
197302
|
"phone",
|
197297
197303
|
"fax"
|
197298
197304
|
];
|
197299
|
-
var
|
197305
|
+
var PERSON_ALIASES = {
|
197306
|
+
ref: "id",
|
197300
197307
|
role: "roles",
|
197301
197308
|
"equal-contributor": "equal_contributor",
|
197302
197309
|
affiliation: "affiliations",
|
@@ -197321,8 +197328,10 @@ var NAME_ALIASES = {
|
|
197321
197328
|
};
|
197322
197329
|
function validateName(input3, opts) {
|
197323
197330
|
let output2;
|
197331
|
+
let raiseCommaWarnings = false;
|
197324
197332
|
if (typeof input3 === "string") {
|
197325
197333
|
output2 = parseName(input3);
|
197334
|
+
raiseCommaWarnings = true;
|
197326
197335
|
} else {
|
197327
197336
|
const value = validateObjectKeys(input3, { optional: NAME_KEYS, alias: NAME_ALIASES }, opts);
|
197328
197337
|
if (value === void 0)
|
@@ -197348,36 +197357,50 @@ function validateName(input3, opts) {
|
|
197348
197357
|
}
|
197349
197358
|
if (Object.keys(output2).length === 1 && output2.literal) {
|
197350
197359
|
output2 = { ...output2, ...parseName(output2.literal) };
|
197360
|
+
raiseCommaWarnings = true;
|
197351
197361
|
} else if (!output2.literal) {
|
197352
197362
|
output2.literal = formatName(output2);
|
197363
|
+
if (output2.literal.startsWith(",")) {
|
197364
|
+
validationWarning(`unexpected comma at beginning of name: ${output2.literal} - you may need to define 'name.literal' explicitly`, opts);
|
197365
|
+
}
|
197353
197366
|
}
|
197354
197367
|
}
|
197355
|
-
|
197356
|
-
|
197357
|
-
|
197358
|
-
|
197359
|
-
|
197360
|
-
|
197361
|
-
|
197362
|
-
|
197363
|
-
|
197364
|
-
|
197365
|
-
|
197366
|
-
validationWarning(`No family name for name '${output2.literal}'`, opts);
|
197367
|
-
}
|
197368
|
-
if (!output2.given) {
|
197369
|
-
validationWarning(`No given name for name '${output2.literal}'`, opts);
|
197368
|
+
if (raiseCommaWarnings) {
|
197369
|
+
const warnOnComma = (part, o) => {
|
197370
|
+
if (part && part.includes(",")) {
|
197371
|
+
validationWarning(`unexpected comma in name part: ${part} - you may need to define 'name' explicitly as an object`, o);
|
197372
|
+
}
|
197373
|
+
};
|
197374
|
+
warnOnComma(output2.given, incrementOptions("given", opts));
|
197375
|
+
warnOnComma(output2.family, incrementOptions("family", opts));
|
197376
|
+
warnOnComma(output2.non_dropping_particle, incrementOptions("non_dropping_particle", opts));
|
197377
|
+
warnOnComma(output2.dropping_particle, incrementOptions("dropping_particle", opts));
|
197378
|
+
warnOnComma(output2.suffix, incrementOptions("suffix", opts));
|
197370
197379
|
}
|
197371
197380
|
return output2;
|
197372
197381
|
}
|
197373
197382
|
function validateContributor(input3, stash, opts) {
|
197374
197383
|
var _a6, _b, _c;
|
197384
|
+
const inputAff = validateObjectKeys(input3, { optional: AFFILIATION_KEYS, alias: AFFILIATION_ALIASES }, {
|
197385
|
+
...opts,
|
197386
|
+
suppressErrors: true,
|
197387
|
+
suppressWarnings: true
|
197388
|
+
});
|
197389
|
+
if ((inputAff === null || inputAff === void 0 ? void 0 : inputAff.collaboration) === true) {
|
197390
|
+
return validateAffiliation(input3, opts);
|
197391
|
+
}
|
197375
197392
|
if (typeof input3 === "string") {
|
197376
|
-
input3 =
|
197393
|
+
input3 = stashPlaceholder(input3);
|
197377
197394
|
}
|
197378
|
-
const value = validateObjectKeys(input3, { optional:
|
197395
|
+
const value = validateObjectKeys(input3, { optional: PERSON_KEYS, alias: PERSON_ALIASES }, opts);
|
197379
197396
|
if (value === void 0)
|
197380
197397
|
return void 0;
|
197398
|
+
if (inputAff && Object.keys(inputAff).length > Object.keys(value).length) {
|
197399
|
+
validationWarning('contributor may be a collaboration, not a person - if so, add "collaboration: true"', opts);
|
197400
|
+
}
|
197401
|
+
if (Object.keys(value).length === 1 && value.id) {
|
197402
|
+
value.name = value.id;
|
197403
|
+
}
|
197381
197404
|
const output2 = {};
|
197382
197405
|
if (defined(value.id)) {
|
197383
197406
|
output2.id = validateString(value.id, incrementOptions("id", opts));
|
@@ -197475,6 +197498,17 @@ function validateContributor(input3, stash, opts) {
|
|
197475
197498
|
if (defined(value.note)) {
|
197476
197499
|
output2.note = validateString(value.note, incrementOptions("note", opts));
|
197477
197500
|
}
|
197501
|
+
if (isStashPlaceholder(output2) || !output2.nameParsed)
|
197502
|
+
return output2;
|
197503
|
+
if (value.nameParsed || value.name && typeof value.name !== "string")
|
197504
|
+
return output2;
|
197505
|
+
const suffix = " - if this is intended, you may define 'name' explicitly as an object";
|
197506
|
+
if (!output2.nameParsed.given) {
|
197507
|
+
validationWarning(`No given name for name '${output2.nameParsed.literal}'${suffix}`, opts);
|
197508
|
+
}
|
197509
|
+
if (!output2.nameParsed.family) {
|
197510
|
+
validationWarning(`No family name for name '${output2.nameParsed.literal}'${suffix}`, opts);
|
197511
|
+
}
|
197478
197512
|
return output2;
|
197479
197513
|
}
|
197480
197514
|
|
@@ -197599,16 +197633,21 @@ var SITE_FRONTMATTER_KEYS = [
|
|
197599
197633
|
"banner",
|
197600
197634
|
"bannerOptimized",
|
197601
197635
|
"authors",
|
197636
|
+
"reviewers",
|
197637
|
+
"editors",
|
197602
197638
|
"contributors",
|
197603
197639
|
"venue",
|
197604
197640
|
"github",
|
197605
197641
|
"keywords",
|
197606
197642
|
"affiliations",
|
197607
197643
|
"funding",
|
197644
|
+
"copyright",
|
197608
197645
|
"options"
|
197609
197646
|
];
|
197610
197647
|
var FRONTMATTER_ALIASES = {
|
197611
197648
|
author: "authors",
|
197649
|
+
reviewer: "reviewers",
|
197650
|
+
editor: "editors",
|
197612
197651
|
contributor: "contributors",
|
197613
197652
|
affiliation: "affiliations",
|
197614
197653
|
export: "exports",
|
@@ -197674,6 +197713,16 @@ function validateSiteFrontmatterKeys(value, opts) {
|
|
197674
197713
|
return validateAndStashObject(contributor, stash, "contributors", (v, o) => validateContributor(v, stash, o), incrementOptions(`contributors.${index4}`, opts));
|
197675
197714
|
});
|
197676
197715
|
}
|
197716
|
+
if (defined(value.reviewers)) {
|
197717
|
+
output2.reviewers = validateList(value.reviewers, { coerce: true, ...incrementOptions("reviewers", opts) }, (reviewer, ind) => {
|
197718
|
+
return validateAndStashObject(reviewer, stash, "contributors", (v, o) => validateContributor(v, stash, o), incrementOptions(`reviewers.${ind}`, opts));
|
197719
|
+
});
|
197720
|
+
}
|
197721
|
+
if (defined(value.editors)) {
|
197722
|
+
output2.editors = validateList(value.editors, { coerce: true, ...incrementOptions("editors", opts) }, (editor, ind) => {
|
197723
|
+
return validateAndStashObject(editor, stash, "contributors", (v, o) => validateContributor(v, stash, o), incrementOptions(`editors.${ind}`, opts));
|
197724
|
+
});
|
197725
|
+
}
|
197677
197726
|
if (defined(value.venue)) {
|
197678
197727
|
output2.venue = validateVenue(value.venue, incrementOptions("venue", opts));
|
197679
197728
|
}
|
@@ -197694,6 +197743,9 @@ function validateSiteFrontmatterKeys(value, opts) {
|
|
197694
197743
|
return validateFunding(fund, stash, incrementOptions(`funding.${index4}`, opts));
|
197695
197744
|
});
|
197696
197745
|
}
|
197746
|
+
if (defined(value.copyright)) {
|
197747
|
+
output2.copyright = validateString(value.copyright, incrementOptions("copyright", opts));
|
197748
|
+
}
|
197697
197749
|
if (defined(value.options)) {
|
197698
197750
|
const optionsOptions = incrementOptions("options", opts);
|
197699
197751
|
const options = validateObject(value.options, optionsOptions);
|
@@ -197718,10 +197770,10 @@ function validateSiteFrontmatterKeys(value, opts) {
|
|
197718
197770
|
});
|
197719
197771
|
if (stashContribAuthors === null || stashContribAuthors === void 0 ? void 0 : stashContribAuthors.length) {
|
197720
197772
|
output2.authors = stashContribAuthors;
|
197721
|
-
const
|
197722
|
-
const
|
197723
|
-
if (!
|
197724
|
-
|
197773
|
+
const correspondingAuthor = (_c = output2.authors) === null || _c === void 0 ? void 0 : _c.find((a2) => a2.corresponding);
|
197774
|
+
const personWithEmail = (_d2 = output2.authors) === null || _d2 === void 0 ? void 0 : _d2.find((a2) => a2.email && !a2.collaboration && a2.corresponding === void 0);
|
197775
|
+
if (!correspondingAuthor && personWithEmail) {
|
197776
|
+
personWithEmail.corresponding = true;
|
197725
197777
|
}
|
197726
197778
|
}
|
197727
197779
|
if (stashContribNonAuthors === null || stashContribNonAuthors === void 0 ? void 0 : stashContribNonAuthors.length) {
|
@@ -197789,7 +197841,17 @@ var PAGE_FRONTMATTER_KEYS = [
|
|
197789
197841
|
// ../myst-frontmatter/dist/exports/validators.js
|
197790
197842
|
var EXPORT_KEY_OBJECT = {
|
197791
197843
|
required: [],
|
197792
|
-
optional: [
|
197844
|
+
optional: [
|
197845
|
+
"format",
|
197846
|
+
"template",
|
197847
|
+
"output",
|
197848
|
+
"zip",
|
197849
|
+
"id",
|
197850
|
+
"name",
|
197851
|
+
"renderer",
|
197852
|
+
"articles",
|
197853
|
+
"sub_articles"
|
197854
|
+
],
|
197793
197855
|
alias: {
|
197794
197856
|
article: "articles",
|
197795
197857
|
sub_article: "sub_articles"
|
@@ -197890,17 +197952,13 @@ function validateExport(input3, opts) {
|
|
197890
197952
|
if (typeof input3 === "string") {
|
197891
197953
|
let format2;
|
197892
197954
|
let output3;
|
197893
|
-
if (input3.
|
197955
|
+
if (input3.startsWith(".")) {
|
197894
197956
|
Object.entries(EXT_TO_FORMAT).forEach(([ext2, fmt]) => {
|
197895
|
-
if (input3 === ext2)
|
197957
|
+
if (input3 === ext2)
|
197896
197958
|
format2 = fmt;
|
197897
|
-
} else if (input3.endsWith(ext2)) {
|
197898
|
-
output3 = input3;
|
197899
|
-
}
|
197900
197959
|
});
|
197901
|
-
|
197902
|
-
|
197903
|
-
}
|
197960
|
+
} else if (input3.includes(".")) {
|
197961
|
+
output3 = input3;
|
197904
197962
|
}
|
197905
197963
|
if (!format2 && !output3) {
|
197906
197964
|
format2 = validateExportFormat(input3, opts);
|
@@ -197925,26 +197983,33 @@ function validateExport(input3, opts) {
|
|
197925
197983
|
template = validateString(value.template, incrementOptions("template", opts));
|
197926
197984
|
}
|
197927
197985
|
if (defined(value.output)) {
|
197928
|
-
|
197986
|
+
const outputOpts = incrementOptions("output", opts);
|
197987
|
+
const outputString = validateString(value.output, outputOpts);
|
197988
|
+
if (outputString) {
|
197989
|
+
Object.keys(EXT_TO_FORMAT).forEach((ext2) => {
|
197990
|
+
if (outputString.endsWith(ext2))
|
197991
|
+
output2 = outputString;
|
197992
|
+
});
|
197993
|
+
if (!outputString.slice(1).includes(".")) {
|
197994
|
+
output2 = outputString;
|
197995
|
+
}
|
197996
|
+
if (!output2) {
|
197997
|
+
return validationError(`unknown export output extension: ${outputString}`, outputOpts);
|
197998
|
+
}
|
197999
|
+
}
|
197929
198000
|
}
|
197930
198001
|
if (defined(value.format)) {
|
197931
198002
|
format = validateExportFormat(value.format, incrementOptions("format", opts));
|
197932
198003
|
if (!format)
|
197933
198004
|
return void 0;
|
197934
|
-
} else if (output2) {
|
197935
|
-
Object.entries(EXT_TO_FORMAT).forEach(([ext2, fmt]) => {
|
197936
|
-
if (output2 === null || output2 === void 0 ? void 0 : output2.endsWith(ext2))
|
197937
|
-
format = fmt;
|
197938
|
-
});
|
197939
|
-
if (!format) {
|
197940
|
-
return validationError(`unable to infer export format from export: ${output2}`, opts);
|
197941
|
-
}
|
197942
|
-
} else {
|
197943
|
-
return validationError("unable to determine export format", opts);
|
197944
198005
|
}
|
197945
|
-
if (format
|
197946
|
-
return
|
198006
|
+
if (!format && !template && !output2) {
|
198007
|
+
return validationError("export must specify one of: format, template, or output", opts);
|
198008
|
+
}
|
197947
198009
|
const validExport = { ...value, format, output: output2, template };
|
198010
|
+
if (defined(value.zip)) {
|
198011
|
+
validExport.zip = validateBoolean(value.zip, incrementOptions("zip", opts));
|
198012
|
+
}
|
197948
198013
|
if (defined(value.articles)) {
|
197949
198014
|
const articles = validateList(value.articles, { coerce: true, ...incrementOptions("articles", opts) }, (item, ind) => validateExportArticle(item, incrementOptions(`articles.${ind}`, opts)));
|
197950
198015
|
const singleArticle = singleArticleWithFile(articles);
|
@@ -200785,6 +200850,8 @@ function validateProjectFrontmatter(input3, opts) {
|
|
200785
200850
|
// ../myst-frontmatter/dist/page/validators.js
|
200786
200851
|
var USE_PROJECT_FALLBACK = [
|
200787
200852
|
"authors",
|
200853
|
+
"reviewers",
|
200854
|
+
"editors",
|
200788
200855
|
"date",
|
200789
200856
|
"doi",
|
200790
200857
|
"arxiv",
|
@@ -200799,6 +200866,7 @@ var USE_PROJECT_FALLBACK = [
|
|
200799
200866
|
"numbering",
|
200800
200867
|
"keywords",
|
200801
200868
|
"funding",
|
200869
|
+
"copyright",
|
200802
200870
|
"affiliations"
|
200803
200871
|
];
|
200804
200872
|
function validatePageFrontmatterKeys(value, opts) {
|
@@ -200857,7 +200925,7 @@ function validatePageFrontmatter(input3, opts) {
|
|
200857
200925
|
|
200858
200926
|
// ../myst-frontmatter/dist/utils/fillPageFrontmatter.js
|
200859
200927
|
function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
200860
|
-
var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
200928
|
+
var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x2;
|
200861
200929
|
const frontmatter = fillMissingKeys(pageFrontmatter, projectFrontmatter, USE_PROJECT_FALLBACK);
|
200862
200930
|
if (pageFrontmatter.numbering || projectFrontmatter.numbering) {
|
200863
200931
|
frontmatter.numbering = fillNumbering(pageFrontmatter.numbering, projectFrontmatter.numbering);
|
@@ -200900,12 +200968,18 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
200900
200968
|
});
|
200901
200969
|
});
|
200902
200970
|
});
|
200903
|
-
|
200971
|
+
(_k = frontmatter.reviewers) === null || _k === void 0 ? void 0 : _k.forEach((reviewer) => {
|
200972
|
+
contributorIds.add(reviewer);
|
200973
|
+
});
|
200974
|
+
(_l = frontmatter.editors) === null || _l === void 0 ? void 0 : _l.forEach((editor) => {
|
200975
|
+
contributorIds.add(editor);
|
200976
|
+
});
|
200977
|
+
if (((_m = frontmatter.authors) === null || _m === void 0 ? void 0 : _m.length) || contributorIds.size) {
|
200904
200978
|
const people = [
|
200905
|
-
...(
|
200906
|
-
...(
|
200907
|
-
...(
|
200908
|
-
...(
|
200979
|
+
...(_o = pageFrontmatter.authors) !== null && _o !== void 0 ? _o : [],
|
200980
|
+
...(_p = projectFrontmatter.authors) !== null && _p !== void 0 ? _p : [],
|
200981
|
+
...(_q = pageFrontmatter.contributors) !== null && _q !== void 0 ? _q : [],
|
200982
|
+
...(_r = projectFrontmatter.contributors) !== null && _r !== void 0 ? _r : []
|
200909
200983
|
];
|
200910
200984
|
const peopleLookup = {};
|
200911
200985
|
people.forEach((auth) => {
|
@@ -200917,7 +200991,7 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
200917
200991
|
validationWarning(`Duplicate contributor id within project: ${auth.id}`, incrementOptions("authors", opts));
|
200918
200992
|
}
|
200919
200993
|
});
|
200920
|
-
if ((
|
200994
|
+
if ((_s = frontmatter.authors) === null || _s === void 0 ? void 0 : _s.length) {
|
200921
200995
|
frontmatter.authors = frontmatter.authors.map((auth) => {
|
200922
200996
|
var _a7;
|
200923
200997
|
if (!auth.id)
|
@@ -200933,20 +201007,20 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
200933
201007
|
});
|
200934
201008
|
}
|
200935
201009
|
}
|
200936
|
-
[...(
|
201010
|
+
[...(_t = frontmatter.authors) !== null && _t !== void 0 ? _t : [], ...(_u = frontmatter.contributors) !== null && _u !== void 0 ? _u : []].forEach((auth) => {
|
200937
201011
|
var _a7;
|
200938
201012
|
(_a7 = auth.affiliations) === null || _a7 === void 0 ? void 0 : _a7.forEach((aff) => {
|
200939
201013
|
affiliationIds.add(aff);
|
200940
201014
|
});
|
200941
201015
|
});
|
200942
|
-
(
|
201016
|
+
(_v = frontmatter.affiliations) === null || _v === void 0 ? void 0 : _v.forEach((aff) => {
|
200943
201017
|
if (aff.id)
|
200944
201018
|
affiliationIds.add(aff.id);
|
200945
201019
|
});
|
200946
201020
|
if (affiliationIds.size) {
|
200947
201021
|
const affiliations2 = [
|
200948
|
-
...(
|
200949
|
-
...(
|
201022
|
+
...(_w = pageFrontmatter.affiliations) !== null && _w !== void 0 ? _w : [],
|
201023
|
+
...(_x2 = projectFrontmatter.affiliations) !== null && _x2 !== void 0 ? _x2 : []
|
200950
201024
|
];
|
200951
201025
|
const affiliationLookup = {};
|
200952
201026
|
affiliations2.forEach((aff) => {
|
@@ -201764,7 +201838,7 @@ function createId() {
|
|
201764
201838
|
function normalizeLabel(label) {
|
201765
201839
|
if (!label)
|
201766
201840
|
return void 0;
|
201767
|
-
const identifier = label.replace(/[\t\n\r ]+/g, " ").trim().toLowerCase();
|
201841
|
+
const identifier = label.replace(/[\t\n\r ]+/g, " ").replace(/['‘’"“”]+/g, "").trim().toLowerCase();
|
201768
201842
|
const html_id = createHtmlId(identifier);
|
201769
201843
|
return { identifier, label, html_id };
|
201770
201844
|
}
|
@@ -202503,17 +202577,17 @@ function coercePart(part) {
|
|
202503
202577
|
if (!part) {
|
202504
202578
|
return [];
|
202505
202579
|
}
|
202506
|
-
return typeof part === "string" ? [part] : part;
|
202580
|
+
return typeof part === "string" ? [part.toLowerCase()] : part.map((s5) => s5.toLowerCase());
|
202507
202581
|
}
|
202508
202582
|
function selectBlockParts(tree, part) {
|
202509
202583
|
const parts = coercePart(part);
|
202510
202584
|
if (parts.length === 0)
|
202511
202585
|
return [];
|
202512
202586
|
const blockParts = selectAll("block", tree).filter((block5) => {
|
202513
|
-
|
202514
|
-
|
202515
|
-
|
202516
|
-
|
202587
|
+
var _a6, _b, _c;
|
202588
|
+
const blockTags = (((_a6 = block5.data) === null || _a6 === void 0 ? void 0 : _a6.tags) && Array.isArray(block5.data.tags) ? block5.data.tags : []).map((tag) => tag === null || tag === void 0 ? void 0 : tag.toLowerCase());
|
202589
|
+
const blockPart = (_c = (_b = block5.data) === null || _b === void 0 ? void 0 : _b.part) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
202590
|
+
return parts.map((p5) => blockPart === p5 || blockTags.includes(p5)).reduce((a2, b) => a2 || b, false);
|
202517
202591
|
});
|
202518
202592
|
return blockParts;
|
202519
202593
|
}
|
@@ -202585,8 +202659,8 @@ function extractPart(tree, part, opts) {
|
|
202585
202659
|
var _a6;
|
202586
202660
|
(_a6 = block5.data) !== null && _a6 !== void 0 ? _a6 : block5.data = {};
|
202587
202661
|
block5.data.part = partStrings[0];
|
202588
|
-
if (block5.data.tags && Array.isArray(block5.data.tags) && block5.data.tags.reduce((a2, t2) => a2 || partStrings.includes(t2), false)) {
|
202589
|
-
block5.data.tags = block5.data.tags.filter((tag) => !partStrings.includes(tag));
|
202662
|
+
if (block5.data.tags && Array.isArray(block5.data.tags) && block5.data.tags.reduce((a2, t2) => a2 || partStrings.includes(t2.toLowerCase()), false)) {
|
202663
|
+
block5.data.tags = block5.data.tags.filter((tag) => !partStrings.includes(tag.toLowerCase()));
|
202590
202664
|
if (block5.data.tags.length === 0) {
|
202591
202665
|
delete block5.data.tags;
|
202592
202666
|
}
|
@@ -202629,6 +202703,7 @@ var RuleId;
|
|
202629
202703
|
RuleId2["texRenders"] = "tex-renders";
|
202630
202704
|
RuleId2["exportExtensionCorrect"] = "export-extension-correct";
|
202631
202705
|
RuleId2["exportArticleExists"] = "export-article-exists";
|
202706
|
+
RuleId2["exportFormatDetermined"] = "export-format-determined";
|
202632
202707
|
RuleId2["texParses"] = "tex-parses";
|
202633
202708
|
RuleId2["jatsParses"] = "jats-parses";
|
202634
202709
|
RuleId2["mystFileLoads"] = "myst-file-loads";
|
@@ -237774,6 +237849,32 @@ function renderEquation(file, node3, opts) {
|
|
237774
237849
|
}
|
237775
237850
|
}
|
237776
237851
|
function mathNestingTransform(tree, file) {
|
237852
|
+
const paragraphs = selectAll("paragraph", tree);
|
237853
|
+
paragraphs.forEach((paragraph4) => {
|
237854
|
+
if (paragraph4.children.length === 1)
|
237855
|
+
return;
|
237856
|
+
paragraph4.children.forEach((child, index4) => {
|
237857
|
+
var _a6, _b, _c, _d2;
|
237858
|
+
if (child.type !== "math")
|
237859
|
+
return;
|
237860
|
+
const math7 = child;
|
237861
|
+
const before = paragraph4.children[index4 - 1];
|
237862
|
+
const after = paragraph4.children[index4 + 1];
|
237863
|
+
if (index4 === 0) {
|
237864
|
+
math7.tight = "after";
|
237865
|
+
} else if (index4 === paragraph4.children.length - 1) {
|
237866
|
+
math7.tight = "before";
|
237867
|
+
} else {
|
237868
|
+
math7.tight = true;
|
237869
|
+
}
|
237870
|
+
if ((before === null || before === void 0 ? void 0 : before.type) === "text") {
|
237871
|
+
before.value = (_b = (_a6 = before.value) === null || _a6 === void 0 ? void 0 : _a6.replace(/\n$/, "")) !== null && _b !== void 0 ? _b : "";
|
237872
|
+
}
|
237873
|
+
if ((after === null || after === void 0 ? void 0 : after.type) === "text") {
|
237874
|
+
after.value = (_d2 = (_c = after.value) === null || _c === void 0 ? void 0 : _c.replace(/^\n/, "")) !== null && _d2 !== void 0 ? _d2 : "";
|
237875
|
+
}
|
237876
|
+
});
|
237877
|
+
});
|
237777
237878
|
unnestTransform(tree, "paragraph", "math");
|
237778
237879
|
}
|
237779
237880
|
function mathLabelTransform(tree, file) {
|
@@ -278006,6 +278107,8 @@ var macros17 = {
|
|
278006
278107
|
multicolumn: 3,
|
278007
278108
|
subfigure: 2,
|
278008
278109
|
tabularx: 2,
|
278110
|
+
longtable: 2,
|
278111
|
+
["longtable*"]: 2,
|
278009
278112
|
supertabular: 1,
|
278010
278113
|
cmidrule: 2,
|
278011
278114
|
cline: 1,
|
@@ -279027,60 +279130,221 @@ var MISC_HANDLERS = {
|
|
279027
279130
|
};
|
279028
279131
|
|
279029
279132
|
// ../tex-to-myst/dist/tables.js
|
279030
|
-
|
279031
|
-
|
279032
|
-
|
279033
|
-
|
279034
|
-
|
279035
|
-
|
279036
|
-
|
279037
|
-
|
279038
|
-
|
279039
|
-
|
279040
|
-
|
279041
|
-
|
279042
|
-
|
279043
|
-
|
279044
|
-
|
279045
|
-
|
279046
|
-
|
279047
|
-
|
279048
|
-
return;
|
279049
|
-
|
279133
|
+
var ALIGNMENT_MAP = { c: "center", l: "left", r: "right" };
|
279134
|
+
function getTabularAlignment(arg2) {
|
279135
|
+
if (!arg2 || !arg2.content.reduce((b, { type: type2 }) => b && ["string", "whitespace"].includes(type2), true)) {
|
279136
|
+
return;
|
279137
|
+
}
|
279138
|
+
const spec = texToText(arg2.content).replace(/[\s|]/g, "");
|
279139
|
+
if (!spec.match(/([lrc]*)/))
|
279140
|
+
return;
|
279141
|
+
return spec.split("").map((a2) => ALIGNMENT_MAP[a2]);
|
279142
|
+
}
|
279143
|
+
function fixTable(vfile2, table5, alignments) {
|
279144
|
+
if ((table5 === null || table5 === void 0 ? void 0 : table5.type) !== "table")
|
279145
|
+
return;
|
279146
|
+
const multirowTracker = {};
|
279147
|
+
const rowSizes = table5.children.map((tr3) => ({
|
279148
|
+
tr: tr3,
|
279149
|
+
size: tr3.children.reduce((size, td) => {
|
279150
|
+
var _a6;
|
279151
|
+
return size + ((_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1);
|
279152
|
+
}, 0)
|
279153
|
+
}));
|
279154
|
+
const uniqueSizes = [...new Set(rowSizes.map(({ size }) => size))];
|
279155
|
+
if (uniqueSizes.length !== 1) {
|
279156
|
+
fileWarn(vfile2, `Uneven table found, please check your rows to get an even table.`, {
|
279157
|
+
node: table5,
|
279158
|
+
note: `Row sizes are: ${rowSizes.map(({ size }) => size).join(", ")}`
|
279159
|
+
});
|
279160
|
+
rowSizes.reduce((rows, row2, index4) => {
|
279161
|
+
if (index4 > 0 && rowSizes[index4 - 1].size !== row2.size) {
|
279162
|
+
rows.push({ ...row2, previous: rowSizes[index4 - 1].size });
|
279163
|
+
}
|
279164
|
+
return rows;
|
279165
|
+
}, []).forEach(({ tr: tr3, size, previous }) => {
|
279166
|
+
fileWarn(vfile2, `Table row of size (${size}) does not match previous row size (${previous})`, {
|
279167
|
+
node: tr3
|
279168
|
+
});
|
279169
|
+
});
|
279170
|
+
}
|
279171
|
+
let useAlignments = false;
|
279172
|
+
if (alignments && uniqueSizes.length === 1 && (uniqueSizes[0] === alignments.length || alignments.length === 1)) {
|
279173
|
+
useAlignments = true;
|
279174
|
+
} else if (alignments && uniqueSizes.length === 1 && uniqueSizes[0] !== alignments.length) {
|
279175
|
+
fileWarn(vfile2, `Table alignment argument does not match number of columns`, { node: table5 });
|
279176
|
+
}
|
279177
|
+
table5.children.forEach((tr3, rowIndex) => {
|
279178
|
+
Object.keys(multirowTracker).forEach((key2) => {
|
279179
|
+
const colIndex = key2;
|
279180
|
+
if (multirowTracker[colIndex] > 1) {
|
279181
|
+
multirowTracker[colIndex]--;
|
279182
|
+
} else {
|
279183
|
+
delete multirowTracker[colIndex];
|
279184
|
+
}
|
279185
|
+
});
|
279186
|
+
const columnIndex = tr3.children.reduce((info, td) => {
|
279187
|
+
var _a6;
|
279188
|
+
info.columnIndex.push(info.size);
|
279189
|
+
info.size += (_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
|
279190
|
+
return info;
|
279191
|
+
}, { columnIndex: [], size: 0 }).columnIndex;
|
279192
|
+
tr3.children = tr3.children.filter((td, index4) => {
|
279193
|
+
var _a6, _b;
|
279194
|
+
const colIndex = columnIndex[index4];
|
279195
|
+
if (td.rowspan && td.rowspan > 1) {
|
279196
|
+
for (let col = 0; col < ((_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1); col++) {
|
279197
|
+
multirowTracker[colIndex + col] = td.rowspan;
|
279198
|
+
}
|
279199
|
+
}
|
279200
|
+
if (alignments && useAlignments && !td.align) {
|
279201
|
+
const align = (_b = alignments[colIndex]) !== null && _b !== void 0 ? _b : alignments[0];
|
279202
|
+
if (align !== "left")
|
279203
|
+
td.align = align;
|
279204
|
+
}
|
279205
|
+
if (multirowTracker[colIndex] && td.rowspan !== multirowTracker[colIndex]) {
|
279206
|
+
if (!isEmptyCell(td)) {
|
279207
|
+
fileWarn(vfile2, `Non-empty placeholder cell found at row ${rowIndex}, column ${colIndex}.`, { node: table5 });
|
279208
|
+
}
|
279209
|
+
return false;
|
279210
|
+
}
|
279211
|
+
return true;
|
279212
|
+
});
|
279213
|
+
});
|
279214
|
+
}
|
279215
|
+
function isEmptyCell(cell3) {
|
279216
|
+
return toText(cell3).trim() === "";
|
279217
|
+
}
|
279218
|
+
var createTable = (addContainer = false) => {
|
279219
|
+
return (node3, state) => {
|
279220
|
+
state.closeParagraph();
|
279221
|
+
const table5 = {
|
279222
|
+
rows: [],
|
279223
|
+
cells: [],
|
279224
|
+
cell: [],
|
279225
|
+
// These are used for longtable
|
279226
|
+
caption: void 0,
|
279227
|
+
label: void 0,
|
279228
|
+
firstHead: [],
|
279229
|
+
head: [],
|
279230
|
+
foot: [],
|
279231
|
+
lastFoot: []
|
279232
|
+
};
|
279233
|
+
const IGNORE = /* @__PURE__ */ new Set([
|
279234
|
+
"cline",
|
279235
|
+
"hline",
|
279236
|
+
"rule",
|
279237
|
+
"midrule",
|
279238
|
+
"cmidrule",
|
279239
|
+
"toprule",
|
279240
|
+
"bottomrule"
|
279241
|
+
]);
|
279242
|
+
const alignments = getTabularAlignment(node3.args[node3.args.length - 1]);
|
279243
|
+
node3.content.forEach((n) => {
|
279244
|
+
if (n.type === "comment")
|
279245
|
+
return;
|
279246
|
+
if (n.type === "macro" && IGNORE.has(n.content))
|
279247
|
+
return;
|
279248
|
+
if (n.type === "macro" && n.content === "label" && !table5.label) {
|
279249
|
+
table5.label = n;
|
279250
|
+
return;
|
279251
|
+
}
|
279252
|
+
if (n.type === "macro" && n.content === "caption") {
|
279253
|
+
table5.caption = n;
|
279254
|
+
return;
|
279255
|
+
}
|
279256
|
+
if (n.type === "macro" && n.content === "endfirsthead") {
|
279257
|
+
table5.firstHead = table5.rows;
|
279258
|
+
table5.rows = [];
|
279259
|
+
return;
|
279260
|
+
}
|
279261
|
+
if (n.type === "macro" && n.content === "endhead") {
|
279262
|
+
table5.head = table5.rows;
|
279263
|
+
table5.rows = [];
|
279264
|
+
return;
|
279265
|
+
}
|
279266
|
+
if (n.type === "macro" && n.content === "endfoot") {
|
279267
|
+
table5.foot = table5.rows;
|
279268
|
+
table5.rows = [];
|
279269
|
+
return;
|
279270
|
+
}
|
279271
|
+
if (n.type === "macro" && n.content === "endlastfoot") {
|
279272
|
+
table5.lastFoot = table5.rows;
|
279273
|
+
table5.rows = [];
|
279274
|
+
return;
|
279275
|
+
}
|
279276
|
+
if (n.type === "macro" && (n.content === "\\" || n.content === "tabularnewline")) {
|
279277
|
+
table5.cells.push(table5.cell);
|
279278
|
+
if (table5.cells.flat().length > 0)
|
279279
|
+
table5.rows.push(table5.cells);
|
279280
|
+
table5.cell = [];
|
279281
|
+
table5.cells = [];
|
279282
|
+
return;
|
279283
|
+
}
|
279284
|
+
if (n.type === "string" && n.content === "&") {
|
279285
|
+
table5.cells.push(table5.cell);
|
279286
|
+
table5.cell = [];
|
279287
|
+
return;
|
279288
|
+
}
|
279289
|
+
if (table5.cell.length === 0 && (n.type === "whitespace" || n.type === "parbreak"))
|
279290
|
+
return;
|
279291
|
+
table5.cell.push(n);
|
279292
|
+
});
|
279293
|
+
if (table5.cell.length > 0)
|
279050
279294
|
table5.cells.push(table5.cell);
|
279295
|
+
if (table5.cells.length > 0)
|
279051
279296
|
table5.rows.push(table5.cells);
|
279052
|
-
|
279053
|
-
table5.
|
279054
|
-
|
279297
|
+
if (table5.firstHead.length > 0) {
|
279298
|
+
table5.rows.unshift(...table5.firstHead);
|
279299
|
+
} else {
|
279300
|
+
table5.rows.unshift(...table5.head);
|
279055
279301
|
}
|
279056
|
-
if (
|
279057
|
-
table5.
|
279058
|
-
|
279059
|
-
|
279302
|
+
if (table5.lastFoot.length > 0) {
|
279303
|
+
table5.rows.push(...table5.lastFoot);
|
279304
|
+
} else {
|
279305
|
+
table5.rows.push(...table5.foot);
|
279060
279306
|
}
|
279061
|
-
if (
|
279062
|
-
|
279063
|
-
|
279064
|
-
|
279065
|
-
|
279066
|
-
|
279067
|
-
|
279068
|
-
|
279069
|
-
|
279070
|
-
|
279071
|
-
|
279072
|
-
|
279073
|
-
|
279074
|
-
|
279075
|
-
|
279307
|
+
if (addContainer) {
|
279308
|
+
state.openNode("container", { kind: "table" });
|
279309
|
+
if (table5.caption) {
|
279310
|
+
state.renderChildren({ content: [{ type: "group", content: [table5.caption] }] });
|
279311
|
+
}
|
279312
|
+
if (table5.label) {
|
279313
|
+
state.renderChildren({ content: [{ type: "group", content: [table5.label] }] });
|
279314
|
+
}
|
279315
|
+
}
|
279316
|
+
state.openNode("table");
|
279317
|
+
table5.rows.forEach((row2) => {
|
279318
|
+
state.openNode("tableRow");
|
279319
|
+
row2.forEach((cell3) => {
|
279320
|
+
state.openNode("tableCell");
|
279321
|
+
state.renderChildren({
|
279322
|
+
content: [
|
279323
|
+
{
|
279324
|
+
// Putting things in a group helps with floating `\bf` commands
|
279325
|
+
// For example:
|
279326
|
+
// `& \bf title &` --> `& {\bf title} &`
|
279327
|
+
type: "group",
|
279328
|
+
// Ignore ending whitespace "title &" should become "title"
|
279329
|
+
content: trimWhitespace(cell3)
|
279330
|
+
}
|
279331
|
+
]
|
279332
|
+
});
|
279333
|
+
state.closeParagraph();
|
279334
|
+
unnestParagraphs(state.top(), "tableCell");
|
279335
|
+
state.closeNode("tableCell");
|
279336
|
+
});
|
279337
|
+
state.closeNode("tableRow");
|
279338
|
+
});
|
279339
|
+
const tableNode = state.top();
|
279340
|
+
fixTable(state.file, tableNode, alignments);
|
279341
|
+
state.closeNode("table");
|
279342
|
+
if (addContainer) {
|
279076
279343
|
state.closeParagraph();
|
279077
|
-
unnestParagraphs(state.top(), "tableCell");
|
279078
279344
|
state.closeNode();
|
279079
|
-
}
|
279080
|
-
|
279081
|
-
|
279082
|
-
state.closeNode();
|
279083
|
-
}
|
279345
|
+
}
|
279346
|
+
};
|
279347
|
+
};
|
279084
279348
|
var TABLE_HANDLERS = {
|
279085
279349
|
env_table(node3, state) {
|
279086
279350
|
state.closeParagraph();
|
@@ -279096,9 +279360,11 @@ var TABLE_HANDLERS = {
|
|
279096
279360
|
state.closeParagraph();
|
279097
279361
|
state.closeNode();
|
279098
279362
|
},
|
279099
|
-
env_tabular: createTable,
|
279100
|
-
env_tabularx: createTable,
|
279101
|
-
env_supertabular: createTable,
|
279363
|
+
env_tabular: createTable(),
|
279364
|
+
env_tabularx: createTable(),
|
279365
|
+
env_supertabular: createTable(),
|
279366
|
+
env_longtable: createTable(true),
|
279367
|
+
"env_longtable*": createTable(true),
|
279102
279368
|
env_threeparttable(node3, state) {
|
279103
279369
|
state.closeParagraph();
|
279104
279370
|
const envId = createId();
|
@@ -279171,7 +279437,9 @@ var TABLE_HANDLERS = {
|
|
279171
279437
|
if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === "tableCell" && Number.isInteger(rowspan)) {
|
279172
279438
|
currentNode.rowspan = rowspan;
|
279173
279439
|
}
|
279174
|
-
|
279440
|
+
const cell3 = node3.args[node3.args.length - 1];
|
279441
|
+
cell3.content = trimWhitespace(cell3.content);
|
279442
|
+
state.renderChildren(cell3);
|
279175
279443
|
state.closeParagraph();
|
279176
279444
|
},
|
279177
279445
|
macro_multicolumn(node3, state) {
|
@@ -279179,20 +279447,34 @@ var TABLE_HANDLERS = {
|
|
279179
279447
|
const ncolArg = node3.args[0];
|
279180
279448
|
const colspan = Number((_b = (_a6 = ncolArg === null || ncolArg === void 0 ? void 0 : ncolArg.content) === null || _a6 === void 0 ? void 0 : _a6[0]) === null || _b === void 0 ? void 0 : _b.content);
|
279181
279449
|
const currentNode = state.top();
|
279182
|
-
|
279183
|
-
|
279450
|
+
const td = (currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === "tableCell" ? currentNode : void 0;
|
279451
|
+
if (td && Number.isInteger(colspan)) {
|
279452
|
+
td.colspan = colspan;
|
279453
|
+
}
|
279454
|
+
if (td && node3.args.length === 3) {
|
279455
|
+
const alignmentText = texToText(node3.args[1].content).replace(/([|\s])/g, "");
|
279456
|
+
const align = ALIGNMENT_MAP[alignmentText] || void 0;
|
279457
|
+
if (align && align !== "left") {
|
279458
|
+
td.align = align;
|
279459
|
+
}
|
279184
279460
|
}
|
279185
|
-
|
279461
|
+
const cell3 = node3.args[node3.args.length - 1];
|
279462
|
+
cell3.content = trimWhitespace(cell3.content);
|
279463
|
+
state.renderChildren(cell3);
|
279186
279464
|
state.closeNode();
|
279187
279465
|
}
|
279188
279466
|
};
|
279189
279467
|
function trimWhitespace(content3) {
|
279190
|
-
var _a6;
|
279191
|
-
|
279192
|
-
|
279193
|
-
|
279468
|
+
var _a6, _b;
|
279469
|
+
let startIndex = 0;
|
279470
|
+
let endIndex = content3.length - 1;
|
279471
|
+
while (startIndex <= endIndex && ((_a6 = content3[startIndex]) === null || _a6 === void 0 ? void 0 : _a6.type) === "whitespace") {
|
279472
|
+
startIndex++;
|
279194
279473
|
}
|
279195
|
-
|
279474
|
+
while (endIndex >= startIndex && ((_b = content3[endIndex]) === null || _b === void 0 ? void 0 : _b.type) === "whitespace") {
|
279475
|
+
endIndex--;
|
279476
|
+
}
|
279477
|
+
return content3.slice(startIndex, endIndex + 1);
|
279196
279478
|
}
|
279197
279479
|
|
279198
279480
|
// ../tex-to-myst/dist/footnotes.js
|
@@ -279875,7 +280157,9 @@ var TexParser = class {
|
|
279875
280157
|
}
|
279876
280158
|
this.closeNode();
|
279877
280159
|
}
|
279878
|
-
closeNode() {
|
280160
|
+
closeNode(type2) {
|
280161
|
+
if (type2 && this.top().type !== type2)
|
280162
|
+
return this.top();
|
279879
280163
|
const node3 = this.stack.pop();
|
279880
280164
|
this.pushNode(node3);
|
279881
280165
|
return node3;
|
@@ -280277,6 +280561,13 @@ function stateError(state, message) {
|
|
280277
280561
|
|
280278
280562
|
// ../markdown-it-myst/dist/directives.js
|
280279
280563
|
var COLON_OPTION_REGEX = /^:(?<option>[^:\s]+?):(\s*(?<value>.*)){0,1}\s*$/;
|
280564
|
+
function computeBlockTightness(src, map6) {
|
280565
|
+
const lines = src.split("\n");
|
280566
|
+
const tightBefore = typeof (map6 === null || map6 === void 0 ? void 0 : map6[0]) === "number" && map6[0] > 0 ? lines[map6[0] - 1].trim() !== "" : false;
|
280567
|
+
const tightAfter = typeof (map6 === null || map6 === void 0 ? void 0 : map6[1]) === "number" && map6[1] < lines.length ? lines[map6[1]].trim() !== "" : false;
|
280568
|
+
const tight = tightBefore && tightAfter ? true : tightBefore ? "before" : tightAfter ? "after" : false;
|
280569
|
+
return tight;
|
280570
|
+
}
|
280280
280571
|
function replaceFences(state) {
|
280281
280572
|
for (const token of state.tokens) {
|
280282
280573
|
if (token.type === "fence" || token.type === "colon_fence") {
|
@@ -280313,7 +280604,9 @@ function runDirectives(state) {
|
|
280313
280604
|
directiveOpen.map = map6;
|
280314
280605
|
directiveOpen.meta = {
|
280315
280606
|
arg: arg2,
|
280316
|
-
options: simplifyDirectiveOptions(options)
|
280607
|
+
options: simplifyDirectiveOptions(options),
|
280608
|
+
// Tightness is computed for all directives (are they separated by a newline before/after)
|
280609
|
+
tight: computeBlockTightness(state.src, token.map)
|
280317
280610
|
};
|
280318
280611
|
const startLineNumber = map6 ? map6[0] : 0;
|
280319
280612
|
const argTokens = directiveArgToTokens(arg2, startLineNumber, state);
|
@@ -282084,14 +282377,16 @@ var mathDirective = {
|
|
282084
282377
|
run(data) {
|
282085
282378
|
var _a6;
|
282086
282379
|
const { label, identifier } = normalizeLabel((_a6 = data.options) === null || _a6 === void 0 ? void 0 : _a6.label) || {};
|
282087
|
-
|
282088
|
-
|
282089
|
-
|
282090
|
-
|
282091
|
-
|
282092
|
-
|
282093
|
-
|
282094
|
-
|
282380
|
+
const math7 = {
|
282381
|
+
type: "math",
|
282382
|
+
identifier,
|
282383
|
+
label,
|
282384
|
+
value: data.body
|
282385
|
+
};
|
282386
|
+
if (data.node.tight) {
|
282387
|
+
math7.tight = data.node.tight;
|
282388
|
+
}
|
282389
|
+
return [math7];
|
282095
282390
|
}
|
282096
282391
|
};
|
282097
282392
|
|
@@ -283967,7 +284262,8 @@ function withoutTrailingNewline(str2) {
|
|
283967
284262
|
return str2[str2.length - 1] == "\n" ? str2.slice(0, str2.length - 1) : str2;
|
283968
284263
|
}
|
283969
284264
|
var MarkdownParseState = class {
|
283970
|
-
constructor(handlers6) {
|
284265
|
+
constructor(src, handlers6) {
|
284266
|
+
this.src = src;
|
283971
284267
|
this.stack = [u2("root", [])];
|
283972
284268
|
this.handlers = getTokenHandlers(handlers6);
|
283973
284269
|
}
|
@@ -284013,8 +284309,9 @@ var MarkdownParseState = class {
|
|
284013
284309
|
if (token.hidden && !UNHIDDEN_TOKENS.has(token.type))
|
284014
284310
|
return;
|
284015
284311
|
const handler = this.handlers[token.type];
|
284016
|
-
if (!handler)
|
284312
|
+
if (!handler) {
|
284017
284313
|
throw new Error(`Token type ${token.type} not supported by tokensToMyst parser`);
|
284314
|
+
}
|
284018
284315
|
handler(this, token, tokens, index4);
|
284019
284316
|
});
|
284020
284317
|
}
|
@@ -284037,9 +284334,9 @@ var MarkdownParseState = class {
|
|
284037
284334
|
}
|
284038
284335
|
}
|
284039
284336
|
};
|
284040
|
-
function getAttrs(spec, token, tokens, index4) {
|
284337
|
+
function getAttrs(state, spec, token, tokens, index4) {
|
284041
284338
|
var _a6;
|
284042
|
-
const attrs = ((_a6 = spec.getAttrs) === null || _a6 === void 0 ? void 0 : _a6.call(spec, token, tokens, index4)) || spec.attrs || {};
|
284339
|
+
const attrs = ((_a6 = spec.getAttrs) === null || _a6 === void 0 ? void 0 : _a6.call(spec, token, tokens, index4, state)) || spec.attrs || {};
|
284043
284340
|
if ("type" in attrs)
|
284044
284341
|
throw new Error('You can not have "type" as attrs.');
|
284045
284342
|
if ("children" in attrs)
|
@@ -284056,15 +284353,15 @@ function getTokenHandlers(specHandlers) {
|
|
284056
284353
|
if (noCloseToken(spec, type2)) {
|
284057
284354
|
handlers6[type2] = (state, tok, tokens, i2) => {
|
284058
284355
|
if (spec.isText) {
|
284059
|
-
state.addText(withoutTrailingNewline(tok.content), tok, spec.type, getAttrs(spec, tok, tokens, i2));
|
284356
|
+
state.addText(withoutTrailingNewline(tok.content), tok, spec.type, getAttrs(state, spec, tok, tokens, i2));
|
284060
284357
|
return;
|
284061
284358
|
}
|
284062
|
-
state.openNode(nodeType, tok, getAttrs(spec, tok, tokens, i2), spec.isLeaf);
|
284359
|
+
state.openNode(nodeType, tok, getAttrs(state, spec, tok, tokens, i2), spec.isLeaf);
|
284063
284360
|
state.addText(withoutTrailingNewline(tok.content), tok);
|
284064
284361
|
state.closeNode();
|
284065
284362
|
};
|
284066
284363
|
} else {
|
284067
|
-
handlers6[type2 + "_open"] = (state, tok, tokens, i2) => state.openNode(nodeType, tok, getAttrs(spec, tok, tokens, i2));
|
284364
|
+
handlers6[type2 + "_open"] = (state, tok, tokens, i2) => state.openNode(nodeType, tok, getAttrs(state, spec, tok, tokens, i2));
|
284068
284365
|
handlers6[type2 + "_close"] = (state) => state.closeNode();
|
284069
284366
|
}
|
284070
284367
|
});
|
@@ -284075,6 +284372,15 @@ function getTokenHandlers(specHandlers) {
|
|
284075
284372
|
}
|
284076
284373
|
|
284077
284374
|
// ../myst-parser/dist/tokensToMyst.js
|
284375
|
+
function computeAmsmathTightness(src, map6) {
|
284376
|
+
var _a6;
|
284377
|
+
const lines = src.split("\n");
|
284378
|
+
const tightBefore = typeof (map6 === null || map6 === void 0 ? void 0 : map6[0]) === "number" && map6[0] > 0 ? lines[map6[0] - 1].trim() !== "" : false;
|
284379
|
+
const last = typeof (map6 === null || map6 === void 0 ? void 0 : map6[1]) === "number" ? (map6 === null || map6 === void 0 ? void 0 : map6[1]) + 1 : void 0;
|
284380
|
+
const tightAfter = typeof last === "number" && last < lines.length ? ((_a6 = lines[last]) === null || _a6 === void 0 ? void 0 : _a6.trim()) !== "" : false;
|
284381
|
+
const tight = tightBefore && tightAfter ? true : tightBefore ? "before" : tightAfter ? "after" : false;
|
284382
|
+
return tight;
|
284383
|
+
}
|
284078
284384
|
var NUMBERED_CLASS = /^numbered$/;
|
284079
284385
|
var ALIGN_CLASS = /(?:(?:align-)|^)(left|right|center)/;
|
284080
284386
|
function getClassName(token, exclude) {
|
@@ -284351,11 +284657,15 @@ var defaultMdast = {
|
|
284351
284657
|
type: "math",
|
284352
284658
|
noCloseToken: true,
|
284353
284659
|
isText: true,
|
284354
|
-
getAttrs(t2) {
|
284660
|
+
getAttrs(t2, tokens, index4, state) {
|
284355
284661
|
var _a6;
|
284356
|
-
|
284662
|
+
const tight = computeAmsmathTightness(state.src, t2.map);
|
284663
|
+
const attrs = {
|
284357
284664
|
enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
|
284358
284665
|
};
|
284666
|
+
if (tight)
|
284667
|
+
attrs.tight = tight;
|
284668
|
+
return attrs;
|
284359
284669
|
}
|
284360
284670
|
},
|
284361
284671
|
footnote_ref: {
|
@@ -284412,12 +284722,13 @@ var defaultMdast = {
|
|
284412
284722
|
parsed_directive: {
|
284413
284723
|
type: "mystDirective",
|
284414
284724
|
getAttrs(t2) {
|
284415
|
-
var _a6, _b;
|
284725
|
+
var _a6, _b, _c;
|
284416
284726
|
return {
|
284417
284727
|
name: t2.info,
|
284418
284728
|
args: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.arg,
|
284419
284729
|
options: (_b = t2.meta) === null || _b === void 0 ? void 0 : _b.options,
|
284420
|
-
value: t2.content || void 0
|
284730
|
+
value: t2.content || void 0,
|
284731
|
+
tight: ((_c = t2.meta) === null || _c === void 0 ? void 0 : _c.tight) || void 0
|
284421
284732
|
};
|
284422
284733
|
}
|
284423
284734
|
},
|
@@ -284544,14 +284855,14 @@ var defaultOptions2 = {
|
|
284544
284855
|
hoistSingleImagesOutofParagraphs: true,
|
284545
284856
|
nestBlocks: true
|
284546
284857
|
};
|
284547
|
-
function tokensToMyst(tokens, options = defaultOptions2) {
|
284858
|
+
function tokensToMyst(src, tokens, options = defaultOptions2) {
|
284548
284859
|
var _a6;
|
284549
284860
|
const opts = {
|
284550
284861
|
...defaultOptions2,
|
284551
284862
|
...options,
|
284552
284863
|
handlers: { ...defaultOptions2.handlers, ...options === null || options === void 0 ? void 0 : options.handlers }
|
284553
284864
|
};
|
284554
|
-
const state = new MarkdownParseState(opts.handlers);
|
284865
|
+
const state = new MarkdownParseState(src, opts.handlers);
|
284555
284866
|
state.parseTokens(tokens);
|
284556
284867
|
let tree;
|
284557
284868
|
do {
|
@@ -284949,7 +285260,7 @@ function mystParse(content3, opts) {
|
|
284949
285260
|
const { vfile: vfile2 } = opts || {};
|
284950
285261
|
const parsedOpts = parseOptions(opts);
|
284951
285262
|
const tokenizer = createTokenizer(parsedOpts);
|
284952
|
-
const tree = tokensToMyst(tokenizer.parse(content3, { vfile: vfile2 }), parsedOpts.mdast);
|
285263
|
+
const tree = tokensToMyst(content3, tokenizer.parse(content3, { vfile: vfile2 }), parsedOpts.mdast);
|
284953
285264
|
applyDirectives(tree, parsedOpts.directives, parsedOpts.vfile);
|
284954
285265
|
applyRoles(tree, parsedOpts.roles, parsedOpts.vfile);
|
284955
285266
|
return tree;
|
@@ -285498,7 +285809,7 @@ var import_node_path16 = __toESM(require("path"), 1);
|
|
285498
285809
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
285499
285810
|
|
285500
285811
|
// ../myst-cli/dist/version.js
|
285501
|
-
var version2 = "1.1.
|
285812
|
+
var version2 = "1.1.49";
|
285502
285813
|
var version_default2 = version2;
|
285503
285814
|
|
285504
285815
|
// ../myst-cli/dist/utils/headers.js
|
@@ -287839,7 +288150,7 @@ async function getRawFrontmatterFromFile(session, file, projectPath) {
|
|
287839
288150
|
return void 0;
|
287840
288151
|
return result.pre.frontmatter;
|
287841
288152
|
}
|
287842
|
-
function getExportListFromRawFrontmatter(session,
|
288153
|
+
function getExportListFromRawFrontmatter(session, rawFrontmatter, file) {
|
287843
288154
|
var _a6;
|
287844
288155
|
const vfile2 = new VFile();
|
287845
288156
|
vfile2.path = file;
|
@@ -287848,10 +288159,7 @@ function getExportListFromRawFrontmatter(session, formats, rawFrontmatter, file)
|
|
287848
288159
|
ruleId: RuleId.validFrontmatterExportList
|
287849
288160
|
}));
|
287850
288161
|
logMessagesFromVFile(session, vfile2);
|
287851
|
-
|
287852
|
-
return [];
|
287853
|
-
const exportOptions = exports2.filter((exp) => !!exp && formats.includes(exp.format));
|
287854
|
-
return exportOptions;
|
288162
|
+
return exports2 !== null && exports2 !== void 0 ? exports2 : [];
|
287855
288163
|
}
|
287856
288164
|
function updateFileInfoFromFrontmatter(session, file, frontmatter, url, dataUrl) {
|
287857
288165
|
session.store.dispatch(watch.actions.updateFileInfo({
|
@@ -297246,121 +297554,235 @@ function getDefaultExportFilename(session, file, projectPath) {
|
|
297246
297554
|
const slug = slugFromProject || createSlug(name3);
|
297247
297555
|
return slug;
|
297248
297556
|
}
|
297249
|
-
function getDefaultExportFolder(session, file,
|
297557
|
+
function getDefaultExportFolder(session, file, format, projectPath) {
|
297250
297558
|
const subpaths = [projectPath || import_node_path32.default.parse(file).dir, "_build", "exports"];
|
297251
|
-
if (
|
297559
|
+
if (format === ExportFormats.tex) {
|
297252
297560
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_tex`);
|
297253
|
-
|
297561
|
+
}
|
297562
|
+
if (format === ExportFormats.typst) {
|
297254
297563
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_typst`);
|
297564
|
+
}
|
297255
297565
|
return import_node_path32.default.join(...subpaths);
|
297256
297566
|
}
|
297257
297567
|
|
297258
297568
|
// ../myst-cli/dist/build/utils/collectExportOptions.js
|
297259
297569
|
var SOURCE_EXTENSIONS = [".ipynb", ".md", ".tex"];
|
297260
|
-
function
|
297570
|
+
function resolveArticlesFromProject(exp, proj, vfile2) {
|
297261
297571
|
var _a6;
|
297262
297572
|
const { file, pages } = proj;
|
297263
297573
|
const fileAsPage = { file, level: 1 };
|
297264
297574
|
const articles = (pages === null || pages === void 0 ? void 0 : pages.length) ? pages : [fileAsPage];
|
297265
297575
|
if (MULTI_ARTICLE_EXPORT_FORMATS.includes(exp.format)) {
|
297266
|
-
|
297267
|
-
}
|
297268
|
-
|
297269
|
-
|
297576
|
+
return { articles };
|
297577
|
+
}
|
297578
|
+
if (exp.format === ExportFormats.xml) {
|
297579
|
+
return {
|
297580
|
+
articles: [fileAsPage],
|
297581
|
+
sub_articles: pages.map((page) => page.file).filter((pageFile) => !!pageFile)
|
297582
|
+
};
|
297270
297583
|
} else {
|
297271
|
-
|
297272
|
-
|
297273
|
-
|
297274
|
-
|
297584
|
+
if (articles.length > 1) {
|
297585
|
+
fileError(vfile2, "multiple articles are only supported for 'tex', 'typst', and 'pdf' exports", {
|
297586
|
+
ruleId: RuleId.validFrontmatterExportList
|
297587
|
+
});
|
297588
|
+
}
|
297589
|
+
return { articles: [(_a6 = singleArticleWithFile(articles)) !== null && _a6 !== void 0 ? _a6 : fileAsPage] };
|
297275
297590
|
}
|
297276
297591
|
}
|
297277
|
-
function
|
297592
|
+
function resolveArticlesFromTOC(session, exp, tocPath, vfile2) {
|
297278
297593
|
const allowLevelLessThanOne = [
|
297279
297594
|
ExportFormats.tex,
|
297280
297595
|
ExportFormats.pdf,
|
297281
297596
|
ExportFormats.pdftex
|
297282
297597
|
].includes(exp.format);
|
297283
297598
|
const proj = projectFromToc(session, tocPath, allowLevelLessThanOne ? -1 : 1);
|
297284
|
-
|
297599
|
+
return resolveArticlesFromProject(exp, proj, vfile2);
|
297285
297600
|
}
|
297286
|
-
|
297287
|
-
|
297288
|
-
|
297289
|
-
|
297290
|
-
|
297291
|
-
|
297292
|
-
|
297293
|
-
|
297294
|
-
} else {
|
297295
|
-
rawFrontmatter = await getRawFrontmatterFromFile(session, sourceFile, projectPath);
|
297296
|
-
}
|
297297
|
-
let exportOptions = getExportListFromRawFrontmatter(session, formats, rawFrontmatter, sourceFile);
|
297298
|
-
if (exportOptions.length === 0 && formats.length && opts.force) {
|
297299
|
-
exportOptions = [{ format: formats[0] }];
|
297601
|
+
function resolveTemplate(sourceFile, exp, disableTemplate) {
|
297602
|
+
if (disableTemplate)
|
297603
|
+
return null;
|
297604
|
+
if (exp.template) {
|
297605
|
+
const resolvedTemplatePath = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.template);
|
297606
|
+
if (import_node_fs26.default.existsSync(resolvedTemplatePath)) {
|
297607
|
+
return resolvedTemplatePath;
|
297608
|
+
}
|
297300
297609
|
}
|
297301
|
-
|
297302
|
-
|
297610
|
+
return exp.template;
|
297611
|
+
}
|
297612
|
+
function resolveFormat(vfile2, exp) {
|
297613
|
+
if (exp.format && exp.format !== ExportFormats.pdf) {
|
297614
|
+
return exp.format;
|
297303
297615
|
}
|
297304
|
-
|
297305
|
-
|
297306
|
-
|
297307
|
-
|
297308
|
-
|
297309
|
-
|
297310
|
-
|
297311
|
-
|
297312
|
-
|
297313
|
-
|
297314
|
-
|
297315
|
-
if (
|
297316
|
-
|
297616
|
+
let suggestedPdfFormat = ExportFormats.pdf;
|
297617
|
+
let suggestedOutputFormat;
|
297618
|
+
if (exp.output) {
|
297619
|
+
const ext2 = import_node_path33.default.extname(exp.output);
|
297620
|
+
if (!ext2) {
|
297621
|
+
suggestedPdfFormat = ExportFormats.pdftex;
|
297622
|
+
} else {
|
297623
|
+
suggestedOutputFormat = EXT_TO_FORMAT[ext2];
|
297624
|
+
}
|
297625
|
+
}
|
297626
|
+
if (!exp.template) {
|
297627
|
+
if (exp.format)
|
297628
|
+
return suggestedPdfFormat;
|
297629
|
+
return suggestedOutputFormat !== null && suggestedOutputFormat !== void 0 ? suggestedOutputFormat : suggestedPdfFormat;
|
297630
|
+
}
|
297631
|
+
if (exp.template.endsWith("-tex"))
|
297632
|
+
return suggestedPdfFormat;
|
297633
|
+
if (exp.template.endsWith("-typst"))
|
297634
|
+
return ExportFormats.typst;
|
297635
|
+
if (exp.template.endsWith("-docx"))
|
297636
|
+
return ExportFormats.docx;
|
297637
|
+
if (import_node_fs26.default.existsSync(exp.template)) {
|
297638
|
+
const templateFiles = import_node_fs26.default.readdirSync(exp.template);
|
297639
|
+
const templateTexFiles = templateFiles.filter((file) => file.endsWith(".tex"));
|
297640
|
+
const templateTypFiles = templateFiles.filter((file) => file.endsWith(".typ"));
|
297641
|
+
if (templateTexFiles.length && !templateTypFiles.length)
|
297642
|
+
return suggestedPdfFormat;
|
297643
|
+
if (!templateTexFiles.length && templateTypFiles.length)
|
297644
|
+
return ExportFormats.typst;
|
297645
|
+
}
|
297646
|
+
fileError(vfile2, `Cannot determine export type from template ${exp.template} - you must specify export 'format'`, { ruleId: RuleId.exportFormatDetermined });
|
297647
|
+
return void 0;
|
297648
|
+
}
|
297649
|
+
function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
297650
|
+
var _a6, _b, _c, _d2;
|
297651
|
+
const { articles, sub_articles } = exp;
|
297652
|
+
let resolved = { articles, sub_articles };
|
297653
|
+
if (exp.toc && !resolved.articles && !resolved.sub_articles) {
|
297654
|
+
const resolvedToc = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.toc);
|
297655
|
+
if (validateTOC(session, resolvedToc)) {
|
297656
|
+
resolved = resolveArticlesFromTOC(session, exp, resolvedToc, vfile2);
|
297317
297657
|
}
|
297318
|
-
|
297319
|
-
|
297320
|
-
|
297321
|
-
|
297322
|
-
|
297323
|
-
|
297324
|
-
|
297325
|
-
|
297658
|
+
}
|
297659
|
+
if (!resolved.articles && SOURCE_EXTENSIONS.includes(import_node_path33.default.extname(sourceFile))) {
|
297660
|
+
resolved.articles = [{ file: import_node_path33.default.resolve(sourceFile) }];
|
297661
|
+
}
|
297662
|
+
if (((_a6 = resolved.articles) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && resolved.articles[0].level == null) {
|
297663
|
+
resolved.articles[0].level = 0;
|
297664
|
+
}
|
297665
|
+
if (!resolved.articles && !resolved.sub_articles) {
|
297666
|
+
if (validateTOC(session, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) {
|
297667
|
+
resolved = resolveArticlesFromTOC(session, exp, projectPath !== null && projectPath !== void 0 ? projectPath : ".", vfile2);
|
297668
|
+
} else {
|
297669
|
+
const cachedProject = selectors_exports.selectLocalProject(session.store.getState(), projectPath !== null && projectPath !== void 0 ? projectPath : ".");
|
297670
|
+
if (cachedProject) {
|
297671
|
+
resolved = resolveArticlesFromProject(exp, cachedProject, vfile2);
|
297326
297672
|
}
|
297327
297673
|
}
|
297328
|
-
|
297329
|
-
|
297330
|
-
|
297331
|
-
|
297332
|
-
|
297333
|
-
|
297334
|
-
|
297335
|
-
|
297336
|
-
|
297337
|
-
|
297338
|
-
|
297339
|
-
|
297340
|
-
|
297341
|
-
const resolvedFile = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), file);
|
297342
|
-
if (!import_node_fs26.default.existsSync(resolvedFile)) {
|
297343
|
-
fileError(vfile2, `Invalid export sub_article '${file}' in source: ${sourceFile}`, {
|
297344
|
-
ruleId: RuleId.exportArticleExists
|
297345
|
-
});
|
297346
|
-
return void 0;
|
297347
|
-
} else {
|
297348
|
-
return resolvedFile;
|
297349
|
-
}
|
297350
|
-
}).filter((resolvedFile) => !!resolvedFile);
|
297351
|
-
});
|
297352
|
-
const filteredExportOptions = exportOptions.map((exp) => {
|
297353
|
-
var _a6;
|
297354
|
-
if ((_a6 = exp.articles) === null || _a6 === void 0 ? void 0 : _a6.length)
|
297355
|
-
return exp;
|
297356
|
-
if (exp.format === ExportFormats.meca)
|
297357
|
-
return exp;
|
297358
|
-
if (!opts.force) {
|
297359
|
-
fileError(vfile2, `Invalid export - unable to resolve 'articles' to export: ${sourceFile}`, {
|
297674
|
+
}
|
297675
|
+
if (!((_b = resolved.articles) === null || _b === void 0 ? void 0 : _b.length) && exp.format !== ExportFormats.meca) {
|
297676
|
+
fileError(vfile2, `Unable to resolve any 'articles' to export`, {
|
297677
|
+
ruleId: RuleId.exportArticleExists
|
297678
|
+
});
|
297679
|
+
return resolved;
|
297680
|
+
}
|
297681
|
+
resolved.articles = (_c = resolved.articles) === null || _c === void 0 ? void 0 : _c.map((article) => {
|
297682
|
+
if (!article.file)
|
297683
|
+
return article;
|
297684
|
+
const resolvedFile = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), article.file);
|
297685
|
+
if (!import_node_fs26.default.existsSync(resolvedFile)) {
|
297686
|
+
fileError(vfile2, `Invalid export article - '${article.file}' does not exist`, {
|
297360
297687
|
ruleId: RuleId.exportArticleExists
|
297361
297688
|
});
|
297689
|
+
return void 0;
|
297362
297690
|
}
|
297691
|
+
return { ...article, file: resolvedFile };
|
297692
|
+
}).filter((article) => !!article);
|
297693
|
+
resolved.sub_articles = (_d2 = resolved.sub_articles) === null || _d2 === void 0 ? void 0 : _d2.map((file) => {
|
297694
|
+
const resolvedFile = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), file);
|
297695
|
+
if (!import_node_fs26.default.existsSync(resolvedFile)) {
|
297696
|
+
fileError(vfile2, `Invalid export sub_article - '${file}' does not exist`, {
|
297697
|
+
ruleId: RuleId.exportArticleExists
|
297698
|
+
});
|
297699
|
+
return void 0;
|
297700
|
+
} else {
|
297701
|
+
return resolvedFile;
|
297702
|
+
}
|
297703
|
+
}).filter((resolvedFile) => !!resolvedFile);
|
297704
|
+
return resolved;
|
297705
|
+
}
|
297706
|
+
var ALLOWED_EXTENSIONS = {
|
297707
|
+
[ExportFormats.docx]: [".doc", ".docx"],
|
297708
|
+
[ExportFormats.md]: [".md"],
|
297709
|
+
[ExportFormats.meca]: [".zip", ".meca"],
|
297710
|
+
[ExportFormats.pdf]: [".pdf"],
|
297711
|
+
[ExportFormats.pdftex]: [".pdf", ".tex", ".zip"],
|
297712
|
+
[ExportFormats.tex]: [".tex", ".zip"],
|
297713
|
+
[ExportFormats.typst]: [".pdf", ".typ", ".typst", ".zip"],
|
297714
|
+
[ExportFormats.xml]: [".xml", ".jats"]
|
297715
|
+
};
|
297716
|
+
function resolveOutput(session, sourceFile, vfile2, exp, projectPath) {
|
297717
|
+
var _a6, _b, _c, _d2, _e;
|
297718
|
+
let output2;
|
297719
|
+
if (exp.output) {
|
297720
|
+
output2 = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.output);
|
297721
|
+
} else {
|
297722
|
+
output2 = getDefaultExportFolder(session, sourceFile, exp.format, projectPath);
|
297723
|
+
}
|
297724
|
+
if (exp.format === ExportFormats.meca && exp.zip === false) {
|
297725
|
+
fileWarn(vfile2, `ignoring "zip: false" for export of format "${ExportFormats.meca}"`);
|
297726
|
+
}
|
297727
|
+
if (exp.zip && !((_a6 = ALLOWED_EXTENSIONS[exp.format]) === null || _a6 === void 0 ? void 0 : _a6.includes(".zip"))) {
|
297728
|
+
fileWarn(vfile2, `ignoring "zip: true" for export of format "${exp.format}"`);
|
297729
|
+
exp.zip = false;
|
297730
|
+
}
|
297731
|
+
if (!import_node_path33.default.extname(output2)) {
|
297732
|
+
const basename3 = getDefaultExportFilename(session, (_c = (_b = singleArticleWithFile(exp.articles)) === null || _b === void 0 ? void 0 : _b.file) !== null && _c !== void 0 ? _c : sourceFile, projectPath);
|
297733
|
+
const ext2 = exp.zip ? ".zip" : (_d2 = ALLOWED_EXTENSIONS[exp.format]) === null || _d2 === void 0 ? void 0 : _d2[0];
|
297734
|
+
output2 = import_node_path33.default.join(output2, `${basename3}${ext2 !== null && ext2 !== void 0 ? ext2 : ""}`);
|
297735
|
+
}
|
297736
|
+
if (!((_e = ALLOWED_EXTENSIONS[exp.format]) === null || _e === void 0 ? void 0 : _e.includes(import_node_path33.default.extname(output2)))) {
|
297737
|
+
fileError(vfile2, `Output file "${output2}" has invalid extension for export format of "${exp.format}"`, { ruleId: RuleId.exportExtensionCorrect });
|
297363
297738
|
return void 0;
|
297739
|
+
}
|
297740
|
+
if (exp.zip && import_node_path33.default.extname(output2) !== ".zip") {
|
297741
|
+
fileWarn(vfile2, `Output file "${output2}" has non-zip extension but "zip: true" is specified; ignoring "zip: true"`, { ruleId: RuleId.exportExtensionCorrect });
|
297742
|
+
}
|
297743
|
+
return output2;
|
297744
|
+
}
|
297745
|
+
async function getExportListFromFile(session, sourceFile, projectPath, opts) {
|
297746
|
+
const { disableTemplate } = opts;
|
297747
|
+
let rawFrontmatter;
|
297748
|
+
const state = session.store.getState();
|
297749
|
+
if (projectPath && import_node_path33.default.resolve(sourceFile) === selectors_exports.selectLocalConfigFile(state, projectPath)) {
|
297750
|
+
rawFrontmatter = selectors_exports.selectLocalProjectConfig(state, projectPath);
|
297751
|
+
} else {
|
297752
|
+
rawFrontmatter = await getRawFrontmatterFromFile(session, sourceFile, projectPath);
|
297753
|
+
}
|
297754
|
+
const exportList = getExportListFromRawFrontmatter(session, rawFrontmatter, sourceFile);
|
297755
|
+
const exportListWithTemplate = exportList.map((exp) => {
|
297756
|
+
const template = resolveTemplate(sourceFile, exp, disableTemplate);
|
297757
|
+
return { ...exp, template };
|
297758
|
+
}).filter((exp) => !!exp);
|
297759
|
+
return exportListWithTemplate;
|
297760
|
+
}
|
297761
|
+
function resolveExportListFormats(session, sourceFile, formats, exportList) {
|
297762
|
+
const vfile2 = new VFile();
|
297763
|
+
vfile2.path = sourceFile;
|
297764
|
+
const exportListWithFormat = exportList.map((exp) => {
|
297765
|
+
const format = resolveFormat(vfile2, exp);
|
297766
|
+
if (!format || !formats.includes(format))
|
297767
|
+
return void 0;
|
297768
|
+
return { ...exp, format };
|
297769
|
+
}).filter((exp) => !!exp);
|
297770
|
+
logMessagesFromVFile(session, vfile2);
|
297771
|
+
return exportListWithFormat;
|
297772
|
+
}
|
297773
|
+
function resolveExportListArticles(session, sourceFile, exportList, projectPath, opts) {
|
297774
|
+
const { renderer } = opts;
|
297775
|
+
const vfile2 = new VFile();
|
297776
|
+
vfile2.path = sourceFile;
|
297777
|
+
const filteredExportOptions = exportList.map((exp) => {
|
297778
|
+
const { articles, sub_articles } = resolveArticles(session, sourceFile, vfile2, exp, projectPath);
|
297779
|
+
if (!(articles === null || articles === void 0 ? void 0 : articles.length) && exp.format !== ExportFormats.meca) {
|
297780
|
+
return void 0;
|
297781
|
+
}
|
297782
|
+
const output2 = resolveOutput(session, sourceFile, vfile2, exp, projectPath);
|
297783
|
+
if (!output2)
|
297784
|
+
return void 0;
|
297785
|
+
return { ...exp, output: output2, articles, sub_articles, renderer };
|
297364
297786
|
}).filter((exp) => !!exp);
|
297365
297787
|
logMessagesFromVFile(session, vfile2);
|
297366
297788
|
return filteredExportOptions;
|
@@ -297377,93 +297799,6 @@ function filterAndMakeUnique(exports2) {
|
|
297377
297799
|
};
|
297378
297800
|
});
|
297379
297801
|
}
|
297380
|
-
function getOutput(session, sourceFile, exp, filename, extension, formats, projectPath) {
|
297381
|
-
var _a6, _b;
|
297382
|
-
let output2;
|
297383
|
-
if (filename) {
|
297384
|
-
output2 = filename;
|
297385
|
-
} else if (exp.output) {
|
297386
|
-
output2 = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.output);
|
297387
|
-
} else {
|
297388
|
-
output2 = getDefaultExportFolder(session, sourceFile, projectPath, formats.includes(ExportFormats.tex) ? "tex" : formats.includes(ExportFormats.typst) ? "typ" : void 0);
|
297389
|
-
}
|
297390
|
-
if (!import_node_path33.default.extname(output2)) {
|
297391
|
-
const basename3 = getDefaultExportFilename(session, (_b = (_a6 = singleArticleWithFile(exp.articles)) === null || _a6 === void 0 ? void 0 : _a6.file) !== null && _b !== void 0 ? _b : sourceFile, projectPath);
|
297392
|
-
output2 = import_node_path33.default.join(output2, `${basename3}.${extension}`);
|
297393
|
-
}
|
297394
|
-
if (!output2.endsWith(`.${extension}`)) {
|
297395
|
-
addWarningForFile(session, sourceFile, `The filename must end with '.${extension}': "${output2}"`, "error", { ruleId: RuleId.exportExtensionCorrect });
|
297396
|
-
return void 0;
|
297397
|
-
}
|
297398
|
-
return output2;
|
297399
|
-
}
|
297400
|
-
async function collectTexExportOptions(session, sourceFile, extension, formats, projectPath, opts) {
|
297401
|
-
const exportOptions = await prepareExportOptions(session, sourceFile, formats, projectPath, opts);
|
297402
|
-
const { disableTemplate, filename, template, zip: zip2 } = opts;
|
297403
|
-
if (disableTemplate && template) {
|
297404
|
-
throw new Error("Conflicting tex export options: disableTemplate requested but a template was provided");
|
297405
|
-
}
|
297406
|
-
const resolvedExportOptions = filterAndMakeUnique(exportOptions.map((exp) => {
|
297407
|
-
const rawOutput = filename || exp.output || "";
|
297408
|
-
const useZip = (extension === "tex" || extension === "typ") && (zip2 || import_node_path33.default.extname(rawOutput) === ".zip");
|
297409
|
-
const usePdf = extension === "typ" && import_node_path33.default.extname(rawOutput) === ".pdf";
|
297410
|
-
const expExtension = useZip ? "zip" : usePdf ? "pdf" : extension;
|
297411
|
-
const output2 = getOutput(session, sourceFile, exp, filename, expExtension, formats, projectPath);
|
297412
|
-
if (!output2)
|
297413
|
-
return void 0;
|
297414
|
-
const resolvedOptions = { output: output2 };
|
297415
|
-
if (disableTemplate) {
|
297416
|
-
resolvedOptions.template = null;
|
297417
|
-
} else if (template) {
|
297418
|
-
resolvedOptions.template = template;
|
297419
|
-
} else if (exp.template) {
|
297420
|
-
const resolvedTemplatePath = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.template);
|
297421
|
-
if (import_node_fs26.default.existsSync(resolvedTemplatePath)) {
|
297422
|
-
resolvedOptions.template = resolvedTemplatePath;
|
297423
|
-
} else {
|
297424
|
-
resolvedOptions.template = exp.template;
|
297425
|
-
}
|
297426
|
-
}
|
297427
|
-
return { ...exp, ...resolvedOptions };
|
297428
|
-
}));
|
297429
|
-
return resolvedExportOptions;
|
297430
|
-
}
|
297431
|
-
async function collectBasicExportOptions(session, sourceFile, extension, formats, projectPath, opts) {
|
297432
|
-
const exportOptions = await prepareExportOptions(session, sourceFile, formats, projectPath, opts);
|
297433
|
-
const { filename } = opts;
|
297434
|
-
const resolvedExportOptions = filterAndMakeUnique(exportOptions.map((exp) => {
|
297435
|
-
const output2 = getOutput(session, sourceFile, exp, filename, extension, formats, projectPath);
|
297436
|
-
if (!output2)
|
297437
|
-
return void 0;
|
297438
|
-
return { ...exp, output: output2 };
|
297439
|
-
}));
|
297440
|
-
return resolvedExportOptions;
|
297441
|
-
}
|
297442
|
-
async function collectWordExportOptions(session, sourceFile, extension, formats, projectPath, opts) {
|
297443
|
-
const exportOptions = await prepareExportOptions(session, sourceFile, formats, projectPath, opts);
|
297444
|
-
const { template, filename, renderer } = opts;
|
297445
|
-
const resolvedExportOptions = filterAndMakeUnique(exportOptions.map((exp) => {
|
297446
|
-
const output2 = getOutput(session, sourceFile, exp, filename, extension, formats, projectPath);
|
297447
|
-
if (!output2)
|
297448
|
-
return void 0;
|
297449
|
-
const resolvedOptions = { output: output2 };
|
297450
|
-
if (renderer) {
|
297451
|
-
resolvedOptions.renderer = renderer;
|
297452
|
-
}
|
297453
|
-
if (template) {
|
297454
|
-
resolvedOptions.template = template;
|
297455
|
-
} else if (exp.template) {
|
297456
|
-
const resolvedTemplatePath = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.template);
|
297457
|
-
if (import_node_fs26.default.existsSync(resolvedTemplatePath)) {
|
297458
|
-
resolvedOptions.template = resolvedTemplatePath;
|
297459
|
-
} else {
|
297460
|
-
resolvedOptions.template = exp.template;
|
297461
|
-
}
|
297462
|
-
}
|
297463
|
-
return { ...exp, ...resolvedOptions };
|
297464
|
-
}));
|
297465
|
-
return resolvedExportOptions;
|
297466
|
-
}
|
297467
297802
|
async function collectExportOptions(session, files, formats, opts) {
|
297468
297803
|
const { projectPath } = opts;
|
297469
297804
|
const sourceFiles = [...files];
|
@@ -297483,29 +297818,10 @@ async function collectExportOptions(session, files, formats, opts) {
|
|
297483
297818
|
} else {
|
297484
297819
|
fileProjectPath = projectPath;
|
297485
297820
|
}
|
297486
|
-
const
|
297487
|
-
|
297488
|
-
|
297489
|
-
|
297490
|
-
if (formats.includes(ExportFormats.pdf) || formats.includes(ExportFormats.pdftex)) {
|
297491
|
-
fileExportOptionsList.push(...await collectTexExportOptions(session, file, "pdf", [ExportFormats.pdf, ExportFormats.pdftex], fileProjectPath, opts));
|
297492
|
-
}
|
297493
|
-
if (formats.includes(ExportFormats.tex)) {
|
297494
|
-
fileExportOptionsList.push(...await collectTexExportOptions(session, file, "tex", [ExportFormats.tex], fileProjectPath, opts));
|
297495
|
-
}
|
297496
|
-
if (formats.includes(ExportFormats.typst)) {
|
297497
|
-
fileExportOptionsList.push(...await collectTexExportOptions(session, file, "typ", [ExportFormats.typst], fileProjectPath, opts));
|
297498
|
-
}
|
297499
|
-
if (formats.includes(ExportFormats.xml)) {
|
297500
|
-
fileExportOptionsList.push(...await collectBasicExportOptions(session, file, "xml", [ExportFormats.xml], fileProjectPath, opts));
|
297501
|
-
}
|
297502
|
-
if (formats.includes(ExportFormats.md)) {
|
297503
|
-
fileExportOptionsList.push(...await collectBasicExportOptions(session, file, "md", [ExportFormats.md], fileProjectPath, opts));
|
297504
|
-
}
|
297505
|
-
if (formats.includes(ExportFormats.meca)) {
|
297506
|
-
fileExportOptionsList.push(...await collectBasicExportOptions(session, file, "zip", [ExportFormats.meca], fileProjectPath, opts));
|
297507
|
-
}
|
297508
|
-
exportOptionsList.push(...fileExportOptionsList.map((exportOptions) => {
|
297821
|
+
const fileExports = await getExportListFromFile(session, file, fileProjectPath, opts);
|
297822
|
+
const fileExportsWithFormat = resolveExportListFormats(session, file, formats, fileExports);
|
297823
|
+
const fileExportsResolved = resolveExportListArticles(session, file, fileExportsWithFormat, fileProjectPath, opts);
|
297824
|
+
exportOptionsList.push(...fileExportsResolved.map((exportOptions) => {
|
297509
297825
|
return { ...exportOptions, $file: file, $project: fileProjectPath };
|
297510
297826
|
}));
|
297511
297827
|
}));
|
@@ -300632,6 +300948,11 @@ function withRecursiveCommands(state, plugins2 = state.data.mathPlugins) {
|
|
300632
300948
|
}
|
300633
300949
|
var math4 = (node3, state) => {
|
300634
300950
|
const { label, enumerated } = node3;
|
300951
|
+
const tightBefore = node3.tight === true || node3.tight === "before";
|
300952
|
+
const tightAfter = node3.tight === true || node3.tight === "after";
|
300953
|
+
if (tightBefore) {
|
300954
|
+
state.ensureNewLine(true);
|
300955
|
+
}
|
300635
300956
|
state.usePackages("amsmath");
|
300636
300957
|
addMacrosToState(node3.value, state);
|
300637
300958
|
if (state.data.isInTable) {
|
@@ -300656,8 +300977,13 @@ var math4 = (node3, state) => {
|
|
300656
300977
|
state.write(`\\end{equation${enumerated === false ? "*" : ""}}`);
|
300657
300978
|
}
|
300658
300979
|
}
|
300659
|
-
if (
|
300980
|
+
if (state.data.isInTable)
|
300981
|
+
return;
|
300982
|
+
if (tightAfter) {
|
300983
|
+
state.ensureNewLine(true);
|
300984
|
+
} else {
|
300660
300985
|
state.closeBlock(node3);
|
300986
|
+
}
|
300661
300987
|
};
|
300662
300988
|
var inlineMath2 = (node3, state) => {
|
300663
300989
|
state.usePackages("amsmath");
|
@@ -302925,8 +303251,7 @@ function isTypstAvailable() {
|
|
302925
303251
|
}
|
302926
303252
|
async function runTypstExecutable(session, typstFile) {
|
302927
303253
|
if (!isTypstAvailable()) {
|
302928
|
-
|
302929
|
-
return;
|
303254
|
+
throw new Error("The typst CLI must be installed to build PDFs with typst");
|
302930
303255
|
}
|
302931
303256
|
if (import_node_path49.default.extname(typstFile) !== ".typ") {
|
302932
303257
|
throw new Error(`invalid input file for typst executable: ${typstFile}`);
|
@@ -303198,7 +303523,7 @@ async function runTypstPdfExport(session, file, exportOptions, opts) {
|
|
303198
303523
|
exportOptions.output = import_node_path49.default.join(typFolder, `${import_node_path49.default.basename(pdfOutput, import_node_path49.default.extname(pdfOutput))}.typ`);
|
303199
303524
|
await runTypstExport(session, file, exportOptions, { ...opts !== null && opts !== void 0 ? opts : {}, clean: false });
|
303200
303525
|
const writeFolder = import_node_path49.default.dirname(pdfOutput);
|
303201
|
-
session.log.info(`\u{1F5A8}
|
303526
|
+
session.log.info(`\u{1F5A8} Rendering typst pdf to ${pdfOutput}`);
|
303202
303527
|
if (!import_node_fs34.default.existsSync(writeFolder))
|
303203
303528
|
import_node_fs34.default.mkdirSync(writeFolder, { recursive: true });
|
303204
303529
|
import_node_fs34.default.copyFileSync(exportOptions.output.replace(".typ", ".pdf"), pdfOutput);
|
@@ -306496,7 +306821,12 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
306496
306821
|
abstractParts: [
|
306497
306822
|
{ part: "abstract" },
|
306498
306823
|
{
|
306499
|
-
part: [
|
306824
|
+
part: [
|
306825
|
+
"plain-language-summary",
|
306826
|
+
"plain-language-abstract",
|
306827
|
+
"summary",
|
306828
|
+
"plain language summary"
|
306829
|
+
],
|
306500
306830
|
type: "plain-language-summary",
|
306501
306831
|
title: "Plain Language Summary"
|
306502
306832
|
},
|
@@ -306504,7 +306834,7 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
306504
306834
|
],
|
306505
306835
|
backSections: [
|
306506
306836
|
{
|
306507
|
-
part: ["data-availability", "data_availability", "availability"],
|
306837
|
+
part: ["data-availability", "data_availability", "availability", "data availability"],
|
306508
306838
|
type: "data-availability",
|
306509
306839
|
title: "Data Availability"
|
306510
306840
|
}
|
@@ -311525,24 +311855,45 @@ function hasAnyExplicitExportFormat(opts) {
|
|
311525
311855
|
const { docx, pdf, tex, typst, xml: xml2, md, meca } = opts;
|
311526
311856
|
return docx || pdf || tex || typst || xml2 || md || meca || false;
|
311527
311857
|
}
|
311528
|
-
function
|
311529
|
-
const { docx, pdf, tex, typst, xml: xml2, md, meca, all: all10, explicit
|
311858
|
+
function getAllowedExportFormats(opts) {
|
311859
|
+
const { docx, pdf, tex, typst, xml: xml2, md, meca, all: all10, explicit } = opts;
|
311530
311860
|
const formats = [];
|
311531
311861
|
const any = hasAnyExplicitExportFormat(opts);
|
311532
|
-
const override = all10 || !any && explicit
|
311533
|
-
if (docx || override
|
311862
|
+
const override = all10 || !any && explicit;
|
311863
|
+
if (docx || override)
|
311534
311864
|
formats.push(ExportFormats.docx);
|
311535
|
-
if (pdf || override
|
311865
|
+
if (pdf || override) {
|
311866
|
+
formats.push(ExportFormats.pdf, ExportFormats.pdftex, ExportFormats.typst);
|
311867
|
+
}
|
311868
|
+
if (tex || override) {
|
311869
|
+
formats.push(ExportFormats.tex, ExportFormats.pdftex);
|
311870
|
+
}
|
311871
|
+
if (typst || override)
|
311872
|
+
formats.push(ExportFormats.typst);
|
311873
|
+
if (xml2 || override)
|
311874
|
+
formats.push(ExportFormats.xml);
|
311875
|
+
if (md || override)
|
311876
|
+
formats.push(ExportFormats.md);
|
311877
|
+
if (meca || override)
|
311878
|
+
formats.push(ExportFormats.meca);
|
311879
|
+
return [...new Set(formats)];
|
311880
|
+
}
|
311881
|
+
function getRequestedExportFormats(opts) {
|
311882
|
+
const { docx, pdf, tex, typst, xml: xml2, md, meca } = opts;
|
311883
|
+
const formats = [];
|
311884
|
+
if (docx)
|
311885
|
+
formats.push(ExportFormats.docx);
|
311886
|
+
if (pdf)
|
311536
311887
|
formats.push(ExportFormats.pdf);
|
311537
|
-
if (tex
|
311888
|
+
if (tex)
|
311538
311889
|
formats.push(ExportFormats.tex);
|
311539
|
-
if (typst
|
311890
|
+
if (typst)
|
311540
311891
|
formats.push(ExportFormats.typst);
|
311541
|
-
if (xml2
|
311892
|
+
if (xml2)
|
311542
311893
|
formats.push(ExportFormats.xml);
|
311543
|
-
if (md
|
311894
|
+
if (md)
|
311544
311895
|
formats.push(ExportFormats.md);
|
311545
|
-
if (meca
|
311896
|
+
if (meca)
|
311546
311897
|
formats.push(ExportFormats.meca);
|
311547
311898
|
return formats;
|
311548
311899
|
}
|
@@ -311561,46 +311912,61 @@ function getProjectPaths(session) {
|
|
311561
311912
|
return uniqueArray(projectPaths);
|
311562
311913
|
}
|
311563
311914
|
async function collectAllBuildExportOptions(session, files, opts) {
|
311564
|
-
|
311915
|
+
var _a6;
|
311916
|
+
const { output: output2 } = opts;
|
311565
311917
|
files = files.map((file) => import_node_path57.default.resolve(file));
|
311566
311918
|
if (output2 && files.length !== 1) {
|
311567
311919
|
throw new Error("When specifying a named output for export, you must list exactly one file.");
|
311568
311920
|
}
|
311569
|
-
const
|
311570
|
-
|
311571
|
-
|
311572
|
-
extension: output2 ? import_node_path57.default.extname(output2) : void 0
|
311573
|
-
});
|
311574
|
-
if (output2 && formats.length !== 1) {
|
311575
|
-
throw new Error(`Unrecognized file extension for output: ${import_node_path57.default.extname(output2)}`);
|
311921
|
+
const requestedFormats = getRequestedExportFormats(opts);
|
311922
|
+
if (output2 && requestedFormats.length > 1) {
|
311923
|
+
throw new Error(`When specifying output, you can only request one format`);
|
311576
311924
|
}
|
311577
|
-
session.log.debug(`Exporting formats: "${formats.join('", "')}"`);
|
311578
311925
|
let exportOptionsList;
|
311579
|
-
|
311580
|
-
|
311581
|
-
|
311582
|
-
|
311583
|
-
});
|
311584
|
-
|
311585
|
-
|
311586
|
-
|
311587
|
-
}
|
311588
|
-
exportOptionsList[0].output = import_node_path57.default.join(import_node_path57.default.resolve("."), output2);
|
311926
|
+
const projectPath = findCurrentProjectAndLoad(session, files[0] ? import_node_path57.default.dirname(files[0]) : ".");
|
311927
|
+
if (projectPath)
|
311928
|
+
await loadProjectFromDisk(session, projectPath);
|
311929
|
+
if (output2) {
|
311930
|
+
session.log.debug(`Exporting formats: "${requestedFormats.join('", "')}"`);
|
311931
|
+
const format = (_a6 = requestedFormats[0]) !== null && _a6 !== void 0 ? _a6 : EXT_TO_FORMAT[import_node_path57.default.extname(output2)];
|
311932
|
+
if (!format) {
|
311933
|
+
throw new Error(`Cannot specify format from output "${output2}" - please specify format option, e.g. --pdf`);
|
311589
311934
|
}
|
311935
|
+
exportOptionsList = resolveExportListArticles(session, files[0], [{ format, output: import_node_path57.default.join(import_node_path57.default.resolve("."), output2) }], projectPath, opts).map((exp) => {
|
311936
|
+
return { ...exp, $file: files[0], $project: projectPath };
|
311937
|
+
});
|
311938
|
+
} else if (files.length) {
|
311939
|
+
const allowedFormats = getAllowedExportFormats({
|
311940
|
+
...opts,
|
311941
|
+
explicit: true
|
311942
|
+
});
|
311943
|
+
session.log.debug(`Exporting formats: "${allowedFormats.join('", "')}"`);
|
311944
|
+
exportOptionsList = (await Promise.all(files.map(async (file) => {
|
311945
|
+
const fileExportOptionsList = await collectExportOptions(session, [file], allowedFormats, {});
|
311946
|
+
if (fileExportOptionsList.length > 0) {
|
311947
|
+
return fileExportOptionsList;
|
311948
|
+
}
|
311949
|
+
return resolveExportListArticles(session, file, requestedFormats.map((format) => {
|
311950
|
+
return { format };
|
311951
|
+
}), projectPath, opts).map((exp) => {
|
311952
|
+
return { ...exp, $file: files[0], $project: projectPath };
|
311953
|
+
});
|
311954
|
+
}))).flat();
|
311590
311955
|
} else {
|
311956
|
+
const allowedFormats = getAllowedExportFormats(opts);
|
311957
|
+
session.log.debug(`Exporting formats: "${allowedFormats.join('", "')}"`);
|
311591
311958
|
const projectPaths = getProjectPaths(session);
|
311592
|
-
exportOptionsList = (await Promise.all(projectPaths.map(async (
|
311959
|
+
exportOptionsList = (await Promise.all(projectPaths.map(async (projPath) => {
|
311593
311960
|
try {
|
311594
|
-
const project = await loadProjectFromDisk(session,
|
311961
|
+
const project = await loadProjectFromDisk(session, projPath);
|
311595
311962
|
files = filterPages(project).map((page) => page.file);
|
311596
311963
|
} catch (err) {
|
311597
|
-
session.log.debug(`Unable to load any content from project at: ${
|
311964
|
+
session.log.debug(`Unable to load any content from project at: ${projPath}
|
311598
311965
|
${err}`);
|
311599
311966
|
return [];
|
311600
311967
|
}
|
311601
|
-
const exportOptions = await collectExportOptions(session, files,
|
311602
|
-
|
311603
|
-
projectPath
|
311968
|
+
const exportOptions = await collectExportOptions(session, files, allowedFormats, {
|
311969
|
+
projectPath: projPath
|
311604
311970
|
});
|
311605
311971
|
return exportOptions;
|
311606
311972
|
}))).flat();
|
@@ -311629,7 +311995,7 @@ async function build(session, files, opts) {
|
|
311629
311995
|
});
|
311630
311996
|
if (exportLogList.length === 0) {
|
311631
311997
|
if (!(site || performSiteBuild)) {
|
311632
|
-
const kinds = Object.entries(opts).filter(([k, v]) =>
|
311998
|
+
const kinds = Object.entries(opts).filter(([k, v]) => !["force", "output", "checkLinks", "site", "maxSizeWebp"].includes(k) && v).map(([k]) => k);
|
311633
311999
|
session.log.info(`\u{1F4ED} No file exports${kinds.length > 0 ? ` with kind "${kinds.map(extToKind).join('", "')}"` : ""} found.`);
|
311634
312000
|
if (kinds.length) {
|
311635
312001
|
session.log.info(source_default.dim(`You may need to add an 'exports' field to the frontmatter of the file(s) you wish to export:
|