@rohal12/twee-ts 1.13.0 → 1.13.1
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.
- package/dist/bin/twee-ts.js +10 -6
- package/dist/bin/twee-ts.js.map +1 -1
- package/dist/{chunk-ORMESTR7.js → chunk-EQAUFATA.js} +11 -7
- package/dist/{chunk-ORMESTR7.js.map → chunk-EQAUFATA.js.map} +1 -1
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/plugins/rollup.js +1 -1
- package/dist/plugins/vite.js +1 -1
- package/package.json +1 -1
package/dist/bin/twee-ts.js
CHANGED
|
@@ -4450,10 +4450,12 @@ function toTwine2Archive(story, startName, options) {
|
|
|
4450
4450
|
function toTwine2HTML(story, format, startName, options) {
|
|
4451
4451
|
let template = readFormatSource(format);
|
|
4452
4452
|
if (template.includes("{{STORY_NAME}}")) {
|
|
4453
|
-
|
|
4453
|
+
const name = htmlEscape(story.name);
|
|
4454
|
+
template = template.replaceAll("{{STORY_NAME}}", () => name);
|
|
4454
4455
|
}
|
|
4455
4456
|
if (template.includes("{{STORY_DATA}}")) {
|
|
4456
|
-
|
|
4457
|
+
const data = getTwine2DataChunk(story, startName, options);
|
|
4458
|
+
template = template.replace("{{STORY_DATA}}", () => data);
|
|
4457
4459
|
}
|
|
4458
4460
|
return template;
|
|
4459
4461
|
}
|
|
@@ -4554,10 +4556,11 @@ function toTwine1HTML(story, format, startName) {
|
|
|
4554
4556
|
const displayStart = startName === "Start" ? "" : startName;
|
|
4555
4557
|
template = template.replace('"VERSION"', `Compiled with ${CREATOR_NAME2}, ${VERSION}`);
|
|
4556
4558
|
template = template.replace('"TIME"', `Built on ${(/* @__PURE__ */ new Date()).toUTCString()}`);
|
|
4557
|
-
|
|
4559
|
+
const startAtValue = `"${jsStringEscape(displayStart)}"`;
|
|
4560
|
+
template = template.replace('"START_AT"', () => startAtValue);
|
|
4558
4561
|
template = template.replace('"STORY_SIZE"', `"${count}"`);
|
|
4559
4562
|
if (template.includes('"STORY"')) {
|
|
4560
|
-
template = template.replace('"STORY"', data);
|
|
4563
|
+
template = template.replace('"STORY"', () => data);
|
|
4561
4564
|
} else {
|
|
4562
4565
|
let footer;
|
|
4563
4566
|
try {
|
|
@@ -4593,7 +4596,7 @@ function tryReplaceComponent(template, placeholder, componentPath, required) {
|
|
|
4593
4596
|
try {
|
|
4594
4597
|
let content = readFileSync2(componentPath, "utf-8");
|
|
4595
4598
|
if (content.charCodeAt(0) === 65279) content = content.slice(1);
|
|
4596
|
-
return template.replace(placeholder, content);
|
|
4599
|
+
return template.replace(placeholder, () => content);
|
|
4597
4600
|
} catch (e) {
|
|
4598
4601
|
if (required) {
|
|
4599
4602
|
throw new Error(
|
|
@@ -4681,7 +4684,8 @@ function modifyHead(html, modulePaths, headFile, diagnostics) {
|
|
|
4681
4684
|
}
|
|
4682
4685
|
if (parts.length > 0) {
|
|
4683
4686
|
parts.push("</head>");
|
|
4684
|
-
|
|
4687
|
+
const replacement = parts.join("\n");
|
|
4688
|
+
return html.replace("</head>", () => replacement);
|
|
4685
4689
|
}
|
|
4686
4690
|
return html;
|
|
4687
4691
|
}
|