Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'shared-style'
Browse files Browse the repository at this point in the history
  • Loading branch information
cikzh committed Mar 26, 2024
2 parents 51015a6 + 430c75c commit a2c8fd2
Show file tree
Hide file tree
Showing 8 changed files with 1,942 additions and 981 deletions.
20 changes: 18 additions & 2 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ pub enum PdfModel {
pub struct ModelO7Input {
gen_datum: String,
leden_van: String,
version: String,
datum: String,
kiesring: String,
kieskring: String,
stemmen: Vec<Lijst>,
}

Expand All @@ -37,7 +38,22 @@ pub struct Kandidaat {
}

#[derive(Serialize, Deserialize)]
pub struct ModelP22_1Input {}
pub struct ModelP22_1Input {
gen_datum: String,
version: String,
sha256: String,
leden_van: String,
datum: String,
partijen: Vec<Party>,
stemmen: Vec<Lijst>,
}

#[derive(Serialize, Deserialize)]
pub struct Party {
positie: u64,
naam: String,
gelijkluidend: bool,
}

impl PdfModel {
/// Get the filename for the input and template
Expand Down
7 changes: 6 additions & 1 deletion src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ fn load_sources() -> Vec<Source> {
// are available. We include these files into the binary in release mode, but
// read them at runtime on initialization to allow more rapid development on the
// typst files.
vec![include_source!("templates/model-o-7.typ")]
vec![
include_source!("templates/common/style.typ"),
include_source!("templates/common/scripts.typ"),
include_source!("templates/model-p-22-1.typ"),
include_source!("templates/model-o-7.typ"),
]
}

/// Load all fonts available from the `fonts/` directory
Expand Down
18 changes: 18 additions & 0 deletions templates/common/scripts.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#let input_digit() = {
box(width: 14pt, height: 9pt)[
#path(
stroke: black,
closed: false,
(15%, 0%),
(0%, 0%),
(0%, 100%),
(100%, 100%),
(100%, 0%),
(85%, 0%),
)
]
}

#let input_date() = [
#input_digit() #input_digit() - #input_digit() #input_digit() - #input_digit() #input_digit() #input_digit() #input_digit() (dd-mm-jjjj)
]
50 changes: 50 additions & 0 deletions templates/common/style.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#let conf(input, doc) = [
#set text(
font: "Bitstream Vera Sans",
size: 8pt
)
#set page(
paper: "a4",
margin: (x: 1.8cm, y: 1.5cm),
numbering: "1 / 1",
header: {
text([#input.version: Proces-verbaal van de uitslag van de verkiezing van de #input.leden_van])
line(length: 100%)
},
footer: [
#grid(
columns: (3fr, 1fr),
[
Datum: #input.gen_datum - SHA-256-Hashcode: \
input.sha256
],
align(right)[
pagina #counter(page).display("1 / 1", both: true)
]
)
]
)

#set heading(numbering: "1.1. ")

#show heading.where(level: 1): it => {
block(width: 100%, fill: black, inset: 6pt)[
#text(fill: white)[#it]
]
}

#doc
]

#let title(version, title, subtitle) = {
grid(
columns: (1fr),
gutter: 13pt,
text(weight: "extrabold", version),
text(size: 20pt, title),
text(subtitle),
[],
grid.hline(),
)

}
1,862 changes: 932 additions & 930 deletions templates/inputs/model-o-7.json

Large diffs are not rendered by default.

811 changes: 811 additions & 0 deletions templates/inputs/model-p-22-1.json

Large diffs are not rendered by default.

55 changes: 7 additions & 48 deletions templates/model-o-7.typ
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
#import "common/style.typ": conf
#import "common/scripts.typ": input_date, input_digit
#let input = json("inputs/model-o-7.json")

#set text(
font: "Bitstream Vera Sans",
size: 10pt
#show: doc => conf(
input,
doc
)
#set page(
paper: "a4",
margin: (x: 1.8cm, y: 1.5cm),
numbering: "1 / 1",
footer: [
#grid(
columns: (1fr, 1fr),
[Datum: #input.gen_datum],
align(right)[
pagina #counter(page).display("1 / 1", both: true)
]
)
]
)

#let input_digit() = {
box(width: 14pt, height: 9pt)[
#path(
stroke: black,
closed: false,
(15%, 0%),
(0%, 0%),
(0%, 100%),
(100%, 100%),
(100%, 0%),
(85%, 0%),
)
]
}

#let input_date() = [
#input_digit() #input_digit() - #input_digit() #input_digit() - #input_digit() #input_digit() #input_digit() #input_digit() (dd-mm-jjjj)
]

#show heading.where(level: 1): set text(size: 18pt)

#show heading.where(level: 3): set text(weight: "regular", size: 12pt)

=== Model O 7: Proces-verbaal van een hoofdstembureau

#line(length: 100%)

== Model O 7

= Proces-verbaal van een hoofdstembureau
De verkiezing van de leden van de *#input.leden_van*
#grid(
columns: (100pt, auto),
gutter: 5pt,
[op],
[*#input.datum*],
[Kiesring],
[*#input.kiesring*],
[kieskring],
[*#input.kieskring*],
)

#line(length: 100%)
Expand Down Expand Up @@ -126,4 +86,3 @@ Met dit proces-verbaal stelt het hoofdstembureau voor een kieskring de uitkomst
pagebreak(weak: true)
}


100 changes: 100 additions & 0 deletions templates/model-p-22-1.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#import "common/style.typ": conf, title
#import "common/scripts.typ": input_date, input_digit
#let input = json("inputs/model-p-22-1.json")

#show: doc => conf(
input,
doc
)

#title(
input.version,
[Proces-verbaal van de uitslag van de verkiezing van de #input.leden_van],
[De verkiezing van de leden van de *#input.leden_van* \ op *#input.datum*]
)

= Zitting; aantal kiesgerechtigden
Het betreft de openbare zitting van het centraal stembureau in *'s-Gravenhage*.
Datum en tijdstip aanvang zitting 1 december 2023 10:00 uur.
Het aantal kiesgerechtigden voor deze verkiezing bedraagt *12345678*.

= Verslag controlewerkzaamheden
Zie bijlage 2 bij dit proces-verbaal.

= Ingeleverde kandidatenlijsten
De volgende politieke groeperingen hebben deelgenomen aan de verkiezing (in de volgende kieskringen):

#pagebreak()

#table(
align: bottom,
columns: (
40pt, 80pt, 22pt, 22pt, 22pt, auto, auto, auto, auto, auto,
auto, auto, auto, auto, auto, auto, auto, auto, auto, auto,
auto, auto, auto, auto, auto,
),
inset: 8pt,
table.header(
[*Lijstnr.*],
[*Lijstnaam*],
table.cell(
colspan: 3,
[*Ingeleverd*]
),
table.cell(
colspan: 20,
[*Kieskring*]
),
[],
[],
rotate(-90deg, reflow: true, [Lijstengroep \ (gelijkluidende lijsten)]),
rotate(-90deg, reflow: true, [Lijstengroep \ (niet gelijkluidende lijsten)]),
rotate(-90deg, reflow: true, [Op zichzelf staande lijst]),
[1], [2], [3], [4], [5], [6], [7], [8], [9], [10],
[11], [12], [13], [14], [15], [16], [17], [18], [19], [20],
),
stroke: (
left: 0pt,
right: 0pt,
top: 0.5pt,
bottom: 0.5pt,
),
..for partij in input.partijen {
(
[#partij.positie],
partij.naam,

// Ingeleverd
if partij.gelijkluidend { [\*] },
if not partij.gelijkluidend { [\*] },
[],

// Kieskring
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],

[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
[\*],
)
}
)

#pagebreak(weak: true)

= Aantal stemmen per lijst

0 comments on commit a2c8fd2

Please sign in to comment.