diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e35ea5bcbf449f09af1db9a1b9326eeab31d3db..211e35e9a35f6e4a6e4f9b2972da6cdabab1e5c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,16 +7,17 @@ stages: execute_ipynbs: stage: execute + before_script: + - pip install notedown script: - export PYTHONPATH=$PYTHONPATH:${PWD}/code - export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 MKL_DYNAMIC=FALSE - export DEST=generated/with_output - mkdir -p $DEST - - cp syllabus.ipynb $DEST + - cp syllabus.md $DEST - cp -r data $DEST - cp -r w[!e]*_* $DEST - - jupyter nbconvert --to notebook --inplace --config scripts/config_filter_smudge.py $DEST/syllabus.ipynb - - find $DEST/w* -name '*.ipynb' | parallel --delay 3 --jobs 32 scripts/nbconvert.sh + - find $DEST -name '*.md' | parallel --delay 3 --jobs 32 notedown -o --run --timeout -1 --match fenced - rm -rf $DEST/data artifacts: paths: diff --git a/docker/python3.yaml b/docker/python3.yaml index d6ee69330c2701c946335898b054fb2f99dda01d..558c561962f7ce7589c2ae68b30c9874ee3767ee 100644 --- a/docker/python3.yaml +++ b/docker/python3.yaml @@ -1,11 +1,10 @@ name: python3 channels: - - kwant - conda-forge dependencies: - python=3.6 - matplotlib=2.0.0 - - kwant=dev # Untill v1.3 is out + - kwant=1.3* # Untill v1.3 is out - scipy=0.18* - holoviews=1.7* - feedparser=5.2* @@ -13,3 +12,4 @@ dependencies: - pelican=3.7* - notebook - markdown + - notedown diff --git a/environment.yml b/environment.yml index 70662a69583df37916cf7eff829622c5bee1e2cb..937ddea223334a77d575e08a0640f8be27fbfc04 100644 --- a/environment.yml +++ b/environment.yml @@ -1,10 +1,9 @@ name: python3 channels: - - kwant - conda-forge dependencies: - python=3.6 - - kwant=dev # Untill v1.3 is out + - kwant=1.3* - holoviews=1.7* - sympy=1.0* - texlive-core diff --git a/scripts/activate_filters.sh b/scripts/activate_filters.sh deleted file mode 100644 index 9e0967004e81293522eea0083574f50972bada4e..0000000000000000000000000000000000000000 --- a/scripts/activate_filters.sh +++ /dev/null @@ -1 +0,0 @@ -git config filter.nb-filters.clean "./scripts/nb_filter_clean.sh" diff --git a/scripts/config_filter_clean.py b/scripts/config_filter_clean.py deleted file mode 100644 index 2e78a2a38b0a39bd8b94024d82e26adb46a519c4..0000000000000000000000000000000000000000 --- a/scripts/config_filter_clean.py +++ /dev/null @@ -1,4 +0,0 @@ -c.Exporter.preprocessors = ['scripts.preprocessors.RemoveVersionPreprocessor', - 'scripts.preprocessors.SetNamePreprocessor'] -c.ClearOutputPreprocessor['enabled'] = True -c.RemoveVersionPreprocessor['enabled'] = True diff --git a/scripts/config_filter_smudge.py b/scripts/config_filter_smudge.py deleted file mode 100644 index be840a9923282875c8f231bfaca92e3fed2f4f0e..0000000000000000000000000000000000000000 --- a/scripts/config_filter_smudge.py +++ /dev/null @@ -1,2 +0,0 @@ -c.Exporter.preprocessors = ['scripts.preprocessors.TrustPreprocessor'] -c.TrustPreprocessor['enabled'] = True diff --git a/scripts/converter.py b/scripts/converter.py index eee7ed0ea5979a5238b45c58db26eafd2537e1ad..11118cba12d954ba47073d9085cfba59d44c24b5 100755 --- a/scripts/converter.py +++ b/scripts/converter.py @@ -3,7 +3,7 @@ import argparse import datetime import io -from itertools import groupby +from itertools import dropwhile import os import re import tarfile @@ -12,7 +12,6 @@ from time import strptime from types import SimpleNamespace import shutil import subprocess -import sys import urllib.request from xml.etree.ElementTree import Element, SubElement from xml.etree import ElementTree @@ -21,7 +20,6 @@ from xml.dom import minidom import nbformat from nbformat import v4 as current from nbconvert import HTMLExporter -from nbconvert.filters.markdown import markdown2html_pandoc from traitlets.config import Config try: @@ -32,25 +30,32 @@ except KeyError: scripts_path = os.path.dirname(os.path.realpath(__file__)) mooc_folder = os.path.join(scripts_path, os.pardir) -cfg = Config({'HTMLExporter': {'template_file': 'edx', - 'template_path': ['.', scripts_path], - 'filters': {'markdown2html': - markdown2html_pandoc}}}) +cfg = Config({ + 'HTMLExporter': { + 'template_file': 'edx', + 'template_path': ['.', scripts_path], + 'exclude_input': True, + } +}) exportHtml = HTMLExporter(config=cfg) -url = "https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.14/iframeResizer.min.js" +url = ( + "https://cdnjs.cloudflare.com/ajax/libs" + "/iframe-resizer/3.5.14/iframeResizer.min.js" +) response = urllib.request.urlopen(url) js = response.read().decode('utf-8') IFRAME_TEMPLATE = r""" -