commit 65dab6340048ef323cfe7cb59a9e28c27a6fba02 Author: Luke Murphy Date: Sun Jun 23 13:29:56 2019 +0200 Bootstrap the portfolio generator diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ab870d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +generated/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a873221 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +CONTAINER := debian:weasyprint +CURL := curl -sSL +PANDOC := pandoc +GENERATED_DIR := generated +HEADER := header.html +PORTFOLIO := https://pad.vvvvvvaria.org/solitude.portfolio/export/txt +STYLES := styles.css +WEASYPRINT := weasyprint -s $(STYLES) + +portfolio: + @mkdir -p generated + @$(CURL) $(PORTFOLIO) | $(PANDOC) \ + --read markdown \ + --write html \ + --standalone \ + --include-in-header $(HEADER) \ + --output $(GENERATED_DIR)/portfolio.html + @$(WEASYPRINT) --presentational-hints $(GENERATED_DIR)/portfolio.html $(GENERATED_DIR)/portfolio.pdf diff --git a/README.md b/README.md new file mode 100644 index 0000000..88692b9 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# rigged-systems-portfolio-generator + +``` +$ sudo apt install -y \ + build-essential curl libcairo2 libcairo2-dev libffi-dev libgdk-pixbuf2.0-0 libpango-1.0-0 \ + libpangocairo-1.0-0 pandoc python3 python3-cffi python3-dev python3-pip python3-setuptools \ + python3-wheel shared-mime-info +$ python3 -m venv .venv && source .venv/bin/activate +$ pip install weasyprint +$ make portfolio +``` diff --git a/header.html b/header.html new file mode 100644 index 0000000..6106878 --- /dev/null +++ b/header.html @@ -0,0 +1,77 @@ + diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..227fc9e --- /dev/null +++ b/styles.css @@ -0,0 +1,73 @@ +@page{ + margin:5mm 12mm; +} + +body{ + position:relative; + font-size: 0.75em; + line-height: 1.25; + color:#444; + max-width: 700px; + margin:5px auto; + left: 0px; + width: 100%; +} + +table, th, td { + border: 1px solid black; +} + table { + width: 100%; + margin: 20px 10px; + } + th, td{ + padding:5px; + text-align: left; + } + +h1, h2, h3{ + margin-top:1.5em; + clear: both; + break-after: avoid; +} + +hr{ + border:0; + page-break-after: always; +} + +figure img, figure figcaption{ + max-width:320px; + max-height:260px; + margin: 10px 10px 0 0; +} + figure figcaption{ + font-family: monospace; + font-size: 12px; + line-height: 1.25; + margin-bottom:20px; + } + +.img-left figure { + float: left; + margin: 0 20px; +} + +.img-right figure { + float: right; + margin: 0 20px; +} + +.img-big figure{ + margin:0 20px; +} + .img-big figure img, .img-big figure figcaption{ + max-width: 100%; + max-height: 100%; + clear: both; + } + + +.footnotes{ + page-break-before: avoid; +}