Skip to content

Commit

Permalink
Pas mal de changements internes.
Browse files Browse the repository at this point in the history
- Utilisation de modules séparés pour le téléchargement, la génération et la transformation des contenus.
- Amélioration de la compilation et du cache.
- Ajout d'images pour chacun des cours.
  • Loading branch information
Skyost committed Dec 12, 2023
1 parent 18ef77e commit d78a831
Show file tree
Hide file tree
Showing 98 changed files with 5,205 additions and 3,191 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
node: [ 20 ]
node: [ latest ]
steps:
- name: Checkout 🛎
uses: actions/checkout@v3
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,3 @@ sw.*
*.run.xml
.output
content/
!components/content/
public/images/lessons/
public/pdf/
static/CNAME
latex/
tikz-images/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fichier `site/authentication.ts`. Indiquez votre `Client ID` dans le champ `clie
Pour modifier le contenu de la page d'accueil, il faut éditer le fichier `pages/index.vue`.
Une façon plus rapide (et intuitive...) de modifier les pages sera sûrement ajoutée à l'avenir.

Vous pouvez également modifier certains paramètres dans le fichier `site/content-generator.js`, ceci vous permettra
Vous pouvez également modifier la plupart des paramètres dans le fichier `site/content.js`. Ceci vous permettra
de personnaliser les fichiers à compiler en PDF, à transformer en markdown, où se situent les images, etc.
Le fichier `site/levels.ts` contient les différents niveaux disponibles. Chacun d'eux doit posséder un sous-dossier
dans votre répertoire LaTeX.
Expand Down
6 changes: 5 additions & 1 deletion components/ErrorDisplay.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script setup lang="ts">
const props = defineProps<{ error: any }>()
const props = defineProps<{
error: any,
changeTitle?: boolean
}>()
const errorCode = computed(() => {
if (/^-?\d+$/.test(props.error.toString())) {
Expand All @@ -24,6 +27,7 @@ const title = computed(() => {

<template>
<div>
<Title v-if="changeTitle">{{ title }}</Title>
<h1 v-text="title" />
<p>
Vous pouvez continuer votre navigation en allant sur <a href="javascript:history.back()">la page précédente</a> ou
Expand Down
104 changes: 83 additions & 21 deletions components/MathDocument.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
<script setup lang="ts">
import html2canvas from 'html2canvas'
import { LessonContent } from '~/types'
withDefaults(defineProps<{
document: LessonContent,
title: string,
body: string,
color?: string
}>(), {
color: 'red'
})
const root = ref<HTMLElement | null>(null)
const setupTimeout = ref<ReturnType<typeof setTimeout> | null>(null)
const initialDotsTimeout = ref<ReturnType<typeof setTimeout> | null>(null)
const route = useRoute()
const setupDocument = () => {
const tables = root.value!.querySelectorAll<HTMLElement>('table')
for (const table of tables) {
table.classList.add('table', 'table-bordered', 'table-hover')
const parent = table.parentNode
const wrapper = document.createElement('div')
wrapper.classList.add('table-responsive')
parent!.replaceChild(wrapper, table)
wrapper.appendChild(table)
}
const dotLines = root.value!.querySelectorAll<HTMLElement>('.dots')
for (const dotLine of dotLines) {
const parent = dotLine.parentElement
Expand Down Expand Up @@ -76,8 +84,6 @@ const setupDocument = () => {
if (scrollCollapse) {
scrollCollapse.scrollIntoView(true)
}
setupTimeout.value = null
}
const resizeDotLines = () => {
Expand All @@ -95,35 +101,26 @@ const resizeDotLines = () => {
dotLine.innerHTML = dotLine.innerHTML.substring(0, Math.max(0, dotLine.innerHTML.length - 2))
}
}
initialDotsTimeout.value = null
}
onMounted(async () => {
await nextTick()
setupTimeout.value = setTimeout(setupDocument, 1000)
initialDotsTimeout.value = setTimeout(resizeDotLines, 1000)
setupDocument()
resizeDotLines()
window.addEventListener('load', resizeDotLines)
window.addEventListener('resize', resizeDotLines)
})
onUnmounted(() => {
if (setupTimeout.value) {
clearTimeout(setupTimeout.value)
setupTimeout.value = null
}
if (initialDotsTimeout.value) {
clearTimeout(initialDotsTimeout.value)
initialDotsTimeout.value = null
}
window.removeEventListener('load', resizeDotLines)
window.removeEventListener('resize', resizeDotLines)
})
</script>

<template>
<div ref="root" class="math-document" :class="color">
<h1 v-html="document.name" />
<content-renderer class="math-document-content" :value="document" />
<h1 v-html="title" />
<div class="math-document-content" v-html="body" />
</div>
</template>

Expand Down Expand Up @@ -187,6 +184,46 @@ onUnmounted(() => {
display: none;
}
h2 {
color: #1c567d;
padding-bottom: 0.2em;
margin-bottom: 0.75em;
counter-increment: headline-2;
counter-reset: headline-3;
&::before {
content: counter(headline-2, upper-roman) ' - ';
}
}
h3 {
color: #2980b9;
border-bottom: 1px solid #d7d7d7;
margin-bottom: 0.75em;
counter-increment: headline-3;
&::before {
content: counter(headline-3) '. ';
}
}
h4 {
border-bottom: none !important;
margin-bottom: 0 !important;
}
img {
max-width: 100%;
}
.table {
background-color: white;
td {
height: 2.5em;
}
}
.button-exercice {
font-size: 0.8em;
margin-top: calc(-1.6em - 1.5rem);
Expand Down Expand Up @@ -241,9 +278,34 @@ onUnmounted(() => {
}
}
ol,
ul {
ol, ul {
padding-left: 1.5rem;
margin-bottom: 1rem;
li {
padding-left: 1rem;
&::marker {
font-weight: bold;
}
:last-child {
margin-bottom: 0;
}
}
}
ol > li > ol {
list-style-type: lower-alpha;
}
ul li {
list-style-type: '';
&:last-child,
&:last-child > p {
margin-bottom: 0;
}
}
.center {
Expand Down
23 changes: 0 additions & 23 deletions components/content/ProseH2.vue

This file was deleted.

22 changes: 0 additions & 22 deletions components/content/ProseH3.vue

This file was deleted.

16 changes: 0 additions & 16 deletions components/content/ProseH4.vue

This file was deleted.

30 changes: 0 additions & 30 deletions components/content/ProseImg.vue

This file was deleted.

23 changes: 0 additions & 23 deletions components/content/ProseOl.vue

This file was deleted.

17 changes: 0 additions & 17 deletions components/content/ProseTable.vue

This file was deleted.

25 changes: 0 additions & 25 deletions components/content/ProseUl.vue

This file was deleted.

Loading

0 comments on commit d78a831

Please sign in to comment.