Compare commits
47 commits
4f983647f1
...
c4038b34cf
Author | SHA1 | Date | |
---|---|---|---|
c4038b34cf | |||
18689043a4 | |||
acec55dfff | |||
a58dcec4ca | |||
cf07f3b064 | |||
1ebd4cbd4f | |||
b525f75055 | |||
daf532a83a | |||
8c56abd321 | |||
3d70d70f2f | |||
d69b02e78c | |||
dcc20d6b3f | |||
d123b3cd65 | |||
0e364f496d | |||
26a71920b0 | |||
f0463071cc | |||
bc3f0f911f | |||
8c259145ef | |||
1fe182d9fe | |||
bee16a9593 | |||
b50a639d9d | |||
53a626474c | |||
9fd96ed628 | |||
434c3d72e0 | |||
faad02b41c | |||
e3ef99661a | |||
19e166d879 | |||
262ed88922 | |||
760d118240 | |||
3deea69d24 | |||
adaa7c0f25 | |||
c5b12cb0a8 | |||
f638a9d5a3 | |||
aee774329f | |||
6b315b2f44 | |||
b601b7b865 | |||
f6b8e5d1f6 | |||
d6844f9a31 | |||
9df6e9911f | |||
854fbd7502 | |||
c94391d782 | |||
f1cb3b484d | |||
c8c3bb90d7 | |||
1fca4d68a0 | |||
|
a02c03e960 | ||
|
7d3811cb3c | ||
|
4f0fccc3b9 |
27 changed files with 2236 additions and 4322 deletions
|
@ -2,3 +2,8 @@
|
||||||
examples
|
examples
|
||||||
exercises
|
exercises
|
||||||
node_modules
|
node_modules
|
||||||
|
.drone.yml
|
||||||
|
docs/*.md
|
||||||
|
docs/**/*.md
|
||||||
|
slides/*.md
|
||||||
|
slides/**/*.md
|
||||||
|
|
59
.drone.yml
Normal file
59
.drone.yml
Normal 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
1
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
||||||
.bundle
|
.bundle
|
||||||
*.docx
|
*.docx
|
||||||
*.epub
|
*.epub
|
||||||
|
/slides/autoslide.md
|
||||||
/images/*.circo.svg
|
/images/*.circo.svg
|
||||||
/images/*.dot.svg
|
/images/*.dot.svg
|
||||||
/images/*.ora.png
|
/images/*.ora.png
|
||||||
|
|
|
@ -5,8 +5,10 @@ build: theme.css
|
||||||
|
|
||||||
%.css: %.scss
|
%.css: %.scss
|
||||||
cd .. \
|
cd .. \
|
||||||
&& npx node-sass --output-style compressed .marp/$< > .marp/$@ \
|
&& npx sass --no-error-css --no-source-map .marp/$<:.marp/$@ \
|
||||||
|| ( rm -f .marp/$@ && exit 1 )
|
|| ( rm -f .marp/$@ && exit 1 )
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f theme.css
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// engine.js
|
// engine.js
|
||||||
// You have to run `npm i @marp-team/marp-core` at first.
|
// You have to run `npm i @marp-team/marp-core` at first.
|
||||||
const { Marp } = require('@marp-team/marp-core')
|
const { Marp } = require('@marp-team/marp-core')
|
||||||
|
const highlightLines = require('markdown-it-highlight-lines')
|
||||||
|
|
||||||
module.exports = opts => {
|
module.exports = opts => {
|
||||||
|
|
||||||
|
@ -10,11 +11,12 @@ module.exports = opts => {
|
||||||
opts.html = true
|
opts.html = true
|
||||||
|
|
||||||
// console.log(opts)
|
// console.log(opts)
|
||||||
|
|
||||||
const marp = new Marp(opts)
|
const marp = new Marp(opts)
|
||||||
|
|
||||||
// Disable parsing fragmented list
|
// Disable parsing fragmented list
|
||||||
marp.markdown.core.ruler.disable('marpit_fragment')
|
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
@import-theme 'default';
|
@import-theme 'default';
|
||||||
|
|
||||||
$primaryColor: #662d91;
|
$primaryColor: #662d91;
|
||||||
$secondaryColor: #241c1c;
|
$secondaryColor: #f60;
|
||||||
$tertiaryColor: #111111;
|
$tertiaryColor: #241c1c;
|
||||||
$textColor: #111111;
|
$textColor: #111111;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
--primary-color: $primaryColor;
|
--primary-color: $primaryColor;
|
||||||
--secondary-color: $secondaryColor;
|
--secondary-color: $secondaryColor;
|
||||||
--text-color: $tertiaryColor;
|
--tertiary-color: $tertiaryColor;
|
||||||
|
--text-color: $textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
|
@ -18,6 +19,14 @@ section {
|
||||||
padding: 120px 80px 80px 80px;
|
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 {
|
section footer {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
color: $textColor; }
|
color: $textColor; }
|
||||||
|
@ -131,6 +140,23 @@ section > h6:first-child::before
|
||||||
section:not(.chapter) > h2:first-child {
|
section:not(.chapter) > h2:first-child {
|
||||||
font-size: 100%; }
|
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 {
|
a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: underline; }
|
text-decoration: underline; }
|
||||||
|
@ -159,10 +185,22 @@ bc-row > bc-column {
|
||||||
flex: 1 1 0;
|
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] {
|
bc-row > bc-column[bc-text-small] {
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bc-row > bc-column[bc-text-tiny] {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
bc-row > bc-column[bc-width-large] {
|
bc-row > bc-column[bc-width-large] {
|
||||||
flex: 2 1 0;
|
flex: 2 1 0;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +217,12 @@ bc-row > bc-column[bc-secondary] {
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bc-row > bc-column[bc-tertiary] {
|
||||||
|
background-color: $tertiaryColor;
|
||||||
|
color: white;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
bc-row > bc-column[bc-grey] {
|
bc-row > bc-column[bc-grey] {
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
|
@ -194,6 +238,10 @@ bc-row > bc-column:first-of-type {
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bc-row > bc-column p:only-child {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
bc-row > bc-column > h1:first-child,
|
bc-row > bc-column > h1:first-child,
|
||||||
bc-row > bc-column > h2:first-child,
|
bc-row > bc-column > h2:first-child,
|
||||||
bc-row > bc-column > h3:first-child,
|
bc-row > bc-column > h3:first-child,
|
||||||
|
@ -203,7 +251,7 @@ bc-row > bc-column > h6:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p img:first-child:last-child[alt*="center"] {
|
p img:only-child[alt*="center"] {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
183
Makefile
183
Makefile
|
@ -29,33 +29,35 @@ DOCS_PORT=5100
|
||||||
SLIDES_PORT=5200
|
SLIDES_PORT=5200
|
||||||
|
|
||||||
## Find .md slides
|
## 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=$(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_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_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_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_PPTX=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MD))
|
||||||
|
|
||||||
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD)
|
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD) $(SLIDES_DIR)/autoslide.md
|
||||||
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF)
|
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)
|
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
|
## 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))
|
DOCS_IMAGES_UML_SVG=$(patsubst $(IMAGES_DIR)/%.uml,$(BUILD_IMAGES_DIR)/%.uml.svg,$(DOCS_IMAGES_UML))
|
||||||
|
|
||||||
## Find .dot graphs
|
## 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))
|
DOCS_IMAGES_DOT_SVG=$(patsubst $(IMAGES_DIR)/%.dot,$(BUILD_IMAGES_DIR)/%.dot.svg,$(DOCS_IMAGES_DOT))
|
||||||
|
|
||||||
## Find .circo graphs
|
## 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))
|
DOCS_IMAGES_CIRCO_SVG=$(patsubst $(IMAGES_DIR)/%.circo,$(BUILD_IMAGES_DIR)/%.circo.svg,$(DOCS_IMAGES_CIRCO))
|
||||||
|
|
||||||
## Find .ora images
|
## 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))
|
DOCS_IMAGES_ORA_PNG=$(patsubst $(IMAGES_DIR)/%.ora,$(BUILD_IMAGES_DIR)/%.ora.png,$(DOCS_IMAGES_ORA))
|
||||||
|
|
||||||
## Merge all lists
|
## Merge all lists
|
||||||
|
@ -68,21 +70,8 @@ all: help
|
||||||
## Install prerequisites
|
## Install prerequisites
|
||||||
##
|
##
|
||||||
|
|
||||||
prepare: prepare-slides prepare-docs ## install prerequisites
|
.PHONY: prepare
|
||||||
|
prepare:
|
||||||
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
|
|
||||||
|
|
||||||
images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
|
images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
|
||||||
@echo "Source:"
|
@echo "Source:"
|
||||||
|
@ -91,6 +80,9 @@ images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
|
||||||
@echo " dot: $(DOCS_IMAGES_DOT)"
|
@echo " dot: $(DOCS_IMAGES_DOT)"
|
||||||
@echo " circo: $(DOCS_IMAGES_CIRCO)"
|
@echo " circo: $(DOCS_IMAGES_CIRCO)"
|
||||||
@echo "Built: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG)"
|
@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
|
.PHONY: images
|
||||||
|
|
||||||
|
@ -114,80 +106,16 @@ $(CACHE_SLIDES_DIR)/%.mdpp.md: $(SLIDES_DIR)/%.mdpp
|
||||||
m4 -d -I$(SLIDES_DIR) -I$(CACHE_SLIDES_DIR) $< > $@ \
|
m4 -d -I$(SLIDES_DIR) -I$(CACHE_SLIDES_DIR) $< > $@ \
|
||||||
|| ( rm -f $@ && exit 1 )
|
|| ( rm -f $@ && exit 1 )
|
||||||
|
|
||||||
.marp/theme.css:
|
|
||||||
cd .marp && $(MAKE) theme.css
|
|
||||||
|
|
||||||
watch: ## run development server
|
watch: ## run development server
|
||||||
pipenv run honcho start
|
$(MAKE) autoslide
|
||||||
|
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
|
|
||||||
|
|
||||||
serve: watch
|
serve: watch
|
||||||
serve-slides: watch-slides
|
|
||||||
serve-docs: watch-docs
|
serve-docs: watch-docs
|
||||||
|
|
||||||
.PHONY: watch watch-slides watch-docs watch-slides-internal watch-docs-internal serve serve-docs serve-slides
|
.PHONY: watch serve
|
||||||
|
.PHONY: watch-docs serve-docs
|
||||||
|
.PHONY: watch-docs-internal
|
||||||
$(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)
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## Build final documents
|
## 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-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
|
.PHONY: build
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
help: ## print this help
|
help: ## print this help
|
||||||
@echo "Usage: make <target>"
|
@echo "Usage: make <target>"
|
||||||
|
@ -255,36 +153,13 @@ help: ## print this help
|
||||||
## Clean
|
## Clean
|
||||||
##
|
##
|
||||||
|
|
||||||
clean: clean-slides clean-docs # remove generated documents
|
clean: # remove generated documents
|
||||||
|
|
||||||
clean-slides:
|
.PHONY: clean
|
||||||
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
|
|
||||||
|
|
||||||
clean-docs:
|
include tasks/docs.mk
|
||||||
rm -fr $(BUILD_DOCS_DIR) # remove generated static docs site
|
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
|
|
||||||
|
|
2
Pipfile
2
Pipfile
|
@ -20,4 +20,4 @@ pymdown-extensions = "*"
|
||||||
mkdocs-pdf-export-plugin = "*"
|
mkdocs-pdf-export-plugin = "*"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.9"
|
python_version = "3.11"
|
||||||
|
|
1257
Pipfile.lock
generated
1257
Pipfile.lock
generated
File diff suppressed because it is too large
Load diff
11
Procfile
11
Procfile
|
@ -1,4 +1,7 @@
|
||||||
docs: make watch-docs-internal
|
# src-docs: make sync-docs-internal
|
||||||
slides: make watch-slides-internal
|
# src-slides: make sync-slides-internal
|
||||||
toc: make watch-tocupdate-internal
|
src-autoslide: make watch-autoslide-internal
|
||||||
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
|
||||||
|
|
50
README.md
50
README.md
|
@ -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
|
### 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.
|
This mode allows you the result on-the-fly as you makea changes in the content.
|
||||||
|
|
||||||
To use watch mode, type:
|
To use watch mode, type:
|
||||||
|
|
||||||
make watch
|
docmachine -a watch
|
||||||
|
|
||||||
To use watch mode for slides only type:
|
To use watch mode for slides only type:
|
||||||
|
|
||||||
make watch-slides
|
docmachine -a watch-slides
|
||||||
|
|
||||||
To use watch mode for docs only type:
|
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)
|
This mode builds final content for delivery (website, PDF files)
|
||||||
|
|
||||||
|
### Building HTML
|
||||||
|
|
||||||
To use build mode:
|
To use build mode:
|
||||||
|
|
||||||
make build
|
docmachine build
|
||||||
|
|
||||||
|
### Building PDF
|
||||||
|
|
||||||
|
|
||||||
|
|
10
caddy.conf
Normal file
10
caddy.conf
Normal 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
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
FROM node:bullseye-slim
|
FROM node:18-bookworm-slim
|
||||||
MAINTAINER Glenn ROLLAND <glenux@glenux.net>
|
LABEL maintainer="Glenn ROLLAND glenux@glenux.net"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends python3 python3-pip pipenv \
|
&& 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
|
# Tools for running the common parts
|
||||||
RUN apt-get update \
|
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 \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||||
&& truncate -s 0 /var/log/*log
|
&& truncate -s 0 /var/log/*log
|
||||||
|
@ -28,6 +28,7 @@ RUN curl -sSL -o /usr/local/bin/yq \
|
||||||
&& chmod +x /usr/local/bin/yq
|
&& chmod +x /usr/local/bin/yq
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
COPY .marp /app/.marp
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV LANG=C.UTF-8 \
|
ENV LANG=C.UTF-8 \
|
||||||
|
|
49
docs.extra/css.extra/extra.css
Normal file
49
docs.extra/css.extra/extra.css
Normal 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);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
18
docs.extra/javascript.extra/mathjax.js
Normal file
18
docs.extra/javascript.extra/mathjax.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
window.MathJax = {
|
||||||
|
tex: {
|
||||||
|
inlineMath: [["\\(", "\\)"]],
|
||||||
|
displayMath: [["\\[", "\\]"]],
|
||||||
|
processEscapes: true,
|
||||||
|
processEnvironments: true
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
ignoreHtmlClass: ".*|",
|
||||||
|
processHtmlClass: "arithmatex"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document$.subscribe(() => {
|
||||||
|
|
||||||
|
|
||||||
|
MathJax.typesetPromise()
|
||||||
|
})
|
|
@ -6,12 +6,13 @@ site_dir: _build/docs
|
||||||
# theme_dir: 'themes/mkdocs-material'
|
# theme_dir: 'themes/mkdocs-material'
|
||||||
|
|
||||||
site_author: 'Glenn Y. Rolland'
|
site_author: 'Glenn Y. Rolland'
|
||||||
site_url: 'http://glenux.github.io/teaching-boilerplate'
|
site_url: 'https://glenux.net'
|
||||||
|
|
||||||
# copyright: 'Copyright (c) 2016 Glenux'
|
# copyright: 'Copyright (c) 2016 Glenux'
|
||||||
|
|
||||||
repo_name: 'Source'
|
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'
|
# site_favicon: 'favicon.ico'
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
|
@ -27,6 +28,7 @@ theme:
|
||||||
neutral: 'black'
|
neutral: 'black'
|
||||||
features:
|
features:
|
||||||
- navigation.sections
|
- navigation.sections
|
||||||
|
- navigation.footer
|
||||||
# - navigation.tabs
|
# - navigation.tabs
|
||||||
# - navigation.tabs.sticky
|
# - navigation.tabs.sticky
|
||||||
|
|
||||||
|
@ -36,9 +38,16 @@ i18n:
|
||||||
|
|
||||||
extra_css:
|
extra_css:
|
||||||
- css/extra.css
|
- css/extra.css
|
||||||
|
- ../docs.assets/css/extra.css
|
||||||
|
# - css/source.css
|
||||||
|
# - css/patch.css
|
||||||
|
|
||||||
extra_javascript:
|
extra_javascript:
|
||||||
- js/extra.js
|
- 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:
|
# author:
|
||||||
# github: 'glenux'
|
# github: 'glenux'
|
||||||
|
@ -55,8 +64,8 @@ markdown_extensions:
|
||||||
- pymdownx.highlight:
|
- pymdownx.highlight:
|
||||||
anchor_linenums: false
|
anchor_linenums: false
|
||||||
- pymdownx.inlinehilite
|
- pymdownx.inlinehilite
|
||||||
# - codehilite:
|
- codehilite:
|
||||||
# guess_lang: false
|
guess_lang: true
|
||||||
|
|
||||||
# pip install mdx_truly_sane_lists
|
# pip install mdx_truly_sane_lists
|
||||||
- mdx_truly_sane_lists
|
- mdx_truly_sane_lists
|
||||||
|
@ -67,6 +76,8 @@ markdown_extensions:
|
||||||
#
|
#
|
||||||
# pip install pymdown-extensions
|
# pip install pymdown-extensions
|
||||||
- pymdownx.superfences:
|
- pymdownx.superfences:
|
||||||
|
# - pymdownx.arithmatex:
|
||||||
|
# generic: true
|
||||||
|
|
||||||
# plugins: []
|
# plugins: []
|
||||||
plugins:
|
plugins:
|
||||||
|
|
4409
package-lock.json
generated
4409
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -12,12 +12,11 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"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",
|
"foreman": "^3.0.1",
|
||||||
"node-sass": "^6.0.1"
|
"markdown-it-footnote": "^3.0.2",
|
||||||
},
|
"markdown-it-highlight-lines": "^1.0.2",
|
||||||
"devDependencies": {
|
"sass": "^1.79.3"
|
||||||
"@marp-team/marp-core": "^3.0.0",
|
|
||||||
"markdown-it-footnote": "^3.0.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
|
|
@ -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
16
tasks/docker.mk
Normal 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
60
tasks/docs.mk
Normal 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
106
tasks/slides.mk
Normal 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
13
tasks/utils.mk
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# vim: set ft=make :
|
||||||
|
|
||||||
|
##
|
||||||
|
## Utilities
|
||||||
|
##
|
||||||
|
|
||||||
|
fixme:
|
||||||
|
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
|
||||||
|
|
||||||
|
debug:
|
||||||
|
echo $(PWD)
|
||||||
|
|
||||||
|
.PHONY: fixme
|
Loading…
Reference in a new issue