Admin: fonction basique pour créer une séquence

This commit is contained in:
Bertrand Benjamin 2021-08-23 19:48:16 +02:00
parent d8bb8d25d2
commit 2ec83a4f1d
6 changed files with 104 additions and 15 deletions

View File

@ -21,6 +21,9 @@ update:
clean:
git clean -idx -e venv/ -e video/
sequence:
sh ./tools/scripts/new_sequence.sh
rsync_cleUSB: clean
rsync -rtv -u --del --exclude "venv" ./ $(COMMON_EXCLUDE) /run/media/lafrite/$(CLEUSB)/Enseignements
rsync -rtv -u $(COMMON_EXCLUDE) ../Divers/ /run/media/lafrite/$(CLEUSB)/Divers

View File

@ -0,0 +1,86 @@
#!/bin/bash
display_result() {
dialog --title "$1" \
--no-collapse \
--msgbox "$result" 0 0
}
exec 3>&1
date=$(dialog --calendar "Date" 0 0 2>&1 1>&3 | awk -F "/" '{print $3"-"$2"-"$1}')
exec 3>&-
exec 3>&1
selection=$(dialog \
--backtitle "Création d'une nouvelle séquence: Classe" \
--title "Menu" \
--clear \
--cancel-label "Exit" \
--menu "Choisir un niveau:" 0 0 4 \
"1" "2nd" \
"2" "Enseignements Scientifique" \
"3" "4e" \
"4" "Technologique" \
2>&1 1>&3)
exec 3>&-
case $selection in
1 )
tribe="2nd"
;;
2 )
tribe="EnseignementsScientifique"
;;
3 )
tribe="4e"
;;
4 )
tribe="Technologique"
;;
esac
exec 3>&1
cd $tribe
existing_seq=$(ls -d */)
nbr_seq=$(echo $existing_seq | wc -w)
next_seq_number=$(expr $nbr_seq + 1)
title=$(dialog \
--inputbox "Séquences trouvée\n${existing_seq/ /\n} \nNom de la nouvelle sequence (n°$next_seq_number)" \
0 0 \
2>&1 1>&3)
exec 3>&-
cd ..
exec 3>&1
summary=$(dialog \
--inputbox "Résumé de la séquence" \
0 0 \
2>&1 1>&3)
exec 3>&-
## ajouter les tags
exec 3>&1
tags=$(dialog \
--inputbox "Liste des tags séparés par une virgule" \
0 0 \
2>&1 1>&3)
exec 3>&-
sequence_path=$tribe/$(printf "%02d" $next_seq_number)_$title/
mkdir -p $sequence_path
export title=$title
export title_under=${title//?/#}
export author='Benjamin Bertrand'
export date=$date
export tribe=$tribe
export tags=$tags
export summary=$summary
envsubst < ./tools/skeleton/sequence/index.rst > $sequence_path/index.rst
envsubst < ./tools/skeleton/sequence/exercises.tex > $sequence_path/exercises.tex
envsubst < ./tools/skeleton/sequence/1E.tex > $sequence_path/1E.tex
envsubst < ./tools/skeleton/sequence/1B.tex > $sequence_path/1B.tex

View File

@ -1,9 +1,9 @@
\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}
\author{\Var{ author }}
\title{\Var{title} - Cours}
\date{\Var{date.strftime("%B %Y")}}
\author{${author}}
\title{${title} - Cours}
\date{${date}}
\pagestyle{empty}

View File

@ -1,9 +1,9 @@
\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}
\author{\Var{ author }}
\title{\Var{title} - Cours}
\date{\Var{date.strftime("%B %Y")}}
\author{${author}}
\title{${title} - Cours}
\date{${date}}
\DeclareExerciseCollection{banque}
\xsimsetup{

View File

@ -1,5 +1,5 @@
\collectexercises{banque}
\begin{exercise}[subtitle={<++>}, step={1}, origin={<++>}, topics={\Var{title}}, tags={\Var{tags}}]
\begin{exercise}[subtitle={<++>}, step={1}, origin={<++>}, topics={ ${title} }, tags={ ${tags} }]
<++>
\end{exercise}

View File

@ -1,12 +1,12 @@
{{ title }}
{{ title_under }}
${title}
${title_under}
:date: {{ date }}
:modified: {{ date }}
:authors: {{ author }}
:tags: {{ tags }}
:category: {{ tribe }}
:summary: {{ summary }}
:date: ${date}
:modified: ${date}
:authors: ${author}
:tags: ${tags}
:category: ${tribe}
:summary: ${summary}
Étape 1:
========