mystmd 1.1.48__py3-none-any.whl → 1.1.50__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.50.dist-info}/METADATA +1 -1
- mystmd-1.1.50.dist-info/RECORD +8 -0
- {mystmd-1.1.48.dist-info → mystmd-1.1.50.dist-info}/WHEEL +1 -1
- mystmd_py/myst.cjs +787 -425
- mystmd-1.1.48.dist-info/RECORD +0 -8
- {mystmd-1.1.48.dist-info → mystmd-1.1.50.dist-info}/entry_points.txt +0 -0
- {mystmd-1.1.48.dist-info → mystmd-1.1.50.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.50";
|
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
|
}
|
@@ -237774,6 +237848,32 @@ function renderEquation(file, node3, opts) {
|
|
237774
237848
|
}
|
237775
237849
|
}
|
237776
237850
|
function mathNestingTransform(tree, file) {
|
237851
|
+
const paragraphs = selectAll("paragraph", tree);
|
237852
|
+
paragraphs.forEach((paragraph4) => {
|
237853
|
+
if (paragraph4.children.length === 1)
|
237854
|
+
return;
|
237855
|
+
paragraph4.children.forEach((child, index4) => {
|
237856
|
+
var _a6, _b, _c, _d2;
|
237857
|
+
if (child.type !== "math")
|
237858
|
+
return;
|
237859
|
+
const math7 = child;
|
237860
|
+
const before = paragraph4.children[index4 - 1];
|
237861
|
+
const after = paragraph4.children[index4 + 1];
|
237862
|
+
if (index4 === 0) {
|
237863
|
+
math7.tight = "after";
|
237864
|
+
} else if (index4 === paragraph4.children.length - 1) {
|
237865
|
+
math7.tight = "before";
|
237866
|
+
} else {
|
237867
|
+
math7.tight = true;
|
237868
|
+
}
|
237869
|
+
if ((before === null || before === void 0 ? void 0 : before.type) === "text") {
|
237870
|
+
before.value = (_b = (_a6 = before.value) === null || _a6 === void 0 ? void 0 : _a6.replace(/\n$/, "")) !== null && _b !== void 0 ? _b : "";
|
237871
|
+
}
|
237872
|
+
if ((after === null || after === void 0 ? void 0 : after.type) === "text") {
|
237873
|
+
after.value = (_d2 = (_c = after.value) === null || _c === void 0 ? void 0 : _c.replace(/^\n/, "")) !== null && _d2 !== void 0 ? _d2 : "";
|
237874
|
+
}
|
237875
|
+
});
|
237876
|
+
});
|
237777
237877
|
unnestTransform(tree, "paragraph", "math");
|
237778
237878
|
}
|
237779
237879
|
function mathLabelTransform(tree, file) {
|
@@ -278006,6 +278106,8 @@ var macros17 = {
|
|
278006
278106
|
multicolumn: 3,
|
278007
278107
|
subfigure: 2,
|
278008
278108
|
tabularx: 2,
|
278109
|
+
longtable: 2,
|
278110
|
+
["longtable*"]: 2,
|
278009
278111
|
supertabular: 1,
|
278010
278112
|
cmidrule: 2,
|
278011
278113
|
cline: 1,
|
@@ -279027,60 +279129,221 @@ var MISC_HANDLERS = {
|
|
279027
279129
|
};
|
279028
279130
|
|
279029
279131
|
// ../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
|
-
|
279132
|
+
var ALIGNMENT_MAP = { c: "center", l: "left", r: "right" };
|
279133
|
+
function getTabularAlignment(arg2) {
|
279134
|
+
if (!arg2 || !arg2.content.reduce((b, { type: type2 }) => b && ["string", "whitespace"].includes(type2), true)) {
|
279135
|
+
return;
|
279136
|
+
}
|
279137
|
+
const spec = texToText(arg2.content).replace(/[\s|]/g, "");
|
279138
|
+
if (!spec.match(/([lrc]*)/))
|
279139
|
+
return;
|
279140
|
+
return spec.split("").map((a2) => ALIGNMENT_MAP[a2]);
|
279141
|
+
}
|
279142
|
+
function fixTable(vfile2, table5, alignments) {
|
279143
|
+
if ((table5 === null || table5 === void 0 ? void 0 : table5.type) !== "table")
|
279144
|
+
return;
|
279145
|
+
const multirowTracker = {};
|
279146
|
+
const rowSizes = table5.children.map((tr3) => ({
|
279147
|
+
tr: tr3,
|
279148
|
+
size: tr3.children.reduce((size, td) => {
|
279149
|
+
var _a6;
|
279150
|
+
return size + ((_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1);
|
279151
|
+
}, 0)
|
279152
|
+
}));
|
279153
|
+
const uniqueSizes = [...new Set(rowSizes.map(({ size }) => size))];
|
279154
|
+
if (uniqueSizes.length !== 1) {
|
279155
|
+
fileWarn(vfile2, `Uneven table found, please check your rows to get an even table.`, {
|
279156
|
+
node: table5,
|
279157
|
+
note: `Row sizes are: ${rowSizes.map(({ size }) => size).join(", ")}`
|
279158
|
+
});
|
279159
|
+
rowSizes.reduce((rows, row2, index4) => {
|
279160
|
+
if (index4 > 0 && rowSizes[index4 - 1].size !== row2.size) {
|
279161
|
+
rows.push({ ...row2, previous: rowSizes[index4 - 1].size });
|
279162
|
+
}
|
279163
|
+
return rows;
|
279164
|
+
}, []).forEach(({ tr: tr3, size, previous }) => {
|
279165
|
+
fileWarn(vfile2, `Table row of size (${size}) does not match previous row size (${previous})`, {
|
279166
|
+
node: tr3
|
279167
|
+
});
|
279168
|
+
});
|
279169
|
+
}
|
279170
|
+
let useAlignments = false;
|
279171
|
+
if (alignments && uniqueSizes.length === 1 && (uniqueSizes[0] === alignments.length || alignments.length === 1)) {
|
279172
|
+
useAlignments = true;
|
279173
|
+
} else if (alignments && uniqueSizes.length === 1 && uniqueSizes[0] !== alignments.length) {
|
279174
|
+
fileWarn(vfile2, `Table alignment argument does not match number of columns`, { node: table5 });
|
279175
|
+
}
|
279176
|
+
table5.children.forEach((tr3, rowIndex) => {
|
279177
|
+
Object.keys(multirowTracker).forEach((key2) => {
|
279178
|
+
const colIndex = key2;
|
279179
|
+
if (multirowTracker[colIndex] > 1) {
|
279180
|
+
multirowTracker[colIndex]--;
|
279181
|
+
} else {
|
279182
|
+
delete multirowTracker[colIndex];
|
279183
|
+
}
|
279184
|
+
});
|
279185
|
+
const columnIndex = tr3.children.reduce((info, td) => {
|
279186
|
+
var _a6;
|
279187
|
+
info.columnIndex.push(info.size);
|
279188
|
+
info.size += (_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
|
279189
|
+
return info;
|
279190
|
+
}, { columnIndex: [], size: 0 }).columnIndex;
|
279191
|
+
tr3.children = tr3.children.filter((td, index4) => {
|
279192
|
+
var _a6, _b;
|
279193
|
+
const colIndex = columnIndex[index4];
|
279194
|
+
if (td.rowspan && td.rowspan > 1) {
|
279195
|
+
for (let col = 0; col < ((_a6 = td.colspan) !== null && _a6 !== void 0 ? _a6 : 1); col++) {
|
279196
|
+
multirowTracker[colIndex + col] = td.rowspan;
|
279197
|
+
}
|
279198
|
+
}
|
279199
|
+
if (alignments && useAlignments && !td.align) {
|
279200
|
+
const align = (_b = alignments[colIndex]) !== null && _b !== void 0 ? _b : alignments[0];
|
279201
|
+
if (align !== "left")
|
279202
|
+
td.align = align;
|
279203
|
+
}
|
279204
|
+
if (multirowTracker[colIndex] && td.rowspan !== multirowTracker[colIndex]) {
|
279205
|
+
if (!isEmptyCell(td)) {
|
279206
|
+
fileWarn(vfile2, `Non-empty placeholder cell found at row ${rowIndex}, column ${colIndex}.`, { node: table5 });
|
279207
|
+
}
|
279208
|
+
return false;
|
279209
|
+
}
|
279210
|
+
return true;
|
279211
|
+
});
|
279212
|
+
});
|
279213
|
+
}
|
279214
|
+
function isEmptyCell(cell3) {
|
279215
|
+
return toText(cell3).trim() === "";
|
279216
|
+
}
|
279217
|
+
var createTable = (addContainer = false) => {
|
279218
|
+
return (node3, state) => {
|
279219
|
+
state.closeParagraph();
|
279220
|
+
const table5 = {
|
279221
|
+
rows: [],
|
279222
|
+
cells: [],
|
279223
|
+
cell: [],
|
279224
|
+
// These are used for longtable
|
279225
|
+
caption: void 0,
|
279226
|
+
label: void 0,
|
279227
|
+
firstHead: [],
|
279228
|
+
head: [],
|
279229
|
+
foot: [],
|
279230
|
+
lastFoot: []
|
279231
|
+
};
|
279232
|
+
const IGNORE = /* @__PURE__ */ new Set([
|
279233
|
+
"cline",
|
279234
|
+
"hline",
|
279235
|
+
"rule",
|
279236
|
+
"midrule",
|
279237
|
+
"cmidrule",
|
279238
|
+
"toprule",
|
279239
|
+
"bottomrule"
|
279240
|
+
]);
|
279241
|
+
const alignments = getTabularAlignment(node3.args[node3.args.length - 1]);
|
279242
|
+
node3.content.forEach((n) => {
|
279243
|
+
if (n.type === "comment")
|
279244
|
+
return;
|
279245
|
+
if (n.type === "macro" && IGNORE.has(n.content))
|
279246
|
+
return;
|
279247
|
+
if (n.type === "macro" && n.content === "label" && !table5.label) {
|
279248
|
+
table5.label = n;
|
279249
|
+
return;
|
279250
|
+
}
|
279251
|
+
if (n.type === "macro" && n.content === "caption") {
|
279252
|
+
table5.caption = n;
|
279253
|
+
return;
|
279254
|
+
}
|
279255
|
+
if (n.type === "macro" && n.content === "endfirsthead") {
|
279256
|
+
table5.firstHead = table5.rows;
|
279257
|
+
table5.rows = [];
|
279258
|
+
return;
|
279259
|
+
}
|
279260
|
+
if (n.type === "macro" && n.content === "endhead") {
|
279261
|
+
table5.head = table5.rows;
|
279262
|
+
table5.rows = [];
|
279263
|
+
return;
|
279264
|
+
}
|
279265
|
+
if (n.type === "macro" && n.content === "endfoot") {
|
279266
|
+
table5.foot = table5.rows;
|
279267
|
+
table5.rows = [];
|
279268
|
+
return;
|
279269
|
+
}
|
279270
|
+
if (n.type === "macro" && n.content === "endlastfoot") {
|
279271
|
+
table5.lastFoot = table5.rows;
|
279272
|
+
table5.rows = [];
|
279273
|
+
return;
|
279274
|
+
}
|
279275
|
+
if (n.type === "macro" && (n.content === "\\" || n.content === "tabularnewline")) {
|
279276
|
+
table5.cells.push(table5.cell);
|
279277
|
+
if (table5.cells.flat().length > 0)
|
279278
|
+
table5.rows.push(table5.cells);
|
279279
|
+
table5.cell = [];
|
279280
|
+
table5.cells = [];
|
279281
|
+
return;
|
279282
|
+
}
|
279283
|
+
if (n.type === "string" && n.content === "&") {
|
279284
|
+
table5.cells.push(table5.cell);
|
279285
|
+
table5.cell = [];
|
279286
|
+
return;
|
279287
|
+
}
|
279288
|
+
if (table5.cell.length === 0 && (n.type === "whitespace" || n.type === "parbreak"))
|
279289
|
+
return;
|
279290
|
+
table5.cell.push(n);
|
279291
|
+
});
|
279292
|
+
if (table5.cell.length > 0)
|
279050
279293
|
table5.cells.push(table5.cell);
|
279294
|
+
if (table5.cells.length > 0)
|
279051
279295
|
table5.rows.push(table5.cells);
|
279052
|
-
|
279053
|
-
table5.
|
279054
|
-
|
279296
|
+
if (table5.firstHead.length > 0) {
|
279297
|
+
table5.rows.unshift(...table5.firstHead);
|
279298
|
+
} else {
|
279299
|
+
table5.rows.unshift(...table5.head);
|
279055
279300
|
}
|
279056
|
-
if (
|
279057
|
-
table5.
|
279058
|
-
|
279059
|
-
|
279301
|
+
if (table5.lastFoot.length > 0) {
|
279302
|
+
table5.rows.push(...table5.lastFoot);
|
279303
|
+
} else {
|
279304
|
+
table5.rows.push(...table5.foot);
|
279060
279305
|
}
|
279061
|
-
if (
|
279062
|
-
|
279063
|
-
|
279064
|
-
|
279065
|
-
|
279066
|
-
|
279067
|
-
|
279068
|
-
|
279069
|
-
|
279070
|
-
|
279071
|
-
|
279072
|
-
|
279073
|
-
|
279074
|
-
|
279075
|
-
|
279306
|
+
if (addContainer) {
|
279307
|
+
state.openNode("container", { kind: "table" });
|
279308
|
+
if (table5.caption) {
|
279309
|
+
state.renderChildren({ content: [{ type: "group", content: [table5.caption] }] });
|
279310
|
+
}
|
279311
|
+
if (table5.label) {
|
279312
|
+
state.renderChildren({ content: [{ type: "group", content: [table5.label] }] });
|
279313
|
+
}
|
279314
|
+
}
|
279315
|
+
state.openNode("table");
|
279316
|
+
table5.rows.forEach((row2) => {
|
279317
|
+
state.openNode("tableRow");
|
279318
|
+
row2.forEach((cell3) => {
|
279319
|
+
state.openNode("tableCell");
|
279320
|
+
state.renderChildren({
|
279321
|
+
content: [
|
279322
|
+
{
|
279323
|
+
// Putting things in a group helps with floating `\bf` commands
|
279324
|
+
// For example:
|
279325
|
+
// `& \bf title &` --> `& {\bf title} &`
|
279326
|
+
type: "group",
|
279327
|
+
// Ignore ending whitespace "title &" should become "title"
|
279328
|
+
content: trimWhitespace(cell3)
|
279329
|
+
}
|
279330
|
+
]
|
279331
|
+
});
|
279332
|
+
state.closeParagraph();
|
279333
|
+
unnestParagraphs(state.top(), "tableCell");
|
279334
|
+
state.closeNode("tableCell");
|
279335
|
+
});
|
279336
|
+
state.closeNode("tableRow");
|
279337
|
+
});
|
279338
|
+
const tableNode = state.top();
|
279339
|
+
fixTable(state.file, tableNode, alignments);
|
279340
|
+
state.closeNode("table");
|
279341
|
+
if (addContainer) {
|
279076
279342
|
state.closeParagraph();
|
279077
|
-
unnestParagraphs(state.top(), "tableCell");
|
279078
279343
|
state.closeNode();
|
279079
|
-
}
|
279080
|
-
|
279081
|
-
|
279082
|
-
state.closeNode();
|
279083
|
-
}
|
279344
|
+
}
|
279345
|
+
};
|
279346
|
+
};
|
279084
279347
|
var TABLE_HANDLERS = {
|
279085
279348
|
env_table(node3, state) {
|
279086
279349
|
state.closeParagraph();
|
@@ -279096,9 +279359,11 @@ var TABLE_HANDLERS = {
|
|
279096
279359
|
state.closeParagraph();
|
279097
279360
|
state.closeNode();
|
279098
279361
|
},
|
279099
|
-
env_tabular: createTable,
|
279100
|
-
env_tabularx: createTable,
|
279101
|
-
env_supertabular: createTable,
|
279362
|
+
env_tabular: createTable(),
|
279363
|
+
env_tabularx: createTable(),
|
279364
|
+
env_supertabular: createTable(),
|
279365
|
+
env_longtable: createTable(true),
|
279366
|
+
"env_longtable*": createTable(true),
|
279102
279367
|
env_threeparttable(node3, state) {
|
279103
279368
|
state.closeParagraph();
|
279104
279369
|
const envId = createId();
|
@@ -279171,7 +279436,9 @@ var TABLE_HANDLERS = {
|
|
279171
279436
|
if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === "tableCell" && Number.isInteger(rowspan)) {
|
279172
279437
|
currentNode.rowspan = rowspan;
|
279173
279438
|
}
|
279174
|
-
|
279439
|
+
const cell3 = node3.args[node3.args.length - 1];
|
279440
|
+
cell3.content = trimWhitespace(cell3.content);
|
279441
|
+
state.renderChildren(cell3);
|
279175
279442
|
state.closeParagraph();
|
279176
279443
|
},
|
279177
279444
|
macro_multicolumn(node3, state) {
|
@@ -279179,20 +279446,34 @@ var TABLE_HANDLERS = {
|
|
279179
279446
|
const ncolArg = node3.args[0];
|
279180
279447
|
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
279448
|
const currentNode = state.top();
|
279182
|
-
|
279183
|
-
|
279449
|
+
const td = (currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === "tableCell" ? currentNode : void 0;
|
279450
|
+
if (td && Number.isInteger(colspan)) {
|
279451
|
+
td.colspan = colspan;
|
279452
|
+
}
|
279453
|
+
if (td && node3.args.length === 3) {
|
279454
|
+
const alignmentText = texToText(node3.args[1].content).replace(/([|\s])/g, "");
|
279455
|
+
const align = ALIGNMENT_MAP[alignmentText] || void 0;
|
279456
|
+
if (align && align !== "left") {
|
279457
|
+
td.align = align;
|
279458
|
+
}
|
279184
279459
|
}
|
279185
|
-
|
279460
|
+
const cell3 = node3.args[node3.args.length - 1];
|
279461
|
+
cell3.content = trimWhitespace(cell3.content);
|
279462
|
+
state.renderChildren(cell3);
|
279186
279463
|
state.closeNode();
|
279187
279464
|
}
|
279188
279465
|
};
|
279189
279466
|
function trimWhitespace(content3) {
|
279190
|
-
var _a6;
|
279191
|
-
|
279192
|
-
|
279193
|
-
|
279467
|
+
var _a6, _b;
|
279468
|
+
let startIndex = 0;
|
279469
|
+
let endIndex = content3.length - 1;
|
279470
|
+
while (startIndex <= endIndex && ((_a6 = content3[startIndex]) === null || _a6 === void 0 ? void 0 : _a6.type) === "whitespace") {
|
279471
|
+
startIndex++;
|
279194
279472
|
}
|
279195
|
-
|
279473
|
+
while (endIndex >= startIndex && ((_b = content3[endIndex]) === null || _b === void 0 ? void 0 : _b.type) === "whitespace") {
|
279474
|
+
endIndex--;
|
279475
|
+
}
|
279476
|
+
return content3.slice(startIndex, endIndex + 1);
|
279196
279477
|
}
|
279197
279478
|
|
279198
279479
|
// ../tex-to-myst/dist/footnotes.js
|
@@ -279875,7 +280156,9 @@ var TexParser = class {
|
|
279875
280156
|
}
|
279876
280157
|
this.closeNode();
|
279877
280158
|
}
|
279878
|
-
closeNode() {
|
280159
|
+
closeNode(type2) {
|
280160
|
+
if (type2 && this.top().type !== type2)
|
280161
|
+
return this.top();
|
279879
280162
|
const node3 = this.stack.pop();
|
279880
280163
|
this.pushNode(node3);
|
279881
280164
|
return node3;
|
@@ -280277,6 +280560,13 @@ function stateError(state, message) {
|
|
280277
280560
|
|
280278
280561
|
// ../markdown-it-myst/dist/directives.js
|
280279
280562
|
var COLON_OPTION_REGEX = /^:(?<option>[^:\s]+?):(\s*(?<value>.*)){0,1}\s*$/;
|
280563
|
+
function computeBlockTightness(src, map6) {
|
280564
|
+
const lines = src.split("\n");
|
280565
|
+
const tightBefore = typeof (map6 === null || map6 === void 0 ? void 0 : map6[0]) === "number" && map6[0] > 0 ? lines[map6[0] - 1].trim() !== "" : false;
|
280566
|
+
const tightAfter = typeof (map6 === null || map6 === void 0 ? void 0 : map6[1]) === "number" && map6[1] < lines.length ? lines[map6[1]].trim() !== "" : false;
|
280567
|
+
const tight = tightBefore && tightAfter ? true : tightBefore ? "before" : tightAfter ? "after" : false;
|
280568
|
+
return tight;
|
280569
|
+
}
|
280280
280570
|
function replaceFences(state) {
|
280281
280571
|
for (const token of state.tokens) {
|
280282
280572
|
if (token.type === "fence" || token.type === "colon_fence") {
|
@@ -280313,7 +280603,9 @@ function runDirectives(state) {
|
|
280313
280603
|
directiveOpen.map = map6;
|
280314
280604
|
directiveOpen.meta = {
|
280315
280605
|
arg: arg2,
|
280316
|
-
options: simplifyDirectiveOptions(options)
|
280606
|
+
options: simplifyDirectiveOptions(options),
|
280607
|
+
// Tightness is computed for all directives (are they separated by a newline before/after)
|
280608
|
+
tight: computeBlockTightness(state.src, token.map)
|
280317
280609
|
};
|
280318
280610
|
const startLineNumber = map6 ? map6[0] : 0;
|
280319
280611
|
const argTokens = directiveArgToTokens(arg2, startLineNumber, state);
|
@@ -282084,14 +282376,16 @@ var mathDirective = {
|
|
282084
282376
|
run(data) {
|
282085
282377
|
var _a6;
|
282086
282378
|
const { label, identifier } = normalizeLabel((_a6 = data.options) === null || _a6 === void 0 ? void 0 : _a6.label) || {};
|
282087
|
-
|
282088
|
-
|
282089
|
-
|
282090
|
-
|
282091
|
-
|
282092
|
-
|
282093
|
-
|
282094
|
-
|
282379
|
+
const math7 = {
|
282380
|
+
type: "math",
|
282381
|
+
identifier,
|
282382
|
+
label,
|
282383
|
+
value: data.body
|
282384
|
+
};
|
282385
|
+
if (data.node.tight) {
|
282386
|
+
math7.tight = data.node.tight;
|
282387
|
+
}
|
282388
|
+
return [math7];
|
282095
282389
|
}
|
282096
282390
|
};
|
282097
282391
|
|
@@ -283967,7 +284261,8 @@ function withoutTrailingNewline(str2) {
|
|
283967
284261
|
return str2[str2.length - 1] == "\n" ? str2.slice(0, str2.length - 1) : str2;
|
283968
284262
|
}
|
283969
284263
|
var MarkdownParseState = class {
|
283970
|
-
constructor(handlers6) {
|
284264
|
+
constructor(src, handlers6) {
|
284265
|
+
this.src = src;
|
283971
284266
|
this.stack = [u2("root", [])];
|
283972
284267
|
this.handlers = getTokenHandlers(handlers6);
|
283973
284268
|
}
|
@@ -284013,8 +284308,9 @@ var MarkdownParseState = class {
|
|
284013
284308
|
if (token.hidden && !UNHIDDEN_TOKENS.has(token.type))
|
284014
284309
|
return;
|
284015
284310
|
const handler = this.handlers[token.type];
|
284016
|
-
if (!handler)
|
284311
|
+
if (!handler) {
|
284017
284312
|
throw new Error(`Token type ${token.type} not supported by tokensToMyst parser`);
|
284313
|
+
}
|
284018
284314
|
handler(this, token, tokens, index4);
|
284019
284315
|
});
|
284020
284316
|
}
|
@@ -284037,9 +284333,9 @@ var MarkdownParseState = class {
|
|
284037
284333
|
}
|
284038
284334
|
}
|
284039
284335
|
};
|
284040
|
-
function getAttrs(spec, token, tokens, index4) {
|
284336
|
+
function getAttrs(state, spec, token, tokens, index4) {
|
284041
284337
|
var _a6;
|
284042
|
-
const attrs = ((_a6 = spec.getAttrs) === null || _a6 === void 0 ? void 0 : _a6.call(spec, token, tokens, index4)) || spec.attrs || {};
|
284338
|
+
const attrs = ((_a6 = spec.getAttrs) === null || _a6 === void 0 ? void 0 : _a6.call(spec, token, tokens, index4, state)) || spec.attrs || {};
|
284043
284339
|
if ("type" in attrs)
|
284044
284340
|
throw new Error('You can not have "type" as attrs.');
|
284045
284341
|
if ("children" in attrs)
|
@@ -284056,15 +284352,15 @@ function getTokenHandlers(specHandlers) {
|
|
284056
284352
|
if (noCloseToken(spec, type2)) {
|
284057
284353
|
handlers6[type2] = (state, tok, tokens, i2) => {
|
284058
284354
|
if (spec.isText) {
|
284059
|
-
state.addText(withoutTrailingNewline(tok.content), tok, spec.type, getAttrs(spec, tok, tokens, i2));
|
284355
|
+
state.addText(withoutTrailingNewline(tok.content), tok, spec.type, getAttrs(state, spec, tok, tokens, i2));
|
284060
284356
|
return;
|
284061
284357
|
}
|
284062
|
-
state.openNode(nodeType, tok, getAttrs(spec, tok, tokens, i2), spec.isLeaf);
|
284358
|
+
state.openNode(nodeType, tok, getAttrs(state, spec, tok, tokens, i2), spec.isLeaf);
|
284063
284359
|
state.addText(withoutTrailingNewline(tok.content), tok);
|
284064
284360
|
state.closeNode();
|
284065
284361
|
};
|
284066
284362
|
} else {
|
284067
|
-
handlers6[type2 + "_open"] = (state, tok, tokens, i2) => state.openNode(nodeType, tok, getAttrs(spec, tok, tokens, i2));
|
284363
|
+
handlers6[type2 + "_open"] = (state, tok, tokens, i2) => state.openNode(nodeType, tok, getAttrs(state, spec, tok, tokens, i2));
|
284068
284364
|
handlers6[type2 + "_close"] = (state) => state.closeNode();
|
284069
284365
|
}
|
284070
284366
|
});
|
@@ -284075,6 +284371,15 @@ function getTokenHandlers(specHandlers) {
|
|
284075
284371
|
}
|
284076
284372
|
|
284077
284373
|
// ../myst-parser/dist/tokensToMyst.js
|
284374
|
+
function computeAmsmathTightness(src, map6) {
|
284375
|
+
var _a6;
|
284376
|
+
const lines = src.split("\n");
|
284377
|
+
const tightBefore = typeof (map6 === null || map6 === void 0 ? void 0 : map6[0]) === "number" && map6[0] > 0 ? lines[map6[0] - 1].trim() !== "" : false;
|
284378
|
+
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;
|
284379
|
+
const tightAfter = typeof last === "number" && last < lines.length ? ((_a6 = lines[last]) === null || _a6 === void 0 ? void 0 : _a6.trim()) !== "" : false;
|
284380
|
+
const tight = tightBefore && tightAfter ? true : tightBefore ? "before" : tightAfter ? "after" : false;
|
284381
|
+
return tight;
|
284382
|
+
}
|
284078
284383
|
var NUMBERED_CLASS = /^numbered$/;
|
284079
284384
|
var ALIGN_CLASS = /(?:(?:align-)|^)(left|right|center)/;
|
284080
284385
|
function getClassName(token, exclude) {
|
@@ -284351,11 +284656,15 @@ var defaultMdast = {
|
|
284351
284656
|
type: "math",
|
284352
284657
|
noCloseToken: true,
|
284353
284658
|
isText: true,
|
284354
|
-
getAttrs(t2) {
|
284659
|
+
getAttrs(t2, tokens, index4, state) {
|
284355
284660
|
var _a6;
|
284356
|
-
|
284661
|
+
const tight = computeAmsmathTightness(state.src, t2.map);
|
284662
|
+
const attrs = {
|
284357
284663
|
enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
|
284358
284664
|
};
|
284665
|
+
if (tight)
|
284666
|
+
attrs.tight = tight;
|
284667
|
+
return attrs;
|
284359
284668
|
}
|
284360
284669
|
},
|
284361
284670
|
footnote_ref: {
|
@@ -284412,12 +284721,13 @@ var defaultMdast = {
|
|
284412
284721
|
parsed_directive: {
|
284413
284722
|
type: "mystDirective",
|
284414
284723
|
getAttrs(t2) {
|
284415
|
-
var _a6, _b;
|
284724
|
+
var _a6, _b, _c;
|
284416
284725
|
return {
|
284417
284726
|
name: t2.info,
|
284418
284727
|
args: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.arg,
|
284419
284728
|
options: (_b = t2.meta) === null || _b === void 0 ? void 0 : _b.options,
|
284420
|
-
value: t2.content || void 0
|
284729
|
+
value: t2.content || void 0,
|
284730
|
+
tight: ((_c = t2.meta) === null || _c === void 0 ? void 0 : _c.tight) || void 0
|
284421
284731
|
};
|
284422
284732
|
}
|
284423
284733
|
},
|
@@ -284544,14 +284854,14 @@ var defaultOptions2 = {
|
|
284544
284854
|
hoistSingleImagesOutofParagraphs: true,
|
284545
284855
|
nestBlocks: true
|
284546
284856
|
};
|
284547
|
-
function tokensToMyst(tokens, options = defaultOptions2) {
|
284857
|
+
function tokensToMyst(src, tokens, options = defaultOptions2) {
|
284548
284858
|
var _a6;
|
284549
284859
|
const opts = {
|
284550
284860
|
...defaultOptions2,
|
284551
284861
|
...options,
|
284552
284862
|
handlers: { ...defaultOptions2.handlers, ...options === null || options === void 0 ? void 0 : options.handlers }
|
284553
284863
|
};
|
284554
|
-
const state = new MarkdownParseState(opts.handlers);
|
284864
|
+
const state = new MarkdownParseState(src, opts.handlers);
|
284555
284865
|
state.parseTokens(tokens);
|
284556
284866
|
let tree;
|
284557
284867
|
do {
|
@@ -284949,7 +285259,7 @@ function mystParse(content3, opts) {
|
|
284949
285259
|
const { vfile: vfile2 } = opts || {};
|
284950
285260
|
const parsedOpts = parseOptions(opts);
|
284951
285261
|
const tokenizer = createTokenizer(parsedOpts);
|
284952
|
-
const tree = tokensToMyst(tokenizer.parse(content3, { vfile: vfile2 }), parsedOpts.mdast);
|
285262
|
+
const tree = tokensToMyst(content3, tokenizer.parse(content3, { vfile: vfile2 }), parsedOpts.mdast);
|
284953
285263
|
applyDirectives(tree, parsedOpts.directives, parsedOpts.vfile);
|
284954
285264
|
applyRoles(tree, parsedOpts.roles, parsedOpts.vfile);
|
284955
285265
|
return tree;
|
@@ -285498,7 +285808,7 @@ var import_node_path16 = __toESM(require("path"), 1);
|
|
285498
285808
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
285499
285809
|
|
285500
285810
|
// ../myst-cli/dist/version.js
|
285501
|
-
var version2 = "1.1.
|
285811
|
+
var version2 = "1.1.50";
|
285502
285812
|
var version_default2 = version2;
|
285503
285813
|
|
285504
285814
|
// ../myst-cli/dist/utils/headers.js
|
@@ -287490,7 +287800,7 @@ function reduceOutputs(session, mdast2, file, writeFolder, opts) {
|
|
287490
287800
|
// ../myst-cli/dist/transforms/inlineExpressions.js
|
287491
287801
|
var metadataSection = "user_expressions";
|
287492
287802
|
function findExpression(expressions, value) {
|
287493
|
-
return expressions.find((expr) => expr.expression === value);
|
287803
|
+
return expressions === null || expressions === void 0 ? void 0 : expressions.find((expr) => expr.expression === value);
|
287494
287804
|
}
|
287495
287805
|
function processLatex(value) {
|
287496
287806
|
return value.trim().replace(/^\$(\\displaystyle)?/, "").replace(/\$$/, "").trim();
|
@@ -287839,7 +288149,7 @@ async function getRawFrontmatterFromFile(session, file, projectPath) {
|
|
287839
288149
|
return void 0;
|
287840
288150
|
return result.pre.frontmatter;
|
287841
288151
|
}
|
287842
|
-
function getExportListFromRawFrontmatter(session,
|
288152
|
+
function getExportListFromRawFrontmatter(session, rawFrontmatter, file) {
|
287843
288153
|
var _a6;
|
287844
288154
|
const vfile2 = new VFile();
|
287845
288155
|
vfile2.path = file;
|
@@ -287848,10 +288158,7 @@ function getExportListFromRawFrontmatter(session, formats, rawFrontmatter, file)
|
|
287848
288158
|
ruleId: RuleId.validFrontmatterExportList
|
287849
288159
|
}));
|
287850
288160
|
logMessagesFromVFile(session, vfile2);
|
287851
|
-
|
287852
|
-
return [];
|
287853
|
-
const exportOptions = exports2.filter((exp) => !!exp && formats.includes(exp.format));
|
287854
|
-
return exportOptions;
|
288161
|
+
return exports2 !== null && exports2 !== void 0 ? exports2 : [];
|
287855
288162
|
}
|
287856
288163
|
function updateFileInfoFromFrontmatter(session, file, frontmatter, url, dataUrl) {
|
287857
288164
|
session.store.dispatch(watch.actions.updateFileInfo({
|
@@ -297246,121 +297553,232 @@ function getDefaultExportFilename(session, file, projectPath) {
|
|
297246
297553
|
const slug = slugFromProject || createSlug(name3);
|
297247
297554
|
return slug;
|
297248
297555
|
}
|
297249
|
-
function getDefaultExportFolder(session, file,
|
297556
|
+
function getDefaultExportFolder(session, file, format, projectPath) {
|
297250
297557
|
const subpaths = [projectPath || import_node_path32.default.parse(file).dir, "_build", "exports"];
|
297251
|
-
if (
|
297558
|
+
if (format === ExportFormats.tex) {
|
297252
297559
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_tex`);
|
297253
|
-
|
297560
|
+
}
|
297561
|
+
if (format === ExportFormats.typst) {
|
297254
297562
|
subpaths.push(`${getDefaultExportFilename(session, file, projectPath)}_typst`);
|
297563
|
+
}
|
297255
297564
|
return import_node_path32.default.join(...subpaths);
|
297256
297565
|
}
|
297257
297566
|
|
297258
297567
|
// ../myst-cli/dist/build/utils/collectExportOptions.js
|
297259
297568
|
var SOURCE_EXTENSIONS = [".ipynb", ".md", ".tex"];
|
297260
|
-
function
|
297569
|
+
function resolveArticlesFromProject(exp, proj, vfile2) {
|
297261
297570
|
var _a6;
|
297262
297571
|
const { file, pages } = proj;
|
297263
297572
|
const fileAsPage = { file, level: 1 };
|
297264
297573
|
const articles = (pages === null || pages === void 0 ? void 0 : pages.length) ? pages : [fileAsPage];
|
297265
297574
|
if (MULTI_ARTICLE_EXPORT_FORMATS.includes(exp.format)) {
|
297266
|
-
|
297267
|
-
}
|
297268
|
-
|
297269
|
-
|
297575
|
+
return { articles };
|
297576
|
+
}
|
297577
|
+
if (exp.format === ExportFormats.xml) {
|
297578
|
+
return {
|
297579
|
+
articles: [fileAsPage],
|
297580
|
+
sub_articles: pages.map((page) => page.file).filter((pageFile) => !!pageFile)
|
297581
|
+
};
|
297270
297582
|
} else {
|
297271
|
-
|
297272
|
-
|
297273
|
-
|
297274
|
-
|
297583
|
+
if (articles.length > 1) {
|
297584
|
+
fileError(vfile2, "multiple articles are only supported for 'tex', 'typst', and 'pdf' exports", {
|
297585
|
+
ruleId: RuleId.validFrontmatterExportList
|
297586
|
+
});
|
297587
|
+
}
|
297588
|
+
return { articles: [(_a6 = singleArticleWithFile(articles)) !== null && _a6 !== void 0 ? _a6 : fileAsPage] };
|
297275
297589
|
}
|
297276
297590
|
}
|
297277
|
-
function
|
297591
|
+
function resolveArticlesFromTOC(session, exp, tocPath, vfile2) {
|
297278
297592
|
const allowLevelLessThanOne = [
|
297279
297593
|
ExportFormats.tex,
|
297280
297594
|
ExportFormats.pdf,
|
297281
297595
|
ExportFormats.pdftex
|
297282
297596
|
].includes(exp.format);
|
297283
297597
|
const proj = projectFromToc(session, tocPath, allowLevelLessThanOne ? -1 : 1);
|
297284
|
-
|
297598
|
+
return resolveArticlesFromProject(exp, proj, vfile2);
|
297285
297599
|
}
|
297286
|
-
|
297287
|
-
|
297288
|
-
|
297289
|
-
|
297290
|
-
|
297291
|
-
|
297292
|
-
|
297293
|
-
|
297294
|
-
}
|
297295
|
-
|
297600
|
+
function resolveTemplate(sourceFile, exp, disableTemplate) {
|
297601
|
+
if (disableTemplate)
|
297602
|
+
return null;
|
297603
|
+
if (exp.template) {
|
297604
|
+
const resolvedTemplatePath = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.template);
|
297605
|
+
if (import_node_fs26.default.existsSync(resolvedTemplatePath)) {
|
297606
|
+
return resolvedTemplatePath;
|
297607
|
+
}
|
297608
|
+
}
|
297609
|
+
return exp.template;
|
297610
|
+
}
|
297611
|
+
function resolveFormat(vfile2, exp) {
|
297612
|
+
var _a6, _b, _c;
|
297613
|
+
if (exp.format && exp.format !== ExportFormats.pdf) {
|
297614
|
+
return exp.format;
|
297615
|
+
}
|
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 ((_a6 = exp.template) === null || _a6 === void 0 ? void 0 : _a6.endsWith("-tex"))
|
297627
|
+
return suggestedPdfFormat;
|
297628
|
+
if ((_b = exp.template) === null || _b === void 0 ? void 0 : _b.endsWith("-typst"))
|
297629
|
+
return ExportFormats.typst;
|
297630
|
+
if ((_c = exp.template) === null || _c === void 0 ? void 0 : _c.endsWith("-docx"))
|
297631
|
+
return ExportFormats.docx;
|
297632
|
+
if (exp.template && import_node_fs26.default.existsSync(exp.template)) {
|
297633
|
+
const templateFiles = import_node_fs26.default.readdirSync(exp.template);
|
297634
|
+
const templateTexFiles = templateFiles.filter((file) => file.endsWith(".tex"));
|
297635
|
+
const templateTypFiles = templateFiles.filter((file) => file.endsWith(".typ"));
|
297636
|
+
if (templateTexFiles.length && !templateTypFiles.length)
|
297637
|
+
return suggestedPdfFormat;
|
297638
|
+
if (!templateTexFiles.length && templateTypFiles.length)
|
297639
|
+
return ExportFormats.typst;
|
297640
|
+
}
|
297641
|
+
if (exp.format)
|
297642
|
+
return suggestedPdfFormat;
|
297643
|
+
return suggestedOutputFormat !== null && suggestedOutputFormat !== void 0 ? suggestedOutputFormat : suggestedPdfFormat;
|
297644
|
+
}
|
297645
|
+
function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
297646
|
+
var _a6, _b, _c, _d2;
|
297647
|
+
const { articles, sub_articles } = exp;
|
297648
|
+
let resolved = { articles, sub_articles };
|
297649
|
+
if (exp.toc && !resolved.articles && !resolved.sub_articles) {
|
297650
|
+
const resolvedToc = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.toc);
|
297651
|
+
if (validateTOC(session, resolvedToc)) {
|
297652
|
+
resolved = resolveArticlesFromTOC(session, exp, resolvedToc, vfile2);
|
297653
|
+
}
|
297296
297654
|
}
|
297297
|
-
|
297298
|
-
|
297299
|
-
exportOptions = [{ format: formats[0] }];
|
297655
|
+
if (!resolved.articles && SOURCE_EXTENSIONS.includes(import_node_path33.default.extname(sourceFile))) {
|
297656
|
+
resolved.articles = [{ file: import_node_path33.default.resolve(sourceFile) }];
|
297300
297657
|
}
|
297301
|
-
if (
|
297302
|
-
|
297658
|
+
if (((_a6 = resolved.articles) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && resolved.articles[0].level == null) {
|
297659
|
+
resolved.articles[0].level = 0;
|
297303
297660
|
}
|
297304
|
-
|
297305
|
-
|
297306
|
-
|
297307
|
-
|
297308
|
-
|
297309
|
-
|
297310
|
-
|
297311
|
-
}
|
297312
|
-
if (!((_c = exp.articles) === null || _c === void 0 ? void 0 : _c.length) && SOURCE_EXTENSIONS.includes(import_node_path33.default.extname(sourceFile))) {
|
297313
|
-
exp.articles = [{ file: import_node_path33.default.resolve(sourceFile) }];
|
297314
|
-
}
|
297315
|
-
if (((_d2 = exp.articles) === null || _d2 === void 0 ? void 0 : _d2.length) === 1 && exp.articles[0].level == null) {
|
297316
|
-
exp.articles[0].level = 0;
|
297317
|
-
}
|
297318
|
-
if (!((_e = exp.articles) === null || _e === void 0 ? void 0 : _e.length) && !((_f = exp.sub_articles) === null || _f === void 0 ? void 0 : _f.length)) {
|
297319
|
-
if (validateTOC(session, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) {
|
297320
|
-
assignArticlesFromTOC(session, exp, projectPath !== null && projectPath !== void 0 ? projectPath : ".", vfile2);
|
297321
|
-
} else {
|
297322
|
-
const cachedProject = selectors_exports.selectLocalProject(session.store.getState(), projectPath !== null && projectPath !== void 0 ? projectPath : ".");
|
297323
|
-
if (cachedProject) {
|
297324
|
-
assignArticlesFromProject(exp, cachedProject, vfile2);
|
297325
|
-
}
|
297661
|
+
if (!resolved.articles && !resolved.sub_articles) {
|
297662
|
+
if (validateTOC(session, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) {
|
297663
|
+
resolved = resolveArticlesFromTOC(session, exp, projectPath !== null && projectPath !== void 0 ? projectPath : ".", vfile2);
|
297664
|
+
} else {
|
297665
|
+
const cachedProject = selectors_exports.selectLocalProject(session.store.getState(), projectPath !== null && projectPath !== void 0 ? projectPath : ".");
|
297666
|
+
if (cachedProject) {
|
297667
|
+
resolved = resolveArticlesFromProject(exp, cachedProject, vfile2);
|
297326
297668
|
}
|
297327
297669
|
}
|
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}`, {
|
297670
|
+
}
|
297671
|
+
if (!((_b = resolved.articles) === null || _b === void 0 ? void 0 : _b.length) && exp.format !== ExportFormats.meca) {
|
297672
|
+
fileError(vfile2, `Unable to resolve any 'articles' to export`, {
|
297673
|
+
ruleId: RuleId.exportArticleExists
|
297674
|
+
});
|
297675
|
+
return resolved;
|
297676
|
+
}
|
297677
|
+
resolved.articles = (_c = resolved.articles) === null || _c === void 0 ? void 0 : _c.map((article) => {
|
297678
|
+
if (!article.file)
|
297679
|
+
return article;
|
297680
|
+
const resolvedFile = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), article.file);
|
297681
|
+
if (!import_node_fs26.default.existsSync(resolvedFile)) {
|
297682
|
+
fileError(vfile2, `Invalid export article - '${article.file}' does not exist`, {
|
297360
297683
|
ruleId: RuleId.exportArticleExists
|
297361
297684
|
});
|
297685
|
+
return void 0;
|
297362
297686
|
}
|
297687
|
+
return { ...article, file: resolvedFile };
|
297688
|
+
}).filter((article) => !!article);
|
297689
|
+
resolved.sub_articles = (_d2 = resolved.sub_articles) === null || _d2 === void 0 ? void 0 : _d2.map((file) => {
|
297690
|
+
const resolvedFile = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), file);
|
297691
|
+
if (!import_node_fs26.default.existsSync(resolvedFile)) {
|
297692
|
+
fileError(vfile2, `Invalid export sub_article - '${file}' does not exist`, {
|
297693
|
+
ruleId: RuleId.exportArticleExists
|
297694
|
+
});
|
297695
|
+
return void 0;
|
297696
|
+
} else {
|
297697
|
+
return resolvedFile;
|
297698
|
+
}
|
297699
|
+
}).filter((resolvedFile) => !!resolvedFile);
|
297700
|
+
return resolved;
|
297701
|
+
}
|
297702
|
+
var ALLOWED_EXTENSIONS = {
|
297703
|
+
[ExportFormats.docx]: [".doc", ".docx"],
|
297704
|
+
[ExportFormats.md]: [".md"],
|
297705
|
+
[ExportFormats.meca]: [".zip", ".meca"],
|
297706
|
+
[ExportFormats.pdf]: [".pdf"],
|
297707
|
+
[ExportFormats.pdftex]: [".pdf", ".tex", ".zip"],
|
297708
|
+
[ExportFormats.tex]: [".tex", ".zip"],
|
297709
|
+
[ExportFormats.typst]: [".pdf", ".typ", ".typst", ".zip"],
|
297710
|
+
[ExportFormats.xml]: [".xml", ".jats"]
|
297711
|
+
};
|
297712
|
+
function resolveOutput(session, sourceFile, vfile2, exp, projectPath) {
|
297713
|
+
var _a6, _b, _c, _d2, _e;
|
297714
|
+
let output2;
|
297715
|
+
if (exp.output) {
|
297716
|
+
output2 = import_node_path33.default.resolve(import_node_path33.default.dirname(sourceFile), exp.output);
|
297717
|
+
} else {
|
297718
|
+
output2 = getDefaultExportFolder(session, sourceFile, exp.format, projectPath);
|
297719
|
+
}
|
297720
|
+
if (exp.format === ExportFormats.meca && exp.zip === false) {
|
297721
|
+
fileWarn(vfile2, `ignoring "zip: false" for export of format "${ExportFormats.meca}"`);
|
297722
|
+
}
|
297723
|
+
if (exp.zip && !((_a6 = ALLOWED_EXTENSIONS[exp.format]) === null || _a6 === void 0 ? void 0 : _a6.includes(".zip"))) {
|
297724
|
+
fileWarn(vfile2, `ignoring "zip: true" for export of format "${exp.format}"`);
|
297725
|
+
exp.zip = false;
|
297726
|
+
}
|
297727
|
+
if (!import_node_path33.default.extname(output2)) {
|
297728
|
+
const basename3 = getDefaultExportFilename(session, (_c = (_b = singleArticleWithFile(exp.articles)) === null || _b === void 0 ? void 0 : _b.file) !== null && _c !== void 0 ? _c : sourceFile, projectPath);
|
297729
|
+
const ext2 = exp.zip ? ".zip" : (_d2 = ALLOWED_EXTENSIONS[exp.format]) === null || _d2 === void 0 ? void 0 : _d2[0];
|
297730
|
+
output2 = import_node_path33.default.join(output2, `${basename3}${ext2 !== null && ext2 !== void 0 ? ext2 : ""}`);
|
297731
|
+
}
|
297732
|
+
if (!((_e = ALLOWED_EXTENSIONS[exp.format]) === null || _e === void 0 ? void 0 : _e.includes(import_node_path33.default.extname(output2)))) {
|
297733
|
+
fileError(vfile2, `Output file "${output2}" has invalid extension for export format of "${exp.format}"`, { ruleId: RuleId.exportExtensionCorrect });
|
297363
297734
|
return void 0;
|
297735
|
+
}
|
297736
|
+
if (exp.zip && import_node_path33.default.extname(output2) !== ".zip") {
|
297737
|
+
fileWarn(vfile2, `Output file "${output2}" has non-zip extension but "zip: true" is specified; ignoring "zip: true"`, { ruleId: RuleId.exportExtensionCorrect });
|
297738
|
+
}
|
297739
|
+
return output2;
|
297740
|
+
}
|
297741
|
+
async function getExportListFromFile(session, sourceFile, projectPath, opts) {
|
297742
|
+
const { disableTemplate } = opts;
|
297743
|
+
let rawFrontmatter;
|
297744
|
+
const state = session.store.getState();
|
297745
|
+
if (projectPath && import_node_path33.default.resolve(sourceFile) === selectors_exports.selectLocalConfigFile(state, projectPath)) {
|
297746
|
+
rawFrontmatter = selectors_exports.selectLocalProjectConfig(state, projectPath);
|
297747
|
+
} else {
|
297748
|
+
rawFrontmatter = await getRawFrontmatterFromFile(session, sourceFile, projectPath);
|
297749
|
+
}
|
297750
|
+
const exportList = getExportListFromRawFrontmatter(session, rawFrontmatter, sourceFile);
|
297751
|
+
const exportListWithTemplate = exportList.map((exp) => {
|
297752
|
+
const template = resolveTemplate(sourceFile, exp, disableTemplate);
|
297753
|
+
return { ...exp, template };
|
297754
|
+
}).filter((exp) => !!exp);
|
297755
|
+
return exportListWithTemplate;
|
297756
|
+
}
|
297757
|
+
function resolveExportListFormats(session, sourceFile, formats, exportList) {
|
297758
|
+
const vfile2 = new VFile();
|
297759
|
+
vfile2.path = sourceFile;
|
297760
|
+
const exportListWithFormat = exportList.map((exp) => {
|
297761
|
+
const format = resolveFormat(vfile2, exp);
|
297762
|
+
if (!format || !formats.includes(format))
|
297763
|
+
return void 0;
|
297764
|
+
return { ...exp, format };
|
297765
|
+
}).filter((exp) => !!exp);
|
297766
|
+
logMessagesFromVFile(session, vfile2);
|
297767
|
+
return exportListWithFormat;
|
297768
|
+
}
|
297769
|
+
function resolveExportListArticles(session, sourceFile, exportList, projectPath, opts) {
|
297770
|
+
const { renderer } = opts;
|
297771
|
+
const vfile2 = new VFile();
|
297772
|
+
vfile2.path = sourceFile;
|
297773
|
+
const filteredExportOptions = exportList.map((exp) => {
|
297774
|
+
const { articles, sub_articles } = resolveArticles(session, sourceFile, vfile2, exp, projectPath);
|
297775
|
+
if (!(articles === null || articles === void 0 ? void 0 : articles.length) && exp.format !== ExportFormats.meca) {
|
297776
|
+
return void 0;
|
297777
|
+
}
|
297778
|
+
const output2 = resolveOutput(session, sourceFile, vfile2, exp, projectPath);
|
297779
|
+
if (!output2)
|
297780
|
+
return void 0;
|
297781
|
+
return { ...exp, output: output2, articles, sub_articles, renderer };
|
297364
297782
|
}).filter((exp) => !!exp);
|
297365
297783
|
logMessagesFromVFile(session, vfile2);
|
297366
297784
|
return filteredExportOptions;
|
@@ -297377,93 +297795,6 @@ function filterAndMakeUnique(exports2) {
|
|
297377
297795
|
};
|
297378
297796
|
});
|
297379
297797
|
}
|
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
297798
|
async function collectExportOptions(session, files, formats, opts) {
|
297468
297799
|
const { projectPath } = opts;
|
297469
297800
|
const sourceFiles = [...files];
|
@@ -297483,29 +297814,10 @@ async function collectExportOptions(session, files, formats, opts) {
|
|
297483
297814
|
} else {
|
297484
297815
|
fileProjectPath = projectPath;
|
297485
297816
|
}
|
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) => {
|
297817
|
+
const fileExports = await getExportListFromFile(session, file, fileProjectPath, opts);
|
297818
|
+
const fileExportsWithFormat = resolveExportListFormats(session, file, formats, fileExports);
|
297819
|
+
const fileExportsResolved = resolveExportListArticles(session, file, fileExportsWithFormat, fileProjectPath, opts);
|
297820
|
+
exportOptionsList.push(...fileExportsResolved.map((exportOptions) => {
|
297509
297821
|
return { ...exportOptions, $file: file, $project: fileProjectPath };
|
297510
297822
|
}));
|
297511
297823
|
}));
|
@@ -300632,6 +300944,11 @@ function withRecursiveCommands(state, plugins2 = state.data.mathPlugins) {
|
|
300632
300944
|
}
|
300633
300945
|
var math4 = (node3, state) => {
|
300634
300946
|
const { label, enumerated } = node3;
|
300947
|
+
const tightBefore = node3.tight === true || node3.tight === "before";
|
300948
|
+
const tightAfter = node3.tight === true || node3.tight === "after";
|
300949
|
+
if (tightBefore) {
|
300950
|
+
state.ensureNewLine(true);
|
300951
|
+
}
|
300635
300952
|
state.usePackages("amsmath");
|
300636
300953
|
addMacrosToState(node3.value, state);
|
300637
300954
|
if (state.data.isInTable) {
|
@@ -300656,8 +300973,13 @@ var math4 = (node3, state) => {
|
|
300656
300973
|
state.write(`\\end{equation${enumerated === false ? "*" : ""}}`);
|
300657
300974
|
}
|
300658
300975
|
}
|
300659
|
-
if (
|
300976
|
+
if (state.data.isInTable)
|
300977
|
+
return;
|
300978
|
+
if (tightAfter) {
|
300979
|
+
state.ensureNewLine(true);
|
300980
|
+
} else {
|
300660
300981
|
state.closeBlock(node3);
|
300982
|
+
}
|
300661
300983
|
};
|
300662
300984
|
var inlineMath2 = (node3, state) => {
|
300663
300985
|
state.usePackages("amsmath");
|
@@ -302925,8 +303247,7 @@ function isTypstAvailable() {
|
|
302925
303247
|
}
|
302926
303248
|
async function runTypstExecutable(session, typstFile) {
|
302927
303249
|
if (!isTypstAvailable()) {
|
302928
|
-
|
302929
|
-
return;
|
303250
|
+
throw new Error("The typst CLI must be installed to build PDFs with typst");
|
302930
303251
|
}
|
302931
303252
|
if (import_node_path49.default.extname(typstFile) !== ".typ") {
|
302932
303253
|
throw new Error(`invalid input file for typst executable: ${typstFile}`);
|
@@ -303198,7 +303519,7 @@ async function runTypstPdfExport(session, file, exportOptions, opts) {
|
|
303198
303519
|
exportOptions.output = import_node_path49.default.join(typFolder, `${import_node_path49.default.basename(pdfOutput, import_node_path49.default.extname(pdfOutput))}.typ`);
|
303199
303520
|
await runTypstExport(session, file, exportOptions, { ...opts !== null && opts !== void 0 ? opts : {}, clean: false });
|
303200
303521
|
const writeFolder = import_node_path49.default.dirname(pdfOutput);
|
303201
|
-
session.log.info(`\u{1F5A8}
|
303522
|
+
session.log.info(`\u{1F5A8} Rendering typst pdf to ${pdfOutput}`);
|
303202
303523
|
if (!import_node_fs34.default.existsSync(writeFolder))
|
303203
303524
|
import_node_fs34.default.mkdirSync(writeFolder, { recursive: true });
|
303204
303525
|
import_node_fs34.default.copyFileSync(exportOptions.output.replace(".typ", ".pdf"), pdfOutput);
|
@@ -306496,7 +306817,12 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
306496
306817
|
abstractParts: [
|
306497
306818
|
{ part: "abstract" },
|
306498
306819
|
{
|
306499
|
-
part: [
|
306820
|
+
part: [
|
306821
|
+
"plain-language-summary",
|
306822
|
+
"plain-language-abstract",
|
306823
|
+
"summary",
|
306824
|
+
"plain language summary"
|
306825
|
+
],
|
306500
306826
|
type: "plain-language-summary",
|
306501
306827
|
title: "Plain Language Summary"
|
306502
306828
|
},
|
@@ -306504,7 +306830,7 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
306504
306830
|
],
|
306505
306831
|
backSections: [
|
306506
306832
|
{
|
306507
|
-
part: ["data-availability", "data_availability", "availability"],
|
306833
|
+
part: ["data-availability", "data_availability", "availability", "data availability"],
|
306508
306834
|
type: "data-availability",
|
306509
306835
|
title: "Data Availability"
|
306510
306836
|
}
|
@@ -311525,24 +311851,45 @@ function hasAnyExplicitExportFormat(opts) {
|
|
311525
311851
|
const { docx, pdf, tex, typst, xml: xml2, md, meca } = opts;
|
311526
311852
|
return docx || pdf || tex || typst || xml2 || md || meca || false;
|
311527
311853
|
}
|
311528
|
-
function
|
311529
|
-
const { docx, pdf, tex, typst, xml: xml2, md, meca, all: all10, explicit
|
311854
|
+
function getAllowedExportFormats(opts) {
|
311855
|
+
const { docx, pdf, tex, typst, xml: xml2, md, meca, all: all10, explicit } = opts;
|
311530
311856
|
const formats = [];
|
311531
311857
|
const any = hasAnyExplicitExportFormat(opts);
|
311532
|
-
const override = all10 || !any && explicit
|
311533
|
-
if (docx || override
|
311858
|
+
const override = all10 || !any && explicit;
|
311859
|
+
if (docx || override)
|
311534
311860
|
formats.push(ExportFormats.docx);
|
311535
|
-
if (pdf || override
|
311861
|
+
if (pdf || override) {
|
311862
|
+
formats.push(ExportFormats.pdf, ExportFormats.pdftex, ExportFormats.typst);
|
311863
|
+
}
|
311864
|
+
if (tex || override) {
|
311865
|
+
formats.push(ExportFormats.tex, ExportFormats.pdftex);
|
311866
|
+
}
|
311867
|
+
if (typst || override)
|
311868
|
+
formats.push(ExportFormats.typst);
|
311869
|
+
if (xml2 || override)
|
311870
|
+
formats.push(ExportFormats.xml);
|
311871
|
+
if (md || override)
|
311872
|
+
formats.push(ExportFormats.md);
|
311873
|
+
if (meca || override)
|
311874
|
+
formats.push(ExportFormats.meca);
|
311875
|
+
return [...new Set(formats)];
|
311876
|
+
}
|
311877
|
+
function getRequestedExportFormats(opts) {
|
311878
|
+
const { docx, pdf, tex, typst, xml: xml2, md, meca } = opts;
|
311879
|
+
const formats = [];
|
311880
|
+
if (docx)
|
311881
|
+
formats.push(ExportFormats.docx);
|
311882
|
+
if (pdf)
|
311536
311883
|
formats.push(ExportFormats.pdf);
|
311537
|
-
if (tex
|
311884
|
+
if (tex)
|
311538
311885
|
formats.push(ExportFormats.tex);
|
311539
|
-
if (typst
|
311886
|
+
if (typst)
|
311540
311887
|
formats.push(ExportFormats.typst);
|
311541
|
-
if (xml2
|
311888
|
+
if (xml2)
|
311542
311889
|
formats.push(ExportFormats.xml);
|
311543
|
-
if (md
|
311890
|
+
if (md)
|
311544
311891
|
formats.push(ExportFormats.md);
|
311545
|
-
if (meca
|
311892
|
+
if (meca)
|
311546
311893
|
formats.push(ExportFormats.meca);
|
311547
311894
|
return formats;
|
311548
311895
|
}
|
@@ -311561,46 +311908,61 @@ function getProjectPaths(session) {
|
|
311561
311908
|
return uniqueArray(projectPaths);
|
311562
311909
|
}
|
311563
311910
|
async function collectAllBuildExportOptions(session, files, opts) {
|
311564
|
-
|
311911
|
+
var _a6;
|
311912
|
+
const { output: output2 } = opts;
|
311565
311913
|
files = files.map((file) => import_node_path57.default.resolve(file));
|
311566
311914
|
if (output2 && files.length !== 1) {
|
311567
311915
|
throw new Error("When specifying a named output for export, you must list exactly one file.");
|
311568
311916
|
}
|
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)}`);
|
311917
|
+
const requestedFormats = getRequestedExportFormats(opts);
|
311918
|
+
if (output2 && requestedFormats.length > 1) {
|
311919
|
+
throw new Error(`When specifying output, you can only request one format`);
|
311576
311920
|
}
|
311577
|
-
session.log.debug(`Exporting formats: "${formats.join('", "')}"`);
|
311578
311921
|
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);
|
311922
|
+
const projectPath = findCurrentProjectAndLoad(session, files[0] ? import_node_path57.default.dirname(files[0]) : ".");
|
311923
|
+
if (projectPath)
|
311924
|
+
await loadProjectFromDisk(session, projectPath);
|
311925
|
+
if (output2) {
|
311926
|
+
session.log.debug(`Exporting formats: "${requestedFormats.join('", "')}"`);
|
311927
|
+
const format = (_a6 = requestedFormats[0]) !== null && _a6 !== void 0 ? _a6 : EXT_TO_FORMAT[import_node_path57.default.extname(output2)];
|
311928
|
+
if (!format) {
|
311929
|
+
throw new Error(`Cannot specify format from output "${output2}" - please specify format option, e.g. --pdf`);
|
311589
311930
|
}
|
311931
|
+
exportOptionsList = resolveExportListArticles(session, files[0], [{ format, output: import_node_path57.default.join(import_node_path57.default.resolve("."), output2) }], projectPath, opts).map((exp) => {
|
311932
|
+
return { ...exp, $file: files[0], $project: projectPath };
|
311933
|
+
});
|
311934
|
+
} else if (files.length) {
|
311935
|
+
const allowedFormats = getAllowedExportFormats({
|
311936
|
+
...opts,
|
311937
|
+
explicit: true
|
311938
|
+
});
|
311939
|
+
session.log.debug(`Exporting formats: "${allowedFormats.join('", "')}"`);
|
311940
|
+
exportOptionsList = (await Promise.all(files.map(async (file) => {
|
311941
|
+
const fileExportOptionsList = await collectExportOptions(session, [file], allowedFormats, {});
|
311942
|
+
if (fileExportOptionsList.length > 0) {
|
311943
|
+
return fileExportOptionsList;
|
311944
|
+
}
|
311945
|
+
return resolveExportListArticles(session, file, requestedFormats.map((format) => {
|
311946
|
+
return { format };
|
311947
|
+
}), projectPath, opts).map((exp) => {
|
311948
|
+
return { ...exp, $file: files[0], $project: projectPath };
|
311949
|
+
});
|
311950
|
+
}))).flat();
|
311590
311951
|
} else {
|
311952
|
+
const allowedFormats = getAllowedExportFormats(opts);
|
311953
|
+
session.log.debug(`Exporting formats: "${allowedFormats.join('", "')}"`);
|
311591
311954
|
const projectPaths = getProjectPaths(session);
|
311592
|
-
exportOptionsList = (await Promise.all(projectPaths.map(async (
|
311955
|
+
exportOptionsList = (await Promise.all(projectPaths.map(async (projPath) => {
|
311593
311956
|
try {
|
311594
|
-
const project = await loadProjectFromDisk(session,
|
311957
|
+
const project = await loadProjectFromDisk(session, projPath);
|
311595
311958
|
files = filterPages(project).map((page) => page.file);
|
311596
311959
|
} catch (err) {
|
311597
|
-
session.log.debug(`Unable to load any content from project at: ${
|
311960
|
+
session.log.debug(`Unable to load any content from project at: ${projPath}
|
311598
311961
|
${err}`);
|
311599
311962
|
return [];
|
311600
311963
|
}
|
311601
|
-
const exportOptions = await collectExportOptions(session, files,
|
311602
|
-
|
311603
|
-
projectPath
|
311964
|
+
const exportOptions = await collectExportOptions(session, files, allowedFormats, {
|
311965
|
+
projectPath: projPath
|
311604
311966
|
});
|
311605
311967
|
return exportOptions;
|
311606
311968
|
}))).flat();
|
@@ -311629,7 +311991,7 @@ async function build(session, files, opts) {
|
|
311629
311991
|
});
|
311630
311992
|
if (exportLogList.length === 0) {
|
311631
311993
|
if (!(site || performSiteBuild)) {
|
311632
|
-
const kinds = Object.entries(opts).filter(([k, v]) =>
|
311994
|
+
const kinds = Object.entries(opts).filter(([k, v]) => !["force", "output", "checkLinks", "site", "maxSizeWebp"].includes(k) && v).map(([k]) => k);
|
311633
311995
|
session.log.info(`\u{1F4ED} No file exports${kinds.length > 0 ? ` with kind "${kinds.map(extToKind).join('", "')}"` : ""} found.`);
|
311634
311996
|
if (kinds.length) {
|
311635
311997
|
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:
|