-
Notifications
You must be signed in to change notification settings - Fork 1.1k
rcv:0.1.0 #4889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
rcv:0.1.0 #4889
Changes from all commits
a2c9571
a0c3c06
a180cd1
1bc4de2
3e2c75c
fd67a08
89ccd3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # typst-rcv | ||
|
|
||
| RCV ballot papers for Typst. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```typst | ||
|
|
||
| #import "@preview/typst-rcv:0.1.0": ballot_template, choices | ||
| #set document(title: [ RCV Ballot ]) | ||
| #show: ballot_template | ||
|
|
||
| # Contest 1 | ||
|
Check warning on line 13 in packages/preview/rcv/0.1.0/README.md
|
||
|
|
||
| #choices([ Choice 1 ], [ Choice 2 ]) | ||
| ``` | ||
|
|
||
| > [!TIP] | ||
| > `choices()` can be used by itself without the template. | ||
|
|
||
| ## License | ||
|
|
||
| ``` | ||
| Copyright (C) 2026 Reese Armstrong | ||
|
|
||
| This program is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
Check warning on line 37 in packages/preview/rcv/0.1.0/README.md
|
||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #let choices(names, box_size: 0.5in, gap: 0.125in, text_size: 20pt, margin_top: 0.25cm) = { | ||
|
Check warning on line 1 in packages/preview/rcv/0.1.0/lib.typ
|
||
| v(margin_top) | ||
|
|
||
| for c in names { | ||
| stack( | ||
| dir: ltr, | ||
| box( | ||
| stroke: luma(0), | ||
| width: box_size, | ||
| height: box_size, | ||
| ), | ||
| h(gap), | ||
| text( size: text_size, baseline: gap )[ #c ] | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| #let ballot_template(doc) = { | ||
| set text(16pt) | ||
| set par( | ||
| spacing: 20pt, | ||
| ) | ||
| title(context { | ||
| if document.title != none { | ||
| document.title | ||
| } else [ | ||
| RCV Ballot | ||
| ] | ||
| }) | ||
|
|
||
| [ | ||
| Rank choices in ascending order from most preferred (1) to least preferred. | ||
|
|
||
| Rank all choices where you would be satisfied with the outcome. | ||
|
|
||
|
|
||
| === Example | ||
|
|
||
| #set text(13pt) | ||
|
|
||
|
|
||
| Johnny and his friends are voting on lunch options. Johnny would be satisfied with either hot dogs or burgers, but prefers hot dogs. | ||
|
|
||
| Johnny ranks hot dogs number 1 and burgers number 2, but leaves pancakes blank because he would not be happy with them. | ||
|
|
||
| #image("media/example.png", width: 2in, height: 2in) | ||
|
|
||
|
|
||
| #v(0.5cm) | ||
| ] | ||
|
|
||
| doc | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, this file is not used anywhere. Can you delete it or use it as an illustration in your README?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used in the template for instructions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, thank you for pointing it out. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #import "@preview/rcv:0.1.0": ballot_template, choices | ||
|
|
||
| #set document(title: [RCV Ballot]) | ||
| #show: ballot_template | ||
|
|
||
| == Contest 1 | ||
|
|
||
| #choices(([ Choice 1 ], [ Choice 2 ], [ Choice 3 ])) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [package] | ||
| name = "rcv" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name is too canonical in my opinion, which we try to avoid. See our naming guidelines. Can you please pick another name? |
||
| version = "0.1.0" | ||
| entrypoint = "lib.typ" | ||
| authors = ["reesericci"] | ||
| license = "GPL-3.0-or-later" | ||
| description = "Simple RCV ballots" | ||
| repository = "https://codeberg.org/reesericci/typst-rcv" | ||
| categories = ["office", "fun"] | ||
|
|
||
| [template] | ||
| path = "template" | ||
| entrypoint = "main.typ" | ||
| thumbnail = "media/thumbnail.png" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import here needs to be updated.