Commit 417a08a3 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

Cleaning

parent 99c2d36c
......@@ -4,7 +4,7 @@ Build a small website to host Jupyter notebooks as course chapters
import argparse
from .nbcourse import NbCourse, DEFAULT_CONFIG_FILE
from .quickstart import init
from .quickstart import initialize
from pathlib import Path
......@@ -20,7 +20,7 @@ def main():
help='initiate a nbcourse directory')
args = parser.parse_args()
if args.course_title:
init(args.course_title)
initialize(args.course_title)
else:
course = NbCourse(args.config)
if args.book:
......
......@@ -156,18 +156,22 @@ class NbCourse:
"""
with open(config_file, 'r') as f:
config = yaml.safe_load(f)
config['configpath'] = Path(os.path.dirname(os.path.abspath(config_file)))
config['configpath'] = Path(os.path.dirname(
os.path.abspath(config_file)))
return config
def build_pages(self):
"""Build a mini website using html templating and markdown conversion"""
"""
Build a mini website using html templating and markdown conversion
"""
# Render homepage
homepage = HomePage('index.html')
homepage.render(self.config)
# Render markdown pages
manual = MarkdownPage('manual.html', title='Notice', src='pages/manual.md',
parent=homepage)
manual = MarkdownPage('manual.html', title='Notice',
src='pages/manual.md',
parent=homepage)
anaconda = MarkdownPage('anaconda.html', title='Anaconda',
src='pages/anaconda.md', parent=manual)
anaconda.render(self.config)
......
......@@ -3,11 +3,12 @@ from distutils.dir_util import copy_tree
from pathlib import Path
SKEL_DIR = Path(os.path.dirname(os.path.abspath(__file__))) / Path("../skeleton")
SKEL_PATH = Path(os.path.dirname(os.path.abspath(__file__))) / \
Path("../skeleton")
def init(course_title):
copy_tree(SKEL_DIR, os.getcwd())
def initialize(course_title):
copy_tree(SKEL_PATH, os.getcwd())
makefile_inc = """\
course_title = {}
config_file = nbcourse.yml
......@@ -16,4 +17,4 @@ output_dir = build
theme_dir = theme/default
""".format(course_title)
with open("Makefile.inc", 'w') as f:
f.write(makefile_inc)
\ No newline at end of file
f.write(makefile_inc)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment