Skip to content

Commit a3eadd4

Browse files
avouacrgithub-actions[bot]linogaliana
authored
Modèle de notebooks de correction exécutables (#304)
* dev scripts * dev tools * dev tools * split questions and answers to make nb executable * dev tools * pimp notebooks only for new changes * fix function name * dev tools * test new correction * tweak parameters for correction only in headers * fix quarto project file * fix mistakes * revert gitignore * fix mistake * fix mistake * fix mistake * fix mistake * Automated changes * Automated changes * fix counter * essaie créer équivalence classes entre box * Automated changes * Automated changes * test heading * tweak again * Automated changes * Automated changes * change css * Automated changes * Automated changes * improve app * css * echo false * Automated changes * Automated changes * style * fontaxesome * Automated changes * Automated changes * corrige css Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: linogaliana <linogaliana@yahoo.fr>
1 parent 4438433 commit a3eadd4

File tree

10 files changed

+355
-154
lines changed

10 files changed

+355
-154
lines changed

assets/scss/custom.scss

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,35 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
8787
CUSTOM BOXES
8888
--------------------*/
8989

90+
.alert.alert-info,
91+
.alert.alert-success {
92+
/* padding: 1px 0px; */
93+
background-color: white;
94+
}
95+
96+
/* Box heading color */
97+
.alert-info > .alert-heading {
98+
background-color: #e7f2fa;
99+
}
100+
.alert-success > .alert-heading {
101+
background-color: #ecf8e8;
102+
}
103+
104+
/* Text color */
105+
.alert-success,
106+
.alert-info {
107+
color: rgba(0,0,0,.8);
108+
}
109+
110+
/* Space after header */
111+
.alert-success > .alert-heading {
112+
margin-bottom: 15px !important;
113+
}
114+
.alert-info > .alert-heading {
115+
margin-bottom: 15px !important;
116+
}
117+
118+
.alert-success,
90119
.box-exercise,
91120
.box-warning,
92121
.box-caution,
@@ -96,6 +125,7 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
96125
.box-tip,
97126
.box-important,
98127
.box-note,
128+
.alert-info,
99129
.box-attention{
100130
margin-top: 1em;
101131
margin-bottom: 1em;
@@ -132,13 +162,13 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
132162
.box-important {
133163
border-left:.2rem solid #007bff80;
134164
}
135-
.box-note {
165+
.alert-info {
136166
border-left:.2rem solid #007bff80;
137167
}
138168
.box-attention {
139169
border-left:.2rem solid #fd7e1480;
140170
}
141-
.box-exercise {
171+
.alert-success {
142172
border-left:.2rem solid #3fb618;
143173
}
144174

@@ -150,6 +180,7 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
150180
.box-header-hint,
151181
.box-header-tip,
152182
.box-header-important,
183+
.alert-heading,
153184
.box-header-note,
154185
.box-header-attention{
155186
/*background-color:#fdf3f2;*/
@@ -205,7 +236,8 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
205236
background-color:#fdf3f2
206237
}
207238

208-
.box h3{
239+
.box h3,
240+
.alert h3{
209241
margin-top: 0rem;
210242
font-weight:600;
211243
font-size: 1.1rem;

build/pimp_notebook.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ def change_box_markdown(fl):
4646
write_file(fl, tweak_md)
4747

4848
if __name__ == '__main__':
49-
list_files = glob.glob("./content/course/**/index.qmd", recursive=True)
50-
print(list_files)
51-
[change_box_markdown(fl) for fl in list_files if not fl.endswith("_index.md")]
49+
with open('diff') as f:
50+
lines = f.read().splitlines()
51+
52+
list_files = [l for l in lines if l.endswith('.qmd')]
53+
54+
for fl in list_files:
55+
if not fl.endswith("_index.md"):
56+
change_box_markdown(fl)

build/tweak_headers_quarto.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import glob
2+
import re
3+
4+
5+
with open('diff') as f:
6+
lines = f.read().splitlines()
7+
8+
list_files = [l for l in lines if l.endswith('.qmd')]
9+
10+
def clean_overwrite_file(fl):
11+
with open(fl, 'r') as file_in:
12+
text_in = file_in.readlines()
13+
14+
text_out = []
15+
c = 0
16+
for line in text_in:
17+
# Delimit header
18+
if "---" in line:
19+
c += 1
20+
if c < 2:
21+
line = re.sub("echo:\s?false", "echo: true", line)
22+
text_out.append(line)
23+
24+
with open(fl, 'w') as file_out:
25+
file_out.writelines(text_out)
26+
27+
28+
if __name__ == '__main__':
29+
for fl in list_files:
30+
clean_overwrite_file(fl)

build/tweak_options_quarto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def clean_overwrite_file(fl):
2121
write_file(fl, content)
2222

2323
if __name__ == '__main__':
24-
[clean_overwrite_file(fl) for fl in list_files]
24+
[clean_overwrite_file(fl) for fl in list_files]

0 commit comments

Comments
 (0)