Compare commits
No commits in common. "c4038b34cf6e20150e85bdf2eee32d9c81d7b04e" and "4f983647f1912ef80b81dd92ef3a88e90f4ae536" have entirely different histories.
c4038b34cf
...
4f983647f1
27 changed files with 4337 additions and 2251 deletions
|
@ -2,8 +2,3 @@
|
||||||
examples
|
examples
|
||||||
exercises
|
exercises
|
||||||
node_modules
|
node_modules
|
||||||
.drone.yml
|
|
||||||
docs/*.md
|
|
||||||
docs/**/*.md
|
|
||||||
slides/*.md
|
|
||||||
slides/**/*.md
|
|
||||||
|
|
59
.drone.yml
59
.drone.yml
|
@ -1,59 +0,0 @@
|
||||||
---
|
|
||||||
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,7 +3,6 @@
|
||||||
.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,10 +5,8 @@ build: theme.css
|
||||||
|
|
||||||
%.css: %.scss
|
%.css: %.scss
|
||||||
cd .. \
|
cd .. \
|
||||||
&& npx sass --no-error-css --no-source-map .marp/$<:.marp/$@ \
|
&& npx node-sass --output-style compressed .marp/$< > .marp/$@ \
|
||||||
|| ( rm -f .marp/$@ && exit 1 )
|
|| ( rm -f .marp/$@ && exit 1 )
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f theme.css
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// 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 => {
|
||||||
|
|
||||||
|
@ -11,12 +10,11 @@ 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')
|
||||||
|
|
||||||
// Enable code lines highlighting
|
return marp
|
||||||
// ref. https://github.com/marp-team/marp-vscode/issues/146
|
|
||||||
return marp.use(highlightLines)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,14 @@
|
||||||
@import-theme 'default';
|
@import-theme 'default';
|
||||||
|
|
||||||
$primaryColor: #662d91;
|
$primaryColor: #662d91;
|
||||||
$secondaryColor: #f60;
|
$secondaryColor: #241c1c;
|
||||||
$tertiaryColor: #241c1c;
|
$tertiaryColor: #111111;
|
||||||
$textColor: #111111;
|
$textColor: #111111;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
--primary-color: $primaryColor;
|
--primary-color: $primaryColor;
|
||||||
--secondary-color: $secondaryColor;
|
--secondary-color: $secondaryColor;
|
||||||
--tertiary-color: $tertiaryColor;
|
--text-color: $tertiaryColor;
|
||||||
--text-color: $textColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
|
@ -19,14 +18,6 @@ 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; }
|
||||||
|
@ -140,23 +131,6 @@ 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; }
|
||||||
|
@ -185,22 +159,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -217,12 +179,6 @@ 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;
|
||||||
|
@ -238,10 +194,6 @@ 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,
|
||||||
|
@ -251,7 +203,7 @@ bc-row > bc-column > h6:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p img:only-child[alt*="center"] {
|
p img:first-child:last-child[alt*="center"] {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
181
Makefile
181
Makefile
|
@ -29,35 +29,33 @@ DOCS_PORT=5100
|
||||||
SLIDES_PORT=5200
|
SLIDES_PORT=5200
|
||||||
|
|
||||||
## Find .md slides
|
## Find .md slides
|
||||||
SLIDES_MDPP=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.mdpp' ! -regex '.*/_.*' \))
|
SLIDES_MDPP=$(shell find $(SLIDES_DIR) \( -name '*.mdpp' ! -name '_*' \))
|
||||||
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 -L $(SLIDES_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \)) $(SLIDES_MDPP_MD)
|
SLIDES_MD=$(shell find $(SLIDES_DIR) \( -name '*.md' ! -name '_*' \)) $(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_DIR)/autoslide.md
|
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD)
|
||||||
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF) $(BUILD_SLIDES_DIR)/autoslide.pdf
|
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF)
|
||||||
SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX) $(BUILD_SLIDES_DIR)/autoslide.pptx
|
SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX)
|
||||||
|
|
||||||
DOCS_MD=$(shell find -L $(DOCS_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \))
|
|
||||||
|
|
||||||
## Find .uml graphs
|
## Find .uml graphs
|
||||||
DOCS_IMAGES_UML=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.uml' ! -regex '.*/_.*' \))
|
DOCS_IMAGES_UML=$(shell find $(IMAGES_DIR) \( -name '*.uml' ! -name '_*' \))
|
||||||
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 -L $(IMAGES_DIR) -regextype sed \( -name '*.dot' ! -regex '.*/_.*' \))
|
DOCS_IMAGES_DOT=$(shell find $(IMAGES_DIR) \( -name '*.dot' ! -name '_*' \))
|
||||||
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 -L $(IMAGES_DIR) -regextype sed \( -name '*.circo' ! -regex '.*/_.*' \))
|
DOCS_IMAGES_CIRCO=$(shell find $(IMAGES_DIR) \( -name '*.circo' ! -name '_*' \))
|
||||||
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 -L $(IMAGES_DIR) -regextype sed \( -name '*.ora' ! -regex '.*/_.*' \))
|
DOCS_IMAGES_ORA=$(shell find $(IMAGES_DIR) \( -name '*.ora' ! -name '_*' \))
|
||||||
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
|
||||||
|
@ -70,8 +68,21 @@ all: help
|
||||||
## Install prerequisites
|
## Install prerequisites
|
||||||
##
|
##
|
||||||
|
|
||||||
.PHONY: prepare
|
prepare: prepare-slides prepare-docs ## install prerequisites
|
||||||
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:"
|
||||||
|
@ -80,9 +91,6 @@ 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
|
||||||
|
|
||||||
|
@ -106,16 +114,80 @@ $(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
|
||||||
$(MAKE) autoslide
|
|
||||||
pipenv run honcho start
|
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 serve
|
.PHONY: watch watch-slides watch-docs watch-slides-internal watch-docs-internal serve serve-docs serve-slides
|
||||||
.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
|
||||||
|
@ -134,7 +206,37 @@ 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
|
||||||
|
|
||||||
.PHONY: build
|
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)
|
||||||
|
|
||||||
help: ## print this help
|
help: ## print this help
|
||||||
@echo "Usage: make <target>"
|
@echo "Usage: make <target>"
|
||||||
|
@ -153,13 +255,36 @@ help: ## print this help
|
||||||
## Clean
|
## Clean
|
||||||
##
|
##
|
||||||
|
|
||||||
clean: # remove generated documents
|
clean: clean-slides clean-docs # remove generated documents
|
||||||
|
|
||||||
.PHONY: clean
|
clean-slides:
|
||||||
|
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
|
||||||
|
|
||||||
include tasks/docs.mk
|
clean-docs:
|
||||||
include tasks/slides.mk
|
rm -fr $(BUILD_DOCS_DIR) # remove generated static docs site
|
||||||
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.11"
|
python_version = "3.9"
|
||||||
|
|
1257
Pipfile.lock
generated
1257
Pipfile.lock
generated
File diff suppressed because it is too large
Load diff
11
Procfile
11
Procfile
|
@ -1,7 +1,4 @@
|
||||||
# src-docs: make sync-docs-internal
|
docs: make watch-docs-internal
|
||||||
# src-slides: make sync-slides-internal
|
slides: make watch-slides-internal
|
||||||
src-autoslide: make watch-autoslide-internal
|
toc: make watch-tocupdate-internal
|
||||||
watch-docs: make watch-docs-internal
|
autoslide: make watch-autoslide-internal
|
||||||
watch-slides: make watch-slides-internal
|
|
||||||
watch-toc: make watch-tocupdate-internal
|
|
||||||
# proxy: caddy
|
|
||||||
|
|
50
README.md
50
README.md
|
@ -1,26 +1,10 @@
|
||||||
<!--
|
# 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>
|
|
||||||
-->
|
|
||||||
|
|
||||||
[](https://cicd.apps.glenux.net/glenux/docmachine-containers)
|
## Prerequisites :
|
||||||

|
|
||||||
[](https://patreon.com/glenux)
|
|
||||||
|
|
||||||
> :information_source: This project is available on our self-hosted server and
|
Make sure you have docker installed
|
||||||
> 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>.
|
|
||||||
|
|
||||||
# DocMachine Containers
|
## Usage
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Make sure you have Docker installed.
|
|
||||||
|
|
||||||
## Writing content
|
|
||||||
|
|
||||||
### Create your directory tree
|
### Create your directory tree
|
||||||
|
|
||||||
|
@ -34,43 +18,33 @@ Make sure you have Docker installed.
|
||||||
|- ...
|
|- ...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Content for docs
|
### Write content for docs
|
||||||
|
|
||||||
FIXME: tree structure
|
|
||||||
|
|
||||||
FIXME: autoslide feature
|
### Write content for slides
|
||||||
|
|
||||||
### Content for slides
|
|
||||||
|
|
||||||
FIXME: tree structure
|
### Watch mode
|
||||||
|
|
||||||
## 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:
|
||||||
|
|
||||||
docmachine -a watch
|
make watch
|
||||||
|
|
||||||
To use watch mode for slides only type:
|
To use watch mode for slides only type:
|
||||||
|
|
||||||
docmachine -a watch-slides
|
make watch-slides
|
||||||
|
|
||||||
To use watch mode for docs only type:
|
To use watch mode for docs only type:
|
||||||
|
|
||||||
docmachine -a watch-docs
|
make 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:
|
||||||
|
|
||||||
docmachine build
|
make build
|
||||||
|
|
||||||
### Building PDF
|
|
||||||
|
|
||||||
|
|
||||||
|
|
10
caddy.conf
10
caddy.conf
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
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:18-bookworm-slim
|
FROM node:bullseye-slim
|
||||||
LABEL maintainer="Glenn ROLLAND glenux@glenux.net"
|
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 rsync \
|
&& apt-get install -y --no-install-recommends make build-essential inotify-tools gosu unzip curl \
|
||||||
&& 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,7 +28,6 @@ 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 \
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
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);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
window.MathJax = {
|
|
||||||
tex: {
|
|
||||||
inlineMath: [["\\(", "\\)"]],
|
|
||||||
displayMath: [["\\[", "\\]"]],
|
|
||||||
processEscapes: true,
|
|
||||||
processEnvironments: true
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
ignoreHtmlClass: ".*|",
|
|
||||||
processHtmlClass: "arithmatex"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document$.subscribe(() => {
|
|
||||||
|
|
||||||
|
|
||||||
MathJax.typesetPromise()
|
|
||||||
})
|
|
0
exercises/.empty
Normal file
0
exercises/.empty
Normal file
0
mindmaps/.empty
Normal file
0
mindmaps/.empty
Normal file
|
@ -6,13 +6,12 @@ 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: 'https://glenux.net'
|
site_url: 'http://glenux.github.io/teaching-boilerplate'
|
||||||
|
|
||||||
# copyright: 'Copyright (c) 2016 Glenux'
|
# copyright: 'Copyright (c) 2016 Glenux'
|
||||||
|
|
||||||
repo_name: 'Source'
|
repo_name: 'Source'
|
||||||
repo_url: ''
|
repo_url: 'https://bitbucket.com/glenux-corp/teaching-boilerplate'
|
||||||
# https://bitbucket.com/glenux-corp/teaching-boilerplate'
|
|
||||||
# site_favicon: 'favicon.ico'
|
# site_favicon: 'favicon.ico'
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
|
@ -28,7 +27,6 @@ theme:
|
||||||
neutral: 'black'
|
neutral: 'black'
|
||||||
features:
|
features:
|
||||||
- navigation.sections
|
- navigation.sections
|
||||||
- navigation.footer
|
|
||||||
# - navigation.tabs
|
# - navigation.tabs
|
||||||
# - navigation.tabs.sticky
|
# - navigation.tabs.sticky
|
||||||
|
|
||||||
|
@ -38,16 +36,9 @@ 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'
|
||||||
|
@ -64,8 +55,8 @@ markdown_extensions:
|
||||||
- pymdownx.highlight:
|
- pymdownx.highlight:
|
||||||
anchor_linenums: false
|
anchor_linenums: false
|
||||||
- pymdownx.inlinehilite
|
- pymdownx.inlinehilite
|
||||||
- codehilite:
|
# - codehilite:
|
||||||
guess_lang: true
|
# guess_lang: false
|
||||||
|
|
||||||
# pip install mdx_truly_sane_lists
|
# pip install mdx_truly_sane_lists
|
||||||
- mdx_truly_sane_lists
|
- mdx_truly_sane_lists
|
||||||
|
@ -76,8 +67,6 @@ markdown_extensions:
|
||||||
#
|
#
|
||||||
# pip install pymdown-extensions
|
# pip install pymdown-extensions
|
||||||
- pymdownx.superfences:
|
- pymdownx.superfences:
|
||||||
# - pymdownx.arithmatex:
|
|
||||||
# generic: true
|
|
||||||
|
|
||||||
# plugins: []
|
# plugins: []
|
||||||
plugins:
|
plugins:
|
||||||
|
|
4439
package-lock.json
generated
4439
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -12,11 +12,12 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@marp-team/marp-cli": "^1.4.1",
|
"@marp-team/marp-cli": "^1.5.0",
|
||||||
"@marp-team/marp-core": "^3.9.0",
|
|
||||||
"foreman": "^3.0.1",
|
"foreman": "^3.0.1",
|
||||||
"markdown-it-footnote": "^3.0.2",
|
"node-sass": "^6.0.1"
|
||||||
"markdown-it-highlight-lines": "^1.0.2",
|
},
|
||||||
"sass": "^1.79.3"
|
"devDependencies": {
|
||||||
|
"@marp-team/marp-core": "^3.0.0",
|
||||||
|
"markdown-it-footnote": "^3.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
86
scripts/gx-mkteaching
Executable file
86
scripts/gx-mkteaching
Executable file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/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)
|
120
scripts/gx-teaching
Executable file
120
scripts/gx-teaching
Executable file
|
@ -0,0 +1,120 @@
|
||||||
|
#!/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
|
|
@ -1,16 +0,0 @@
|
||||||
# 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
|
|
|
@ -1,60 +0,0 @@
|
||||||
# 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
106
tasks/slides.mk
|
@ -1,106 +0,0 @@
|
||||||
|
|
||||||
.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
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# vim: set ft=make :
|
|
||||||
|
|
||||||
##
|
|
||||||
## Utilities
|
|
||||||
##
|
|
||||||
|
|
||||||
fixme:
|
|
||||||
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
|
|
||||||
|
|
||||||
debug:
|
|
||||||
echo $(PWD)
|
|
||||||
|
|
||||||
.PHONY: fixme
|
|
Loading…
Add table
Reference in a new issue