Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JuhoErvasti committed Dec 18, 2023
0 parents commit e712136
Show file tree
Hide file tree
Showing 31 changed files with 2,603 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/render-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Render to HTML & Deploy
on:
push:
paths:
- src/**/*

jobs:
check-changes:
name: Check if Rmd files changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Find directories with changed rmd or image files
id: changed-files-dir-names
uses: tj-actions/changed-files@v39
with:
files: |
src/G*/*.{rmd,Rmd}
src/G*/img/*.{png,gif}
src/G*/img/*/*.{png,gif}
dir_names: "true"
dir_names_max_depth: 2

- name: Render modified courses to HTML and move output to docs
run: |
folder_list="${{ steps.changed-files-dir-names.outputs.all_changed_files }}"
IFS=" "
read -ra folders <<< "$folder_list"
export WORKFLOW=true
for folder in "${folders[@]}"; do
code="${folder#src/}"
./render.sh $code
done
- name: Add, Commit & Push
uses: EndBug/add-and-commit@v7
with:
add: "docs/G*"
message: "Automatic: Update docs"
23 changes: 23 additions & 0 deletions .github/workflows/update-assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update assets
on:
push:
paths:
- assets/*

jobs:
update-preview:
name: Update assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Copy modified assets to each directory
run: ./update_assets.sh

- name: Add, Commit & Push
uses: EndBug/add-and-commit@v7
with:
add: "src/G*"
message: "Automatic: Update assets"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.zip
.idea
.vscode/launch.json
**/_main.Rmd
*.Rhistory
.Rhistory

out

**/_book
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Gispo Training Repository

This is a repository hosting Gispo's training materials.

## Editing content

The course materials are written and edited in R Markdown (.rmd) files which are then automatically rendered to HTML using [Bookdown](https://bookdown.org). The materials are in the 'src' folder in which each course is in its own folder named after its course code. English and Swedish translations of courses have a suffix, '_eng', or '_sv' respectively. Editing or adding new rmd files or image files in the course's folder will trigger a workflow which will render the course to HTML and either add or modify the corresponding course folder in the 'docs' folder. The docs folder is published using GitHub pages.

Using RStudio to edit the rmd files is recommended. You can install the bookdown package and preview the HTML document using RStudio. If you have Docker installed, you can also render locally using the [render.sh](render.sh) ([render.ps1](render.ps1) on Windows) script.

For Windows, you may need to enable script support first.
Open Powershell as an administrator and run the command `Set-ExecutionPolicy RemoteSigned`.

## Editing the assets

The HTML is rendered using custom HTML and CSS templates defined in the index.Rmd YAML header. Some extra functionality (f.e. copying the contents of a code box) is added with javascript (.js) files. These can be found and added to the 'js' folder. They also might have to be added to the end of the HTML template.

If you wish to edit the assets, for example change the style of the pages or add functionality with javascript you can edit the files in the assets folder. When you make changes to the assets folder a workflow is triggered which updates the assets automatically to each course folder in 'src'.

## Rendering

The [index.Rmd](src/index.Rmd) file is a special file that always gets rendered first
Other Rmd files get rendered in alphabetic order to separate pages.
Use the YAML header section (separated by `---`) of index.Rmd to define a author, title, and abstract for the materials.
<!-- ## Repository configuration
After creating a new repository from this template, two steps are required to publish the course materials online.
First, add a new *repository secret* to allow GitHub to automatically render and commit the materials.
In order to do this, you need to have a [GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with `repo` scope.
After generating an access token, add a new repository secret **in the newly created repository** by clicking Settings - Secrets - New repository secret.
Create a new secret with the name `ACCESS_TOKEN`, paste in your access token to the value field and click Add secret.
Second, publish the new repository on GitHub pages.
**In the new repository**, click on Settings - Pages.
Under the Source section, Select the `main` branch, choose the `/docs` root directory, and click Save.
GitHub will provide you with an URL where the course materials are automatically published after rendering.
## Editing content
The course materials are written using R Markdown and rendered to HTML using [Bookdown](https://bookdown.org).
Editing the .Rmd files triggers a GitHub workflow that renders the materials to the [docs/](docs) directory.
See the [Bookdown documentation](https://bookdown.org) for instructions on Rmd syntax.
You can also render locally with Docker using the [render.sh](render.sh) ([render.ps1](render.ps1) on Windows) script.
For Windows, you may need to enable script support first.
Open Powershell as an administrator and run the command `Set-ExecutionPolicy RemoteSigned`.
## Rendering
The [index.Rmd](src/index.Rmd) file is a special file that always gets rendered first
Other Rmd files get rendered in alphabetic order to separate pages.
Use the YAML header section (separated by `---`) of index.Rmd to define a author, title, and abstract for the materials.
The HTML is rendered using custom HTML and CSS templates defined in the index.Rmd YAML header.
By default, these are [src/custom.html](src/custom.html) and [src/custom.css](src/custom.css).
Edit the template files to change the layout and appearance of the output.
Always preview the affect of changes to template files before committing changes.
This can be done by rendering the output HTML locally using [render.sh](render.sh).
After rendering, navigate to the out directory, start a http server (`python -m http.server`), and open [http://localhost:8000](http://localhost:8000). -->
7 changes: 7 additions & 0 deletions assets/css/bootstrap.min.css

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions assets/css/hamburgers.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*!
* Hamburgers
* @description Tasty CSS-animated hamburgers
* @author Jonathan Suh @jonsuh
* @site https://jonsuh.com/hamburgers
* @link https://github.com/jonsuh/hamburgers
*/
.hamburger {
padding: 15px 15px;
display: inline-block;
cursor: pointer;
transition-property: opacity, filter;
transition-duration: 0.15s;
transition-timing-function: linear;
font: inherit;
color: inherit;
text-transform: none;
background-color: transparent;
border: 0;
margin: 0;
overflow: visible; }
.hamburger:hover {
opacity: 0.7; }
.hamburger.is-active:hover {
opacity: 0.7; }
.hamburger.is-active .hamburger-inner,
.hamburger.is-active .hamburger-inner::before,
.hamburger.is-active .hamburger-inner::after {
background-color: #fbfbfb; }

.hamburger-box {
width: 40px;
height: 24px;
display: inline-block;
position: relative; }

.hamburger-inner {
display: block;
top: 50%;
margin-top: -2px; }
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
width: 40px;
height: 4px;
background-color: #000;
border-radius: 4px;
position: absolute;
transition-property: transform;
transition-duration: 0.15s;
transition-timing-function: ease; }
.hamburger-inner::before, .hamburger-inner::after {
content: "";
display: block; }
.hamburger-inner::before {
top: -10px; }
.hamburger-inner::after {
bottom: -10px; }

/*
* Arrow
*/
.hamburger--arrow.is-active .hamburger-inner::before {
transform: translate3d(-8px, 0, 0) rotate(-45deg) scale(0.7, 1); }

.hamburger--arrow.is-active .hamburger-inner::after {
transform: translate3d(-8px, 0, 0) rotate(45deg) scale(0.7, 1); }

/*
* Collapse
*/
.hamburger--collapse .hamburger-inner {
top: auto;
bottom: 0;
transition-duration: 0.13s;
transition-delay: 0.13s;
transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }
.hamburger--collapse .hamburger-inner::after {
top: -20px;
transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), opacity 0.1s linear; }
.hamburger--collapse .hamburger-inner::before {
transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); }

.hamburger--collapse.is-active .hamburger-inner {
transform: translate3d(0, -10px, 0) rotate(-45deg);
transition-delay: 0.22s;
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
.hamburger--collapse.is-active .hamburger-inner::after {
top: 0;
opacity: 0;
transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), opacity 0.1s 0.22s linear; }
.hamburger--collapse.is-active .hamburger-inner::before {
top: 0;
transform: rotate(-90deg);
transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1); }
Loading

0 comments on commit e712136

Please sign in to comment.