Commit 4f4631da authored by Dorian's avatar Dorian
Browse files

added a cute cover

parent c02b19e0
......@@ -45,3 +45,8 @@ This will generate the ```potelets.html``` file, by filling the ```template.html
The layout uses **paged.js** for pagination, which need to be on a server in order to work.
Open the server in a web browser and you can get your .pdf from here.
Note that you have to rerun python script every time you make a change to the template, then the server should update automatically.
To avoid ultra big .pdf we can resample them with ```resample-pdf.sh``` with this command
```
./resample-pdf.sh [dpi] [$pdffile]
```
:root{
--page-height: calc(var(--pagedjs-height) - var(--pagedjs-margin-top));
}
body{
font-family: "Liberation Mono";
font-size: 0.8125rem;
}
.mono{
font-family: "Liberation Mono";
/* for monospace compatibility */
/*good font-size for monospace visual compatibility with variablewidth fonts */
font-size: 0.8125rem;
}
.serif{
......@@ -14,6 +23,52 @@
align-items: baseline;
}
/* ___ COVER ____ */
#cover{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
height: var(--page-height);
}
/* #cover h1{
flex: 0 0 100%;
font-family: "Liberation Serif";
font-size: 134pt;
text-align: center;
margin-bottom: 0;
} */
#cover h1{
flex: 0 0 100%;
font-family: "Liberation Serif";
font-size: 300pt;
text-align: center;
margin: 0;
}
#cover h1 .missing{
border: 1pt dashed black;
text-align: center;
padding: 0.05em;
/* padding-right: calc(0.045em + 0.05em); */
position: relative;
bottom: -0.2em;
border-radius: 1em;
}
#cover h1 .damaged{
font-style: italic;
}
#cover h2{
flex: 0 0 100%;
font-size: 1rem;
font-weight: normal;
text-align: left;
color: darkgrey;
position: absolute;
top: 0; left: 0;
}
/* ___ POTELETS LAYOUT ____ */
.potelet{
......@@ -122,8 +177,6 @@ main .date{
margin: 1.6cm;
@bottom-right {
font-family: "Liberation Mono";
font-size: 0.8125rem;
color: lightgrey;
content: string(title) " - page " counter(page);
}
......
......@@ -28,7 +28,7 @@ def create_connection(db_file):
def get_potelets(conn):
""" return the last 100 potelet cases and format them for templating
"""
sql = ''' SELECT * FROM potelets ORDER BY id DESC LIMIT 200'''
sql = ''' SELECT * FROM potelets ORDER BY id DESC LIMIT 50'''
# sql = ''' SELECT potelet_id FROM history WHERE type='INCIDENT_ASKED_REOPENING '''
cur = conn.cursor()
cur.execute(sql)
......@@ -110,21 +110,21 @@ def format_actor(actor_type, organisation, department):
if __name__ == '__main__':
print('--- Writing the html layout ---')
print('___ Writing the html layout ___')
print('Establishing db connection')
print('1. Establishing db connection')
conn = create_connection(db_file)
print('Opening template file')
print('2. Opening template file')
with open(template_file, 'r') as file:
template = Template(file.read())
print('Making the sqlite requests')
context = get_potelets(conn)
print('3. Making the sqlite requests')
potelets = get_potelets(conn)
print('Printing html layout in ' + layout_file)
html = template.render(context = context)
print('4. Printing html layout in ' + layout_file)
html = template.render(potelets = potelets)
with open(layout_file, 'w') as file:
file.write(html)
print('Layout generated')
print('---> Layout generated')
This diff is collapsed.
#! /bin/bash
dpi=$1;
pdffile=$2;
gs \
-o "${pdffile%.pdf}-resampled.pdf" \
-sDEVICE=pdfwrite \
-dDownsampleColorImages=true \
-dDownsampleGrayImages=true \
-dDownsampleMonoImages=true \
-dColorImageResolution=$dpi \
-dGrayImageResolution=$dpi \
-dMonoImageResolution=$dpi \
-dColorImageDownsampleThreshold=1.0 \
-dGrayImageDownsampleThreshold=1.0 \
-dMonoImageDownsampleThreshold=1.0 \
-dAutoRotatePages=/None \
"${pdffile}"
......@@ -13,7 +13,20 @@
</head>
<body>
{% for potelet in context %}
<div id="cover">
<!-- <h1>_¡_<i>¡</i>_._¡_</h1> -->
<h1 class="alt">
<span class="missing">&nbsp;</span>
<span class="damaged">¡</span>
</h1>
<h2>
6349<br/>
missing and damaged boolards<br/>
in Bruxelles
</h2>
</div>
{% for potelet in potelets %}
<div class="potelet mono">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment