Shorten URL code even more

pull/8427/head
Puru Vijay 4 years ago
parent 84863ae3c5
commit dcd6f3926c

@ -32,7 +32,7 @@
slug: chapter.slug, slug: chapter.slug,
section, section,
chapter, chapter,
prev, prev
}; };
lookup.set(chapter.slug, obj); lookup.set(chapter.slug, obj);
@ -54,13 +54,13 @@
const clone = (file) => ({ const clone = (file) => ({
name: file.name.replace(/.\w+$/, ''), name: file.name.replace(/.\w+$/, ''),
type: file.type, type: file.type,
source: file.content, source: file.content
}); });
$: if (repl) { $: if (repl) {
completed = false; completed = false;
repl.set({ repl.set({
components: data.tutorial.initial.map(clone), components: data.tutorial.initial.map(clone)
}); });
} }
@ -68,13 +68,13 @@
function reset() { function reset() {
repl.update({ repl.update({
components: data.tutorial.initial.map(clone), components: data.tutorial.initial.map(clone)
}); });
} }
function complete() { function complete() {
repl.update({ repl.update({
components: data.tutorial.complete.map(clone), components: data.tutorial.complete.map(clone)
}); });
} }
@ -154,11 +154,14 @@
</div> </div>
<!-- HACK: To prerender all tutorial pages --> <!-- HACK: To prerender all tutorial pages -->
{#each data.tutorials_list as { tutorials }} <div style="display: none">
{#each data.tutorials_list as { tutorials }}
{#each tutorials as { slug }} {#each tutorials as { slug }}
<a style="display: none" href="/tutorial/{slug}">.</a> <!-- svelte-ignore a11y-missing-content -->
<a href="/tutorial/{slug}" />
{/each} {/each}
{/each} {/each}
</div>
<style> <style>
.tutorial-outer { .tutorial-outer {

Loading…
Cancel
Save