Skip to content

Commit

Permalink
Add the basic template to generate webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
GeliezaK committed Jul 31, 2023
1 parent 5b47a09 commit 65e88df
Show file tree
Hide file tree
Showing 41 changed files with 47,715 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI
on:
push:
branches:
- main
tags: ['*']
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.9'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: write
statuses: write
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Set up Python
uses: actions/setup-python@v4.7.0
with:
python-version: '3.9'
- name: Install nbconvert
run: |
python -m pip install jupyter nbconvert
- name: Configure doc environment
run: |
julia --project=docs/ -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


10 changes: 10 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = "XM_40017"
uuid = "bac2549d-7fb4-47a9-ab16-d1e9b77d8fc7"
authors = ["Francesc Verdugo <f.verdugo.rojano@vu.nl>"]
version = "0.1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# XM_40017
Jupyter notebook scripts for the course Programming Large-Scale Parallel Systems (XM_40017) at Vrije Universiteit Amsterdam.

- [**Go to webpage**](https://fverdugo.github.io/XM_40017/dev)

## Run webpage locally
In XM_40017 folder, call `using LiveServer; servedocs(skip_dir=joinpath("docs","src","notebook-output"))` in terminal.
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
site/
Manifest.toml
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
XM_40017 = "bac2549d-7fb4-47a9-ab16-d1e9b77d8fc7"
62 changes: 62 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using XM_40017
using Documenter

# Convert to html using nbconvert
function convert_notebook_to_html(notebook_path; output_name = "index", output_dir = "./docs/src/notebook-output", theme = "dark")
command_jup = "jupyter"
command_nbc = "nbconvert"
output_format = "--to=html"
theme = "--theme=$theme"
output = "--output=$output_name"
output_dir = "--output-dir=$output_dir"
infile = notebook_path
run(`$command_jup $command_nbc $output_format $output $output_dir $theme $infile`)
end

# Resize iframes using IframeResizer
function modify_notebook_html( html_name )
content = open( html_name, "r" ) do html_file
read( html_file, String )
end
content = replace(content,
r"(<script\b[^>]*>[\s\S]*?<\/script>\K)" =>
s"\1\n\t<script src='../assets/iframeResizer.contentWindow.min.js'></script>\n";
count = 1
)
content = replace_colors(content)
open( html_name, "w" ) do html_file
write( html_file, content )
end
return nothing
end

# Replace colors to match Documenter.jl
function replace_colors(content)
content = replace( content, "--jp-layout-color0: #111111;" => "--jp-layout-color0: #1f2424;")
content = replace(content, "--md-grey-900: #212121;" => "--md-grey-900: #282f2f;")
return content
end

convert_notebook_to_html("docs/src/notebooks/matrix_matrix.ipynb", output_name = "matrix_matrix")
modify_notebook_html("docs/src/notebook-output/matrix_matrix.html")

convert_notebook_to_html("docs/src/notebooks/notebook-hello.ipynb", output_name = "notebook-hello")
modify_notebook_html("docs/src/notebook-output/notebook-hello.html")

makedocs(;
modules=[XM_40017],
authors="Francesc Verdugo <f.verdugo.rojano@vu.nl>",
repo="https://github.com/fverdugo/XM_40017/blob/{commit}{path}#{line}",
sitename="XM_40017",
format=Documenter.HTML(;
assets = ["assets/iframeResizer.min.js", "assets/custom.css"],
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://fverdugo.github.io/XM_40017",
edit_link="main",),
pages=["Home" => "index.md","Hello World" => "notebook-hello.md", "Notebooks"=>["Matrix Multiplication"=>"matrix_matrix.md"]],
)

deploydocs(;
repo="github.com/fverdugo/XM_40017",
devbranch="main",
)
4 changes: 4 additions & 0 deletions docs/src/assets/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#documenter .docs-sidebar .docs-logo > img,
html.theme--documenter-dark #documenter .docs-sidebar .docs-logo > img {
max-height: 8em;
}
9 changes: 9 additions & 0 deletions docs/src/assets/iframeResizer.contentWindow.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 65e88df

Please sign in to comment.