10 |
--------------------------------------------------------------------------------
/_action_files/action.yml:
--------------------------------------------------------------------------------
1 | name: 'fastpages: An easy to use blogging platform with support for Jupyter Notebooks.'
2 | description: Converts Jupyter notebooks and Word docs into Jekyll blog posts.
3 | author: Hamel Husain
4 | inputs:
5 | BOOL_SAVE_MARKDOWN:
6 | description: Either 'true' or 'false'. Whether or not to commit converted markdown files from notebooks and word documents into the _posts directory in your repo. This is useful for debugging.
7 | required: false
8 | default: false
9 | SSH_DEPLOY_KEY:
10 | description: a ssh deploy key is required if BOOL_SAVE_MARKDOWN = 'true'
11 | required: false
12 | branding:
13 | color: 'blue'
14 | icon: 'book'
15 | runs:
16 | using: 'docker'
17 | image: 'Dockerfile'
18 |
--------------------------------------------------------------------------------
/_pages/search.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | permalink: /search/
4 | title: Search
5 | search_exclude: true
6 | ---
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/_action_files/fastpages.tpl:
--------------------------------------------------------------------------------
1 | {%- extends 'hide.tpl' -%}
2 | {%- block body -%}
3 | {%- set internals = ["metadata", "output_extension", "inlining",
4 | "raw_mimetypes", "global_content_filter"] -%}
5 | ---
6 | {%- for k in resources |reject("in", internals) %}
7 | {% if k == "summary" and "description" not in resources %}description{% else %}{{ k }}{% endif %}: {{ resources[k] }}
8 | {%- endfor %}
9 | layout: notebook
10 | ---
11 |
12 |
18 |
19 |
20 | {{ super() }}
21 |
22 | {%- endblock body %}
--------------------------------------------------------------------------------
/_notebooks/README.md:
--------------------------------------------------------------------------------
1 | # Auto-convert Jupyter Notebooks To Posts
2 |
3 | [`fastpages`](https://github.com/fastai/fastpages) will automatically convert [Jupyter](https://jupyter.org/) Notebooks saved into this directory as blog posts!
4 |
5 | You must save your notebook with the naming convention `YYYY-MM-DD-*.ipynb`. Examples of valid filenames are:
6 |
7 | ```shell
8 | 2020-01-28-My-First-Post.ipynb
9 | 2012-09-12-how-to-write-a-blog.ipynb
10 | ```
11 |
12 | If you fail to name your file correctly, `fastpages` will automatically attempt to fix the problem by prepending the last modified date of your notebook. However, it is recommended that you name your files properly yourself for more transparency.
13 |
14 | See [Writing Blog Posts With Jupyter](https://github.com/fastai/fastpages#writing-blog-posts-with-jupyter) for more details.
--------------------------------------------------------------------------------
/_includes/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 | services:
3 | fastpages: &fastpages
4 | working_dir: /data
5 | environment:
6 | - INPUT_BOOL_SAVE_MARKDOWN=false
7 | build:
8 | context: ./_action_files
9 | dockerfile: ./Dockerfile
10 | image: fastpages-dev
11 | logging:
12 | driver: json-file
13 | options:
14 | max-size: 50m
15 | stdin_open: true
16 | tty: true
17 | volumes:
18 | - .:/data/
19 |
20 | converter:
21 | <<: *fastpages
22 | command: /fastpages/action_entrypoint.sh
23 |
24 | watcher:
25 | <<: *fastpages
26 | command: watchmedo shell-command --command /fastpages/action_entrypoint.sh --pattern *.ipynb --recursive --drop
27 |
28 | jekyll:
29 | working_dir: /data
30 | image: hamelsmu/fastpages-jekyll
31 | restart: unless-stopped
32 | ports:
33 | - "4000:4000"
34 | volumes:
35 | - .:/data/
36 | command: >
37 | bash -c "gem install bundler
38 | && jekyll serve --trace"
39 |
40 |
--------------------------------------------------------------------------------
/_action_files/nb2post.py:
--------------------------------------------------------------------------------
1 | """Converts Jupyter Notebooks to Jekyll compliant blog posts"""
2 | from datetime import datetime
3 | import re, os, logging
4 | from nbdev import export2html
5 | from nbdev.export2html import Config, Path, _re_digits, _to_html, _re_block_notes
6 | from fast_template import rename_for_jekyll
7 |
8 | warnings = set()
9 |
10 | # Modify the naming process such that destination files get named properly for Jekyll _posts
11 | def _nb2htmlfname(nb_path, dest=None):
12 | fname = rename_for_jekyll(nb_path, warnings=warnings)
13 | if dest is None: dest = Config().doc_path
14 | return Path(dest)/fname
15 |
16 | # TODO: Open a GitHub Issue in addition to printing warnings
17 | for original, new in warnings:
18 | print(f'{original} has been renamed to {new} to be complaint with Jekyll naming conventions.\n')
19 |
20 | ## apply monkey patches
21 | export2html._nb2htmlfname = _nb2htmlfname
22 | export2html.notebook2html(fname='_notebooks/*.ipynb', dest='_posts/', template_file='/fastpages/fastpages.tpl')
23 |
--------------------------------------------------------------------------------
/_action_files/pr_comment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Make a comment on a PR.
4 | # Usage:
5 | # > pr_comment.sh <>
6 |
7 | set -e
8 |
9 | # This is populated by our secret from the Workflow file.
10 | if [[ -z "${GITHUB_TOKEN}" ]]; then
11 | echo "Set the GITHUB_TOKEN env variable."
12 | exit 1
13 | fi
14 |
15 | if [[ -z "${ISSUE_NUMBER}" ]]; then
16 | echo "Set the ISSUE_NUMBER env variable."
17 | exit 1
18 | fi
19 |
20 | if [ -z "$1" ]
21 | then
22 | echo "No MESSAGE argument supplied. Usage: issue_comment.sh "
23 | exit 1
24 | fi
25 |
26 | MESSAGE=$1
27 |
28 | ## Set Vars
29 | URI=https://api.github.com
30 | API_VERSION=v3
31 | API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
32 | AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
33 |
34 | # Create a comment with APIv3 # POST /repos/:owner/:repo/issues/:issue_number/comments
35 | curl -XPOST -sSL \
36 | -d "{\"body\": \"$MESSAGE\"}" \
37 | -H "${AUTH_HEADER}" \
38 | -H "${API_HEADER}" \
39 | "${URI}/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments"
40 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | search_exclude: true
4 | ---
5 |
6 | > Tools for teaching in apocalyptic times - the learning remains to be evaluated!
7 |
8 | This is a blog of **esoteric teaching and learning tools** that may be of useful when moving to fully online delivery during the #covid19 lockdown.
9 |
10 | * The recommended tools are not for all disciplines.
11 | * The initial focus will be on programming, data science and maths related areas with a bit of collaborative knowledge sharing, branching scenario/problem based learning and problem solving thrown in.
12 | * Each blog post will cover a new tool.
13 | * Comments/suggestions for each tool or additional tools are welcome.
14 | * No mainstream tools will be included. Enough information is available on tools like Zoom and Skype. There is a broad assumption that a range of different tools are required to create engaging courseware - not just videos and quizzes.
15 |
16 |
17 | This site is built with [fastpages](https://github.com/fastai/fastpages), an easy to use blogging platform with extra features for Jupyter Notebooks.
18 |
19 | # Posts
20 |
--------------------------------------------------------------------------------
/_pages/tags.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: categories
3 | permalink: /categories/
4 | title: Tags
5 | search_exclude: true
6 | ---
7 |
8 |
Contents
9 |
10 | {% if site.categories.size > 0 %}
11 |
12 | {% for category in site.categories %}
13 | {% capture category_name %}{{ category | first }}{% endcapture %}
14 |
36 | {%- else -%}
37 | {{ super() }}
38 | {%- endif -%}
39 | {% endblock output_area_prompt %}
--------------------------------------------------------------------------------
/_posts/2020-03-17- codetour.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: Annotate code and files to explain programming code instead of recording a video.
5 | categories: [Content Authoring, Tutorials]
6 | tags: [Programming, Data Science]
7 | title: CodeTour - A VS Code extension for code walkthroughs
8 | comments: true
9 | ---
10 | # CodeTour - A VS Code extension for code walkthroughs
11 |
12 | Need to explain programming code or introduce students to a new code repository starting point for a programming assignment? Don’t record a video! CodeTour is a Visual Studio Code extension, which allows you to record and playback guided walkthroughs of software code.
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Author Walkthroughs
18 |
19 | Annotate files and lines of code. Even markdown can be included
20 |
21 | - Playback Walkthroughs
22 |
23 | Steps presented interactively with navigation
24 |
25 | - Store walkthrough files in the code base
26 |
27 | Walkthroughs are stored as text files and easily committed to the code repository.
28 |
29 | ## To get started:
30 | 1. Install [CodeTour VS Code extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour).
31 | 1. Follow [instructions for recording and playback](https://github.com/vsls-contrib/codetour) of the CodeTour.
32 |
--------------------------------------------------------------------------------
/_fastpages_docs/_upgrade_pr.md:
--------------------------------------------------------------------------------
1 | Hello :wave: @{_username_}!
2 |
3 | This PR pulls the most recent files from [fastpages](https://github.com/fastai/fastpages), and attempts to replace relevant files in your repository, without changing the content of your blog posts. This allows you to receive bug fixes and feature updates.
4 |
5 | ## Warning
6 |
7 | If you have applied **customizations to the HTML or styling of your site, they may be lost if you merge this PR. Please review the changes this PR makes carefully before merging!.** However, for people who only write content and don't change the styling of their site, this method is recommended.
8 |
9 | If you would like more fine-grained control over what changes to accept or decline, consider [following this approach](https://stackoverflow.com/questions/56577184/github-pull-changes-from-a-template-repository/56577320) instead.
10 |
11 | ### What to Expect After Merging This PR
12 |
13 | - GitHub Actions will build your site, which will take 3-4 minutes to complete. **This will happen anytime you push changes to the master branch of your repository.** You can monitor the logs of this if you like on the [Actions tab of your repo](https://github.com/{_username_}/{_repo_name_}/actions).
14 | - You can monitor the status of your site in the GitHub Pages section of your [repository settings](https://github.com/{_username_}/{_repo_name_}/settings).
15 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yaml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - master # need to filter here so we only deploy when there is a push to master
6 | # no filters on pull requests, so intentionally left blank
7 | pull_request:
8 |
9 | jobs:
10 | build-site:
11 | if: ( github.event.commits[0].message != 'Initial commit' ) || github.run_number > 1
12 | runs-on: ubuntu-latest
13 | steps:
14 |
15 | - name: Copy Repository Contents
16 | uses: actions/checkout@master
17 | with:
18 | persist-credentials: false
19 |
20 | - name: convert notebooks and word docs to posts
21 | uses: ./_action_files
22 |
23 | - name: setup directories for Jekyll build
24 | run: |
25 | rm -rf _site
26 | sudo chmod -R 777 .
27 |
28 | - name: Jekyll build
29 | uses: docker://hamelsmu/fastpages-jekyll
30 | with:
31 | args: bash -c "gem install bundler && jekyll build -V"
32 | env:
33 | JEKYLL_ENV: 'production'
34 |
35 | - name: copy CNAME file into _site if CNAME exists
36 | run: |
37 | sudo chmod -R 777 _site/
38 | cp CNAME _site/ 2>/dev/null || :
39 |
40 | - name: Deploy
41 | if: github.event_name == 'push'
42 | uses: peaceiris/actions-gh-pages@v3
43 | with:
44 | deploy_key: ${{ secrets.SSH_DEPLOY_KEY }}
45 | publish_dir: ./_site
46 |
--------------------------------------------------------------------------------
/_fastpages_docs/NOTEBOOK_FOOTNOTES.md:
--------------------------------------------------------------------------------
1 | # Detailed Guide To Footnotes in Notebooks
2 |
3 | Notebook -> HTML Footnotes don't work the same as Markdown. There isn't a good solution, so made these Jekyll plugins as a workaround
4 |
5 | ```
6 | This adds a linked superscript {% fn 15 %}
7 |
8 | {{ "This is the actual footnote" | fndetail: 15 }}
9 | ```
10 |
11 | 
12 |
13 | You can have links, but then you have to use **single quotes** to escape the link.
14 | ```
15 | This adds a linked superscript {% fn 20 %}
16 |
17 | {{ 'This is the actual footnote with a [link](www.github.com) as well!' | fndetail: 20 }}
18 | ```
19 | 
20 |
21 | However, what if you want a single quote in your footnote? There is not an easy way to escape that. Fortunately, you can use the special HTML character `'` (you must keep the semicolon!). For example, you can include a single quote like this:
22 |
23 |
24 | ```
25 | This adds a linked superscript {% fn 20 %}
26 |
27 | {{ 'This is the actual footnote; with a [link](www.github.com) as well! and a single quote ' too!' | fndetail: 20 }}
28 | ```
29 |
30 | 
31 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 | # Hello! This is where you manage which Jekyll version is used to run.
3 | # When you want to use a different version, change it below, save the
4 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
5 | #
6 | # bundle exec jekyll serve
7 | #
8 | # This will help ensure the proper Jekyll version is running.
9 | # Happy Jekylling!
10 | gem "jekyll", "~> 4.0.0"
11 | # This is the default theme for new Jekyll sites. You may change this to anything you like.
12 | gem "minima"
13 | # To upgrade, run `bundle update github-pages`.
14 | # gem "github-pages", group: :jekyll_plugins
15 | # If you have any plugins, put them here!
16 | group :jekyll_plugins do
17 | gem "jekyll-feed", "~> 0.12"
18 | gem 'jekyll-octicons'
19 | gem 'jekyll-remote-theme'
20 | gem "jekyll-twitter-plugin"
21 | gem 'jekyll-relative-links'
22 | gem 'jekyll-seo-tag'
23 | gem 'jekyll-toc'
24 | gem 'jekyll-gist'
25 | gem 'jekyll-paginate'
26 | end
27 |
28 | gem "kramdown-math-katex"
29 |
30 | # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
31 | # and associated library.
32 | install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
33 | gem "tzinfo", "~> 1.2"
34 | gem "tzinfo-data"
35 | end
36 |
37 | # Performance-booster for watching directories on Windows
38 | gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
39 |
40 | gem "faraday", "< 1.0"
41 |
42 |
--------------------------------------------------------------------------------
/_action_files/fast_template.py:
--------------------------------------------------------------------------------
1 | from datetime import datetime
2 | import re, os
3 | from pathlib import Path
4 | from typing import Tuple, Set
5 |
6 | # Check for YYYY-MM-DD
7 | _re_blog_date = re.compile(r'([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])-)')
8 | # Check for leading dashses or numbers
9 | _re_numdash = re.compile(r'(^[-\d]+)')
10 |
11 | def rename_for_jekyll(nb_path: Path, warnings: Set[Tuple[str, str]]=None) -> str:
12 | """
13 | Return a Path's filename string appended with its modified time in YYYY-MM-DD format.
14 | """
15 | assert nb_path.exists(), f'{nb_path} could not be found.'
16 |
17 | # Checks if filename is compliant with Jekyll blog posts
18 | if _re_blog_date.match(nb_path.name): return nb_path.with_suffix('.md').name.replace(' ', '-')
19 |
20 | else:
21 | clean_name = _re_numdash.sub('', nb_path.with_suffix('.md').name).replace(' ', '-')
22 |
23 | # Gets the file's last modified time and and append YYYY-MM-DD- to the beginning of the filename
24 | mdate = os.path.getmtime(nb_path) - 86400 # subtract one day b/c dates in the future break Jekyll
25 | dtnm = datetime.fromtimestamp(mdate).strftime("%Y-%m-%d-") + clean_name
26 | assert _re_blog_date.match(dtnm), f'{dtnm} is not a valid name, filename must be pre-pended with YYYY-MM-DD-'
27 | # push this into a set b/c _nb2htmlfname gets called multiple times per conversion
28 | if warnings: warnings.add((nb_path, dtnm))
29 | return dtnm
30 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | help:
2 | cat Makefile
3 |
4 | # start (or restart) the services
5 | server: .FORCE
6 | docker-compose down --remove-orphans || true;
7 | docker-compose up
8 |
9 | # start (or restart) the services in detached mode
10 | server-detached: .FORCE
11 | docker-compose down || true;
12 | docker-compose up -d
13 |
14 | # build or rebuild the services WITHOUT cache
15 | build: .FORCE
16 | docker-compose stop || true; docker-compose rm || true;
17 | docker build -t hamelsmu/fastpages-jekyll -f _action_files/fastpages-jekyll.Dockerfile .
18 | docker-compose build --force-rm --no-cache
19 |
20 | # rebuild the services WITH cache
21 | quick-build: .FORCE
22 | docker-compose stop || true;
23 | docker build -t hamelsmu/fastpages-jekyll -f _action_files/fastpages-jekyll.Dockerfile .
24 | docker-compose build
25 |
26 | # convert word & nb without Jekyll services
27 | convert: .FORCE
28 | docker-compose up converter
29 |
30 | # stop all containers
31 | stop: .FORCE
32 | docker-compose stop
33 |
34 | # remove all containers
35 | remove: .FORCE
36 | docker-compose stop || true; docker-compose rm || true;
37 |
38 | # get shell inside the notebook converter service (Must already be running)
39 | bash-nb: .FORCE
40 | docker-compose exec watcher /bin/bash
41 |
42 | # get shell inside jekyll service (Must already be running)
43 | bash-jekyll: .FORCE
44 | docker-compose exec jekyll /bin/bash
45 |
46 | # restart just the Jekyll server
47 | restart-jekyll: .FORCE
48 | docker-compose restart jekyll
49 |
50 | .FORCE:
--------------------------------------------------------------------------------
/_action_files/word2post.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This sets the environment variable when testing locally and not in a GitHub Action
4 | if [ -z "$GITHUB_ACTIONS" ]; then
5 | GITHUB_WORKSPACE='/data'
6 | echo "=== Running Locally: All assets expected to be in the directory /data ==="
7 | fi
8 |
9 | # Loops through directory of *.docx files and converts to markdown
10 | # markdown files are saved in _posts, media assets are saved in assets/img//media
11 | for FILENAME in ${GITHUB_WORKSPACE}/_word/*.docx; do
12 | [ -e "$FILENAME" ] || continue # skip when glob doesn't match
13 | NAME=${FILENAME##*/} # Get filename without the directory
14 | NEW_NAME=`python3 "/fastpages/word2post.py" "${FILENAME}"` # clean filename to be Jekyll compliant for posts
15 | BASE_NEW_NAME=${NEW_NAME%.md} # Strip the file extension
16 |
17 | if [ -z "$NEW_NAME" ]; then
18 | echo "Unable To Rename: ${FILENAME} to a Jekyll complaint filename for blog posts"
19 | exit 1
20 | fi
21 |
22 | echo "Converting: ${NAME} ---to--- ${NEW_NAME}"
23 | cd ${GITHUB_WORKSPACE}
24 | pandoc --from docx --to gfm --output "${GITHUB_WORKSPACE}/_posts/${NEW_NAME}" --columns 9999 \
25 | --extract-media="assets/img/${BASE_NEW_NAME}" --standalone "${FILENAME}"
26 |
27 | # Inject correction to image links in markdown
28 | sed -i.bak 's/!\[\](assets/!\[\]({{ site.url }}{{ site.baseurl }}\/assets/g' "_posts/${NEW_NAME}"
29 | # Remove intermediate files
30 | rm _posts/*.bak
31 | done
32 |
--------------------------------------------------------------------------------
/_action_files/settings.ini:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | lib_name = nbdev
3 | user = fastai
4 | branch = master
5 | version = 0.2.10
6 | description = Writing a library entirely in notebooks
7 | keywords = jupyter notebook
8 | author = Sylvain Gugger and Jeremy Howard
9 | author_email = info@fast.ai
10 | baseurl = /esoteric-teaching-tools
11 | title = nbdev
12 | copyright = fast.ai
13 | license = apache2
14 | status = 2
15 | min_python = 3.6
16 | audience = Developers
17 | language = English
18 | requirements = nbformat>=4.4.0 nbconvert>=5.6.1 pyyaml fastscript packaging
19 | console_scripts = nbdev_build_lib=nbdev.cli:nbdev_build_lib
20 | nbdev_update_lib=nbdev.cli:nbdev_update_lib
21 | nbdev_diff_nbs=nbdev.cli:nbdev_diff_nbs
22 | nbdev_test_nbs=nbdev.cli:nbdev_test_nbs
23 | nbdev_build_docs=nbdev.cli:nbdev_build_docs
24 | nbdev_nb2md=nbdev.cli:nbdev_nb2md
25 | nbdev_trust_nbs=nbdev.cli:nbdev_trust_nbs
26 | nbdev_clean_nbs=nbdev.clean:nbdev_clean_nbs
27 | nbdev_read_nbs=nbdev.cli:nbdev_read_nbs
28 | nbdev_fix_merge=nbdev.cli:nbdev_fix_merge
29 | nbdev_install_git_hooks=nbdev.cli:nbdev_install_git_hooks
30 | nbdev_bump_version=nbdev.cli:nbdev_bump_version
31 | nbdev_new=nbdev.cli:nbdev_new
32 | nbdev_detach=nbdev.cli:nbdev_detach
33 | nbs_path = nbs
34 | doc_path = images/copied_from_nb
35 | doc_host = https://nbdev.fast.ai
36 | doc_baseurl = %(baseurl)s/images/copied_from_nb/
37 | git_url = https://github.com/fastai/nbdev/tree/master/
38 | lib_path = nbdev
39 | tst_flags = fastai2
40 | custom_sidebar = False
41 | cell_spacing = 1
42 | monospace_docstrings = False
43 | jekyll_styles = note,warning,tip,important,youtube,twitter
44 |
45 |
--------------------------------------------------------------------------------
/_word/README.md:
--------------------------------------------------------------------------------
1 | # Automatically Convert MS Word (*.docx) Documents To Blog Posts
2 |
3 | _Note: You can convert Google Docs to Word Docs by navigating to the File menu, and selecting Download > Microsoft Word (.docx)_
4 |
5 | [`fastpages`](https://github.com/fastai/fastpages) will automatically convert Word Documents (.docx) saved into this directory as blog posts!. Furthermore, images in your document are saved and displayed as you would expect on your blog post automatically.
6 |
7 | ## Usage
8 |
9 | 1. Create a Word Document (must be .docx) with the contents of your blog post.
10 |
11 | 2. Save your file with the naming convention `YYYY-MM-DD-*.docx` into the `/_word` folder of this repo. For example `2020-01-28-My-First-Post.docx`. This [naming convention is required by Jekyll](https://jekyllrb.com/docs/posts/) to render your blog post.
12 | - Be careful to name your file correctly! It is easy to forget the last dash in `YYYY-MM-DD-`. Furthermore, the character immediately following the dash should only be an alphabetical letter. Examples of valid filenames are:
13 |
14 | ```shell
15 | 2020-01-28-My-First-Post.docx
16 | 2012-09-12-how-to-write-a-blog.docx
17 | ```
18 |
19 | - If you fail to name your file correctly, `fastpages` will automatically attempt to fix the problem by prepending the last modified date of your notebook to your generated blog post. However, it is recommended that you name your files properly yourself for more transparency.
20 |
21 | 3. Synchronize your files with GitHub by [following the instructions in this blog post](https://www.fast.ai/2020/01/18/gitblog/).
22 |
--------------------------------------------------------------------------------
/_posts/2020-03-18- spreadsheet-convertor.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: Using the Spreadsheet Convertor to build models, calculators and simulations in Excel and then embed within a Web page.
5 | categories: [Content Authoring, Interactive Simulation]
6 | tags: [Maths, Data Science]
7 | title: Spreadsheet Convertor - Convert Excel to HTML
8 | comments: true
9 | ---
10 | # Interactive Fiction with a Twist for Scenario/Problem Based Learning
11 |
12 | Do you have a model, simulation, calculator or interactive chart implemented in Excel and what to include it within a course? Spreadsheet Convertor is an Excel add-on that can export to pure HTML and javascript. Various charts and functions are supported. It is not free but comes with a free trial and is well worth the $245 USD. You will need a Window PC or VM with Excel.
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Large subset of Excel features supported
18 |
19 | Many chart types and functions can be used.
20 |
21 | - Includes UI controls and ability to specify input fields and columns
22 |
23 | Quite easy to make sliders and have all dependent calculations updated.
24 |
25 | - Various Export Options
26 |
27 | HTML, iOS and Android and also able to embed in WordPress
28 |
29 | ## To get started:
30 | 1. Try the [examples](https://www.spreadsheetconverter.com/examples/).
31 | 1. Download the [Trial Version](https://www.spreadsheetconverter.com/download/).
32 | 1. Follow a simple tutorial on [building a calculator](https://www.spreadsheetconverter.com/news/take-the-tour/).
33 |
--------------------------------------------------------------------------------
/_posts/2020-09-14- klipse-interactive-code.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: A Tool for Embedding Interactive Code Snippets in Web Pages
5 | categories: [Interactive, Coding]
6 | tags: [ALL]
7 | title: Klipse - embed interactive code snippets in a web page
8 | comments: true
9 | ---
10 | # Klipse - A Tool for Embedding Interactive Code Snippets in Web Pages
11 |
12 | Sprinkle some javascript magic on a web page and get embedded and editable code examples. Great for teaching multi-language programming, web design and database design. No server-side code is required!
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Interactive programming
18 |
19 | Javascript (inc EcmaScript2017), PHP, Ruby, C++, Python, Scheme, Prolog, Common Lisp, Lua.
20 |
21 | - Teach web design
22 |
23 | HTML, CSS, SVG and even React JSX.
24 |
25 | - Teach Database Design and Queries
26 |
27 | Support for SQL
28 |
29 | ## To get started:
30 | 1. Read ["A new way of blogging about javascript"](http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html) to learn how to embed within a web page and see examples.
31 | 1. Read ["A new way of blogging about HTML and CSS"](https://blog.klipse.tech//clojure/2020/09/10/new-way-html-css.html) to learn about HTML editing capabilities.
32 | 1. Read ["Symbolic Computation in JavaScript with Math.js"](https://blog.klipse.tech/javascript/2020/09/10/symbolic-computation-math-js.html) to get inspired.
33 | 1. Read [Procedural Texture Generator in JavaScript](https://blog.klipse.tech/javascript/2020/09/10/procedural-texture-generator-javascript.html) and be impressed.
34 |
--------------------------------------------------------------------------------
/_action_files/action_entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # setup ssh: allow key to be used without a prompt and start ssh agent
5 | export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
6 | eval "$(ssh-agent -s)"
7 |
8 | ######## Run notebook/word converter ########
9 | # word converter using pandoc
10 | /fastpages/word2post.sh
11 | # notebook converter using nbdev
12 | cp /fastpages/settings.ini .
13 | python /fastpages/nb2post.py
14 |
15 |
16 | ######## Optionally save files and build GitHub Pages ########
17 | if [[ "$INPUT_BOOL_SAVE_MARKDOWN" == "true" ]];then
18 |
19 | if [ -z "$INPUT_SSH_DEPLOY_KEY" ];then
20 | echo "You must set the SSH_DEPLOY_KEY input if BOOL_SAVE_MARKDOWN is set to true.";
21 | exit 1;
22 | fi
23 |
24 | # Get user's email from commit history
25 | if [[ "$GITHUB_EVENT_NAME" == "push" ]];then
26 | USER_EMAIL=`cat $GITHUB_EVENT_PATH | jq '.commits | .[0] | .author.email'`
27 | else
28 | USER_EMAIL="actions@github.com"
29 | fi
30 |
31 | # Setup Git credentials if we are planning to change the data in the repo
32 | git config --global user.name "$GITHUB_ACTOR"
33 | git config --global user.email "$USER_EMAIL"
34 | git remote add fastpages-origin "git@github.com:$GITHUB_REPOSITORY.git"
35 | echo "${INPUT_SSH_DEPLOY_KEY}" > _mykey
36 | chmod 400 _mykey
37 | ssh-add _mykey
38 |
39 | # Optionally save intermediate markdown
40 | if [[ "$INPUT_BOOL_SAVE_MARKDOWN" == "true" ]]; then
41 | git pull fastpages-origin ${GITHUB_REF} --ff-only
42 | git add _posts
43 | git commit -m "[Bot] Update $INPUT_FORMAT blog posts" --allow-empty
44 | git push fastpages-origin HEAD:${GITHUB_REF}
45 | fi
46 | fi
47 |
48 |
49 |
--------------------------------------------------------------------------------
/assets/badges/github.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/js/search-data.json:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 | {
4 | {% assign comma = false %}
5 | {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
6 | {% for post in site.posts %}
7 | {% if post.search_exclude != true %}
8 | {% if comma == true%},{% endif %}"post{{ forloop.index0 }}": {
9 | "title": "{{ post.title | replace: '&', '&' }}",
10 | "content": "{{ post.content | markdownify | replace: '
6 | {%- if page.title -%}
7 |
61 | {%- endif %}
62 |
63 | {%- endif -%}
64 |
65 |
--------------------------------------------------------------------------------
/_posts/2020-03-19-twine-problem-based-learning.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: Using the Twine interactive fiction authoring tool to create branching scenarios and problem based learning exercises.
5 | categories: [Content Authoring, Scenario Based Learning, Problem Based Learning]
6 | tags: [All]
7 | title: Twine - Interactive Fiction with a Twist for Scenario/Problem Based Learning
8 | comments: true
9 | ---
10 | # Twine - Interactive Fiction with a Twist for Scenario/Problem Based Learning
11 |
12 | Tools to build interactive fiction are rarely used to build interactive branching scenarios! I don’t know why? I’ve always found the current set of tools at our disposal to be lacking because variables (or choices made) can’t be shared across screens/branches and custom scripting is often not allowed. I’ve always thought using interactive fiction software would be a better alternative, although I never explored it further until I played an interactive [project decision scenario](https://www.screenface.net/TSF/TSF.html) built with Twine (via Twitter - created by the ASCILITE TELedvisors Special Interest Group, Monash Education Innovation (Monash University) and Charles Darwin University). The scenario involves making key decisions to implement a project while reviewing various project status attributes (i.e. day remaining, budget, project risk and even your reputation).
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Author Complex Branching/Problem Based Learning Scenarios
18 |
19 | You can download and create multi-pathway scenarios that have branches, variables and conditional logic. The scenario can be exported to HTML.
20 | - Include Media
21 |
22 | Full support for media and styling (i.e. css). Additional functionality via SugarCube library (http://www.motoslave.net/sugarcube/)
23 | - Embed complex decision logic
24 |
25 | Javascript is supported.
26 |
27 | ## To get started:
28 | 1. Download for [Mac, Linux or Windows](https://twinery.org/). There is even an online editor.
29 | 1. Follow a [simple tutorial](https://opensource.com/article/18/2/twine-gaming) to get started.
30 |
--------------------------------------------------------------------------------
/assets/badges/colab.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/_posts/2020-03-20-fastpages-rapid-course-authoring.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: Using the Fastpages blogging platform to create courseware.
5 | categories: [Content Authoring, Tutorials]
6 | tags: [Maths, Data Science, Programming]
7 | title: Fastpages - Rapid Courseware Authoring
8 | comments: true
9 | ---
10 | # Fastpages - Rapid Courseware Authoring
11 |
12 | In your move to wholly online don’t count on full video streaming and synchronous collaborative tools. With everybody working from home and using these tools bandwidth is going to vary and be unreliable. You need to return to providing a text based alternative. This is where fastpages comes to the rescue. If you know github and markdown and have a heap of existing Jupyter notebooks, you’ll find fastpages a great way to rapidly publish your content as a blog on Github pages.
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Rapid authoring
18 |
19 | You don’t need to be copying and pasting content into the uni provided LMS - no need to create folder by folder and upload file by file one at a time. You can use the tools you already know and be productive using existing jupyter notebooks, word docs, markdown, latex. Behind the scenes using github actions and Jekyll, static files are rendered and deployed to github pages. You can still link to the site from within your LMS but improve your productivity and take the load off the uni provided LMS.
20 | - Great for Programming or Data Science Tutorial
21 |
22 | Interactive charts using Altair are rendered. Syntax highlighting and folding available for code.
23 | - Easy media integration
24 |
25 | Easily embed images and youtube videos.
26 | - Full Taxonomy support
27 |
28 | Tags and categories are supported
29 | - Full search support
30 |
31 | Many LMS don’t even have this feature! Students will be able to search for content.
32 | - Support for comments on each page
33 |
34 | Made possible via github issues. A great way for students to ask questions.
35 |
36 | ## To get started:
37 | 1. Preview the [Demo site](https://fastpages.fast.ai/).
38 | 1. Watch the [setup video](https://www.youtube.com/watch?v=L0boq3zqazI&feature=youtu.be).
39 | 1. Follow the [instructions](https://github.com/fastai/fastpages#setup-instructions) for creating your own course site.
40 |
--------------------------------------------------------------------------------
/_posts/2020-03-28- group-map.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: A Tool for Brainstorming and Group Decision Making
5 | categories: [Annotation, LTI, LMS]
6 | tags: [ALL]
7 | title: GroupMap - A Tool for Brainstorming and Group Decision Making
8 | comments: true
9 | ---
10 | # GroupMap - A Tool for Brainstorming and Group Decision Making
11 |
12 | GroupMap is very different from many voting and idea collection tools. GroupMap allows participants to brainstorm, discuss ideas and make decisions. The tool is very flexible and is able to support brainstorming in various domain areas with 60+ templates (grid and mindmap) provided. GroupMap activities can be sequences to include individual submission, idea grouping of submissions from all participants, idea voting and final decision making. GroupMap allows the group perspective to be captures without anybody dominating the conversation. The tool is not free but worth investigating.
13 |
14 | 
15 |
16 | ## What can you do?
17 | - Use Lots of templates
18 |
19 | 60+ customizable templates available including Stakeholder Analysis, SWOT Analysis, Business Canvas Model, 2D Risk Assessment Maps.
20 |
21 | - Allow Anonymous Submissions
22 |
23 | Share names and email addresses of participants, only show names or keep submissions fully anonymous
24 |
25 | - Choose Contribution Modes for Each Activity
26 |
27 | Let's participants contribute together or individually. Responses collated in real-time.
28 |
29 | - Enable Idea Voting and Ranking
30 |
31 | Simple idea sorting, Agree or disagree with suggested ideas, Like or dislike ideas, Rate along multiple dimensions and Weighted scoring against criteria.
32 |
33 | - Customize Workflow
34 |
35 | Decide on and setup the sequence of the activity e.g., Brainstorm, group responses, then rate responses and have a final survey.
36 |
37 | - Export and View Submission Statistics
38 |
39 | Contributions can be exported to csv format. A submission statistics and ratings report is available.
40 |
41 | ## To get started:
42 | 1. Read ["Outcomes from student engagement in collaborative brainstorming."](https://www.groupmap.com/2019/11/29/outcomes-from-student-engagement-in-collaborative-brainstorming/).
43 | 1. Read ["Teaching with technology – Going beyond Kahoot, Socrative and other quiz apps"](https://www.groupmap.com/2019/09/30/classroom-collaboration-tools/)
44 | 1. [Sign up for a plan](https://www.groupmap.com/plans/) - base plan is $20 USD per month for 1 map creator and 10 participants.
45 |
--------------------------------------------------------------------------------
/_fastpages_docs/_manual_setup.md:
--------------------------------------------------------------------------------
1 | # Manual Setup Instructions
2 |
3 | These are the setup steps that are automated by [setup.yaml](.github/workflows/setup.yaml)
4 |
5 | 1. Click the [](https://github.com/fastai/fastpages/generate) button to create a copy of this repo in your account.
6 |
7 | 2. [Follow these instructions to create an ssh-deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys). Make sure you **select Allow write access** when adding this key to your GitHub account.
8 |
9 | 3. [Follow these instructions to upload your deploy key](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets) as an encrypted secret on GitHub. Make sure you name your key `SSH_DEPLOY_KEY`. Note: The deploy key secret is your **private key** (NOT the public key).
10 |
11 | 4. [Create a branch](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository#creating-a-branch) named `gh-pages`.
12 |
13 | 5. Change the badges on this README to point to **your** repository instead of `fastai/fastpages`. Badges are organized in a section at the beginning of this README. For example, you should replace `fastai` and `fastpages` in the below url:
14 |
15 | ``
16 |
17 | to
18 |
19 | ``
20 |
21 | 6. Change `baseurl:` in `_config.yaml` to the name of your repository. For example, instead of
22 |
23 | `baseurl: "/fastpages"`
24 |
25 | this should be
26 |
27 | `baseurl: "/your-repo-name"`
28 |
29 | 7. Similarly, change the `url:` parameter in `_config.yaml` to the url your blog will be served on. For example, instead of
30 |
31 | `url: "https://fastpages.fast.ai/"`
32 |
33 | this should be
34 |
35 | `url: "https://.github.io"`
36 |
37 | 8. Read through `_config.yaml` carefully as there may be other options that must be set. The comments in this file will provide instructions.
38 |
39 | 9. Delete the `CNAME` file from the root of your `master` branch (or change it if you are using a custom domain)
40 |
41 | 10. Go to your [repository settings and enable GitHub Pages](https://help.github.com/en/enterprise/2.13/user/articles/configuring-a-publishing-source-for-github-pages) with the `gh-pages` branch you created earlier.
--------------------------------------------------------------------------------
/_posts/2020-03-22- hypothes-is.md:
--------------------------------------------------------------------------------
1 | ---
2 | toc: true
3 | layout: post
4 | description: Add social annotation to an LMS or any web page
5 | categories: [Annotation, LTI, LMS]
6 | tags: [ALL]
7 | title: hypothes.is - Collaborative Annotation
8 | comments: true
9 | ---
10 | # hypothes.is - Collaborative Annotation
11 |
12 | Looking for a way to increase student engagement with coursework (either web or pdf) and still monitor learner reading progress? Hypothes.is is a social annotation tool that plugs directly into a LMS and allows learners to highlight text and anchor discussions to course content. Social annotation allows learners to see the annotations made by other learners and participate in a discussion. Annotation can foster a deeper understanding of content, encourage the learners to make inferences and draw conclusions as well as allow learners to gain an overview of a reading without having to reread the content.
13 |
14 | 
15 |
16 | Due to COVID19, hypothes.is has [waived all fees for educational institutions during 2020](https://web.hypothes.is/blog/hypothesis-for-instructional-continuity-during-covid-19/).
17 |
18 | ## What can you do?
19 | - Enable Annotation with embedded media just about everywhere
20 |
21 | Within an LMS, a pdf or just a web page. Highlight text to create an annotation, or reply to an annotation to start a discussion. Images and video can be added to an annotation.
22 |
23 | - LMS Support via LTI
24 |
25 | LTI is the default way for tools to integrate with an LMS. Essentially LTI allows students and staff to access external apps without creating a new account and login. LTI also allows the app to send grades back to the LMS. Supported LMS in include Blackboard, Moodle, Canvas and D2L.
26 |
27 | - Annotate together in groups
28 |
29 | Groups can be created within each course and annotations remain private within the group.
30 |
31 | - Rapid Grading
32 |
33 | hypothes.is can pass grades back to the LMS via LTI. While it may seem tedious to grade annotations, a Speed Grader interface is provided.
34 |
35 | ## To get started:
36 | 1. Watch the [demo video](https://youtu.be/N4QPxr6cN7Q).
37 | 1. Read [Social Reading and Remote Learning with Hypothesis](https://web.hypothes.is/blog/social-reading-and-remote-learning-with-hypothesis/).
38 | 1. Sign up for a [pilot](https://web.hypothes.is/education/lms/) and Install the LTI within your LMS.
39 | 1. Review [A quick guide to using the hypothes.is LMS plugin](https://digitocentrism.com/teaching-2/a-quick-guide-to-using-the-hypothes-is-lms-plugin/).
40 |
--------------------------------------------------------------------------------
/_fastpages_docs/_setup_pr_template.md:
--------------------------------------------------------------------------------
1 | Hello :wave: @aneesha! Thank you for using fastpages!
2 |
3 | ## Before you merge this PR
4 |
5 | 1. Create an ssh key-pair. Open this utility. Select: `RSA` and `4096` and leave `Passphrase` blank. Click the blue button `Generate-SSH-Keys`.
6 |
7 | 2. Navigate to this link and click `Add a new secret`. Copy and paste the **Private Key** into the `Value` field. This includes the "---BEGIN RSA PRIVATE KEY---" and "--END RSA PRIVATE KEY---" portions. In the `Name` field, name the secret `SSH_DEPLOY_KEY`.
8 |
9 | 3. Navigate to this link and click the `Add deploy key` button. Paste your **Public Key** from step 1 into the `Key` box. In the `Title`, name the key anything you want, for example `fastpages-key`. Finally, **make sure you click the checkbox next to `Allow write access`** (pictured below), and click `Add key` to save the key.
10 |
11 | 
12 |
13 |
14 | ### What to Expect After Merging This PR
15 |
16 | - GitHub Actions will build your site, which will take 2-3 minutes to complete. **This will happen anytime you push changes to the master branch of your repository.** You can monitor the logs of this if you like on the [Actions tab of your repo](https://github.com/aneesha/esoteric-teaching-tools/actions).
17 | - Your GH-Pages Status badge on your README will eventually appear and be green, indicating your first sucessfull build.
18 | - You can monitor the status of your site in the GitHub Pages section of your [repository settings](https://github.com/aneesha/esoteric-teaching-tools/settings).
19 |
20 | If you are not using a custom domain, your website will appear at:
21 |
22 | #### https://aneesha.github.io/esoteric-teaching-tools
23 |
24 |
25 | ## Optional: Using a Custom Domain
26 |
27 | 1. After merging this PR, add a file named `CNAME` at the root of your repo. For example, the `fastpages` blog is hosted at `https://fastpages.fast.ai`, which means [our CNAME](https://github.com/fastai/fastpages/blob/master/CNAME) contains the following contents:
28 |
29 |
30 | >`fastpages.fast.ai`
31 |
32 |
33 | 2. Change the `url` and `baseurl` parameters in your `/_config.yml` file to reflect your custom domain.
34 |
35 |
36 | Wondering how to setup a custom domain? See [this article](https://dev.to/trentyang/how-to-setup-google-domain-for-github-pages-1p58). You must add a CNAME file to the root of your master branch for the intructions in the article to work correctly.
37 |
38 |
39 | ## Questions
40 |
41 | Please use the [nbdev & blogging channel](https://forums.fast.ai/c/fastai-users/nbdev/48) in the fastai forums for any questions or feature requests.
42 |
--------------------------------------------------------------------------------
/_layouts/post.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 |
6 |
7 |
56 | {%- if page.comments -%}
57 | {%- include utterances.html -%}
58 | {%- endif -%}
59 | {%- if site.disqus.shortname -%}
60 | {%- include disqus_comments.html -%}
61 | {%- endif -%}
62 |
63 |
--------------------------------------------------------------------------------
/_includes/custom-head.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Placeholder to allow defining custom head, in principle, you can add anything here, e.g. favicons:
3 |
4 | 1. Head over to https://realfavicongenerator.net/ to add your own favicons.
5 | 2. Customize default _includes/custom-head.html in your source directory and insert the given code snippet.
6 | {% endcomment %}
7 |
8 |
9 | {%- include favicons.html -%}
10 | {% seo %}
11 |
12 |
13 | {%- feed_meta -%}
14 | {%- if jekyll.environment == 'production' and site.google_analytics -%}
15 | {%- include google-analytics.html -%}
16 | {%- endif -%}
17 |
18 | {% if site.use_math %}
19 |
20 |
21 |
22 |
23 |
34 | {% endif %}
35 |
36 |
57 |
58 |
65 |
--------------------------------------------------------------------------------
/assets/badges/binder.svg:
--------------------------------------------------------------------------------
1 | launchlaunchbinderbinder
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [//]: # (This template replaces README.md when someone creates a new repo with the fastpages template.)
2 |
3 | 
4 | 
5 | [](https://github.com/fastai/fastpages)
6 |
7 | https://aneesha.github.io/esoteric-teaching-tools/
8 |
9 | # My Blog
10 |
11 |
12 | _powered by [fastpages](https://github.com/fastai/fastpages)_
13 |
14 |
15 | ## What To Do Next?
16 |
17 | Great! You have setup your repo. Now its time to start writing content. Some helpful links:
18 |
19 | - [Writing Blogs With Jupyter](https://github.com/fastai/fastpages#writing-blog-posts-with-jupyter)
20 |
21 | - [Writing Blogs With Markdown](https://github.com/fastai/fastpages#writing-blog-posts-with-markdown)
22 |
23 | - [Writing Blog Posts With Word](https://github.com/fastai/fastpages#writing-blog-posts-with-microsoft-word)
24 |
25 | - [(Optional) Preview Your Blog Locally](_fastpages_docs/DEVELOPMENT.md)
26 |
27 | Note: you may want to remove example blog posts from the `_posts`, `_notebooks` or `_word` folders (but leave them empty, don't delete these folders) if you don't want these blog posts to appear on your site.
28 |
29 | Please use the [nbdev & blogging channel](https://forums.fast.ai/c/fastai-users/nbdev/48) in the fastai forums for any questions or feature requests.
30 |
--------------------------------------------------------------------------------
/_fastpages_docs/README_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | [//]: # (This template replaces README.md when someone creates a new repo with the fastpages template.)
2 |
3 | 
4 | 
5 | [](https://github.com/fastai/fastpages)
6 |
7 | https://{_username_}.github.io/{_repo_name_}/
8 |
9 | # My Blog
10 |
11 |
12 | _powered by [fastpages](https://github.com/fastai/fastpages)_
13 |
14 |
15 | ## What To Do Next?
16 |
17 | Great! You have setup your repo. Now its time to start writing content. Some helpful links:
18 |
19 | - [Writing Blogs With Jupyter](https://github.com/fastai/fastpages#writing-blog-posts-with-jupyter)
20 |
21 | - [Writing Blogs With Markdown](https://github.com/fastai/fastpages#writing-blog-posts-with-markdown)
22 |
23 | - [Writing Blog Posts With Word](https://github.com/fastai/fastpages#writing-blog-posts-with-microsoft-word)
24 |
25 | - [(Optional) Preview Your Blog Locally](_fastpages_docs/DEVELOPMENT.md)
26 |
27 | Note: you may want to remove example blog posts from the `_posts`, `_notebooks` or `_word` folders (but leave them empty, don't delete these folders) if you don't want these blog posts to appear on your site.
28 |
29 | Please use the [nbdev & blogging channel](https://forums.fast.ai/c/fastai-users/nbdev/48) in the fastai forums for any questions or feature requests.
30 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | # Welcome to Jekyll!
2 | #
3 | # This config file is meant for settings that affect your whole blog.
4 | #
5 | # If you need help with YAML syntax, here are some quick references for you:
6 | # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
7 | # https://learnxinyminutes.com/docs/yaml/
8 |
9 | title: Esoteric Teaching Tools
10 | description: Tools for teaching in apocalyptic times - the learning remains to be evaluated!
11 | github_username: aneesha
12 | # you can comment the below line out if your repo name is not different than your baseurl
13 | github_repo: "esoteric-teaching-tools"
14 |
15 | # OPTIONAL: override baseurl and url if using a custom domain
16 | # Note: leave out the trailing / from this value.
17 | url: "https://aneesha.github.io" # the base hostname & protocol for your site, e.g. http://example.com
18 |
19 | ###########################################################
20 | ######### Special Instructions for baseurl ###############
21 | #
22 | #### Scenario One: If you do not have a Custom Domain #####
23 | # - if you are not using a custom domain, the baseurl *must* be set to your repo name
24 | #
25 | #### Scenario Two: If you have a Custom Domain #####
26 | # 1. If your domain does NOT have a subpath, this leave this value as ""
27 | # 2. If your domain does have a subpath, you must preceed the value with a / and NOT have a / at the end.
28 | # For example:
29 | # "" is valid
30 | # "/blog" is valid
31 | # "/blog/site/" is invalid ( / at the end)
32 | # "/blog/site" is valid
33 | # "blog/site" is invalid ( because doesn't begin with a /)
34 | #
35 | # 3. You must replace the parameter `baseurl` in _action_files/settings.ini with the same value as you set here but WITHOUT QUOTES.
36 | #
37 | baseurl: "/esoteric-teaching-tools" # the subpath of your site, e.g. "/blog".
38 |
39 | # Github and twitter are optional:
40 | minima:
41 | social_links:
42 | twitter: aneesha
43 | github: aneesha
44 |
45 | # Set this to true to get LaTeX math equation support
46 | use_math:
47 |
48 | # Set this to true to display the summary of your blog post under your title on the Home page.
49 | show_description: true
50 |
51 | # Set this to true to display image previews on home page, if they exist
52 | show_image: true
53 |
54 | # Set this to true to display tags on each post
55 | show_tags: true
56 |
57 | # Add your Google Analytics ID here if you have one and want to use it
58 | google_analytics:
59 |
60 | exclude:
61 | - docker-compose.yml
62 | - action.yml
63 | - Makefile
64 |
65 | # this setting allows you to keep pages organized in the _pages folder
66 | include:
67 | - _pages
68 |
69 | # This specifies what badges are turned on by default for notebook posts.
70 | default_badges:
71 | github: true
72 | binder: true
73 | colab: true
74 |
75 | # Everything below here should be left alone. Modifications may break fastpages
76 | future: true
77 | theme: minima
78 | plugins:
79 | - jekyll-feed
80 | - jekyll-gist
81 | - jekyll-octicons
82 | - jekyll-toc
83 | - jekyll-twitter-plugin
84 | - jekyll-relative-links
85 | - jekyll-seo-tag
86 | - jekyll-remote-theme
87 | - jekyll-paginate
88 |
89 | # See https://jekyllrb.com/docs/pagination/
90 | # For pagination to work, you cannot have index.md at the root of your repo, instead you must rename this file to index.html
91 | paginate: 15
92 | paginate_path: /page:num/
93 |
94 | remote_theme: jekyll/minima
95 |
96 | titles_from_headings:
97 | enabled: true
98 | strip_title: true
99 | collections: true
100 |
101 | highlighter: rouge
102 | markdown: kramdown
103 | kramdown:
104 | math_engine: katex
105 | input: GFM
106 | auto_ids: true
107 | hard_wrap: false
108 | syntax_highlighter: rouge
109 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | addressable (2.7.0)
5 | public_suffix (>= 2.0.2, < 5.0)
6 | colorator (1.1.0)
7 | concurrent-ruby (1.1.6)
8 | em-websocket (0.5.1)
9 | eventmachine (>= 0.12.9)
10 | http_parser.rb (~> 0.6.0)
11 | eventmachine (1.2.7)
12 | execjs (2.7.0)
13 | faraday (0.17.3)
14 | multipart-post (>= 1.2, < 3)
15 | ffi (1.12.2)
16 | forwardable-extended (2.6.0)
17 | http_parser.rb (0.6.0)
18 | i18n (1.8.2)
19 | concurrent-ruby (~> 1.0)
20 | jekyll (4.0.0)
21 | addressable (~> 2.4)
22 | colorator (~> 1.0)
23 | em-websocket (~> 0.5)
24 | i18n (>= 0.9.5, < 2)
25 | jekyll-sass-converter (~> 2.0)
26 | jekyll-watch (~> 2.0)
27 | kramdown (~> 2.1)
28 | kramdown-parser-gfm (~> 1.0)
29 | liquid (~> 4.0)
30 | mercenary (~> 0.3.3)
31 | pathutil (~> 0.9)
32 | rouge (~> 3.0)
33 | safe_yaml (~> 1.0)
34 | terminal-table (~> 1.8)
35 | jekyll-feed (0.13.0)
36 | jekyll (>= 3.7, < 5.0)
37 | jekyll-gist (1.5.0)
38 | octokit (~> 4.2)
39 | jekyll-octicons (9.5.0)
40 | jekyll (>= 3.6, < 5.0)
41 | octicons (= 9.5.0)
42 | jekyll-paginate (1.1.0)
43 | jekyll-relative-links (0.6.1)
44 | jekyll (>= 3.3, < 5.0)
45 | jekyll-remote-theme (0.4.2)
46 | addressable (~> 2.0)
47 | jekyll (>= 3.5, < 5.0)
48 | jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
49 | rubyzip (>= 1.3.0, < 3.0)
50 | jekyll-sass-converter (2.1.0)
51 | sassc (> 2.0.1, < 3.0)
52 | jekyll-seo-tag (2.6.1)
53 | jekyll (>= 3.3, < 5.0)
54 | jekyll-toc (0.13.1)
55 | jekyll (>= 3.7)
56 | nokogiri (~> 1.9)
57 | jekyll-twitter-plugin (2.1.0)
58 | jekyll-watch (2.2.1)
59 | listen (~> 3.0)
60 | katex (0.6.0)
61 | execjs (~> 2.7)
62 | kramdown (2.3.0)
63 | rexml
64 | kramdown-math-katex (1.0.1)
65 | katex (~> 0.4)
66 | kramdown (~> 2.0)
67 | kramdown-parser-gfm (1.1.0)
68 | kramdown (~> 2.0)
69 | liquid (4.0.3)
70 | listen (3.2.1)
71 | rb-fsevent (~> 0.10, >= 0.10.3)
72 | rb-inotify (~> 0.9, >= 0.9.10)
73 | mercenary (0.3.6)
74 | mini_portile2 (2.4.0)
75 | minima (2.5.1)
76 | jekyll (>= 3.5, < 5.0)
77 | jekyll-feed (~> 0.9)
78 | jekyll-seo-tag (~> 2.1)
79 | multipart-post (2.1.1)
80 | nokogiri (1.10.9)
81 | mini_portile2 (~> 2.4.0)
82 | octicons (9.5.0)
83 | nokogiri (>= 1.6.3.1)
84 | octokit (4.16.0)
85 | faraday (>= 0.9)
86 | sawyer (~> 0.8.0, >= 0.5.3)
87 | pathutil (0.16.2)
88 | forwardable-extended (~> 2.6)
89 | public_suffix (4.0.3)
90 | rb-fsevent (0.10.3)
91 | rb-inotify (0.10.1)
92 | ffi (~> 1.0)
93 | rexml (3.2.4)
94 | rouge (3.16.0)
95 | rubyzip (2.2.0)
96 | safe_yaml (1.0.5)
97 | sassc (2.2.1)
98 | ffi (~> 1.9)
99 | sawyer (0.8.2)
100 | addressable (>= 2.3.5)
101 | faraday (> 0.8, < 2.0)
102 | terminal-table (1.8.0)
103 | unicode-display_width (~> 1.1, >= 1.1.1)
104 | thread_safe (0.3.6)
105 | tzinfo (1.2.6)
106 | thread_safe (~> 0.1)
107 | tzinfo-data (1.2019.3)
108 | tzinfo (>= 1.0.0)
109 | unicode-display_width (1.6.1)
110 | wdm (0.1.1)
111 |
112 | PLATFORMS
113 | ruby
114 |
115 | DEPENDENCIES
116 | faraday (< 1.0)
117 | jekyll (~> 4.0.0)
118 | jekyll-feed (~> 0.12)
119 | jekyll-gist
120 | jekyll-octicons
121 | jekyll-paginate
122 | jekyll-relative-links
123 | jekyll-remote-theme
124 | jekyll-seo-tag
125 | jekyll-toc
126 | jekyll-twitter-plugin
127 | kramdown-math-katex
128 | minima
129 | tzinfo (~> 1.2)
130 | tzinfo-data
131 | wdm (~> 0.1.1)
132 |
133 | BUNDLED WITH
134 | 2.1.4
135 |
--------------------------------------------------------------------------------
/_fastpages_docs/UPGRADE.md:
--------------------------------------------------------------------------------
1 | # Upgrading fastpages
2 |
3 |
4 |
5 | - [Automated Upgrade](#automated-upgrade)
6 | - [Step 1: Open An Issue With The Upgrade Template.](#step-1-open-an-issue-with-the-upgrade-template)
7 | - [Step 2: Click `Submit new issue`](#step-2-click-submit-new-issue)
8 | - [Step 3: A Link to Pull Request Will Appaer](#step-3-a-link-to-pull-request-will-appaer)
9 | - [Step 4: Review & Merge PR](#step-4-review-merge-pr)
10 | - [Manual Upgrade](#manual-upgrade)
11 | - [Easy Way (Recommended)](#easy-way-recommended)
12 | - [Advanced](#advanced)
13 | - [Additional Resources](#additional-resources)
14 |
15 |
16 | There are two ways to upgrade fastpages. One is an automated way that assumes you have made no changes to the HTML of your site. Alternatively, you may [upgrade manually](#manual-upgrade) and determine which changes to accept or reject. For most people we recommend upgrading fastpages automatically.
17 |
18 | ## Automated Upgrade
19 |
20 | - This method is appropriate for those who have not customized the HTML of their site.
21 | - **If you are unsure, try the Automated approach and review which files are changed in the automated PR** to see if this appropriate for you.
22 |
23 | ### Step 1: Open An Issue With The Upgrade Template.
24 |
25 | - Open a new issue in your repository, and push the "Get Started" button for the `[fastpages] Automated Upgrade` Issue template, which looks like this:
26 | - **IF YOU DON'T SEE THIS**: you have an older version of fastpages and you **must [manually upgrade](#manual-upgrade) once** to get this new functionality.
27 |
28 | 
29 |
30 | ### Step 2: Click `Submit new issue`
31 |
32 | - Be careful not to change anything before clicking the button.
33 |
34 | 
35 |
36 | ### Step 3: A Link to Pull Request Will Appaer
37 |
38 | - This issue will trigger GitHub to open a PR making changes to your repository for the upgrade to take palce. A comment with the link to the PR will be made in the issue, and will look like this:
39 |
40 | 
41 |
42 | It is possible that you might receive an error message instead of this command. You can follow the instructions in the comment to troubleshoot the issue. Common reasons for receiving an error are:
43 |
44 | - You are up to date, therefore no upgrade is possible. You will see an error that there is "nothing to commit".
45 | - You already have a PR from a prevoius upgrade open that you never merged.
46 |
47 | Please [ask on the forums](https://forums.fast.ai/) if you have encounter another problem that is unclear.
48 |
49 | ### Step 4: Review & Merge PR
50 |
51 | - Ensure that you read the instructions in the PR carefully. Furthermore, carefully review which files will be changed to determine if this interferes with any customizations you have mades to your site. When ready, select `Merge pull request`.
52 | - If the PR is making undesired changes to files you can use the manual upgrade approach instead.
53 |
54 | ## Manual Upgrade
55 |
56 | ### Easy Way (Recommended)
57 |
58 | Create a new repo with the current `fastpages` template by following the [setup instructions](https://github.com/fastai/fastpages#setup-instructions) in the README, and copy all of your blog posts from `_notebooks`, `_word`, and `_posts` into the new template. This is very similar to what the automated process is doing.
59 |
60 | ### Advanced
61 |
62 | - This method is appropriate for those who made customizations to the HTML of fastpages.
63 | - You must proceed with caution, as new versions of fastpages may not be compatible with your customizations.
64 | - You can use git to perform the upgrade by [following this approach](https://stackoverflow.com/questions/56577184/github-pull-changes-from-a-template-repository/56577320) instead. A step-by-step companion to this stack overflow post with screenshots is [written up here](https://github.com/fastai/fastpages/issues/163#issuecomment-593766189).
65 | - Be careful to not duplicate files, as files in fastpages have been reorganized several times.
66 |
67 |
68 | ## Additional Resources
69 |
70 | - [This Actions workflow](/.github/workflows/upgrade.yaml) defines the automated upgrade process.
71 | - You can get more help with upgrading in the [fastai forums - nbdev & blogging category](https://forums.fast.ai/c/fastai-users/nbdev/48).
72 |
--------------------------------------------------------------------------------
/.github/workflows/setup.yaml:
--------------------------------------------------------------------------------
1 | name: Setup
2 | on: push
3 |
4 | jobs:
5 | setup:
6 | if: (github.event.commits[0].message == 'Initial commit') && (github.run_number == 1)
7 | runs-on: ubuntu-latest
8 | steps:
9 |
10 | - name: Set up Python
11 | uses: actions/setup-python@v1
12 | with:
13 | python-version: 3.6
14 |
15 | - name: Copy Repository Contents
16 | uses: actions/checkout@v2
17 |
18 | - name: modify files
19 | run: |
20 | import re, os
21 | from pathlib import Path
22 | from configparser import ConfigParser
23 | config = ConfigParser()
24 |
25 | nwo = os.getenv('GITHUB_REPOSITORY')
26 | username, repo_name = nwo.split('/')
27 | readme_template_path = Path('_fastpages_docs/README_TEMPLATE.md')
28 | readme_path = Path('README.md')
29 | config_path = Path('_config.yml')
30 | pr_msg_path = Path('_fastpages_docs/_setup_pr_template.md')
31 | settings = Path('_action_files/settings.ini')
32 |
33 | assert readme_template_path.exists(), 'Did not find _fastpages_docs/README_TEMPLATE.md in the current directory!'
34 | assert readme_path.exists(), 'Did not find README.md in the current directory!'
35 | assert config_path.exists(), 'Did not find _config.yml in the current directory!'
36 | assert pr_msg_path.exists(), 'Did not find _fastpages_docs/_setup_pr_template.md in the current directory!'
37 | assert settings.exists(), 'Did not find _action_files/settings.ini in the current directory!'
38 |
39 | # edit settings.ini file to inject baseurl
40 | config.read(settings)
41 | config['DEFAULT']['baseurl'] = f'/{repo_name}'
42 | with open('_action_files/settings.ini', 'w') as configfile:
43 | config.write(configfile)
44 |
45 | # replace content of README with template
46 | readme = readme_template_path.read_text().replace('{_username_}', username).replace('{_repo_name_}', repo_name)
47 | readme_path.write_text(readme)
48 |
49 | # update _config.yml
50 | cfg = config_path.read_text()
51 | cfg = re.sub(r'^(github_username: )(fastai)', r'\1{}'.format(username), cfg, flags=re.MULTILINE)
52 | cfg = re.sub(r'^(baseurl: )("")', r'\1"/{}"'.format(repo_name), cfg, flags=re.MULTILINE)
53 | cfg = re.sub(r'^(github_repo: ")(fastpages)', r'\1{}'.format(repo_name), cfg, flags=re.MULTILINE)
54 | cfg = re.sub(r'^(url: "https://)(fastpages.fast.ai)(")', r'\1{}.github.io\3'.format(username), cfg, flags=re.MULTILINE)
55 | cfg = re.sub('UA-57531313-5', '', cfg, flags=re.MULTILINE)
56 | config_path.write_text(cfg)
57 |
58 | # prepare the pr message
59 | pr = pr_msg_path.read_text().replace('{_username_}', username).replace('{_repo_name_}', repo_name)
60 | pr_msg_path.write_text(pr)
61 | shell: python
62 |
63 | - name: commit changes
64 | run: |
65 | git config --global user.email "${GH_EMAIL}"
66 | git config --global user.name "${GH_USERNAME}"
67 | git checkout -B fastpages-automated-setup
68 | git rm CNAME action.yml
69 | git rm _notebooks/2020-02-21-introducing-fastpages.ipynb
70 | git rm _posts/2020-03-06-fastpages-actions.md
71 | git rm -rf images/fastpages_posts
72 | git rm .github/workflows/chatops.yaml
73 | git rm .github/workflows/docker.yaml
74 | git rm .github/workflows/docker-nbdev.yaml
75 | git rm .github/ISSUE_TEMPLATE/bug.md
76 | git rm .github/ISSUE_TEMPLATE/feature_request.md
77 | git add _config.yml README.md _fastpages_docs/ _action_files/settings.ini
78 | git commit -m'setup repo'
79 | git push -f --set-upstream origin fastpages-automated-setup
80 | env:
81 | GH_EMAIL: ${{ github.event.commits[0].author.email }}
82 | GH_USERNAME: ${{ github.event.commits[0].author.username }}
83 |
84 | - name: Open a PR
85 | uses: actions/github-script@0.5.0
86 | with:
87 | github-token: ${{secrets.GITHUB_TOKEN}}
88 | script: |
89 | var fs = require('fs');
90 | var contents = fs.readFileSync('_fastpages_docs/_setup_pr_template.md', 'utf8');
91 | github.pulls.create({
92 | owner: context.repo.owner,
93 | repo: context.repo.repo,
94 | title: 'Initial Setup',
95 | head: 'fastpages-automated-setup',
96 | base: 'master',
97 | body: `${contents}`
98 | })
99 |
--------------------------------------------------------------------------------
/_sass/minima/fastpages-dracula-highlight.scss:
--------------------------------------------------------------------------------
1 | // Override Syntax Highlighting In Minima With the Dracula Theme: https://draculatheme.com/
2 | // If you wish to override any of this CSS, do so in _sass/minima/custom-styles.css
3 |
4 | $dt-gray-dark: #282a36; // Background
5 | $dt-code-cell-background: #323443;
6 | $dt-gray: #44475a; // Current Line & Selection
7 | $dt-gray-light: #f8f8f2; // Foreground
8 | $dt-blue: #6272a4; // Comment
9 | $dt-cyan: #8be9fd;
10 | $dt-green: #50fa7b;
11 | $dt-orange: #ffb86c;
12 | $dt-pink: #ff79c6;
13 | $dt-purple: #bd93f9;
14 | $dt-red: #ff5555;
15 | $dt-yellow: #f1fa8c;
16 | $dt-green-light: rgb(172, 229, 145);
17 |
18 | .language-python + .language-plaintext {
19 | border-left: 1px solid grey;
20 | margin-left: 1rem !important;
21 | }
22 |
23 | // ensure dark background for code in markdown
24 | [class^="language-"]:not(.language-plaintext) pre,
25 | [class^="language-"]:not(.language-plaintext) code {
26 | background-color: $dt-code-cell-background !important;
27 | color: $dt-gray-light;
28 | }
29 |
30 | .language-python + .language-plaintext code { background-color: white !important; }
31 | .language-python + .language-plaintext pre { background-color: white !important; }
32 |
33 | // for Jupyter Notebook HTML Code Cells modified from https://www.fast.ai/public/css/hyde.css
34 |
35 | .input_area pre, .input_area div {
36 | margin-bottom:2rem !important;
37 | margin-top:1.5rem !important;
38 | padding-bottom:0 !important;
39 | padding-top:0 !important;
40 | background: #323443 !important;
41 | -webkit-font-smoothing: antialiased;
42 | text-rendering: optimizeLegibility;
43 | font-family: Menlo, Monaco, Consolas, "Lucida Console", Roboto, Ubuntu, monospace;
44 | border-radius: 5px;
45 | font-size: 100%;
46 | }
47 | .output_area pre, .output_area div {
48 | margin-bottom:1rem !important;
49 | margin-top:1rem !important;
50 | padding-bottom:0 !important;
51 | padding-top:0 !important;
52 | }
53 | .input_area pre {
54 | border-left: 1px solid lightcoral;
55 | }
56 | .output_area pre {
57 | border-left: 1px solid grey;
58 | margin-left: 1rem !important;
59 | }
60 |
61 | .code_cell table { width: auto; }
62 |
63 | /* Dracula Theme v1.2.5
64 | *
65 | * https://github.com/zenorocha/dracula-theme
66 | *
67 | * Copyright 2016, All rights reserved
68 | *
69 | * Code licensed under the MIT license
70 | *
71 | */
72 |
73 | .highlight {
74 | background: $dt-code-cell-background !important;
75 | color: $dt-gray-light !important;
76 | pre, code {
77 | background: $dt-code-cell-background;
78 | color: $dt-gray-light;
79 | }
80 |
81 | .hll,
82 | .s,
83 | .sa,
84 | .sb,
85 | .sc,
86 | .dl,
87 | .sd,
88 | .s2,
89 | .se,
90 | .sh,
91 | .si,
92 | .sx,
93 | .sr,
94 | .s1,
95 | .ss {
96 | color:rgb(231, 153, 122);
97 | }
98 |
99 | .go {
100 | color: $dt-gray;
101 | }
102 |
103 | .err,
104 | .g,
105 | .l,
106 | .n,
107 | .x,
108 | .ge,
109 | .gr,
110 | .gh,
111 | .gi,
112 | .gp,
113 | .gs,
114 | .gu,
115 | .gt,
116 | .ld,
117 | .no,
118 | .nd,
119 | .pi,
120 | .ni,
121 | .ne,
122 | .nn,
123 | .nx,
124 | .py,
125 | .w,
126 | .bp {
127 | color: $dt-gray-light;
128 | background-color: $dt-code-cell-background !important;
129 | }
130 |
131 | .p {
132 | font-weight: bold;
133 | color: rgb(102, 217, 239);
134 | }
135 |
136 | .ge {
137 | text-decoration: underline;
138 | }
139 |
140 | .bp {
141 | font-style: italic;
142 | }
143 |
144 | .c,
145 | .ch,
146 | .cm,
147 | .cpf,
148 | .c1,
149 | .cs {
150 | color: $dt-blue;
151 | }
152 |
153 | .kd,
154 | .kt,
155 | .nb,
156 | .nl,
157 | .nv,
158 | .vc,
159 | .vg,
160 | .vi,
161 | .vm {
162 | color: $dt-cyan;
163 | }
164 |
165 | .kd,
166 | .nb,
167 | .nl,
168 | .nv,
169 | .vc,
170 | .vg,
171 | .vi,
172 | .vm {
173 | font-style: italic;
174 | }
175 |
176 | .fm,
177 | .na,
178 | .nc,
179 | .nf
180 | {
181 | color: $dt-green-light;
182 | }
183 |
184 | .k,
185 | .o,
186 | .cp,
187 | .kc,
188 | .kn,
189 | .kp,
190 | .kr,
191 | .nt,
192 | .ow {
193 | color: $dt-pink;
194 | }
195 |
196 | .kc {
197 | color: $dt-green-light;
198 | }
199 |
200 | .m,
201 | .mb,
202 | .mf,
203 | .mh,
204 | .mi,
205 | .mo,
206 | .il {
207 | color: $dt-purple;
208 | }
209 |
210 | .gd {
211 | color: $dt-red;
212 | }
213 | }
214 |
--------------------------------------------------------------------------------
/_fastpages_docs/DEVELOPMENT.md:
--------------------------------------------------------------------------------
1 | # Development Guide
2 | - [Seeing All Options From the Terminal](#seeing-all-commands-in-the-terminal)
3 | - [Basic usage: viewing your blog](#basic-usage-viewing-your-blog)
4 | - [Converting the pages locally](#converting-the-pages-locally)
5 | - [Visual Studio Code integration](#visual-studio-code-integration)
6 | - [Advanced usage](#advanced-usage)
7 | - [Rebuild all the containers](#rebuild-all-the-containers)
8 | - [Removing all the containers](#removing-all-the-containers)
9 | - [Attaching a shell to a container](#attaching-a-shell-to-a-container)
10 | - [Running a Jupyter Server](#running-a-jupyter-server)
11 |
12 | You can run your fastpages blog on your local machine, and view any changes you make to your posts, including Jupyter Notebooks and Word documents, live.
13 | The live preview requires that you have Docker installed on your machine. [Follow the instructions on this page if you need to install Docker.](https://www.docker.com/products/docker-desktop)
14 |
15 | ## Seeing All Commands In The Terminal
16 |
17 | There are many different `docker-compose` commands that are necessary to manage the lifecycle of the fastpages Docker containers. To make this easier, we aliased common commands in a [Makefile](https://www.gnu.org/software/make/manual/html_node/Introduction.html).
18 |
19 | You can quickly see all available commands by running this command in the root of your repository:
20 |
21 | `make`
22 |
23 | ## Basic usage: viewing your blog
24 |
25 | All of the commands in this block assume that you're in your blog root directory.
26 | To run the blog with live preview:
27 |
28 | ```bash
29 | make server
30 | ```
31 |
32 | When you run this command for the first time, it'll build the required Docker images, and the process might take a couple minutes.
33 |
34 | This command will build all the necessary containers and run the following services:
35 | 1. A service that monitors any changes in `./_notebooks/*.ipynb/` and `./_word/*.docx;*.doc` and rebuild the blog on change.
36 | 2. A Jekyll server on https://127.0.0.1:4000 — use this to preview your blog.
37 |
38 | The services will output to your terminal. If you close the terminal or hit `Ctrl-C`, the services will stop.
39 | If you want to run the services in the background:
40 |
41 | ```bash
42 | # run all services in the background
43 | make server-detached
44 |
45 | # stop the services
46 | make stop
47 | ```
48 |
49 | If you need to restart just the Jekyll server, and it's running in the background — you can do `make restart-jekyll`.
50 |
51 | _Note that the blog won't autoreload on change, you'll have to refresh your browser manually._
52 |
53 | **If containers won't start**: try `make build` first, this would rebuild all the containers from scratch, This might fix the majority of update problems.
54 |
55 | ## Converting the pages locally
56 |
57 | If you just want to convert your notebooks and word documents to `.md` posts in `_posts`, this command will do it for you:
58 |
59 | ```bash
60 | make convert
61 | ```
62 |
63 | You can launch just the jekyll server with `make server`.
64 |
65 | ## Visual Studio Code integration
66 |
67 | If you're using VSCode with the Docker extension, you can run these containers from the sidebar: `fastpages_watcher_1` and `fastpages_jekyll_1`.
68 | The containers will only show up in the list after you run or build them for the first time. So if they're not in the list — try `make build` in the console.
69 |
70 | ## Advanced usage
71 |
72 | ### Rebuild all the containers
73 | If you changed files in `_action_files` directory, you might need to rebuild the containers manually, without cache.
74 |
75 | ```bash
76 | make build
77 | ```
78 |
79 | ### Removing all the containers
80 | Want to start from scratch and remove all the containers?
81 |
82 | ```
83 | make remove
84 | ```
85 |
86 | ### Attaching a shell to a container
87 | You can attach a terminal to a running service:
88 |
89 | ```bash
90 |
91 | # If the container is already running:
92 |
93 | # attach to a bash shell in the jekyll service
94 | make bash-jekyll
95 |
96 | # attach to a bash shell in the watcher service.
97 | make bash-nb
98 | ```
99 |
100 | _Note: you can use `docker-compose run` instead of `make bash-nb` or `make bash-jekyll` to start a service and then attach to it.
101 | Or you can run all your services in the background, `make server-detached`, and then use `make bash-nb` or `make bash-jekyll` as in the examples above._
102 |
103 | ## Running A Jupyter Server
104 |
105 | The fastpages development enviornment does not provide a Jupyter server for you. This is intentional so that you are free to run Jupyter Notebooks or Jupyter Lab in a manner that is familiar to you, and manage dependencies (requirements.txt, conda, etc) in the way you wish. Some tips that may make your life easier:
106 |
107 | - Provide instructions in your README and your blog posts on how to install the dependencies required to run your notebooks. This will make it eaiser for your audience to reproduce your notebooks.
108 | - Do not edit the Dockerfile in `/_action_files`, as that may interfere with the blogging environment. Furthermore, any changes you make to these files may get lost in future upgrades, if [upgrading automatically](UGPRADE.md). Instead, if you wish to manage your Jupyter server with Docker, we recommend that you maintain a seperate Dockerfile at the root of your repository.
109 |
--------------------------------------------------------------------------------
/_sass/minima/fastpages-styles.scss:
--------------------------------------------------------------------------------
1 | //Default Overrides For Styles In Minima
2 | // If you wish to override any of this CSS, do so in _sass/minima/custom-styles.css
3 |
4 | .post img {
5 | display: block;
6 | // border:1px solid #021a40;
7 | vertical-align: top;
8 | margin-left: auto;
9 | margin-right: auto;
10 | }
11 |
12 | .post figcaption {
13 | text-align: center;
14 | font-size: .8rem;
15 | font-style: italic;
16 | color: light-grey;
17 | }
18 |
19 | .page-content {
20 | -webkit-font-smoothing: antialiased !important;
21 | text-rendering: optimizeLegibility !important;
22 | font-family: "Segoe UI", SegoeUI, Roboto, "Segoe WP", "Helvetica Neue", "Helvetica", "Tahoma", "Arial", sans-serif !important;
23 | }
24 |
25 | // make non-headings slightly lighter
26 | .post-content p, .post-content li {
27 | font-size: 20px;
28 | color: #515151;
29 | }
30 |
31 | .post-link{
32 | font-weight: normal;
33 | }
34 |
35 | // change padding of headings
36 | h1 {
37 | margin-top:2.5rem !important;
38 | }
39 |
40 | h2 {
41 | margin-top:2rem !important;
42 | }
43 |
44 | h3, h4 {
45 | margin-top:1.5rem !important;
46 | }
47 |
48 | p {
49 | margin-top:1rem !important;
50 | margin-bottom:1rem !important;
51 | }
52 |
53 | h1, h2, h3, h4 {
54 | font-weight: normal !important;
55 | margin-bottom:0.5rem !important;
56 | }
57 |
58 | pre {
59 | margin-bottom:1.5rem !important;
60 | }
61 |
62 | // make sure the post title doesn't have too much spacing
63 | .post-title { margin-top: .5rem !important; }
64 |
65 | li {
66 | h3, h4 {
67 | margin-top:.05rem !important;
68 | margin-bottom:.05rem !important;
69 | }
70 | .post-meta-description {
71 | color: rgb(88, 88, 88);
72 | font-size: 15px;
73 | margin-top:.05rem !important;
74 | margin-bottom:.05rem !important;
75 | }
76 | }
77 |
78 |
79 |
80 | // Code Folding
81 | details.description[open] summary::after {
82 | content: attr(data-open);
83 | }
84 |
85 | details.description:not([open]) summary::after {
86 | content: attr(data-close);
87 | }
88 |
89 | // Notebook badges
90 | .notebook-badge-image {
91 | border:0 !important;
92 | }
93 |
94 | // Adjust font size for footnotes.
95 | .footnotes {
96 | font-size: 12px !important;
97 | p, li{
98 | font-size: 12px !important;
99 | }
100 | }
101 |
102 | // Adjust with of social media icons were getting cut off
103 | .social-media-list{
104 | .svg-icon {
105 | width: 25px !important;
106 | height: 23px !important;
107 | }
108 | }
109 |
110 | // Make Anchor Links Appear Only on Hover
111 |
112 | .anchor-link {
113 | opacity: 0;
114 | padding-left: 0.375em;
115 | \-webkit-text-stroke: 1.75px white;
116 | \-webkit-transition: opacity 0.2s ease-in-out 0.1s;
117 | \-moz-transition: opacity 0.2s ease-in-out 0.1s;
118 | \-ms-transition: opacity 0.2s ease-in-out 0.1s;
119 | }
120 |
121 | h1:hover .anchor-link,
122 | h2:hover .anchor-link,
123 | h3:hover .anchor-link,
124 | h4:hover .anchor-link,
125 | h5:hover .anchor-link,
126 | h6:hover .anchor-link {
127 | opacity: 1;
128 | }
129 |
130 |
131 | // category tags
132 | .category-tags {
133 | margin-top: .25rem !important;
134 | margin-bottom: .25rem !important;
135 | font-size: 105%;
136 | }
137 |
138 | // Custom styling for homepage post previews
139 | .post-meta-title, .post-meta{
140 | margin-top: .25em !important;
141 | margin-bottom: .25em !important;
142 | font-size: 105%;
143 | }
144 |
145 | .page-description {
146 | margin-top: .5rem !important;
147 | margin-bottom: .5rem !important;
148 | color: #585858;
149 | font-size: 115%;
150 | }
151 |
152 | // Custom styling for category tags
153 | .category-tags-icon {
154 | font-size: 75% !important;
155 | padding-left: 0.375em;
156 | opacity: 35%;
157 | }
158 | .category-tags-link {
159 | color:rgb(187, 129, 129) !important;
160 | font-size: 13px !important;
161 | }
162 |
163 | // Search Page Styles
164 | .js-search-results {padding-top: 0.2rem;}
165 | .search-results-list-item {padding-bottom: 1rem;}
166 | .search-results-list-item .search-result-title {
167 | font-size: 16px;
168 | color: #d9230f;
169 | }
170 | .search-result-rel-url {color: silver;}
171 | .search-results-list-item a {display: block; color: #777;}
172 | .search-results-list-item a:hover, .search-results-list-item a:focus {text-decoration: none;}
173 | .search-results-list-item a:hover .search-result-title {text-decoration: underline;}
174 |
175 | .search-result-rel-date {
176 | color: rgb(109, 120, 138);
177 | font-size: 14px;
178 | }
179 |
180 | .search-result-preview {
181 | color: #777;
182 | font-size: 16px;
183 | margin-top:.02rem !important;
184 | margin-bottom:.02rem !important;
185 | }
186 | .search-result-highlight {
187 | color: #2e0137;
188 | font-weight:bold;
189 | }
190 |
191 | // Handle Overflow With Table Output
192 |
193 | table {
194 | display: block !important;
195 | overflow-x: auto;
196 | white-space: nowrap;
197 | font-size: 75%;
198 | border:none;
199 | th{
200 | text-align: center! important;
201 | }
202 | td{
203 | text-overflow:ellipsis;
204 | overflow:hidden;
205 | max-width: 15em;
206 | }
207 | }
208 |
209 | // customize scrollbars
210 | ::-webkit-scrollbar {
211 | width: 14px;
212 | height: 18px;
213 | }
214 | ::-webkit-scrollbar-thumb {
215 | height: 6px;
216 | border: 4px solid rgba(0, 0, 0, 0);
217 | background-clip: padding-box;
218 | -webkit-border-radius: 7px;
219 | background-color: #9D9D9D;
220 | -webkit-box-shadow: inset -1px -1px 0px rgba(0, 0, 0, 0.05), inset 1px 1px 0px rgba(0, 0, 0, 0.05);
221 | }
222 | ::-webkit-scrollbar-button {
223 | width: 0;
224 | height: 0;
225 | display: none;
226 | }
227 | ::-webkit-scrollbar-corner {
228 | background-color: transparent;
229 | }
230 |
231 | // Wrap text outputs instead of horizontal scroll
232 | .output_text.output_execute_result {
233 | pre{
234 | white-space: pre-wrap;
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/_fastpages_docs/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | _Adapted from [fastai/nbdev/CONTRIBUTING.md](https://github.com/fastai/nbdev/blob/master/CONTRIBUTING.md)_
2 |
3 | # How to contribute to fastpages
4 |
5 | First, thanks a lot for wanting to help! Some things to keep in mind:
6 |
7 | - The jupyter to blog post conversion functionality relies on [fastai/nbdev](https://github.com/fastai/nbdev). For idiosyncratic uses of nbdev that only apply to blogs that would require a large refactor to nbdev, it might be acceptable to apply a [monkey patch](https://stackoverflow.com/questions/5626193/what-is-monkey-patching) in `fastpages`. However, it is encouraged to contribute to `nbdev` where possible if there is a change that could unlock a new feature. If you are unsure, please open an issue in this repo to discucss.
8 |
9 |
10 | ## Note for new contributors from Jeremy
11 |
12 | It can be tempting to jump into a new project by questioning the stylistic decisions that have been made, such as naming, formatting, and so forth. This can be especially so for python programmers contributing to this project, which is unusual in following a number of conventions that are common in other programming communities, but not in Python. However, please don’t do this, for (amongst others) the following reasons:
13 |
14 | - Contributing to [Parkinson’s law of triviality](https://www.wikiwand.com/en/Law_of_triviality) has negative consequences for a project. Let’s focus on deep learning!
15 | - It’s exhausting to repeat the same discussion over and over again, especially when it’s been well documented already. When you have a question about the project, please check the pages in the docs website linked here.
16 | - You’re likely to get a warmer welcome from the community if you start out by contributing something that’s been requested on the forum, since you’ll be solving someone’s current problem.
17 | - If you start out by just telling us your point of view, rather than studying the background behind the decisions that have been made, you’re unlikely to be contributing anything new or useful.
18 | - I’ve been writing code for nearly 40 years now, across dozens of languages, and other folks involved have quite a bit of experience too - the approaches used are based on significant experience and research. Whilst there’s always room for improvement, it’s much more likely you’ll be making a positive contribution if you spend a few weeks studying and working within the current framework before suggesting wholesale changes.
19 |
20 |
21 | ## Did you find a bug?
22 |
23 | * Nobody is perfect, especially not us. But first, please double-check the bug doesn't come from something on your side. The [forum](http://forums.fast.ai/) is a tremendous source for help, and we'd advise to use it as a first step. Be sure to include as much code as you can so that other people can easily help you.
24 | * Then, ensure the bug was not already reported by searching on GitHub under [Issues](https://github.com/fastai/fastpages/issues).
25 | * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/fastai/fastpages/issues/new). Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
26 | * Be sure to add the complete error messages.
27 |
28 | #### Did you write a patch that fixes a bug?
29 |
30 | * Open a new GitHub pull request with the patch.
31 | * Ensure that your PR includes a test that fails without your patch, and pass with it.
32 | * Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
33 | * Before submitting, please be sure you abide by our [coding style](https://docs.fast.ai/dev/style.html) (where appropriate) and [the guide on abbreviations](https://docs.fast.ai/dev/abbr.html) and clean-up your code accordingly.
34 |
35 | ## Do you intend to add a new feature or change an existing one?
36 |
37 | * You can suggest your change on the [fastai forum](http://forums.fast.ai/) to see if others are interested or want to help.
38 | * Once your approach has been discussed and confirmed on the forum, you are welcome to push a PR, including a complete description of the new feature and an example of how it's used. Be sure to document your code in the notabook.
39 | * Ensure that your code includes tests that exercise not only your feature, but also any other code that might be impacted.
40 |
41 | ## PR submission guidelines
42 |
43 | Some general rules of thumb that will make your life easier.
44 |
45 | * Test locally before opening a pull request. See [the development guide](_fastpages_docs/DEVELOPMENT.md) for instructions on how to run fastpages on your local machine.
46 | * When you do open a pull request, please request a draft build of your PR by making a **comment with the magic command `/preview` in the pull request.** This will allow reviewers to see a live-preview of your changes without having to clone your branch.
47 | * You can do this multiple times, if necessary, to rebuild your preview due to changes. But please do not abuse this and test locally before doing this.
48 |
49 | * Keep each PR focused. While it's more convenient, do not combine several unrelated fixes together. Create as many branches as needing to keep each PR focused.
50 | * Do not mix style changes/fixes with "functional" changes. It's very difficult to review such PRs and it most likely get rejected.
51 | * Do not add/remove vertical whitespace. Preserve the original style of the file you edit as much as you can.
52 | * Do not turn an already submitted PR into your development playground. If after you submitted PR, you discovered that more work is needed - close the PR, do the required work and then submit a new PR. Otherwise each of your commits requires attention from maintainers of the project.
53 | * If, however, you submitted a PR and received a request for changes, you should proceed with commits inside that PR, so that the maintainer can see the incremental fixes and won't need to review the whole PR again. In the exception case where you realize it'll take many many commits to complete the requests, then it's probably best to close the PR, do the work and then submit it again. Use common sense where you'd choose one way over another.
54 | * When you open a pull request, you can generate a live preview build of how the blog site will look by making a comment in the PR that contains this command: `/preview`. GitHub will build your site and drop a temporary link for everyone to review. You can do this as multiple times if necessary, however as mentioned previously do not turn an already submitted PR inot a development playground.
55 |
56 | ## Do you have questions about the source code?
57 |
58 | * Please ask it on the [fastai forum](http://forums.fast.ai/) (after searching someone didn't ask the same one before with a quick search). We'd rather have the maximum of discussions there so that the largest number can benefit from it.
59 |
60 | ## Do you want to contribute to the documentation?
61 |
62 | * PRs are welcome for this. For any confusion about the documentation, please feel free to open an issue on this repo.
63 |
64 |
--------------------------------------------------------------------------------
/.github/workflows/upgrade.yaml:
--------------------------------------------------------------------------------
1 | name: Upgrade fastpages
2 | on:
3 | issues:
4 | types: [opened]
5 |
6 | jobs:
7 | check_credentials:
8 | if: |
9 | (github.repository != 'fastai/fastpages') &&
10 | (github.event.issue.title == '[fastpages] Automated Upgrade')
11 | runs-on: ubuntu-latest
12 | steps:
13 |
14 | - name: see payload
15 | run: |
16 | echo "FULL PAYLOAD:\n${PAYLOAD}\n"
17 | echo "PR_PAYLOAD PAYLOAD:\n${PR_PAYLOAD}"
18 | env:
19 | PAYLOAD: ${{ toJSON(github.event) }}
20 | PR_PAYLOAD: ${{ github.event.pull_request }}
21 |
22 | - name: Comment on issue if sufficient access does not exist
23 | if: |
24 | (github.event.issue.author_association != 'OWNER') &&
25 | (github.event.issue.author_association != 'COLLABORATOR') &&
26 | (github.event.issue.author_association != 'MEMBER')
27 | uses: actions/github-script@0.6.0
28 | with:
29 | github-token: ${{secrets.GITHUB_TOKEN}}
30 | script: |
31 | var permission_level = process.env.permission_level;
32 | var url = 'https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/permission-levels-for-a-user-account-repository#collaborator-access-on-a-repository-owned-by-a-user-account'
33 | var msg = `You must have the [permission level](${url}) of either an **OWNER**, **COLLABORATOR** or **MEMBER** to instantiate an upgrade request. Your permission level is ${permission_level}`
34 | github.issues.createComment({
35 | issue_number: context.issue.number,
36 | owner: context.repo.owner,
37 | repo: context.repo.repo,
38 | body: msg
39 | })
40 | github.issues.update({
41 | issue_number: context.issue.number,
42 | owner: context.repo.owner,
43 | repo: context.repo.repo,
44 | state: 'closed'
45 | })
46 | throw msg;
47 | env:
48 | permission_level: ${{ github.event.issue.author_association }}
49 |
50 | upgrade:
51 | needs: [check_credentials]
52 | if: |
53 | (github.repository != 'fastai/fastpages') &&
54 | (github.event.issue.title == '[fastpages] Automated Upgrade') &&
55 | (github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'COLLABORATOR' || github.event.issue.author_association == 'MEMBER')
56 | runs-on: ubuntu-latest
57 | steps:
58 |
59 | - name: Set up Python
60 | uses: actions/setup-python@v1
61 | with:
62 | python-version: 3.7
63 |
64 | - name: checkout latest fastpages
65 | uses: actions/checkout@v2
66 | with:
67 | repository: 'fastai/fastpages'
68 | path: 'new_files'
69 | persist-credentials: false
70 |
71 | - name: copy this repo's contents
72 | uses: actions/checkout@v2
73 | with:
74 | path: 'current_files'
75 | persist-credentials: false
76 |
77 | - name: compare versions
78 | id: check_version
79 | run: |
80 | from pathlib import Path
81 | new_version = Path('new_files/_fastpages_docs/version.txt')
82 | old_version = Path('current_files/_fastpages_docs/version.txt')
83 |
84 | if old_version.exists():
85 | old_num = old_version.read_text().strip()
86 | new_num = new_version.read_text().strip()
87 | print(f'Old version: {old_num}')
88 | print(f'New version: {new_num}')
89 | if old_num == new_num:
90 | print('::set-output name=vbump::false')
91 | else:
92 | print('::set-output name=vbump::true')
93 | else:
94 | print('::set-output name=vbump::true')
95 | shell: python
96 |
97 | - name: copy new files
98 | if: steps.check_version.outputs.vbump == 'true'
99 | run: |
100 | # remove files you don't want to copy from current version of fastpages
101 | cd new_files
102 | rm -rf _posts _notebooks _word images
103 | rm *.md CNAME action.yml _config.yml index.html LICENSE
104 | rm .github/workflows/chatops.yaml
105 | rm .github/workflows/docker-nbdev.yaml
106 | rm .github/workflows/docker.yaml
107 | rm .github/ISSUE_TEMPLATE/bug.md .github/ISSUE_TEMPLATE/feature_request.md
108 |
109 | # copy new files from fastpages into your repo
110 | for file in $(ls | egrep -v "(assets|_sass)"); do
111 | if [[ -f "$file" ]] || [[ -d "$file" ]]
112 | then
113 | echo "copying $file";
114 | cp -r $file ../current_files;
115 | fi
116 | done
117 |
118 | # copy select files in assets and _sass
119 | cp -r assets/js ../current_files/assets
120 | cp -r assets/badges ../current_files/assets
121 | cp _sass/minima/fastpages-styles.scss ../current_files/_sass/minima/
122 | cp _sass/minima/fastpages-dracula-highlight.scss ../current_files/_sass/minima/
123 |
124 | # copy action workflows
125 | cp -r .github ../current_files
126 |
127 | # install dependencies
128 | pip3 install pyyaml
129 |
130 | - name: sync baseurl
131 | if: steps.check_version.outputs.vbump == 'true'
132 | run: |
133 | import re, os, yaml
134 | from pathlib import Path
135 | from configparser import ConfigParser
136 | settings = ConfigParser()
137 |
138 | # specify location of config files
139 | nwo = os.getenv('GITHUB_REPOSITORY')
140 | username, repo_name = nwo.split('/')
141 | settings_path = Path('current_files/_action_files/settings.ini')
142 | config_path = Path('current_files/_config.yml')
143 | setup_pr_path = Path('current_files/_fastpages_docs/_setup_pr_template.md')
144 | upgrade_pr_path = Path('current_files/_fastpages_docs/_upgrade_pr.md')
145 |
146 | assert settings_path.exists(), 'Did not find _action_files/settings.ini in your repository!'
147 | assert config_path.exists(), 'Did not find _config.yml in your repository!'
148 | assert setup_pr_path.exists(), 'Did not find_fastpages_docs/_setup_pr_template.md in the current directory!'
149 | assert upgrade_pr_path.exists(), 'Did not find _fastpages_docs/_upgrade_pr.md in your repository!'
150 |
151 | # read data from config files
152 | settings.read(settings_path)
153 | with open(config_path, 'r') as cfg:
154 | config = yaml.load(cfg)
155 |
156 | # sync value for baseurl b/w config.yml and settings.ini
157 | settings['DEFAULT']['baseurl'] = config['baseurl']
158 | with open(settings_path, 'w') as stg:
159 | settings.write(stg)
160 |
161 | # update PR templates
162 | setup_pr = setup_pr_path.read_text().replace('{_username_}', username).replace('{_repo_name_}', repo_name)
163 | setup_pr_path.write_text(setup_pr)
164 | upgrade_pr = upgrade_pr_path.read_text().replace('{_username_}', username).replace('{_repo_name_}', repo_name)
165 | upgrade_pr_path.write_text(upgrade_pr)
166 | shell: python
167 |
168 | - uses: webfactory/ssh-agent@v0.2.0
169 | if: steps.check_version.outputs.vbump == 'true'
170 | with:
171 | ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
172 |
173 | - name: push changes to branch
174 | if: steps.check_version.outputs.vbump == 'true'
175 | run: |
176 | # commit changes
177 | cd current_files
178 | git config --global user.email "${GH_USERNAME}@users.noreply.github.com"
179 | git config --global user.name "${GH_USERNAME}"
180 | git remote remove origin
181 | git remote add origin "git@github.com:${GITHUB_REPOSITORY}.git"
182 |
183 | git add _action_files/settings.ini
184 | git checkout -b fastpages-automated-upgrade
185 | git add -A
186 | git commit -m'upgrade fastpages'
187 | git push -f --set-upstream origin fastpages-automated-upgrade master
188 | env:
189 | GH_USERNAME: ${{ github.event.issue.user.login }}
190 |
191 | - name: Open a PR
192 | if: steps.check_version.outputs.vbump == 'true'
193 | id: pr
194 | uses: actions/github-script@0.6.0
195 | with:
196 | github-token: ${{secrets.GITHUB_TOKEN}}
197 | script: |
198 | var fs = require('fs');
199 | var contents = fs.readFileSync('current_files/_fastpages_docs/_upgrade_pr.md', 'utf8');
200 | github.pulls.create({
201 | owner: context.repo.owner,
202 | repo: context.repo.repo,
203 | title: '[fastpages] Update repo with changes from fastpages',
204 | head: 'fastpages-automated-upgrade',
205 | base: 'master',
206 | body: `${contents}`
207 | })
208 | .then(result => console.log(`::set-output name=pr_num::${result.data.number}`))
209 |
210 | - name: Comment on issue if failure
211 | if: failure() && (steps.check_version.outputs.vbump == 'true')
212 | uses: actions/github-script@0.6.0
213 | with:
214 | github-token: ${{secrets.GITHUB_TOKEN}}
215 | script: |
216 | var pr_num = process.env.PR_NUM;
217 | var repo = process.env.REPO
218 | github.issues.createComment({
219 | issue_number: context.issue.number,
220 | owner: context.repo.owner,
221 | repo: context.repo.repo,
222 | body: `An error occurred when attempting to open a PR to update fastpages. See the [Actions tab of your repo](https://github.com/${repo}/actions) for more details.`
223 | })
224 | env:
225 | PR_NUM: ${{ steps.pr.outputs.pr_num }}
226 | REPO: ${{ github.repository }}
227 |
228 | - name: Comment on issue
229 | if: steps.check_version.outputs.vbump == 'true'
230 | uses: actions/github-script@0.6.0
231 | with:
232 | github-token: ${{secrets.GITHUB_TOKEN}}
233 | script: |
234 | var pr_num = process.env.PR_NUM;
235 | var repo = process.env.REPO
236 | github.issues.createComment({
237 | issue_number: context.issue.number,
238 | owner: context.repo.owner,
239 | repo: context.repo.repo,
240 | body: `Opened PR https://github.com/${repo}/pull/${pr_num} to assist with updating fastpages.`
241 | })
242 | env:
243 | PR_NUM: ${{ steps.pr.outputs.pr_num }}
244 | REPO: ${{ github.repository }}
245 |
246 | - name: Comment on issue if version has not changed
247 | if: steps.check_version.outputs.vbump == 'false'
248 | uses: actions/github-script@0.6.0
249 | with:
250 | github-token: ${{secrets.GITHUB_TOKEN}}
251 | script: |
252 | github.issues.createComment({
253 | issue_number: context.issue.number,
254 | owner: context.repo.owner,
255 | repo: context.repo.repo,
256 | body: `Your version of fastpages is up to date. There is nothing to change.`
257 | })
258 |
259 | - name: Close Issue
260 | if: always()
261 | uses: actions/github-script@0.6.0
262 | with:
263 | github-token: ${{secrets.GITHUB_TOKEN}}
264 | script: |
265 | github.issues.update({
266 | issue_number: context.issue.number,
267 | owner: context.repo.owner,
268 | repo: context.repo.repo,
269 | state: 'closed'
270 | })
271 |
--------------------------------------------------------------------------------
/assets/js/search.js:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 | // from https://github.com/pmarsceill/just-the-docs/blob/master/assets/js/just-the-docs.js#L47
4 |
5 | (function (jtd, undefined) {
6 |
7 | // Event handling
8 |
9 | jtd.addEvent = function(el, type, handler) {
10 | if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
11 | }
12 | jtd.removeEvent = function(el, type, handler) {
13 | if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
14 | }
15 | jtd.onReady = function(ready) {
16 | // in case the document is already rendered
17 | if (document.readyState!='loading') ready();
18 | // modern browsers
19 | else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
20 | // IE <= 8
21 | else document.attachEvent('onreadystatechange', function(){
22 | if (document.readyState=='complete') ready();
23 | });
24 | }
25 |
26 | // Show/hide mobile menu
27 |
28 | // function initNav() {
29 | // const mainNav = document.querySelector('.js-main-nav');
30 | // const pageHeader = document.querySelector('.js-page-header');
31 | // const navTrigger = document.querySelector('.js-main-nav-trigger');
32 |
33 | // jtd.addEvent(navTrigger, 'click', function(e){
34 | // e.preventDefault();
35 | // var text = navTrigger.innerText;
36 | // var textToggle = navTrigger.getAttribute('data-text-toggle');
37 |
38 | // mainNav.classList.toggle('nav-open');
39 | // pageHeader.classList.toggle('nav-open');
40 | // navTrigger.classList.toggle('nav-open');
41 | // navTrigger.innerText = textToggle;
42 | // navTrigger.setAttribute('data-text-toggle', text);
43 | // textToggle = text;
44 | // })
45 | // }
46 |
47 |
48 | // Site search
49 |
50 | function initSearch() {
51 | var request = new XMLHttpRequest();
52 | request.open('GET', '{{ "assets/js/search-data.json" | relative_url }}', true);
53 |
54 | request.onload = function(){
55 | if (request.status >= 200 && request.status < 400) {
56 | // Success!
57 | var data = JSON.parse(request.responseText);
58 |
59 | {% if site.search_tokenizer_separator != nil %}
60 | lunr.tokenizer.separator = {{ site.search_tokenizer_separator }}
61 | {% else %}
62 | lunr.tokenizer.separator = /[\s\-/]+/
63 | {% endif %}
64 |
65 | var index = lunr(function () {
66 | this.ref('id');
67 | this.field('title', { boost: 200 });
68 | this.field('content', { boost: 2 });
69 | this.field('url');
70 | this.metadataWhitelist = ['position']
71 |
72 | for (var i in data) {
73 | this.add({
74 | id: i,
75 | title: data[i].title,
76 | content: data[i].content,
77 | url: data[i].url
78 | });
79 | }
80 | });
81 |
82 | searchResults(index, data);
83 | } else {
84 | // We reached our target server, but it returned an error
85 | console.log('Error loading ajax request. Request status:' + request.status);
86 | }
87 | };
88 |
89 | request.onerror = function(){
90 | // There was a connection error of some sort
91 | console.log('There was a connection error');
92 | };
93 |
94 | request.send();
95 |
96 | function searchResults(index, data) {
97 | var index = index;
98 | var docs = data;
99 | var searchInput = document.querySelector('.js-search-input');
100 | var searchResults = document.querySelector('.js-search-results');
101 |
102 | function hideResults() {
103 | searchResults.innerHTML = '';
104 | searchResults.classList.remove('active');
105 | }
106 |
107 | jtd.addEvent(searchInput, 'keydown', function(e){
108 | switch (e.keyCode) {
109 | case 38: // arrow up
110 | e.preventDefault();
111 | var active = document.querySelector('.search-result.active');
112 | if (active) {
113 | active.classList.remove('active');
114 | if (active.parentElement.previousSibling) {
115 | var previous = active.parentElement.previousSibling.querySelector('.search-result');
116 | previous.classList.add('active');
117 | }
118 | }
119 | return;
120 | case 40: // arrow down
121 | e.preventDefault();
122 | var active = document.querySelector('.search-result.active');
123 | if (active) {
124 | if (active.parentElement.nextSibling) {
125 | var next = active.parentElement.nextSibling.querySelector('.search-result');
126 | active.classList.remove('active');
127 | next.classList.add('active');
128 | }
129 | } else {
130 | var next = document.querySelector('.search-result');
131 | if (next) {
132 | next.classList.add('active');
133 | }
134 | }
135 | return;
136 | case 13: // enter
137 | e.preventDefault();
138 | var active = document.querySelector('.search-result.active');
139 | if (active) {
140 | active.click();
141 | } else {
142 | var first = document.querySelector('.search-result');
143 | if (first) {
144 | first.click();
145 | }
146 | }
147 | return;
148 | }
149 | });
150 |
151 | jtd.addEvent(searchInput, 'keyup', function(e){
152 | switch (e.keyCode) {
153 | case 27: // When esc key is pressed, hide the results and clear the field
154 | hideResults();
155 | searchInput.value = '';
156 | return;
157 | case 38: // arrow up
158 | case 40: // arrow down
159 | case 13: // enter
160 | e.preventDefault();
161 | return;
162 | }
163 |
164 | hideResults();
165 |
166 | var input = this.value;
167 | if (input === '') {
168 | return;
169 | }
170 |
171 | var results = index.query(function (query) {
172 | var tokens = lunr.tokenizer(input)
173 | query.term(tokens, {
174 | boost: 10
175 | });
176 | query.term(tokens, {
177 | wildcard: lunr.Query.wildcard.TRAILING
178 | });
179 | });
180 |
181 | if (results.length > 0) {
182 | searchResults.classList.add('active');
183 | var resultsList = document.createElement('ul');
184 | resultsList.classList.add('search-results-list');
185 | searchResults.appendChild(resultsList);
186 |
187 | for (var i in results) {
188 | var result = results[i];
189 | var doc = docs[result.ref];
190 |
191 | var resultsListItem = document.createElement('li');
192 | resultsListItem.classList.add('search-results-list-item');
193 | resultsList.appendChild(resultsListItem);
194 |
195 | var resultLink = document.createElement('a');
196 | resultLink.classList.add('search-result');
197 | resultLink.setAttribute('href', doc.url);
198 | resultsListItem.appendChild(resultLink);
199 |
200 | var resultTitle = document.createElement('div');
201 | resultTitle.classList.add('search-result-title');
202 | resultTitle.innerText = doc.title;
203 | resultLink.appendChild(resultTitle);
204 |
205 | var resultRelUrl = document.createElement('span');
206 | resultRelUrl.classList.add('search-result-rel-date');
207 | resultRelUrl.innerText = doc.date;
208 | resultTitle.appendChild(resultRelUrl);
209 |
210 | var metadata = result.matchData.metadata;
211 | var contentFound = false;
212 | for (var j in metadata) {
213 | if (metadata[j].title) {
214 | var position = metadata[j].title.position[0];
215 | var start = position[0];
216 | var end = position[0] + position[1];
217 | resultTitle.innerHTML = doc.title.substring(0, start) + '' + doc.title.substring(start, end) + '' + doc.title.substring(end, doc.title.length)+''+doc.date+'';
218 |
219 | } else if (metadata[j].content && !contentFound) {
220 | contentFound = true;
221 |
222 | var position = metadata[j].content.position[0];
223 | var start = position[0];
224 | var end = position[0] + position[1];
225 | var previewStart = start;
226 | var previewEnd = end;
227 | var ellipsesBefore = true;
228 | var ellipsesAfter = true;
229 | for (var k = 0; k < 3; k++) {
230 | var nextSpace = doc.content.lastIndexOf(' ', previewStart - 2);
231 | var nextDot = doc.content.lastIndexOf('.', previewStart - 2);
232 | if ((nextDot > 0) && (nextDot > nextSpace)) {
233 | previewStart = nextDot + 1;
234 | ellipsesBefore = false;
235 | break;
236 | }
237 | if (nextSpace < 0) {
238 | previewStart = 0;
239 | ellipsesBefore = false;
240 | break;
241 | }
242 | previewStart = nextSpace + 1;
243 | }
244 | for (var k = 0; k < 10; k++) {
245 | var nextSpace = doc.content.indexOf(' ', previewEnd + 1);
246 | var nextDot = doc.content.indexOf('.', previewEnd + 1);
247 | if ((nextDot > 0) && (nextDot < nextSpace)) {
248 | previewEnd = nextDot;
249 | ellipsesAfter = false;
250 | break;
251 | }
252 | if (nextSpace < 0) {
253 | previewEnd = doc.content.length;
254 | ellipsesAfter = false;
255 | break;
256 | }
257 | previewEnd = nextSpace;
258 | }
259 | var preview = doc.content.substring(previewStart, start);
260 | if (ellipsesBefore) {
261 | preview = '... ' + preview;
262 | }
263 | preview += '' + doc.content.substring(start, end) + '';
264 | preview += doc.content.substring(end, previewEnd);
265 | if (ellipsesAfter) {
266 | preview += ' ...';
267 | }
268 |
269 | var resultPreview = document.createElement('div');
270 | resultPreview.classList.add('search-result-preview');
271 | resultPreview.innerHTML = preview;
272 | resultLink.appendChild(resultPreview);
273 | }
274 | }
275 | }
276 | }
277 | });
278 |
279 | // jtd.addEvent(searchInput, 'blur', function(){
280 | // setTimeout(function(){ hideResults() }, 300);
281 | // });
282 | }
283 | }
284 |
285 | // function pageFocus() {
286 | // var mainContent = document.querySelector('.js-main-content');
287 | // mainContent.focus();
288 | // }
289 |
290 | // Document ready
291 |
292 | jtd.onReady(function(){
293 | // initNav();
294 | // pageFocus();
295 | if (typeof lunr !== 'undefined') {
296 | initSearch();
297 | }
298 | });
299 |
300 | })(window.jtd = window.jtd || {});
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2020 onwards, fast.ai, Inc
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/assets/js/vendor/lunr.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.6
3 | * Copyright (C) 2019 Oliver Nightingale
4 | * @license MIT
5 | */
6 | !function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.6",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.utils.clone=function(e){if(null===e||void 0===e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i0){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:sa?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}();
7 |
--------------------------------------------------------------------------------