Fetch directly from patched path if language is patched
This commit is contained in:
parent
7c3d4b6f86
commit
05e587b018
3 changed files with 8 additions and 6 deletions
|
@ -36,7 +36,7 @@
|
|||
<div id="length">Waiting...</div>
|
||||
|
||||
<div id="info">
|
||||
v2.2.1 | © Nicd 2023 | <a href="https://gitlab.com/Nicd/t" target="_blank">Source</a> | <a href="./licenses.txt"
|
||||
v2.2.2 | © Nicd 2023 | <a href="https://gitlab.com/Nicd/t" target="_blank">Source</a> | <a href="./licenses.txt"
|
||||
target="_blank">Licenses</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -311,6 +311,7 @@ for (let i = 0; i < LANGUAGE_NAMES.length; ++i) {
|
|||
}
|
||||
|
||||
export const PLAINTEXT = LANGUAGE_NAMES[0];
|
||||
export const PATCHED_LANGUAGES = new Set(["gleam"]);
|
||||
|
||||
export async function getDepsData() {
|
||||
const resp = await fetch("./vendor/prism/components.json");
|
||||
|
|
|
@ -17,6 +17,7 @@ import {
|
|||
LANGUAGES,
|
||||
LANGUAGE_NAMES,
|
||||
PLAINTEXT,
|
||||
PATCHED_LANGUAGES,
|
||||
} from "./languages.js";
|
||||
|
||||
const PROJECT_NAME = "Tahnaroskakori";
|
||||
|
@ -105,11 +106,11 @@ async function highlightLanguage() {
|
|||
dataOptions.language
|
||||
);
|
||||
for (const dep of [...deps, dataOptions.language]) {
|
||||
try {
|
||||
await import(`./vendor/prism/components/prism-${dep}.js`);
|
||||
} catch {
|
||||
await import(`./vendor/prism-patches/prism-${dep}.js`);
|
||||
}
|
||||
const importPath = PATCHED_LANGUAGES.has(dep)
|
||||
? `./vendor/prism-patches/prism-${dep}.js`
|
||||
: `./vendor/prism/components/prism-${dep}.js`;
|
||||
|
||||
await import(importPath);
|
||||
}
|
||||
|
||||
if (viewMode === ViewMode.VIEW) {
|
||||
|
|
Loading…
Reference in a new issue