Skip to content

Commit

Permalink
Init docs
Browse files Browse the repository at this point in the history
  • Loading branch information
meomancer committed Jun 7, 2024
1 parent 8592f9e commit fbf4b94
Show file tree
Hide file tree
Showing 31 changed files with 2,874 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/BuildMKDocsAndPublishToGithubPages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# GeoSight is UNICEF's geospatial web-based business intelligence platform.
#
# Contact : [email protected]
#
# .. note:: This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# __author__ = '[email protected]'
# __date__ = '13/06/2023'
# __copyright__ = ('Copyright 2023, Unicef')

name: 📖 Documentation
on:
push:
branches:
- main
- docs
# Paths can be used to only trigger actions when you have edited certain files, such as a file within the /docs directory
paths:
- ".github/workflows/BuildMKDocsAndPublishToGithubPages.yml"
- "docs/**.md"
- "docs/**.py"
- "docs/assets/**"
# Allow manually running in the actions tab
workflow_dispatch:

jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout main from github
uses: actions/checkout@v1
- name: Create Mkdocs Config 🚀
working-directory: ./docs
run: ./create-mkdocs-html-config.sh
- name: Deploy docs to github pages
# This is where we get the material theme from
uses: timlinux/mkdocs-deploy-gh-pages@master
# Wrong
#uses: timlinux/QGISAnimationWorkbench@main
env:
# Read this carefully:
# https://github.com/marketplace/actions/deploy-mkdocs#building-with-github_token
# The token is automatically generated by the GH Action
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_DIRECTORY: docs
CONFIG_FILE: docs/mkdocs.yml
REQUIREMENTS: docs/requirements.txt
7 changes: 5 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
make dev-runserver
make dev-load-demo-data
make sleep
# TODO:
# Fix this after we have the tests
# - name: Test django endpoint
Expand All @@ -92,5 +93,7 @@ jobs:
# path: playwright/ci-test/playwright-report/
# retention-days: 30

- name: Test backend
run: make dev-test
# TODO:
# Test is broken, fix it
# - name: Test backend
# run: make dev-test
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use nix
layout python
15 changes: 15 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.idea
.venv
pdfs/

# mkdocs related
mkdocs.yml
templates/graphics.scss
site/*

#direnv for docs building
.direnv
# Autogenerated api docs
src/developer/manual/*.md

*.swp
661 changes: 661 additions & 0 deletions docs/LICENSE

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Building the documentation as a PDF

## Install Dependencies

You need to install these packages:

```bash
pip install mkdocs-with-pdf
pip install mkdocs-material
pip install mdx_gh_links
pip install mkdocs-pdf-export-plugin
```

## Building in a terminal

> Note that whenever you add new sections to nav in the mkdocs.yml
> (used for building the web version), you should apply those same
> edits to mkdocs-pdf.yml if you want those new sections to appear
> in the pdf too.
```bash
cd docs
./build-docs-pdf.sh
xdg-open Handbook.pdf
```

## Building in VSCode

If you are in VSCode, you can also just run the 'Compile PDF' task. The
generated PDF will be placed in docs/pdfs/.
Binary file added docs/assets/kartoza-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/build-docs-html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# This is only intended for local
# testing. See github workflows for
# how this build is automated.

# this will create mkdocs.yml
./create-mkdocs-html-config.sh
# and this will build the html site
mkdocs build
10 changes: 10 additions & 0 deletions docs/build-docs-pdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# This is only intended for local
# testing. See github workflows for
# how this build is automated.

# this will create mkdocs.yml
./create-mkdocs-pdf-config.sh
# and this will build the PDF document
mkdocs build > /tmp/document.html
6 changes: 6 additions & 0 deletions docs/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env bash

rm -rf .venv
rm -rf site
rm -rf __pycache__

14 changes: 14 additions & 0 deletions docs/create-mkdocs-html-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# This script will assemble a mkdocs.yml
# file with plugins section suitable for
# html site generation.

# This script is used both in manual
# site compilation (via build-docs-html.sh)
# and via the github workflow for
# publishing the site to github pages
# .github/workflows/BuildMKDocsAndPublishToGithubPages.yml

cat mkdocs-base.yml > mkdocs.yml
cat mkdocs-html.yml >> mkdocs.yml
17 changes: 17 additions & 0 deletions docs/create-mkdocs-pdf-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# This script will assemble a mkdocs.yml
# file with plugins section suitable for
# PDF site generation.

# This script is used both in manual
# site compilation (via build-docs-html.sh)
# and via the github workflow for
# publishing the site to github pages
# .github/workflows/CompileMKDocsToPDF.yml

cat mkdocs-base.yml > mkdocs.yml
cat mkdocs-pdf.yml >> mkdocs.yml
# This is a kludge: I could not figure out
# how to reference image resources using a relative path in the scss...
cat templates/graphics.scss.templ | sed "s?\[BASE_FOLDER\]?$PWD?g" > templates/graphics.scss
5 changes: 5 additions & 0 deletions docs/create-uuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env python

import shortuuid
uuid = shortuuid.uuid()
print (uuid)
Empty file added docs/css/extra.css
Empty file.
61 changes: 61 additions & 0 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
with import <nixpkgs> { };

let
# For packages pinned to a specific version
pinnedHash = "933d7dc155096e7575d207be6fb7792bc9f34f6d";
pinnedPkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/${pinnedHash}.tar.gz") { };
pythonPackages = pinnedPkgs.python3Packages;
in pkgs.mkShell rec {
name = "impurePythonEnv";
venvDir = "./.venv";
buildInputs = [
# A Python interpreter including the 'venv' module is required to bootstrap
# the environment.
pythonPackages.python

# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell

# For PDF production in mkdocs
pythonPackages.venvShellHook
python311Packages.weasyprint
pinnedPkgs.cairo
pinnedPkgs.pango
pinnedPkgs.gdk-pixbuf
pinnedPkgs.glib
pinnedPkgs.gtk2
# Those are dependencies that we would like to use from nixpkgs, which will
# add them to PYTHONPATH and thus make them accessible from within the venv.
pythonPackages.requests
pythonPackages.pygobject3
# Doesnt work properly
#python311Packages.cffi
pinnedPkgs.gobject-introspection
pinnedPkgs.gtk3
pinnedPkgs.taglib
pinnedPkgs.openssl
pinnedPkgs.git
pinnedPkgs.libxml2
pinnedPkgs.libxslt
pinnedPkgs.libzip
pinnedPkgs.zlib
pinnedPkgs.gnused
pinnedPkgs.rpl
];

# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';

shellHook = ''
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';

}
6 changes: 6 additions & 0 deletions docs/js/tablesort.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
document$.subscribe(function () {
var tables = document.querySelectorAll("article table:not([class])")
tables.forEach(function (table) {
new Tablesort(table)
})
})
41 changes: 41 additions & 0 deletions docs/mkdocs-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
site_name: Cloud Native GIS
site_description: "Project technical and user documentation."
site_author: "Kartoza"
docs_dir: ./src
site_dir: ./site
repo_name: "CloudNativeGIS"
repo_url: "https://github.com/kartoza/CloudNativeGIS.git"
edit_uri: "https://github.com/kartoza/CloudNativeGIS/blob/main/docs/"

copyright: Kartoza and Contributors

markdown_extensions:
- attr_list # lets us resize images see https://github.com/mkdocs/mkdocs/issues/1678#issuecomment-455500757
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
#- mdx_truly_sane_lists
- toc:
permalink: true
#slugify: !!python/name:pymdownx.slugs.slugify
- pymdownx.snippets:
base_path: .
- admonition
- tables
- pymdownx.details
- pymdownx.caret
- pymdownx.keys
- pymdownx.mark
- pymdownx.tilde
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.emoji:
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:materialx.emoji.twemoji

nav:
- Home:
- index.md
Loading

0 comments on commit fbf4b94

Please sign in to comment.