Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit 8df1dba

Browse files
committedJun 24, 2022
build: Port to Deliverance
1 parent 8cf8166 commit 8df1dba

File tree

10 files changed

+210
-74
lines changed

10 files changed

+210
-74
lines changed
 

‎.github/workflows/deliverance.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Deliverance CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * 0"
8+
9+
jobs:
10+
build-linux:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout, build and publish with Deliverance
14+
uses: pojntfx/deliverance@latest
15+
with:
16+
github_token: "${{ secrets.GITHUB_TOKEN }}"

‎.github/workflows/pandoc.yaml

-29
This file was deleted.

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
out
2+
Makefile

‎Makefile

+138-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,144 @@
1+
# Public variables
2+
OUTPUT_DIR ?= out
3+
4+
# Private variables
5+
obj = $(shell ls docs/*.md | sed -r 's@docs/(.*).md@\1@g')
6+
mta = $(wildcard *.md)
7+
changelog_exists = $(wildcard CHANGELOG.txt)
8+
origin_exists = $(wildcard ORIGIN.txt)
9+
is_git_repo = $(wildcard .git)
10+
current_dir = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
11+
formats = pdf slides.pdf html slides.html epub odt txt
112
all: build
213

3-
.PHONY: docs
4-
docs:
5-
mkdir -p out/docs
6-
if [ -d "docs/static" ]; then cp -r docs/static out/docs; fi
7-
echo "<!DOCTYPE html><meta charset="utf-8"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"$$(sed -n '2 p' docs/metadata.txt)\"><link rel=\"stylesheet\" href=\"https://unpkg.com/marx-css/css/marx.min.css\"><title>$$(sed -n '1 p' docs/metadata.txt)</title><main><h1>$$(sed -n '1 p' docs/metadata.txt)</h1><p>$$(sed -n '2 p' docs/metadata.txt)</p><hr><a href=\"$$(sed -n '4 p' docs/metadata.txt)\" target=\"_blank\">📃 View source (✍️ $$(sed -n '3 p' docs/metadata.txt))</a><br><a href=\"$$(sed -n '5 p' docs/metadata.txt)\" download=\"$$(sed -n '1 p' docs/metadata.txt).zip\">📥 Download all as ZIP</a><hr><div>You may do the following:</div><ul>" > "out/docs/index.html"
8-
for document in docs/*.md; do\
9-
echo "Compiling $${document} ..." ;\
10-
docker run -v "$(PWD):/data:z" pandoc/latex "$${document}" --resource-path=docs --pdf-engine=xelatex -o "out/$${document}.pdf" & docker run -v "$(PWD):/data:z" pandoc/latex "$${document}" --resource-path=docs --toc --self-contained -t html5 -o "out/$${document}.html" & docker run -v "$(PWD):/data:z" pandoc/latex "$${document}" --resource-path=docs --self-contained -t slidy --slide-level 3 -o "out/$${document}.slides.html" & docker run -v "$(PWD):/data:z" pandoc/latex "$${document}" --resource-path=docs -t beamer --slide-level 3 --pdf-engine=xelatex -o "out/$${document}.slides.pdf";\
11-
echo "<li><a href=\"$${document#docs/}.html\" target=\"_blank\">🌐 View $${document#docs/} in your browser</a> (also available as <a href=\"$${document#docs/}.slides.html\" target=\"_blank\">slides</a>) or <a href=\"$${document#docs/}.pdf\" target=\"_blank\">📥 download $${document#docs/} as PDF</a> (also available as <a href=\"$${document#docs/}.slides.pdf\" target=\"_blank\">slides</a>)" >> "out/docs/index.html";\
12-
done
13-
echo "</ul><div><strong><em>$$(sed -n '6 p' docs/metadata.txt)</em></strong></div></main>" >> "out/docs/index.html"
14-
mkdir -p "out/release"
15-
zip -j -r "out/release/all.zip" "out/docs"
16-
17-
build: docs
18-
19-
dev:
20-
while [ -z "$${MAKE_PID}" ] || [ -n "$$(inotifywait -q -r -e modify docs/*.md)" ]; do\
21-
$(MAKE) PWD=$(PWD) & export MAKE_PID="$$!";\
22-
done
14+
# Build
15+
build: build/archive
16+
$(addprefix build/,$(obj)):
17+
$(MAKE) build-pdf/$(subst build/,,$@) build-slides.pdf/$(subst build/,,$@) build-html/$(subst build/,,$@) build-slides.html/$(subst build/,,$@) build-epub/$(subst build/,,$@) build-odt/$(subst build/,,$@) build-gmi/$(subst build/,,$@) build-txt/$(subst build/,,$@)
18+
19+
# Build PDF
20+
$(addprefix build-pdf/,$(obj)): build/qr
21+
mkdir -p "$(OUTPUT_DIR)"
22+
pandoc --template eisvogel --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs -M titlepage=true -M toc=true -M toc-own-page=true -M linkcolor=blue --pdf-engine=xelatex -o "$(OUTPUT_DIR)/$(subst build-pdf/,,$@).pdf" "docs/$(subst build-pdf/,,$@).md"
23+
24+
# Build PDF slides
25+
$(addprefix build-slides.pdf/,$(obj)): build/qr
26+
ifeq ($(DISABLE_PDF_SLIDES),true)
27+
exit 0
28+
else
29+
mkdir -p "$(OUTPUT_DIR)"
30+
pandoc --to beamer --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs --slide-level=3 --variable theme=metropolis --pdf-engine=xelatex -o "$(OUTPUT_DIR)/$(subst build-slides.pdf/,,$@).slides.pdf" "docs/$(subst build-slides.pdf/,,$@).md"
31+
endif
32+
33+
# Build HTML
34+
$(addprefix build-html/,$(obj)): build/qr
35+
mkdir -p "$(OUTPUT_DIR)"
36+
pandoc --to markdown --shift-heading-level-by=-1 --resource-path=docs --standalone "docs/$(subst build-html/,,$@).md" | pandoc --to html5 --citeproc --listings --shift-heading-level-by=1 --number-sections --resource-path=docs --toc --katex --self-contained --number-offset=1 -o "$(OUTPUT_DIR)/$(subst build-html/,,$@).html"
37+
38+
# Build HTML slides
39+
$(addprefix build-slides.html/,$(obj)): build/qr
40+
mkdir -p "$(OUTPUT_DIR)"
41+
pandoc --to slidy --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs --toc --katex --self-contained -o "$(OUTPUT_DIR)/$(subst build-slides.html/,,$@).slides.html" "docs/$(subst build-slides.html/,,$@).md"
42+
43+
# Build EPUB
44+
$(addprefix build-epub/,$(obj)): build/qr
45+
mkdir -p "$(OUTPUT_DIR)"
46+
pandoc --to epub --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs -M titlepage=true -M toc=true -M toc-own-page=true -M linkcolor=blue -o "$(OUTPUT_DIR)/$(subst build-epub/,,$@).epub" "docs/$(subst build-epub/,,$@).md"
47+
48+
# Build ODT
49+
$(addprefix build-odt/,$(obj)): build/qr
50+
mkdir -p "$(OUTPUT_DIR)"
51+
pandoc --to odt --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs -M titlepage=true -M toc=true -M toc-own-page=true -M linkcolor=blue -o "$(OUTPUT_DIR)/$(subst build-odt/,,$@).odt" "docs/$(subst build-odt/,,$@).md"
52+
53+
# Build Gemtext
54+
$(addprefix build-gmi/,$(obj)): build/qr
55+
rm -rf "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi"
56+
mkdir -p "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi"
57+
cd "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi" && pandoc --to html --citeproc --extract-media static --metadata title="intermediate" --resource-path="../../docs" "../../docs/$(subst build-gmi/,,$@).md" | pandoc --read html --to gfm-raw_html | md2gemini -a -p -s | sed -e 's@^=> static/static/@=>static/@g' > "$(subst build-gmi/,,$@).gmi" && [ -d static/static ] && mv -f static/static/* static/; rm -rf static/static
58+
tar -I 'gzip -9' -cvf "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi.gz" -C "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi" .
59+
rm -rf "$(OUTPUT_DIR)/$(subst build-gmi/,,$@).gmi"
60+
61+
# Build txt
62+
$(addprefix build-txt/,$(obj)): build/qr
63+
mkdir -p "$(OUTPUT_DIR)"
64+
pandoc --to plain --citeproc --listings --shift-heading-level-by=-1 --number-sections --resource-path=docs --toc --self-contained -o "$(OUTPUT_DIR)/$(subst build-txt/,,$@).txt" "docs/$(subst build-txt/,,$@).md"
65+
66+
# Build metadata
67+
build/metadata:
68+
mkdir -p "$(OUTPUT_DIR)"
69+
ifneq ("$(origin_exists)", "")
70+
cp ORIGIN.txt "$(OUTPUT_DIR)"/ORIGIN.txt
71+
else ifneq ("$(is_git_repo)", "")
72+
git remote get-url origin > "$(OUTPUT_DIR)"/ORIGIN.txt
73+
else
74+
echo "file://$(current_dir)" > "$(OUTPUT_DIR)"/ORIGIN.txt
75+
endif
76+
ifneq ("$(changelog_exists)", "")
77+
cp CHANGELOG.txt "$(OUTPUT_DIR)"/CHANGELOG.txt
78+
else ifneq ("$(is_git_repo)", "")
79+
git log > "$(OUTPUT_DIR)"/CHANGELOG.txt
80+
else
81+
touch "$(OUTPUT_DIR)"/CHANGELOG.txt
82+
endif
83+
cp LICENSE "$(OUTPUT_DIR)"/LICENSE.txt
84+
$(foreach mt,$(mta),pandoc --to markdown --shift-heading-level-by=-1 --standalone "$(mt)" | pandoc --to html5 --citeproc --listings --shift-heading-level-by=1 --number-sections --resource-path=docs --toc --katex --self-contained --number-offset=1 -o "$(OUTPUT_DIR)/$(subst .md,.html,$(mt))";)
85+
86+
# Build QR code
87+
build/qr:
88+
mkdir -p docs/static
89+
ifneq ("$(origin_exists)", "")
90+
qr "$(shell cat ORIGIN.txt)" > docs/static/qr.png
91+
else ifneq ("$(is_git_repo)", "")
92+
qr "https://$(shell git remote get-url origin | sed -r 's|^.*@(.*):|\1/|g' | sed 's@.*://@@g' | sed 's/.git$$//g')" > docs/static/qr.png
93+
else
94+
qr "file://$(current_dir)" > docs/static/qr.png
95+
endif
96+
97+
# Build tarball
98+
build/tarball: build/qr build/metadata
99+
mkdir -p "$(OUTPUT_DIR)"
100+
tar cvf "$(OUTPUT_DIR)"/source.tar --exclude-from=.gitignore --exclude=.git --exclude="$(OUTPUT_DIR)" .
101+
tar uvf "$(OUTPUT_DIR)"/source.tar ./Makefile
102+
tar uvf "$(OUTPUT_DIR)"/source.tar -C "$(OUTPUT_DIR)" ./CHANGELOG.txt ./ORIGIN.txt
103+
gzip -9 < "$(OUTPUT_DIR)"/source.tar > "$(OUTPUT_DIR)"/source.tar.gz
104+
rm "$(OUTPUT_DIR)"/source.tar
105+
106+
# Build tree
107+
build/tree: $(addprefix build/,$(obj)) build/tarball
108+
mkdir -p "$(OUTPUT_DIR)"
109+
ifneq ("$(origin_exists)", "")
110+
cd "$(OUTPUT_DIR)" && tree -T "$(shell cat ORIGIN.txt | sed -r 's|^.*@(.*):|\1/|g' | sed 's@.*://@@g' | sed 's/.git$$//g')" --du -h -D -H . -I 'index.html|release.tar.gz|release.zip' -o "index.html"
111+
else ifneq ("$(is_git_repo)", "")
112+
cd "$(OUTPUT_DIR)" && tree -T "$(shell git remote get-url origin | sed -r 's|^.*@(.*):|\1/|g' | sed 's@.*://@@g' | sed 's/.git$$//g')" --du -h -D -H . -I 'index.html|release.tar.gz|release.zip' -o "index.html"
113+
else
114+
cd "$(OUTPUT_DIR)" && tree -T "$(notdir $(patsubst %/,%,$(current_dir)))" --du -h -D -H . -I 'index.html|release.tar.gz|release.zip' -o "index.html"
115+
endif
116+
117+
# Build archive
118+
build/archive: build/tree
119+
mkdir -p "$(OUTPUT_DIR)"
120+
tar -I 'gzip -9' -cvf "$(OUTPUT_DIR)"/release.tar.gz -C "$(OUTPUT_DIR)" --exclude="release.tar.gz" --exclude="release.zip" $(shell ls $(OUTPUT_DIR))
121+
rm -f "$(OUTPUT_DIR)"/release.zip
122+
zip -9 -j -x 'release.tar.gz' -x 'release.zip' -FSr "$(OUTPUT_DIR)"/release.zip "$(OUTPUT_DIR)"/*
123+
124+
# Open
125+
$(foreach o,$(obj),$(foreach f,$(formats),open-$(f)/$(o))):
126+
xdg-open "$(OUTPUT_DIR)/$(notdir $(subst open-,,$@)).$(subst /,,$(dir $(subst open-,,$@)))"
127+
128+
# Develop
129+
dev: build
130+
while inotifywait -r -e close_write --exclude 'out' .; do $(MAKE); done
131+
$(foreach o,$(obj),$(foreach f,$(formats),dev-$(f)/$(o))):
132+
$(MAKE) $(subst dev-,build-,$@)
133+
while inotifywait -r -e close_write --exclude 'out' .; do $(MAKE) $(subst dev-,build-,$@); done
23134

135+
# Clean
24136
clean:
25-
rm -rf out
137+
rm -rf "$(OUTPUT_DIR)" docs/static/qr.png
26138

139+
# Dependencies
27140
depend:
28-
docker pull pandoc/latex
141+
pip install pillow qrcode md2gemini
142+
curl -L -o /tmp/Eisvogel.zip 'https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest/download/Eisvogel.zip'
143+
mkdir -p "$${HOME}/.local/share/pandoc/templates"
144+
unzip -p /tmp/Eisvogel.zip eisvogel.latex > "$${HOME}/.local/share/pandoc/templates/eisvogel.latex"

‎README.md

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
# Uni DB1 Notes
22

3-
Personal notes for the DB1 course at HdM Stuttgart. DB1 is an introduction to SQL and PL/SQL using the proprietary Oracle database.
3+
Notes for the DB1 (databases) course at HdM Stuttgart. DB1 is an introduction to SQL and PL/SQL using the proprietary Oracle database.
44

55
If you intend on learning how to work with databases, please refrain from using the proprietary Oracle database. Choose a superior alternative, such as PostgreSQL or MariaDB instead. [Free Software, Free Society](https://www.fsf.org/about/what-is-free-software)!
66

7-
[![pandoc CI](https://github.com/pojntfx/uni-db1-notes/actions/workflows/pandoc.yaml/badge.svg)](https://github.com/pojntfx/uni-db1-notes/actions/workflows/pandoc.yaml)
7+
[![Deliverance CI](https://github.com/pojntfx/uni-db1-notes/actions/workflows/deliverance.yaml/badge.svg)](https://github.com/pojntfx/uni-db1-notes/actions/workflows/deliverance.yaml)
88

99
## Overview
1010

11-
You can [view and download the notes from GitHub pages](https://pojntfx.github.io/uni-db1-notes/). They can also be downloaded as a Zip archive from [GitHub releases](https://github.com/pojntfx/uni-db1-notes/releases).
11+
You can [view the notes on GitHub pages](https://pojntfx.github.io/uni-db1-notes/), [download them from GitHub releases](https://github.com/pojntfx/uni-db1-notes/releases/latest) or [check out the source on GitHub](https://github.com/pojntfx/uni-db1-notes).
12+
13+
## Contributing
14+
15+
To contribute, please use the [GitHub flow](https://guides.github.com/introduction/flow/) and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
16+
17+
To build and open a note locally, run the following:
18+
19+
```shell
20+
$ git clone https://github.com/pojntfx/uni-db1-notes.git
21+
$ cd uni-db1-notes
22+
$ ./configure
23+
$ make depend
24+
$ make dev-pdf/your-note # Use Bash completion to list available targets
25+
# In another terminal
26+
$ make open-pdf/your-note # Use Bash completion to list available targets
27+
```
28+
29+
The note should now be opened. Whenever you change a source file, it will automatically be re-compiled.
1230

1331
## License
1432

15-
Uni DB1 Notes (c) 2021 Felicitas Pojtinger and contributors
33+
Uni DB1 Notes (c) 2022 Felicitas Pojtinger and contributors
1634

1735
SPDX-License-Identifier: AGPL-3.0

‎configure

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
curl -LO https://github.com/pojntfx/deliverance/releases/latest/download/Makefile

‎docs/DB1 Syntax-Cheatsheet.md ‎docs/cheatsheet.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
% DB1 Syntax-Cheatsheet
2-
% Felicitas Pojtinger
3-
% \today
4-
\setcounter{tocdepth}{5}
5-
\tableofcontents
6-
7-
# DB1 Syntax-Cheatsheet
1+
---
2+
author: [Felicitas Pojtinger]
3+
date: "2022-02-01"
4+
subject: "Uni DB1 Syntax Details"
5+
keywords: [databases, oracle, hdm-stuttgart]
6+
subtitle: "Syntax cheatsheet for the DB1 (databases) course at HdM Stuttgart"
7+
lang: "de"
8+
---
9+
10+
# Uni DB1 Syntax Cheatsheet
811

912
> "Come, let us go down and confuse their language so they will not understand each other" - Genesis 11:7, _Die Bibel_
1013

‎docs/DB1 Auswendiglernen.md ‎docs/main.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
% DB1 Auswendiglernen
2-
% Felicitas Pojtinger
3-
% \today
4-
\tableofcontents
5-
6-
# DB1 Auswendiglernen
1+
---
2+
author: [Felicitas Pojtinger]
3+
date: "2022-02-01"
4+
subject: "Uni DB1 Notes"
5+
keywords: [databases, oracle, hdm-stuttgart]
6+
subtitle: "Notes for the DB1 (databases) course at HdM Stuttgart"
7+
lang: "de"
8+
---
9+
10+
# Uni DB1 Notes
711

812
> "The true courage is to admit that the light at the end of the tunnel is probably the headlight of another train approaching" - Slavoj Žižek, _The Courage of Hopelessness_
913

‎docs/static/qr.png

668 Bytes
Loading

‎docs/DB1 Syntax Details.md ‎docs/syntax.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
% DB1 Syntax Details
2-
% Felicitas Pojtinger
3-
% \today
4-
\tableofcontents
5-
6-
# DB1 Syntax Details
1+
---
2+
author: [Felicitas Pojtinger]
3+
date: "2022-02-01"
4+
subject: "Uni DB1 Syntax Details"
5+
keywords: [databases, oracle, hdm-stuttgart]
6+
subtitle: "Syntax details for the DB1 (databases) course at HdM Stuttgart"
7+
lang: "de"
8+
---
9+
10+
# Uni DB1 Syntax Details
711

812
> "so basically i am monkey" - monke, _monkeeee_
913

0 commit comments

Comments
 (0)
This repository has been archived.