#!/usr/bin/env python

# convert ./docs_src nbs into html under ./docs

# build/rebuild modified nbs:
# tools/build-docs
#
# force rebuild all nbs:
# tools/build-docs -f

from fastai.gen_doc.nbdoc import *
from fastai.gen_doc.convert2html import *

import argparse, os
from pathlib import Path

parser = argparse.ArgumentParser(description="Build fastai docs from ipynb files")
parser.add_argument('-f', '--force_all', action="store_true", help="force all to be rebuilt")
args = parser.parse_args()

if Path.cwd().name != 'docs_src': os.chdir('docs_src')

path_in  = Path('.')
path_out = path_in/".."/"docs"

convert_all(path_in, path_out, args.force_all)
