Skip to content

Commit

Permalink
Modèle de notebooks de correction exécutables (#304)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Nov 1, 2022
1 parent 4438433 commit a3eadd4
Show file tree
Hide file tree
Showing 10 changed files with 355 additions and 154 deletions.
38 changes: 35 additions & 3 deletions assets/scss/custom.scss
Expand Up @@ -87,6 +87,35 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
CUSTOM BOXES
--------------------*/

.alert.alert-info,
.alert.alert-success {
/* padding: 1px 0px; */
background-color: white;
}

/* Box heading color */
.alert-info > .alert-heading {
background-color: #e7f2fa;
}
.alert-success > .alert-heading {
background-color: #ecf8e8;
}

/* Text color */
.alert-success,
.alert-info {
color: rgba(0,0,0,.8);
}

/* Space after header */
.alert-success > .alert-heading {
margin-bottom: 15px !important;
}
.alert-info > .alert-heading {
margin-bottom: 15px !important;
}

.alert-success,
.box-exercise,
.box-warning,
.box-caution,
Expand All @@ -96,6 +125,7 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
.box-tip,
.box-important,
.box-note,
.alert-info,
.box-attention{
margin-top: 1em;
margin-bottom: 1em;
Expand Down Expand Up @@ -132,13 +162,13 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
.box-important {
border-left:.2rem solid #007bff80;
}
.box-note {
.alert-info {
border-left:.2rem solid #007bff80;
}
.box-attention {
border-left:.2rem solid #fd7e1480;
}
.box-exercise {
.alert-success {
border-left:.2rem solid #3fb618;
}

Expand All @@ -150,6 +180,7 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
.box-header-hint,
.box-header-tip,
.box-header-important,
.alert-heading,
.box-header-note,
.box-header-attention{
/*background-color:#fdf3f2;*/
Expand Down Expand Up @@ -205,7 +236,8 @@ https://github.com/jupyter/notebook/blob/9de5042e1058dc8aef7632f313e3e86c33390d3
background-color:#fdf3f2
}

.box h3{
.box h3,
.alert h3{
margin-top: 0rem;
font-weight:600;
font-size: 1.1rem;
Expand Down
11 changes: 8 additions & 3 deletions build/pimp_notebook.py
Expand Up @@ -46,6 +46,11 @@ def change_box_markdown(fl):
write_file(fl, tweak_md)

if __name__ == '__main__':
list_files = glob.glob("./content/course/**/index.qmd", recursive=True)
print(list_files)
[change_box_markdown(fl) for fl in list_files if not fl.endswith("_index.md")]
with open('diff') as f:
lines = f.read().splitlines()

list_files = [l for l in lines if l.endswith('.qmd')]

for fl in list_files:
if not fl.endswith("_index.md"):
change_box_markdown(fl)
30 changes: 30 additions & 0 deletions build/tweak_headers_quarto.py
@@ -0,0 +1,30 @@
import glob
import re


with open('diff') as f:
lines = f.read().splitlines()

list_files = [l for l in lines if l.endswith('.qmd')]

def clean_overwrite_file(fl):
with open(fl, 'r') as file_in:
text_in = file_in.readlines()

text_out = []
c = 0
for line in text_in:
# Delimit header
if "---" in line:
c += 1
if c < 2:
line = re.sub("echo:\s?false", "echo: true", line)
text_out.append(line)

with open(fl, 'w') as file_out:
file_out.writelines(text_out)


if __name__ == '__main__':
for fl in list_files:
clean_overwrite_file(fl)
2 changes: 1 addition & 1 deletion build/tweak_options_quarto.py
Expand Up @@ -21,4 +21,4 @@ def clean_overwrite_file(fl):
write_file(fl, content)

if __name__ == '__main__':
[clean_overwrite_file(fl) for fl in list_files]
[clean_overwrite_file(fl) for fl in list_files]

0 comments on commit a3eadd4

Please sign in to comment.