Skip to content
Snippets Groups Projects
Commit 40ebf567 authored by Alfex4936's avatar Alfex4936
Browse files

Optimize js and css

parent 26a89dcb
No related branches found
No related tags found
No related merge requests found
Pipeline #5528 passed
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
......
@import url("https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap"); @import url("https://fonts.googleapis.com/css?family=Noto+Sans+KR|Fira+Code&display=swap");
@import url("https://fonts.googleapis.com/css?family=Fira+Code&display=swap");
a { a {
color: #1e90ff; color: #1e90ff;
......
...@@ -63,6 +63,7 @@ document.addEventListener("touchstart", handleTouchStart, false); ...@@ -63,6 +63,7 @@ document.addEventListener("touchstart", handleTouchStart, false);
document.addEventListener("touchmove", handleTouchMove, false); document.addEventListener("touchmove", handleTouchMove, false);
setupKeys(); setupKeys();
document.addEventListener("DOMContentLoaded", function () {
const iframeElement = document.querySelector("iframe"); const iframeElement = document.querySelector("iframe");
if (iframeElement) { if (iframeElement) {
setupKeys(); setupKeys();
...@@ -80,3 +81,4 @@ if (iframeElement) { ...@@ -80,3 +81,4 @@ if (iframeElement) {
} else { } else {
setupKeys(); setupKeys();
} }
});
...@@ -5,71 +5,33 @@ const yaml = require("js-yaml"); ...@@ -5,71 +5,33 @@ const yaml = require("js-yaml");
const lessonSource = process.argv[2]; const lessonSource = process.argv[2];
const targetDir = process.argv[3]; const targetDir = process.argv[3];
showdown.extension("rust", function () { const rustExtension = {
return [
{
type: "lang", type: "lang",
regex: /%rust%([^]+?)%end%/gi, regex: /%rust%([^]+?)%end%/gi,
replace: function (s, match) { replace: (s, match) => `<pre><code class="rust">${match.trim()}</code></pre>`,
return '<pre><code class="rust">' + match.trim() + "</code></pre>"; };
},
},
];
});
showdown.extension("centerImage", function () { const centerImageExtension = {
return [
{
type: "lang", type: "lang",
regex: /%center\s*-\s*([^\s%]+)(?:\s*,\s*([^%\n]+))?\s*%/gi, regex: /%center\s*-\s*([^\s%]+)(?:\s*,\s*([^%\n]+))?\s*%/gi,
replace: function (s, src, subtitle) { replace: (s, src, subtitle) => {
var html = const baseHtml = `<div align="center"><p><img src="${src}" alt="NO IMG" style="width: 20%; margin-bottom: 20px; border-radius: 10px;"></p>`;
'<div align="center">' + return subtitle
'<p><img src="' + ? baseHtml + `<h3>${subtitle.trim()}</h3></div>`
src + : baseHtml + "</div>";
'" alt="NO IMG" style="width: 20%; margin-bottom: 20px; border-radius: 10px;"></p>';
if (subtitle) {
html += "<h3>" + subtitle.trim() + "</h3>";
}
html += "</div>";
return html;
},
}, },
]; };
});
/** const pad = num => String(num).padStart(2, "0");
* @param {number} num const getWord = (words, lang, w) => words[lang][w] || words.ko[w];
* @returns {string}
*/
function pad(num) {
const s = `${num}`;
return s.padStart(2, "0");
}
/** const getFileName = (lang, i, chapter) =>
* @param {string} lang i === 0 && lang === "ko"
* @param {number} i ? "index.html"
* @param {boolean} isBeta currently unused : chapter
* @param {string} chapter ? `chapter_${chapter}_${lang}.html`
* @returns {string} : `${pad(i)}_${lang}.html`;
*/
function getFileName(lang, i, isBeta, chapter) {
if (i === 0 && lang === "ko") {
return "index.html";
}
// let fileName = `${pad(i)}_${lang}.html`;
let fileName = `${pad(i)}_${lang}.html`;
if (chapter !== undefined && chapter !== null) {
fileName = `chapter_${chapter}_${lang}.html`;
}
return fileName;
}
/**
* @param {string} source
* @returns {string[]}
*/
const getDirectories = source => const getDirectories = source =>
fs fs
.readdirSync(source, { withFileTypes: true }) .readdirSync(source, { withFileTypes: true })
...@@ -87,35 +49,31 @@ const commonWords = {}; ...@@ -87,35 +49,31 @@ const commonWords = {};
const chapters = []; const chapters = [];
languages.forEach(lang => { languages.forEach(lang => {
// const lang = languages[x];
const langDir = `${lessonSource}/${lang}`; const langDir = `${lessonSource}/${lang}`;
commonWords[lang] = getYaml(`${langDir}/common_words.yaml`); commonWords[lang] = getYaml(`${langDir}/common_words.yaml`);
const languageFiles = fs
.readdirSync(langDir, { withFileTypes: true }) fs.readdirSync(langDir, { withFileTypes: true })
.filter(f => f.isFile() && f.name.indexOf("chapter_") === 0) .filter(f => f.isFile() && f.name.startsWith("chapter_"))
.map(f => f.name); .forEach(f => {
languageFiles.forEach(l => { const chap = parseInt(f.name.substring(8, f.name.indexOf(".")), 10);
const chap = parseInt(l.substring(8, l.indexOf(".")), 10); chapters[chap] = chapters[chap] || {};
if (chapters[chap] === undefined) { chapters[chap][lang] = getYaml(`${langDir}/${f.name}`);
chapters[chap] = {};
}
chapters[chap][lang] = getYaml(`${langDir}/${l}`);
}); });
}); });
const pages = []; const pages = [];
chapters.forEach((c, x) => { chapters.forEach((c, x) => {
for (let i = 0; i < c.ko.length; i += 1) { c.ko.forEach((_, i) => {
const page = {}; const page = {};
if (i === 0 && x !== 0) { if (i === 0 && x !== 0) {
page.chapter = x; page.chapter = x;
} }
Object.keys(c).forEach(lang => { Object.entries(c).forEach(([lang, content]) => {
page[lang] = c[lang][i]; page[lang] = content[i];
}); });
pages.push(page); pages.push(page);
} });
}); });
const lessons = { const lessons = {
...@@ -132,25 +90,11 @@ const aBinder = [ ...@@ -132,25 +90,11 @@ const aBinder = [
]; ];
const converter = new showdown.Converter({ const converter = new showdown.Converter({
extensions: [...aBinder, "rust", "centerImage"], extensions: [...aBinder, rustExtension, centerImageExtension],
}); });
converter.setOption("parseImgDimensions", true); converter.setOption("parseImgDimensions", true);
converter.setOption("simpleLineBreaks", true); converter.setOption("simpleLineBreaks", true);
/**
* @param {string[]} words
* @param {string} lang
* @param {string} w
* @returns {string}
*/
function getWord(words, lang, w) {
if (words[lang][w]) {
return words[lang][w];
}
return words.ko[w];
}
/** /**
* *
* @param {string[]} words * @param {string[]} words
...@@ -165,7 +109,7 @@ const getHead = (words, lang) => `<!DOCTYPE html> ...@@ -165,7 +109,7 @@ const getHead = (words, lang) => `<!DOCTYPE html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding"> <meta content="utf-8" http-equiv="encoding">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Rust, Programming, Learning"> <meta name="keywords" content="Rust, Programming, Learning">
<meta name="description" content="Rust tutorial website based on tour_of_rust"> <meta name="description" content="Rust tutorial website based on tour_of_rust">
<meta name="theme-color" content="#ff6801"/> <meta name="theme-color" content="#ff6801"/>
...@@ -196,7 +140,6 @@ const getHead = (words, lang) => `<!DOCTYPE html> ...@@ -196,7 +140,6 @@ const getHead = (words, lang) => `<!DOCTYPE html>
* @param {number} index * @param {number} index
* @param {boolean} isLast * @param {boolean} isLast
* @param {string[]} words * @param {string[]} words
* @param {boolean} isBeta
* @returns * @returns
*/ */
function template( function template(
...@@ -208,8 +151,7 @@ function template( ...@@ -208,8 +151,7 @@ function template(
source, source,
index, index,
isLast, isLast,
words, words
isBeta
) { ) {
return `${getHead(words, lang)} return `${getHead(words, lang)}
<body> <body>
...@@ -218,7 +160,6 @@ function template( ...@@ -218,7 +160,6 @@ function template(
<span class="title"><a href="${getFileName( <span class="title"><a href="${getFileName(
lang, lang,
0, 0,
isBeta,
lessonsData[0]?.chapter lessonsData[0]?.chapter
)}">${getWord(words, lang, "tor")}</a></span> )}">${getWord(words, lang, "tor")}</a></span>
<span class="nav"> <span class="nav">
...@@ -234,12 +175,9 @@ function template( ...@@ -234,12 +175,9 @@ function template(
<div class="bottomnav"> <div class="bottomnav">
${ ${
index !== 0 index !== 0
? `<span class="back"><a href="${ ? `<span class="back"><a href="${getFileName(
isBeta ? "beta_" : ""
}${getFileName(
lang, lang,
index - 1, index - 1,
isBeta,
lessonsData[index - 1]?.chapter lessonsData[index - 1]?.chapter
)}" rel="prev">❮ ${getWord( )}" rel="prev">❮ ${getWord(
words, words,
...@@ -251,12 +189,9 @@ function template( ...@@ -251,12 +189,9 @@ function template(
${ ${
isLast isLast
? "" ? ""
: `<span class="next"><a href="${ : `<span class="next"><a href="${getFileName(
isBeta ? "beta_" : ""
}${getFileName(
lang, lang,
index + 1, index + 1,
isBeta,
lessonsData[index + 1]?.chapter lessonsData[index + 1]?.chapter
)}" rel="next">${getWord( )}" rel="next">${getWord(
words, words,
...@@ -314,7 +249,7 @@ languages.forEach(lang => { ...@@ -314,7 +249,7 @@ languages.forEach(lang => {
}); });
langLessons.forEach((lesson, i) => { langLessons.forEach((lesson, i) => {
let fileName = getFileName(lang, i, false, lesson?.chapter); let fileName = getFileName(lang, i, lesson?.chapter);
if (i === 0 && lang === "ko") { if (i === 0 && lang === "ko") {
fileName = "index.html"; fileName = "index.html";
} }
...@@ -388,7 +323,7 @@ languages.forEach(lang => { ...@@ -388,7 +323,7 @@ languages.forEach(lang => {
if (x[lang] && x[lang].clone) { if (x[lang] && x[lang].clone) {
targetLang = x[lang].clone; targetLang = x[lang].clone;
} }
let s = `<li><a href="${getFileName(lang, i, false, x.chapter)}">${ let s = `<li><a href="${getFileName(lang, i, x.chapter)}">${
x[targetLang] x[targetLang]
? x[targetLang].title ? x[targetLang].title
: `[${getWord(words, targetLang, "untranslated")}] ${ : `[${getWord(words, targetLang, "untranslated")}] ${
...@@ -396,12 +331,7 @@ languages.forEach(lang => { ...@@ -396,12 +331,7 @@ languages.forEach(lang => {
}` }`
}</a></li>`; }</a></li>`;
if (x.chapter !== undefined) { if (x.chapter !== undefined) {
s = `</ul><h3><a href="${getFileName( s = `</ul><h3><a href="${getFileName(lang, i, x.chapter)}">${
lang,
i,
false,
x.chapter
)}">${
x[targetLang] x[targetLang]
? x[targetLang].title ? x[targetLang].title
: `[${getWord(words, targetLang, "untranslated")}] ${ : `[${getWord(words, targetLang, "untranslated")}] ${
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment