Browse Source

Bootstrap the portfolio generator

master
Luke Murphy 5 years ago
commit
65dab63400
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 1
      .gitignore
  2. 18
      Makefile
  3. 11
      README.md
  4. 77
      header.html
  5. 73
      styles.css

1
.gitignore

@ -0,0 +1 @@
generated/

18
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

11
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
```

77
header.html

@ -0,0 +1,77 @@
<style type='text/css' media='screen'>
@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;
}
</style>

73
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;
}
Loading…
Cancel
Save