diff --git a/docs/en-US/install/citra.md b/docs/en-US/install/citra.md new file mode 100644 index 0000000..092db32 --- /dev/null +++ b/docs/en-US/install/citra.md @@ -0,0 +1,5 @@ +# Citra + +At the moment Citra does not support true online play, so it doesn't work with Pretendo. Moreover, it shows no sign of supporting true play in the future. + +Mikage, a 3DS emulator for mobile devices, may provide support in the future, though this is far from certain. diff --git a/public/assets/css/documentation.css b/public/assets/css/documentation.css index d62b808..6d1f85d 100644 --- a/public/assets/css/documentation.css +++ b/public/assets/css/documentation.css @@ -181,6 +181,39 @@ a.logo-link { border-radius: 4px 4px 0 0; } +.platform-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 24px; + margin-top: 36px; +} + +.platform-grid a { + text-decoration: none; + background: var(--bg-shade-3); + border-radius: 12px; + color: var(--text-shade-4); + display: grid; + grid-template-rows: auto fit-content(100%); + align-items: center; + justify-content: center; + text-align: center; + padding: 36px; + padding-bottom: 24px; + gap: 24px; +} + +.platform-grid a img { + width: 100%; + max-width: 216px; + height: auto; + max-height: 184px; +} +.platform-grid a span { + margin-top: auto; + font-size: 1.2rem; +} + /* @media screen and (max-width: 1080px) { .docs-wrapper .sidebar .section { diff --git a/public/assets/images/3ds.svg b/public/assets/images/3ds.svg new file mode 100644 index 0000000..0b33f84 --- /dev/null +++ b/public/assets/images/3ds.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/images/cemu.svg b/public/assets/images/cemu.svg new file mode 100644 index 0000000..5c6c4b9 --- /dev/null +++ b/public/assets/images/cemu.svg @@ -0,0 +1 @@ + diff --git a/public/assets/images/citra.svg b/public/assets/images/citra.svg new file mode 100644 index 0000000..99a3c9f --- /dev/null +++ b/public/assets/images/citra.svg @@ -0,0 +1 @@ + diff --git a/public/assets/images/wiiu-gamepad.svg b/public/assets/images/wiiu-gamepad.svg new file mode 100644 index 0000000..1456118 --- /dev/null +++ b/public/assets/images/wiiu-gamepad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/routes/docs.js b/src/routes/docs.js index 26502ae..770700b 100644 --- a/src/routes/docs.js +++ b/src/routes/docs.js @@ -26,40 +26,59 @@ router.get('/install', async (request, response) => { response.render('docs/install', renderData); }); -router.get('/:slug', async (request, response, next) => { - const renderData = { - currentPage: request.params.slug - }; +function getRawDocs(locale, subpath, pageName) { - // Get the name of the page from the URL - const pageName = request.params.slug; + const localePath = path.join(__dirname, '../../docs', locale, subpath, `${pageName}.md`); + const defaultPath = path.join(__dirname, '../../docs', 'en-US', subpath, `${pageName}.md`); - let markdownLocale = response.locals.localeString; - let missingInLocale = false; - // Check if the MD file exists in the user's locale, if not try en-US and show notice, or finally log error and show 404. - if (fs.existsSync(path.join('docs', markdownLocale, `${pageName}.md`))) { - null; - } else if (fs.existsSync(path.join('docs', 'en-US', `${pageName}.md`))) { - markdownLocale = 'en-US'; - missingInLocale = true; + if (fs.existsSync(localePath)) { + return { + content: parseDocs(fs.readFileSync(localePath, 'utf8')), + MDLocale: locale, + }; + } else if (fs.existsSync(defaultPath)) { + return { + content: parseDocs(fs.readFileSync(defaultPath, 'utf8')), + MDLocale: 'en-US' + }; } else { - next(); - return; + return { + content: null, + MDLocale: null + }; } - renderData.missingInLocale = missingInLocale; +} - let content; - // Get the markdown file corresponding to the page. - content = fs.readFileSync(path.join('docs', markdownLocale, `${pageName}.md`), 'utf-8'); +function parseDocs(rawDocs) { + if (rawDocs) { + let markedContent = marked(rawDocs); + markedContent = markedContent.replaceAll(/\[yt-iframe\]\(.{11}\)/g, (match) => { + const videoIDRegex = /(?<=\[yt-iframe\]\().*(?=\))/g; + const videoID = match.match(videoIDRegex)[0]; + return `
`; + }); - // Replace [yt-iframe](videoID) with the full '); + const htmlContent = marked.parse(markedContent); + return htmlContent; + } else { + return null; + } +} - // Convert the content into HTML - content = marked.parse(content); - renderData.content = content; +router.get('/:page', async (request, response, next) => { + const renderData = {}; + + const locale = response.locals.localeString; + const pageName = request.params.page; + renderData.currentPage = pageName; + + const { content, MDLocale } = getRawDocs(locale, '', pageName); + if (content) { + renderData.content = content; + } else { + return next(); + } + renderData.missingInLocale = locale !== MDLocale; // A boolean to show the quick links grid or not. if (pageName === 'welcome') { @@ -68,5 +87,23 @@ router.get('/:slug', async (request, response, next) => { response.render('docs/docs', renderData); }); +router.get('/:subpath/:page', async (request, response, next) => { + const renderData = {}; + + const locale = response.locals.localeString; + const pageName = request.params.page; + renderData.currentPage = pageName; + const subpath = request.params.subpath; + + const { content, MDLocale } = getRawDocs(locale, subpath, pageName); + if (content) { + renderData.content = content; + } else { + return next(); + } + renderData.missingInLocale = locale !== MDLocale; + + response.render('docs/docs', renderData); +}); module.exports = router; diff --git a/views/docs/install.handlebars b/views/docs/install.handlebars new file mode 100644 index 0000000..1022a77 --- /dev/null +++ b/views/docs/install.handlebars @@ -0,0 +1,65 @@ + + +
+ + + + + + + Pretendo + + + + + + {{> header}} + + {{> docs-sidebar}} + +
+
+

Installation

+

+ Please choose your platform below. +

+ +
+
+
+ + + + + diff --git a/views/partials/docs-sidebar.handlebars b/views/partials/docs-sidebar.handlebars index e6bd757..82b45ea 100644 --- a/views/partials/docs-sidebar.handlebars +++ b/views/partials/docs-sidebar.handlebars @@ -2,7 +2,7 @@
Getting started
Welcome - Installing Juxt + Install Pretendo Search
@@ -46,5 +46,4 @@ } selectSidebarElement(document.querySelector("div.sidebar a[href='/docs/{{currentPage}}']")); -