Compare commits

...

47 commits

Author SHA1 Message Date
c4038b34cf fix: ignore md files in docs/ and slides/
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-22 23:43:32 +02:00
18689043a4 fix: bump versions in pipfile 2024-09-22 23:43:02 +02:00
acec55dfff refactor: move tasks in subfiles 2024-09-22 23:42:26 +02:00
a58dcec4ca fix: switch to recent version of sass 2024-09-22 23:24:30 +02:00
cf07f3b064 refactor: split Makefile into task files 2024-09-10 18:43:40 +02:00
1ebd4cbd4f refactor(make): split Makefile into sub-tasks files 2024-08-05 12:36:47 +02:00
b525f75055 Merge branch 'master' of code.apps.glenux.net:glenux/docmachine-containers
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-11 22:29:31 +02:00
daf532a83a feat: enable navigation footer 2024-06-11 22:28:00 +02:00
8c56abd321 Update README.md
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-02 07:11:52 +00:00
3d70d70f2f fix: change caddy port 2024-05-12 21:27:24 +02:00
d69b02e78c fix: change caddy port
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2024-05-12 21:27:03 +02:00
dcc20d6b3f feat: add support for margins & draft class
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-12 21:25:10 +02:00
d123b3cd65 chore: bump marp versions 2024-04-17 17:05:16 +02:00
0e364f496d feat: add support for rsync (needed by image subdirs)
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-16 23:58:51 +01:00
26a71920b0 fix: ignore caddy for now 2024-02-16 23:58:29 +01:00
f0463071cc chore: update marp dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-16 23:58:12 +01:00
bc3f0f911f fix: ignore _* files and dirs & manage image subfolders 2024-02-16 23:57:43 +01:00
8c259145ef fix: enable code highlight in marp 2024-02-16 23:56:36 +01:00
1fe182d9fe chore: ignore autoslide 2024-02-01 14:15:34 +01:00
bee16a9593 Bump debian and python versions 2024-02-01 14:12:24 +01:00
b50a639d9d chore: Remove script/docmachine* scripts now we have real tools 2023-04-06 20:22:22 +02:00
53a626474c make: Fix bad ref and help text for PPTX
All checks were successful
continuous-integration/drone/push Build is passing
2023-04-06 20:20:15 +02:00
9fd96ed628 make: Auto-build autoslide 2023-04-06 20:15:54 +02:00
434c3d72e0 doc: Update README
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-16 12:36:18 +01:00
faad02b41c fix: docker build must ignore drone file
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-16 12:25:43 +01:00
e3ef99661a ci: remove useless build step
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-16 12:18:02 +01:00
19e166d879 ci: fix image name
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-16 12:00:40 +01:00
262ed88922 ci: fix dockerfile path
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-01-16 11:59:23 +01:00
760d118240 brand: rename project
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-16 11:56:01 +01:00
3deea69d24 config: enable codehilite 2023-01-16 11:46:45 +01:00
adaa7c0f25 fix: Force version number for node image 2023-01-12 08:47:45 +01:00
c5b12cb0a8 fix: Make sure autoslide is run before watch 2023-01-12 08:47:21 +01:00
f638a9d5a3 Add extra JS & CSS 2022-11-18 16:13:28 +01:00
aee774329f feat: Kill previous container for the same project if it exists 2022-11-02 20:55:53 +01:00
6b315b2f44 doc: Improve readability of script 2022-11-02 20:53:20 +01:00
b601b7b865 fix: PDF build for docs must output to docs.pdf 2022-08-29 17:10:03 +02:00
f6b8e5d1f6 doc: Update doc structure 2022-08-18 11:14:02 +02:00
d6844f9a31 chore(dirs): Remove useless directories 2022-08-18 10:56:51 +02:00
9df6e9911f fix: Use Marp configuration files 2022-08-18 10:55:58 +02:00
854fbd7502 chore(dirs): Remove useless directories 2022-08-18 10:55:38 +02:00
c94391d782 Merge branch 'master' of github.com:glenux/teaching-boilerplate 2022-06-20 12:18:56 +02:00
f1cb3b484d
Merge pull request #28 from glenux/dependabot/npm_and_yarn/follow-redirects-1.14.8
build(deps): bump follow-redirects from 1.14.7 to 1.14.8
2022-04-26 11:27:11 +02:00
c8c3bb90d7
Merge pull request #27 from glenux/dependabot/npm_and_yarn/node-sass-7.0.0
build(deps): bump node-sass from 6.0.1 to 7.0.0
2022-04-26 11:27:00 +02:00
1fca4d68a0
Merge pull request #29 from glenux/dependabot/pip/pillow-9.0.1
build(deps): bump pillow from 9.0.0 to 9.0.1
2022-04-26 11:26:45 +02:00
dependabot[bot]
a02c03e960
build(deps): bump pillow from 9.0.0 to 9.0.1
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.0 to 9.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.0.0...9.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-12 01:09:45 +00:00
dependabot[bot]
7d3811cb3c
build(deps): bump follow-redirects from 1.14.7 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-15 10:30:47 +00:00
dependabot[bot]
4f0fccc3b9
build(deps): bump node-sass from 6.0.1 to 7.0.0
Bumps [node-sass](https://github.com/sass/node-sass) from 6.0.1 to 7.0.0.
- [Release notes](https://github.com/sass/node-sass/releases)
- [Changelog](https://github.com/sass/node-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/node-sass/compare/v6.0.1...v7.0.0)

---
updated-dependencies:
- dependency-name: node-sass
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-10 22:02:50 +00:00
27 changed files with 2236 additions and 4322 deletions

View file

@ -2,3 +2,8 @@
examples
exercises
node_modules
.drone.yml
docs/*.md
docs/**/*.md
slides/*.md
slides/**/*.md

59
.drone.yml Normal file
View file

@ -0,0 +1,59 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: debug
image: alpine
environment:
commands:
- 'echo "Repository: glenux/docmachine"'
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
- name: publish:commit_branch
image: plugins/docker
# volumes:
# - name: cache
# path: /stupid
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/docmachine:latest_${DRONE_BRANCH/\\//-}"
context: .
dockerfile: docker/Dockerfile
repo: glenux/docmachine
tags:
- "latest_${DRONE_BRANCH/\\//-}"
- "${DRONE_COMMIT_SHA:0:8}"
purge: false
when:
branch:
- "master"
- "develop"
- "feature/*"
- name: publish:latest
image: plugins/docker
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/docmachine:latest_${DRONE_BRANCH/\\//-}"
context: .
dockerfile: docker/Dockerfile
repo: glenux/docmachine
tags: latest
purge: false
when:
branch:
- master
# volumes:
# - name: cache
# temp: {}
#

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
.bundle
*.docx
*.epub
/slides/autoslide.md
/images/*.circo.svg
/images/*.dot.svg
/images/*.ora.png

View file

@ -5,8 +5,10 @@ build: theme.css
%.css: %.scss
cd .. \
&& npx node-sass --output-style compressed .marp/$< > .marp/$@ \
&& npx sass --no-error-css --no-source-map .marp/$<:.marp/$@ \
|| ( rm -f .marp/$@ && exit 1 )
.PHONY: build
clean:
rm -f theme.css

View file

@ -1,6 +1,7 @@
// engine.js
// You have to run `npm i @marp-team/marp-core` at first.
const { Marp } = require('@marp-team/marp-core')
const highlightLines = require('markdown-it-highlight-lines')
module.exports = opts => {
@ -10,11 +11,12 @@ module.exports = opts => {
opts.html = true
// console.log(opts)
const marp = new Marp(opts)
// Disable parsing fragmented list
marp.markdown.core.ruler.disable('marpit_fragment')
return marp
// Enable code lines highlighting
// ref. https://github.com/marp-team/marp-vscode/issues/146
return marp.use(highlightLines)
}

View file

@ -2,14 +2,15 @@
@import-theme 'default';
$primaryColor: #662d91;
$secondaryColor: #241c1c;
$tertiaryColor: #111111;
$secondaryColor: #f60;
$tertiaryColor: #241c1c;
$textColor: #111111;
body {
--primary-color: $primaryColor;
--secondary-color: $secondaryColor;
--text-color: $tertiaryColor;
--tertiary-color: $tertiaryColor;
--text-color: $textColor;
}
section {
@ -18,6 +19,14 @@ section {
padding: 120px 80px 80px 80px;
}
// https://github.com/marp-team/marp-vscode/issues/146
.highlighted-line {
background-color: #ff0;
display: block;
margin: 0 -16px;
padding: 0 16px;
}
section footer {
opacity: 0.75;
color: $textColor; }
@ -131,6 +140,23 @@ section > h6:first-child::before
section:not(.chapter) > h2:first-child {
font-size: 100%; }
section.draft {
box-shadow: inset 20px 20px 0px red, inset -20px 20px 0px red, inset 20px -20px 0px red, inset -20px -20px 0px red;
}
section.draft::before {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(-30deg);
font-size: 100px;
display: block;
content: "DRAFT";
color: darkred;
opacity: 0.25;
}
a {
color: inherit;
text-decoration: underline; }
@ -159,10 +185,22 @@ bc-row > bc-column {
flex: 1 1 0;
}
bc-row > bc-column[bc-margin-small] {
margin-left: 50px;
}
bc-row > bc-column[bc-margin-tiny] {
margin-left: 25px;
}
bc-row > bc-column[bc-text-small] {
font-size: 90%;
}
bc-row > bc-column[bc-text-tiny] {
font-size: 80%;
}
bc-row > bc-column[bc-width-large] {
flex: 2 1 0;
}
@ -179,6 +217,12 @@ bc-row > bc-column[bc-secondary] {
padding: 24px;
}
bc-row > bc-column[bc-tertiary] {
background-color: $tertiaryColor;
color: white;
padding: 24px;
}
bc-row > bc-column[bc-grey] {
background-color: #eeeeee;
padding: 24px;
@ -194,6 +238,10 @@ bc-row > bc-column:first-of-type {
margin-left: 0px;
}
bc-row > bc-column p:only-child {
margin-bottom: 0px;
}
bc-row > bc-column > h1:first-child,
bc-row > bc-column > h2:first-child,
bc-row > bc-column > h3:first-child,
@ -203,7 +251,7 @@ bc-row > bc-column > h6:first-child {
margin-top: 0;
}
p img:first-child:last-child[alt*="center"] {
p img:only-child[alt*="center"] {
display: block;
margin-left: auto;
margin-right: auto;

183
Makefile
View file

@ -29,33 +29,35 @@ DOCS_PORT=5100
SLIDES_PORT=5200
## Find .md slides
SLIDES_MDPP=$(shell find $(SLIDES_DIR) \( -name '*.mdpp' ! -name '_*' \))
SLIDES_MDPP=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.mdpp' ! -regex '.*/_.*' \))
SLIDES_MDPP_MD=$(patsubst $(SLIDES_DIR)/%.mdpp,$(CACHE_SLIDES_DIR)/%.mdpp.md,$(SLIDES_MDPP))
SLIDES_MDPP_MD_PDF=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MDPP_MD))
SLIDES_MDPP_MD_PPTX=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MDPP_MD))
SLIDES_MD=$(shell find $(SLIDES_DIR) \( -name '*.md' ! -name '_*' \)) $(SLIDES_MDPP_MD)
SLIDES_MD=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \)) $(SLIDES_MDPP_MD)
SLIDES_MD_PDF=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MD))
SLIDES_MD_PPTX=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MD))
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD)
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF)
SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX)
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD) $(SLIDES_DIR)/autoslide.md
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF) $(BUILD_SLIDES_DIR)/autoslide.pdf
SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX) $(BUILD_SLIDES_DIR)/autoslide.pptx
DOCS_MD=$(shell find -L $(DOCS_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \))
## Find .uml graphs
DOCS_IMAGES_UML=$(shell find $(IMAGES_DIR) \( -name '*.uml' ! -name '_*' \))
DOCS_IMAGES_UML=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.uml' ! -regex '.*/_.*' \))
DOCS_IMAGES_UML_SVG=$(patsubst $(IMAGES_DIR)/%.uml,$(BUILD_IMAGES_DIR)/%.uml.svg,$(DOCS_IMAGES_UML))
## Find .dot graphs
DOCS_IMAGES_DOT=$(shell find $(IMAGES_DIR) \( -name '*.dot' ! -name '_*' \))
DOCS_IMAGES_DOT=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.dot' ! -regex '.*/_.*' \))
DOCS_IMAGES_DOT_SVG=$(patsubst $(IMAGES_DIR)/%.dot,$(BUILD_IMAGES_DIR)/%.dot.svg,$(DOCS_IMAGES_DOT))
## Find .circo graphs
DOCS_IMAGES_CIRCO=$(shell find $(IMAGES_DIR) \( -name '*.circo' ! -name '_*' \))
DOCS_IMAGES_CIRCO=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.circo' ! -regex '.*/_.*' \))
DOCS_IMAGES_CIRCO_SVG=$(patsubst $(IMAGES_DIR)/%.circo,$(BUILD_IMAGES_DIR)/%.circo.svg,$(DOCS_IMAGES_CIRCO))
## Find .ora images
DOCS_IMAGES_ORA=$(shell find $(IMAGES_DIR) \( -name '*.ora' ! -name '_*' \))
DOCS_IMAGES_ORA=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.ora' ! -regex '.*/_.*' \))
DOCS_IMAGES_ORA_PNG=$(patsubst $(IMAGES_DIR)/%.ora,$(BUILD_IMAGES_DIR)/%.ora.png,$(DOCS_IMAGES_ORA))
## Merge all lists
@ -68,21 +70,8 @@ all: help
## Install prerequisites
##
prepare: prepare-slides prepare-docs ## install prerequisites
prepare-slides: ## install prerequisites for PDF slides only
npm install
npx browserslist@latest --update-db
prepare-docs: ## install prerequisites for static docs site only
pipenv install
# if [ "$(SYSTEM_INSTALL)" -eq 1 ]; then \
# pipenv install --deploy --system ; \
#else \
# pipenv install ; \
#fi
.PHONY: prepare prepare-slides prepare-docs
.PHONY: prepare
prepare:
images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
@echo "Source:"
@ -91,6 +80,9 @@ images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
@echo " dot: $(DOCS_IMAGES_DOT)"
@echo " circo: $(DOCS_IMAGES_CIRCO)"
@echo "Built: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG)"
for dir in $$(find -L $(DOCS_DIR) -type d -regextype sed -regex '.*/[0-9][^/]*/images$$') $(DOCS_DIR)/images ; do \
rsync -av $$dir/ $(SLIDES_DIR)/images/ || exit 1 ; \
done
.PHONY: images
@ -114,80 +106,16 @@ $(CACHE_SLIDES_DIR)/%.mdpp.md: $(SLIDES_DIR)/%.mdpp
m4 -d -I$(SLIDES_DIR) -I$(CACHE_SLIDES_DIR) $< > $@ \
|| ( rm -f $@ && exit 1 )
.marp/theme.css:
cd .marp && $(MAKE) theme.css
watch: ## run development server
pipenv run honcho start
autoslide:
find $(DOCS_DIR) -regextype sed -regex '.*/[0-9][^/]*\.md' -print0 \
| sort -z |xargs -0 cat \
> $(SLIDES_DIR)/autoslide.md
watch-autoslide-internal:
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 0.25 ; \
$(MAKE) autoslide ; \
done
watch-tocupdate-internal:
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 2 ; \
$(MAKE) images ; \
done
watch-docs-internal:
pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT)
watch-slides-internal: .marp/theme.css
PORT=$(SLIDES_PORT) \
npx marp \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
-w $(SLIDES_DIR) \
-s
watch-slides: ## run development server for PDF slides
pipenv run honcho start slides autoslide
watch-docs: ## run development server for static docs site
pipenv run honcho start docs toc
$(MAKE) autoslide
pipenv run honcho start
serve: watch
serve-slides: watch-slides
serve-docs: watch-docs
.PHONY: watch watch-slides watch-docs watch-slides-internal watch-docs-internal serve serve-docs serve-slides
$(BUILD_SLIDES_DIR)/%.pdf: $(CACHE_SLIDES_DIR)/%.mdpp.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pdf: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pptx: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR):
mkdir -p $(BUILD_SLIDES_DIR)
.PHONY: watch serve
.PHONY: watch-docs serve-docs
.PHONY: watch-docs-internal
##
## Build final documents
@ -206,37 +134,7 @@ build-html: build-docs-html build-slides-html ## build both docs and slides as
build-docs: build-docs-pdf build-docs-html ## build only docs as PDF and HTML
build-slides: build-slides-pdf build-slides-html ## build only slides as PDF and HTML
build-slides-pptx: $(SLIDES_PPTX_ALL) $(SLIDES_PPTX_ALL) ## build PDF slides only
build-slides-pdf: $(SLIDES_PDF_ALL) $(SLIDES_MD_ALL) ## build PDF slides only
build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only
merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL)
build-docs-pdf: ## build pdf docs only
mkdir -p $(BUILD_DOCS_DIR)
rm -f $(BUILD_DOCS_DIR)/combined.pdf
PYTHONUTF8=1 \
ENABLE_PDF_EXPORT=1 \
pipenv run mkdocs build \
--site-dir $(BUILD_DOCS_DIR)
pdftk \
$$(find $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \
cat output $(BUILD_DOCS_DIR)/combined.pdf
build-docs-html: ## build static docs site only
mkdir -p $(BUILD_DOCS_DIR)
pipenv run mkdocs build \
--site-dir $(BUILD_DOCS_DIR)
.PHONY: build build-slides
deploy-docs: ## deploy static docs site to github
git push $(DEPLOY_REPO)
pipenv run mkdocs gh-deploy $(DEPLOY_OPTS)
.PHONY: build
help: ## print this help
@echo "Usage: make <target>"
@ -255,36 +153,13 @@ help: ## print this help
## Clean
##
clean: clean-slides clean-docs # remove generated documents
clean: # remove generated documents
clean-slides:
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
.PHONY: clean
clean-docs:
rm -fr $(BUILD_DOCS_DIR) # remove generated static docs site
include tasks/docs.mk
include tasks/slides.mk
include tasks/docker.mk
include tasks/utils.mk
include tasks/images.mk
.PHONY: clean clean-slides clean-docs
##
## Utilities
##
fixme:
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
.PHONY: fixme
docker-build: ## build docker image
docker build \
--file docker/Dockerfile \
--tag glenux/teaching-boilerplate:$(BUILD_VERSION) \
.
docker tag \
glenux/teaching-boilerplate:$(BUILD_VERSION) \
glenux/teaching-boilerplate:latest
docker-push: ## push docker image
env docker push glenux/teaching-boilerplate:latest
docker-pull: ## download docker image
env docker pull glenux/teaching-boilerplate:latest

View file

@ -20,4 +20,4 @@ pymdown-extensions = "*"
mkdocs-pdf-export-plugin = "*"
[requires]
python_version = "3.9"
python_version = "3.11"

1257
Pipfile.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,7 @@
docs: make watch-docs-internal
slides: make watch-slides-internal
toc: make watch-tocupdate-internal
autoslide: make watch-autoslide-internal
# src-docs: make sync-docs-internal
# src-slides: make sync-slides-internal
src-autoslide: make watch-autoslide-internal
watch-docs: make watch-docs-internal
watch-slides: make watch-slides-internal
watch-toc: make watch-tocupdate-internal
# proxy: caddy

View file

@ -1,10 +1,26 @@
# Teaching-Boilerplate
<!--
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
-->
## Prerequisites :
[![Build Status](https://cicd.apps.glenux.net/api/badges/glenux/docmachine-containers/status.svg)](https://cicd.apps.glenux.net/glenux/docmachine-containers)
![License LGPL3.0-or-later](https://img.shields.io/badge/license-LGPL3.0--or--later-blue.svg)
[![Donate on patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://patreon.com/glenux)
Make sure you have docker installed
> :information_source: This project is available on our self-hosted server and
> on CodeBerg and GitHub as mirrors. For the latest updates and comprehensive
> version of our project, please visit our primary repository at:
> <https://code.apps.glenux.net/glenux/docmachine-containers>.
## Usage
# DocMachine Containers
## Prerequisites
Make sure you have Docker installed.
## Writing content
### Create your directory tree
@ -18,33 +34,43 @@ Make sure you have docker installed
|- ...
```
### Write content for docs
### Content for docs
FIXME: tree structure
### Write content for slides
FIXME: autoslide feature
### Content for slides
### Watch mode
FIXME: tree structure
## Watch mode
This mode allows you the result on-the-fly as you makea changes in the content.
To use watch mode, type:
make watch
docmachine -a watch
To use watch mode for slides only type:
make watch-slides
docmachine -a watch-slides
To use watch mode for docs only type:
make watch-docs
docmachine -a watch-docs
### Build mode
## Build mode
This mode builds final content for delivery (website, PDF files)
### Building HTML
To use build mode:
make build
docmachine build
### Building PDF

10
caddy.conf Normal file
View file

@ -0,0 +1,10 @@
handle_path /docs* {
reverse_proxy 127.0.0.1:5100
}
handle_path /slides* {
reverse_proxy 127.0.0.1:5200
}

View file

@ -1,5 +1,5 @@
FROM node:bullseye-slim
MAINTAINER Glenn ROLLAND <glenux@glenux.net>
FROM node:18-bookworm-slim
LABEL maintainer="Glenn ROLLAND glenux@glenux.net"
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-pip pipenv \
@ -9,7 +9,7 @@ RUN apt-get update \
# Tools for running the common parts
RUN apt-get update \
&& apt-get install -y --no-install-recommends make build-essential inotify-tools gosu unzip curl \
&& apt-get install -y --no-install-recommends make build-essential inotify-tools gosu unzip curl rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
@ -28,6 +28,7 @@ RUN curl -sSL -o /usr/local/bin/yq \
&& chmod +x /usr/local/bin/yq
COPY . /app
COPY .marp /app/.marp
WORKDIR /app
ENV LANG=C.UTF-8 \

View file

@ -0,0 +1,49 @@
p > img[alt*="center"] {
display: block;
margin-left: auto;
margin-right: auto;
}
hr {
display: none;
}
@page {
size: a4 portrait;
margin: 25mm 10mm 25mm 10mm;
counter-increment: page;
font-family: "Noto", sans-serif;
white-space: pre;
color: grey;
@top-left {
font-size: 70%;
content: 'Formation « Cloud & Enjeux »';
}
/*
@top-center {
content: string(chapter);
}*/
@top-right {
font-size: 70%;
/* content: 'SQLI INSTITUT (ASTON)'; */
/* content: 'AELION'; */
content: '';
}
@bottom-left {
font-size: 70%;
content: '2017-2022 © Glenn ROLLAND - Ne pas diffuser';
}
/*
@bottom-center {
content: string(chapter);
}*/
/*
@bottom-right {
font-size: 70%;
content: 'Page ' counter(page);
}*/
}

View file

@ -0,0 +1,18 @@
window.MathJax = {
tex: {
inlineMath: [["\\(", "\\)"]],
displayMath: [["\\[", "\\]"]],
processEscapes: true,
processEnvironments: true
},
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {
MathJax.typesetPromise()
})

View file

View file

View file

@ -6,12 +6,13 @@ site_dir: _build/docs
# theme_dir: 'themes/mkdocs-material'
site_author: 'Glenn Y. Rolland'
site_url: 'http://glenux.github.io/teaching-boilerplate'
site_url: 'https://glenux.net'
# copyright: 'Copyright (c) 2016 Glenux'
repo_name: 'Source'
repo_url: 'https://bitbucket.com/glenux-corp/teaching-boilerplate'
repo_url: ''
# https://bitbucket.com/glenux-corp/teaching-boilerplate'
# site_favicon: 'favicon.ico'
theme:
@ -27,6 +28,7 @@ theme:
neutral: 'black'
features:
- navigation.sections
- navigation.footer
# - navigation.tabs
# - navigation.tabs.sticky
@ -36,9 +38,16 @@ i18n:
extra_css:
- css/extra.css
- ../docs.assets/css/extra.css
# - css/source.css
# - css/patch.css
extra_javascript:
- js/extra.js
- ../docs.assets/javascript/mathjax.js
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
# - ../docs.assets/javascript/extra.js
# author:
# github: 'glenux'
@ -55,8 +64,8 @@ markdown_extensions:
- pymdownx.highlight:
anchor_linenums: false
- pymdownx.inlinehilite
# - codehilite:
# guess_lang: false
- codehilite:
guess_lang: true
# pip install mdx_truly_sane_lists
- mdx_truly_sane_lists
@ -67,6 +76,8 @@ markdown_extensions:
#
# pip install pymdown-extensions
- pymdownx.superfences:
# - pymdownx.arithmatex:
# generic: true
# plugins: []
plugins:

4409
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -12,12 +12,11 @@
"author": "",
"license": "ISC",
"dependencies": {
"@marp-team/marp-cli": "^1.5.0",
"@marp-team/marp-cli": "^1.4.1",
"@marp-team/marp-core": "^3.9.0",
"foreman": "^3.0.1",
"node-sass": "^6.0.1"
},
"devDependencies": {
"@marp-team/marp-core": "^3.0.0",
"markdown-it-footnote": "^3.0.2"
"markdown-it-footnote": "^3.0.2",
"markdown-it-highlight-lines": "^1.0.2",
"sass": "^1.79.3"
}
}

View file

@ -1,86 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
require 'find'
require 'thor'
require 'colorize'
EXCLUDE_LIST = ['.git', 'node_modules'].freeze
SKEL_DIR = ENV['HOME'] + '/src/Glenux.Teaching/teaching-boilerplate'
if ! File.directory? SKEL_DIR
warn "ERROR: missing #{SKEL_DIR}"
exit 1
end
# TeachingCli
class TeachingCli < Thor
desc 'create PROJECT', 'Create PROJECT directory'
def create(target)
# Create dir
if target.empty?
warn 'Target not specified'
exit 1
end
puts "Creating project #{target}"
FileUtils.mkdir_p target
# Create structure
Find.find(SKEL_DIR) do |path|
if EXCLUDE_LIST.include? File.basename(path)
Find.prune
next
end
next unless File.directory?(path)
shortpath = path.gsub(SKEL_DIR, '').gsub(%r{^/}, '')
next if shortpath.empty?
targetpath = File.join(target, shortpath)
print "Creating directory #{shortpath}… "
FileUtils.mkdir_p targetpath
puts 'ok'.green
end
# Create files if possible
Find.find(SKEL_DIR) do |path|
if EXCLUDE_LIST.include? File.basename(path)
Find.prune
next
end
next if File.directory?(path)
shortpath = path.gsub(SKEL_DIR, '').gsub(%r{^/}, '')
next if shortpath.empty?
targetpath = File.join(target, shortpath)
print "Creating file #{shortpath}… "
# File does not exist => install it
unless File.exist? targetpath
FileUtils.cp path, targetpath
puts 'ok (installed)'.green
next
end
# File exist & different
unless system 'cmp', '--quiet', path, targetpath
if File.exist? targetpath + '.new'
puts 'error (pease solve previous conflict)'.red
else
puts 'warning (conflict when creating file)'.yellow
FileUtils.cp path, targetpath + '.new'
end
next
end
puts 'ok (identical)'.green
FileUtils.cp path, targetpath
end
end
end
TeachingCli.start(ARGV)

View file

@ -1,120 +0,0 @@
#!/bin/sh
# vim: set ft=sh:
# Set defaults
BASEDIR="$(pwd)"
ACTION="watch"
VERBOSITY="0"
DOCKER_IMAGE=glenux/teaching-boilerplate:latest
DOCKER_OPT_TTY="-t"
gxt_usage() {
echo "Usage: $0 [options]"
echo ""
echo "-d, --data-dir DIR Content directory"
echo "-a, --action ACTION Action (watch, build, shell, etc.)"
echo "-t, --tty Enable TTY mode (needed for shell)"
echo "-v, --verbose Enable verbosity"
echo "-h, --help Show this help"
}
# Parse arguments
while [ $# -gt 0 ]; do
ARG="${1:-}"
OPT="${2:-}"
shift
# echo "DEBUG: ARG=$ARG OPT=$OPT"
case "$ARG" in
-a|--action)
shift # argument requires a parameter
if [ -z "$OPT" ]; then
>&2 echo "ERROR: missing argument for --action"
exit 1
fi
ACTION="$OPT"
;;
-d|--data-dir)
shift # argument requires a parameter
if [ -z "$OPT" ]; then
>&2 echo "ERROR: missing argument for --data-dir"
exit 1
fi
if [ ! -d "$OPT" ]; then
>&2 echo "ERROR: argument for --data-dir must be a directory"
exit 1
fi
BASEDIR="$(cd "$OPT" && pwd)"
;;
-h|--help)
>&2 gxt_usage
exit 0
;;
-T|--no-tty)
DOCKER_OPT_TTY=""
;;
-v|--verbosity)
VERBOSITY="$((VERBOSITY+1))"
;;
*)
>&2 gxt_usage
>&2 echo "ERROR: unknown option '$ARG'"
exit 1
;;
esac
done
echo "basedir = $BASEDIR"
echo "docker_image = $DOCKER_IMAGE"
echo "action = $ACTION"
if [ -f "$BASEDIR/.marp/theme.scss" ]; then
DOCKER_OPT_MARP_THEME="-v $BASEDIR/.marp:/app/.marp"
echo "Theme: detected Marp files. Adding option to command line ($DOCKER_OPT_MARP_THEME)"
else
echo "Theme: no theme detected. Using default files"
fi
if [ -f "$BASEDIR/mkdocs.yml" ]; then
>&2 echo "Mkdocs: detected mkdocs.yml file. Please rename to mkdocs-patch.yml"
exit 1
fi
if [ -f "$BASEDIR/mkdocs-patch.yml" ]; then
DOCKER_OPT_MKDOCS_CONFIG="-v $BASEDIR/mkdocs-patch.yml:/app/mkdocs-patch.yml"
echo "Mkdocs: detected mkdocs-patch.yml file. Adding option to command line ($DOCKER_OPT_MKDOCS_CONFIG)"
else
echo "Mkdocs: no mkdocs-patch.yml detected. Using default files"
fi
if [ -d "$BASEDIR/slides" ]; then
DOCKER_OPT_MARP_PORT="-p 5200:5200"
fi
if [ -d "$BASEDIR/docs" ]; then
DOCKER_OPT_MKDOCS_PORT="-p 5100:5100"
fi
if [ "$VERBOSITY" -gt 0 ]; then
set -x
fi
docker run -i $DOCKER_OPT_TTY \
--shm-size=1gb \
-e "EXT_UID=$(id -u)" \
-e "EXT_GID=$(id -g)" \
-v "$BASEDIR/docs:/app/docs" \
-v "$BASEDIR/slides:/app/slides" \
-v "$BASEDIR/images:/app/images" \
-v "$BASEDIR/_build:/app/_build" \
$DOCKER_OPT_MKDOCS_CONFIG \
$DOCKER_OPT_MARP_THEME \
$DOCKER_OPT_MKDOCS_PORT \
$DOCKER_OPT_MARP_PORT \
"$DOCKER_IMAGE" "$ACTION"
if [ "$VERBOSITY" -gt 0 ]; then
set +x
fi
# TODO: ask current user permissions
# TODO: fix permissions on generated files

16
tasks/docker.mk Normal file
View file

@ -0,0 +1,16 @@
# vim: set ft=make :
docker-build: ## build docker image
docker build \
--file docker/Dockerfile \
--tag glenux/docmachine:$(BUILD_VERSION) \
.
docker tag \
glenux/docmachine:$(BUILD_VERSION) \
glenux/docmachine:latest
docker-push: ## push docker image
env docker push glenux/docmachine:latest
docker-pull: ## download docker image
env docker pull glenux/docmachine:latest

60
tasks/docs.mk Normal file
View file

@ -0,0 +1,60 @@
# vim: set ft=make :
prepare-docs: ## install prerequisites for static docs site only
pipenv install
.PHONY: prepare-docs
prepare: prepare-docs
sync-docs-internal:
@>&2 echo "ERROR: not implemented"
exit 1
clean-docs: ## remove generated static docs site
rm -fr $(BUILD_DOCS_DIR)
.PHONY: clean-docs
clean: clean-docs
deploy-docs: ## deploy static docs site to github
git push $(DEPLOY_REPO)
pipenv run mkdocs gh-deploy $(DEPLOY_OPTS)
.PHONY: deploy-docs
deploy: deploy-docs
build-docs-pdf: ## build pdf docs only
mkdir -p $(BUILD_DOCS_DIR)
rm -f $(BUILD_DOCS_DIR)/combined.pdf
PYTHONUTF8=1 \
ENABLE_PDF_EXPORT=1 \
pipenv run mkdocs build \
--site-dir $(BUILD_DOCS_DIR)
pdftk \
$$(find -L $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \
cat output $(BUILD_DOCS_DIR)/docs.pdf
.PHONY: build-docs-pdf
build-docs: build-docs-pdf
build-docs-html: ## build static docs site only
mkdir -p $(BUILD_DOCS_DIR)
pipenv run mkdocs build \
--site-dir $(BUILD_DOCS_DIR)
.PHONY: build-docs-html
build-docs: build-docs-html
build: build-docs
watch-docs-internal:
pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT)
.PHONY: watch-docs-internal
watch-docs: ## run development server for static docs site
pipenv run honcho start watch-docs watch-toc
.PHONY: watch-docs
watch: watch-docs

106
tasks/slides.mk Normal file
View file

@ -0,0 +1,106 @@
.PHONY: clean-slides
clean-slides:
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
.PHONY: clean
clean: clean-slides
.PHONY: watch-slides-internal
watch-slides-internal: .marp/theme.css
PORT=$(SLIDES_PORT) \
npx marp \
--allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
-w $(SLIDES_DIR) \
-s
.PHONY: watch-slides serve-slides
watch-slides: ## run development server for PDF slides
pipenv run honcho start watch-slides src-autoslide
.PHONY: prepare
prepare: prepare-slides
.PHONY: prepare-slides
prepare-slides: ## install prerequisites for PDF slides only
npm install
npm rebuild node-sass
npx browserslist@latest --update-db
$(BUILD_SLIDES_DIR)/%.pdf: $(CACHE_SLIDES_DIR)/%.mdpp.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pdf: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pptx: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
.marp/theme.css:
cd .marp && $(MAKE) theme.css
$(BUILD_SLIDES_DIR):
mkdir -p $(BUILD_SLIDES_DIR)
.PHONY: build-slides
build-slides: build-slides-pdf build-slides-html ## build only slides as PDF and HTML
.PHONY: build-slides-pptx
build-slides-pptx: $(SLIDES_PPTX_ALL) $(SLIDES_MD_ALL) ## build PPTX slides only
.PHONY: build-slides-pdf
build-slides-pdf: $(SLIDES_PDF_ALL) $(SLIDES_MD_ALL) ## build PDF slides only
.PHONY: build-slides-html
build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only
.PHONY: merge-slides
merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL)
.PHONY: watch-slides
serve-slides: watch-slides
.PHONY: autoslide
autoslide: $(SLIDES_DIR)/autoslide.md | $(BUILD_SLIDES_DIR)
$(SLIDES_DIR)/autoslide.md: $(DOCS_MD)
find -L $(DOCS_DIR) -regextype sed \( -regex '.*/[0-9][^/]*\.md' ! -regex '.*/_.*' \) -print0 \
| sort -z \
| xargs -0 sed '/^---$$/,/^---$$/d' \
> $(SLIDES_DIR)/autoslide.md
.PHONY: watch-autoslide-internal
watch-autoslide-internal:
# FIXME: use watchexec instead
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 0.25 ; \
$(MAKE) autoslide ; \
done
.PHONY: watch-tocupdate-internal
watch-tocupdate-internal:
# FIXME: use watchexec instead
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 2 ; \
$(MAKE) images ; \
done

13
tasks/utils.mk Normal file
View file

@ -0,0 +1,13 @@
# vim: set ft=make :
##
## Utilities
##
fixme:
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
debug:
echo $(PWD)
.PHONY: fixme