MapComplete/test.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
2 KiB
TypeScript
Raw Normal View History

2022-09-08 21:26:17 +02:00
import "./assets/templates/Ubuntu-M-normal.js"
import "./assets/templates/Ubuntu-L-normal.js"
import "./assets/templates/UbuntuMono-B-bold.js"
2022-09-12 20:14:03 +02:00
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import MinimapImplementation from "./UI/Base/MinimapImplementation";
import {Utils} from "./Utils";
import FeaturePipelineState from "./Logic/State/FeaturePipelineState";
import Locale from "./UI/i18n/Locale";
import {SvgToPdf} from "./Utils/svgToPdf";
2022-09-08 21:26:17 +02:00
2022-09-12 20:14:03 +02:00
MinimapImplementation.initialize()
2022-09-08 21:26:17 +02:00
async function main() {
const svg = await Utils.download(window.location.protocol + "//" + window.location.host + "/assets/templates/MapComplete-flyer.svg")
2022-09-12 20:14:03 +02:00
const svgBack = await Utils.download(window.location.protocol + "//" + window.location.host + "/assets/templates/MapComplete-flyer.back.svg")
Locale.language.setData("en")
2022-09-08 21:26:17 +02:00
/*
2022-09-12 20:14:03 +02:00
await new SvgToPdf([svg], {
state,
textSubstitutions: {
mapCount: "" + Array.from(AllKnownLayouts.allKnownLayouts.values()).filter(th => !th.hideFromOverview).length
}
}).ConvertSvg("flyer_en.pdf")
//*/
Locale.language.setData("en")
const svgToPdf = new SvgToPdf([svgBack], {
freeDivId: "extradiv",
textSubstitutions: {
mapCount: "" + Array.from(AllKnownLayouts.allKnownLayouts.values()).filter(th => !th.hideFromOverview).length
}
})
await svgToPdf.Prepare()
console.log("Used translations", svgToPdf._usedTranslations)
await svgToPdf.ConvertSvg("flyer_nl.pdf")
/*
Locale.language.setData("en")
await new SvgToPdf([svgBack], {
textSubstitutions: {
mapCount: "" + Array.from(AllKnownLayouts.allKnownLayouts.values()).filter(th => !th.hideFromOverview).length
}
}).ConvertSvg("flyer_en.pdf")
2022-09-08 21:26:17 +02:00
2022-09-12 20:14:03 +02:00
Locale.language.setData("nl")
await new SvgToPdf([svgBack], {
textSubstitutions: {
mapCount: "" + Array.from(AllKnownLayouts.allKnownLayouts.values()).filter(th => !th.hideFromOverview).length
}
}).ConvertSvg("flyer_nl.pdf")*/
2022-09-08 21:26:17 +02:00
}
main().then(() => console.log("Done!"))