alan-turing-institute / bio-Turing-Way

Experimenting with JupyterBooks, Sphinx, and training materials for biomed/life sciences from the Turing Way.
https://the-turing-way-personas.netlify.app/welcome
Other
4 stars 5 forks source link

istenson/issue-12 #16

Closed Iain-S closed 3 years ago

Iain-S commented 3 years ago

There is a bug (closes #12) where large directories could be generated if you ran main.py multiple times. To fix this, and to remove the need to call jupyter-book build mybook/ before calling main.py build mybook/ we have changed to this order of operations:

  1. call jupyter-book clean mybook/ to empty mybook/_build.
  2. build all of the new additions
    1. copy mybook/ to mybook_profile-name/
    2. jupyter-book build mybook_profile-name/
    3. copy mybook_profile-name/_build/html to mybook/_build/html/editions (making that folder if it doesn't already exist)
  3. build the main book with jupyter-book build mybook/

This PR also contains the .pre-commit.yml config file for Git pre-commit checks (also executed as a CI job).

Iain-S commented 3 years ago

Suggestion from this afternoon (changes to be made in this branch):

  1. call jupyter-book clean mybook/ to empty mybook/_build.
  2. generate the new _tocs (where _tocs is a List[Dict])
  3. [optional] call insert_cards('/path/to/welcome.md', _tocs)
  4. for each new addition:
    1. copy mybook/ to mybook_profile-name/
    2. overwrite mybook_profile-name/_toc.yml
    3. overwrite mybook_profile-name/_config.yml
    4. jupyter-book build mybook_profile-name/
  5. build the main book with jupyter-book build mybook/ and mkdir(mybook/_build/html/editions)
  6. for each new addition:
    1. copy mybook_profile-name/_build/html to mybook/_build/html/editions
    2. remove mybook_profile-name/