Skip to content
Public template

About

A starting point for tutorials by OSGeo Indonesia

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Tutorial template

A starting point for tutorials by OSGeo Indonesia: a bilingual website (English and Bahasa Indonesia) of chapters written as Jupyter notebooks or plain pages, in the style of osgeo.id, published with GitHub Pages. Authors write chapters; the template handles the menus, the language switch, the boxes, the checks and the publishing.

Bahasa Indonesia: README.id.md. See it working: osgeo.id/tutorial-template.

Start a tutorial

  1. On GitHub, Use this template > Create a new repository (in the osgeoid organisation or your own).

  2. Clone it and set it up once:

    python tools/init_tutorial.py

    It asks for the title in both languages and the repository name, and writes them everywhere they are needed. Add --remove-examples to delete the two example chapters.

  3. Create the environment: conda env create -f environment.yml, then add what your chapters need.

  4. Start a chapter: python tools/new_chapter.py 01 data "Getting the data" (add --lang id to write in Indonesian first). The number is the chapter's place in the tutorial: use 01 if you removed the example chapters, or 03 if you kept them.

  5. Write it, run it from top to bottom, and look at the site while you work: python tools/site.py preview.

  6. Push. In the repository's Settings > Pages, set Source to GitHub Actions once; after that every push to main publishes the site.

The tools need Python with pyyaml, and Quarto 1.11 or later on your PATH.

What the template gives you

Part What it does Where
One chapter list Titles and order in both languages, in one file. Menus, sidebars and the chapter tables on the home pages are built from it tutorial.yml, tools/prepare.py
Missing languages handled A chapter written in one language only gets a page in the other that says so and links to the version that exists, marked in the menus tools/prepare.py, assets/i18n.lua
Language switch The EN/ID button goes to the same chapter in the other language; the root address sends readers to their browser's language assets/i18n.lua, assets/html/lang-switcher.html, index.qmd
Translation tracking Each translation records which version of its source it was made from. When the source changes, the translation is listed as stale and its page shows a notice tools/translations.py, assets/translation-status.lua
Boxes from plain text A bold lead-in ("Learning objectives.", "Slow cell", "Look before moving on." and their Indonesian forms) becomes a coloured box on the website; the notebook keeps plain text assets/callouts.lua
At a glance What the chapter builds, what it needs, how long it takes and its level, from the front matter, in the page's language assets/glance.lua
Source ledger Every fact not computed in the chapter has a MEASURED or CITED row; "ledger L1" in the text links to it on the sources page ledger.md, assets/ledger-links.lua
Chapter scaffold A new chapter with the standard sections, in either language tools/new_chapter.py
Checks Broken links and anchors, missing language links, images without alternative text, oversized notebooks tools/check_site.py, tools/check_size.py
Publishing Renders, checks and publishes on every push to main; builds and checks pull requests without publishing .github/workflows/publish.yml
osgeo.id look Fonts, colours, navbar and footer of osgeo.id assets/

How it fits together

tutorial.yml        titles and order of the chapters             (you edit)
en/, id/            the chapters: NN-name.ipynb or NN-name.qmd   (you edit)
ledger.md           sources of facts and numbers                 (you edit)
sample-data/        small files the chapters read                (you edit)
tools/prepare.py    writes menus, placeholders, sources page     (runs before every render)
tools/site.py       prepare + render + check                     (what you run)
assets/             look and behaviour of the website            (rarely edited)

The website never runs code: chapters are saved with their outputs, and Quarto only formats them. So the publishing workflow needs no data and none of your chapters' software.

Working in a cloud-synced folder

If the repository sits in OneDrive, Dropbox or Google Drive, render outside it: python tools/site.py render --outside D:/build/my-tutorial. Quarto writes thousands of small files while it renders, and a sync client uploading them at the same time slows both down. For the same reason, keep data and large outputs outside the synced folder.

Contributing and licence

Writing, translating and checking are described in CONTRIBUTING.md and in the example Chapter 2. Code is under the MIT licence; text and figures under CC BY 4.0.

About

A starting point for tutorials by OSGeo Indonesia

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages