Skip to content

Commit

Permalink
electify:0.1.1 (#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
G0STG0D authored Feb 17, 2025
1 parent 374c0be commit 81cf16b
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/preview/electify/0.1.1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pdf
5 changes: 5 additions & 0 deletions packages/preview/electify/0.1.1/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58 changes: 58 additions & 0 deletions packages/preview/electify/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# German Ballot Paper

![Thumbnail](thumbnail.png "Example of the Federal Election 2025")

## Code Example

```typst
#import "@preview/ballot-paper-de:0.1.0": ballot-paper
#show: ballot-paper(
type: "zum Deutschen Bundestag", // Type of election
date: datetime(year: 2025, month: 2, day: 23), // Date of election
constituency: "2 Nordfriesland \u{2012} Dithmarschen Nord", // Constituency of the Ballot Paper
parties: ( // Party list on the Ballot Paper
(
name: "Partei der Parteien Deutschlands", // Party full name
abbrevation: "PDPD", // Party abbrevation
top_candidate: ( // (First Vote) Party top candidate
first_name: "Max", // (First Vote) First Name of the top candidate
last_name: "Mustermann", // (First Vote) Last Name of the top candidate
profession: "Musterarbeiter", // (First Vote) Profession of the top candidate
place: "Musterstadt" // (First Vote) Work place of the top candidate
),
candidates: ( // (Second Vote) Candidates of the party
"Max Mustermann", "Erika Musterfrau"
)
),
(
name: "Die Neue Union der Parteien",
abbrevation: "NUP",
top_candidate: none, // `none` if the party has no top candidate in this constituency
candidates: (
"Max Mustermann", "Erika Musterfrau"
)
),
(
name: "Unabhängig für Deutschland",
abbrevation: "",
top_candidate: (
first_name: "Erika",
last_name: "Musterfrau",
profession: "Musterberuf",
place: "Musterort"
),
candidates: none // `none` if the candidate has no party (independent or association)
)
)
)
```

## Dependencies

- typst 0.12.0
- datify 0.1.3 (a Typst package for improved date formatting)

## License

This template is licensed according to the MIT license (see `LICENSE`)
164 changes: 164 additions & 0 deletions packages/preview/electify/0.1.1/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#let ballot-paper(
type: str,
date: datetime,
constituency: str,
parties: array) = {

import "@preview/datify:0.1.3": custom-date-format

let txtBlue = rgb("0e7ec3")
let txtGray = rgb("4b4c4d")

set text(lang: "de", font: "Fira Sans", size: 10pt, fill: txtGray)
set page(height: auto, margin: (top: 40pt, bottom: 20pt, x: 20pt), columns: 2)
set columns(gutter: 15pt)
set par(leading: 10pt)

let party-first-counter = counter("party-first")
let party-second-counter = counter("party-second")

place(
top + center,
scope: "parent",
float: true,
block[
#text(size: 25pt, weight: "bold")[Stimmzettel] \ #v(2pt)
#text(size: 12pt)[
für die Wahl #type \
am #custom-date-format(date, "DD. MMMM YYYY", "de") \
im Wahlkreis #constituency
]
#v(5pt)

#text(size: 20pt, weight: "bold")[Sie haben]
#text(size: 30pt, weight: "black")[#h(8pt)2#h(12pt)]
#text(size: 20pt, weight: "bold")[Stimmen]
#v(-6pt)
#image("media/arrows.png", width: 260pt)
#v(-8pt)
]
)

// ERSTSTIMME
set align(right)

text(size: 12pt, weight: "bold")[hier 1 Stimme\ ]
text[für die Wahl\ ]
text(size: 12pt, weight: "bold")[einer Wahlkreisbewerberin/\ ]
text(size: 12pt, weight: "bold")[eines Wahlkreisbewerbers\ ]

linebreak()
linebreak()
text(size: 18pt, weight: "bold")[Erststimme]

set align(left)

table(
columns: (auto, 1.2fr, 1fr, auto),
inset: (x: 5pt, y: 8pt),
stroke: none,
rows: 65pt,
align: horizon,

table.hline(stroke: 1.3pt + txtGray),

..for party in parties {
( table.vline(stroke: 1.3pt + txtGray), )

if party.top_candidate == none {
(table.cell(colspan: 4)[#party-first-counter.step()],)
( table.hline(stroke: 0.6pt + txtGray), )
continue
}

( text(weight: "bold", size: 12pt)[
#align(right)[
#party-first-counter.step()
#context party-first-counter.display()#v(1fr)]
],
)
( table.vline(stroke: 0.6pt + txtGray),)
([
#text(weight: "bold", size: 12pt)[#party.top_candidate.last_name,]
#text(size: 7pt)[#party.top_candidate.first_name]
#v(1fr)
#par(leading: 5pt)[#text(size: 7pt)[
#party.top_candidate.profession \
#party.top_candidate.place
]]
],)
([
#par(leading: 6pt)[
#text(size: 12pt, weight: "bold")[#party.abbrevation]; #linebreak()
#text(size: 7pt)[#party.name]
]
],)
( table.vline(stroke: 0.6pt + txtGray), )
( circle(radius: 13pt), )
( table.vline(stroke: 1.3pt + txtGray), )
( table.hline(stroke: 0.6pt + txtGray), )
},

table.hline(stroke: 1.3pt + txtGray),
)

// ZWEITSTIMME
colbreak()

set align(left)
set text(fill: txtBlue)

text(size: 12pt, weight: "bold")[hier 1 Stimme\ ]
text[für die Wahl\ ]
text(size: 12pt, weight: "bold")[einer Landesliste (Partei)\ ]
text(size: 10pt)[\u{2012} maßgebende Stimme für die Verteilung der \
#h(8pt)Sitze ingesamt auf die einzelnen Parteien \u{2012}]

v(-0.55pt)
linebreak()
text(size: 18pt, weight: "bold")[Zweitstimme]

linebreak()
table(
columns: (auto, 1fr, 2fr, auto),
inset: (x: 5pt, y: 8pt),
stroke: none,
rows: 65pt,
align: horizon,

table.hline(stroke: 1.3pt + txtBlue),

..for party in parties {
( table.vline(stroke: 1.3pt + txtBlue), )

if party.candidates == none {
(table.cell(colspan: 4)[#party-second-counter.step()],)
( table.hline(stroke: 0.6pt + txtBlue), )
continue
}

( circle(radius: 13pt, stroke: txtBlue), )
( table.vline(stroke: 0.6pt + txtBlue), )
( par(justify: true)[#text(weight: "bold", size: 14pt)[#party.abbrevation]],)
( par(leading: 5.5pt)[
#text(size: 9pt, weight: "bold")[#party.name]
#v(-5pt)
#text(size: 6.25pt)[#party.candidates.join(", ")]
],
)
( table.vline(stroke: 0.6pt + txtBlue), )
( text(weight: "bold", size: 12pt)[
#align(right)[
#party-second-counter.step()
#context party-second-counter.display()#v(1fr)]
],
)
( table.vline(stroke: 1.3pt + txtBlue), )
( table.hline(stroke: 0.6pt + txtBlue), )
},

table.hline(stroke: 1.3pt + txtBlue),

)

}
Binary file added packages/preview/electify/0.1.1/media/arrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
153 changes: 153 additions & 0 deletions packages/preview/electify/0.1.1/template/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#import "@preview/electify:0.1.1": ballot-paper

#show: ballot-paper(
type: "zum Deutschen Bundestag",
date: datetime(year: 2025, month: 2, day: 23),
constituency: "2 Nordfriesland \u{2012} Dithmarschen Nord",
parties: (
(
name: "Sozialdemokratische Partei Deutschlands",
abbrevation: "SPD",
top_candidate: (
first_name: "Truels",
last_name: "Reichardt",
profession: "Sozialpädagoge / Sozialarbeiter",
place: "Mildstedt"
),
candidates: (
"Tim Klüssendorf", "Dr. Nina Scheer", "Dr. Ralf Stegner", "Bettina Hagedorn", "Truels Reichardt"
)
),
(
name: "Christlich Demokratische Union Deutschlands",
abbrevation: "CDU",
top_candidate: (
first_name: "Mark",
last_name: "Helfrich",
profession: "MdB",
place: "Dängeling"
),
candidates: (
"Dr. Johann David Wadephul", "Petra Nicolaisen", "Mark Helfrich", "Melanie Bernstein", "Leif Erik Bodin"
)
),
(
name: "BÜNDNIS 90/DIE GRÜNEN",
abbrevation: "GRÜNE",
top_candidate: (
first_name: "Fabian",
last_name: "Dr. Faller",
profession: "Betriebsleiter\nEnergiewirtschaft",
place: "Kiel"
),
candidates: (
"Luise Amtsberg", "Robert Habeck", "Denise Loop", "Dr. Konstantin von Notz", "Mayra Vriesema"
)
),
(
name: "Freie Demokratische Partei",
abbrevation: "FDP",
top_candidate: (
first_name: "Michael",
last_name: "Wamser",
profession: "Technischer Betriebswirt",
place: "Brunsbüttel"
),
candidates: (
"Wolfgang Kubicki, Gyde Jensen-Bornhöft", "Maximilian Mordhorst", "Nora Grundmann", "Philipp Rösch"
)
),
(
name: "Alternative für Deutschland",
abbrevation: "AfD",
top_candidate: (
first_name: "Ralf",
last_name: "Kirbach",
profession: "Gas-Wasserinstallateur-Meister",
place: "Itzehoe"
),
candidates: (
"Kurt Kleinschmidt", "Gereon Bollmann", "Volker Schnurrbusch", "Kerstin Przygodda", "Sven Wendorf"
)
),
(
name: "Die Linke",
abbrevation: "Die Linke",
top_candidate: (
first_name: "Tobias",
last_name: "Braunsdorf",
profession: "Angesteller (Soziale Medien)",
place: "Wedel"
),
candidates: (
"Lorenz Gösta Beutin", "Tamara Mazzi", "Marlies Wiegand", "Finn Luca Frey", "Bianca Szygula"
)
),
(
name: "Südschleswigscher Wählerverband",
abbrevation: "SSW",
top_candidate: none,
candidates: (
"Stefan Seidler", "Maylis Roßberg", "Lukas Knöfler", "Sarina Magdalena Quäck", "Svend Wippich"
)
),
(
name: "Partei für Arbeit, Rechtsstaat, Tierschutz, Elitenförderung und basisdemokratische Initiative",
abbrevation: "Die\nPARTEI",
top_candidate: none,
candidates: (
"Niels Reimers", "Jana Käding", "Alexandra Richter", "Ove Schröter", "Beate Schreiber"
)
),
(
name: "FREIE WÄHLER",
abbrevation: "FREIE WÄHLER",
top_candidate: (
first_name: "Jens",
last_name: "Köster",
profession: "Account Manager",
place: "Krempe"
),
candidates: (
"Thomas Thedens", "Jens Köster", "Christian Runge", "Nicole Andres", "Arne Olaf Jöhnk"
)
),
(
name: "Volt Deutschland",
abbrevation: "Volt",
top_candidate: (
first_name: "Marco",
last_name: "Schulz",
profession: "User Experience Designer",
place: "Herzhorn"
),
candidates: (
"Kim Christin Holzmann", "Marco Schulz", "Kathrin Ostertag", "Christian Schweckendieck", "Kristina Silvia Scheuber"
)
),
(
name: "Marxistisch-Leninistische Partei Deutschlands",
abbrevation: "MLPD",
top_candidate: none,
candidates: (
"Maria Meyer", "Hans-Joachim Paulsen", "Karin Zan Bi", "Lüder Möller"
)
),
(
name: "BÜNDNIS DEUTSCHLAND",
abbrevation: "BÜNDNIS\nDEUTSCHLAND",
top_candidate: none,
candidates: (
"Stefan Andresen", "Nicolai Livonius", "Erika Damerow", "Dr. Christoph Heller", "Kerstin Hansen"
)
),
(
name: "Bündnis Sarah Wagenknecht\n\u{2012} Vernunft und Gerechtigkeit",
abbrevation: "BSW",
top_candidate: none,
candidates: (
"Milad Salami", "Martina Möller", "Dr. Jan-Philip Schneider", "Ramona Heppert", "Sahin Ercan"
)
),
)
)
Binary file added packages/preview/electify/0.1.1/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 81cf16b

Please sign in to comment.