2.7 KiB
title | description | categories | git | cover | cover_alt | date | |||
---|---|---|---|---|---|---|---|---|---|
Post it generator | Prototype for web-to-print postit |
|
https://git.xpub.nl/kamo/postit-gen | susi.jpg | fake sushi | 08/03/2022 |
POST-IT GENERATOR
TO AUGMENT OUR PRODUCTIVITY HERE IS A SCRIPT THAT
Generate post-it blocks from markdown files.
Install
Clone the repo
git clone https://git.xpub.nl/kamo/postit-gen.git
Move to the cloned folder
cd postit-gen
Create a virtual environment
python3 -m venv venv
and activate it
. venv/bin/activate
Then you can install the repo
pip3 install -e .
How to use
The package offers two scripts: template.py
and generate.py
.
template.py
generate a template folder with a markdown file that can be used as a starting point for formatting the contents.
python3 template.py -f test
Will generate a test
folder, with the markdown template for the contents.
The contents.md
file has these properties:
title
, the title of the blockfolder
, the base folder in which the files arepage_width
, the width of the page for the printingpage_height
, the height of the page for the printingpost_width
, the width of the post-it for the printingpost_height
, the height of the post-it for the printingmargin
, the margin for the pageunit
, the measure unit in which the measures are expressed, default is mmbackground
, the color of the post-its. Accept all the format CSS specs accept. Default is white.contents
, a list of contents to put in the post-it block. Each entry is a post-it.
All these parameters are formatted in YAML.
After setting all the parameters to match your needs, you can fill the contents. ATM you can insert text and images, in the form of a list.
contents:
- A flat with no floors
- Hello, where are you, what can you see from there?
- type: image
src: game.png
Usually each entry of the list will be considered as a string. If you want to insert an image you will need to provide a type: image
, and a src: <filename>
.
In this way:
contents:
- type: image
src: <filename>
Once you inserted your contents, you can run the generate.py
script, specifying the working folder from which you want to take the contents.
python3 generate.py -f test
It will take the contents inside the test
folder and will generate a ready-to-print HTML file, serving it with a simple http-server at http://localhost:8000/test
. Opening that link you can preview your post-it blocks. Each entry of the contents
list is now a page in the document (in the print mode!)
TODO: link css file in the template to work directly on the preview.