Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
675 changes: 675 additions & 0 deletions packages/preview/rcv/0.1.0/LICENSE.md

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions packages/preview/rcv/0.1.0/README.md
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
Copy link
Copy Markdown
Member

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.

#set document(title: [ RCV Ballot ])
#show: ballot_template

# Contest 1

Check warning on line 13 in packages/preview/rcv/0.1.0/README.md

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/README.md#L13

Syntax error in README. expected expression If this code block is not supposed to be parsed as a Typst source, please explicitely specify another language.

#choices([ Choice 1 ], [ Choice 2 ])
```

> [!TIP]
> `choices()` can be used by itself without the template.

Check warning on line 19 in packages/preview/rcv/0.1.0/README.md

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/README.md#L18-L19

GFM alert boxes are not supported on Typst Universe.

## 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

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/README.md#L37

Syntax error in README. unclosed label If this code block is not supposed to be parsed as a Typst source, please explicitely specify another language.
```
53 changes: 53 additions & 0 deletions packages/preview/rcv/0.1.0/lib.typ
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

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/lib.typ#L1

This argument seems to be part of public function. It is recommended to use kebab-case names.

Check warning on line 1 in packages/preview/rcv/0.1.0/lib.typ

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/lib.typ#L1

This argument seems to be part of public function. It is recommended to use kebab-case names.

Check warning on line 1 in packages/preview/rcv/0.1.0/lib.typ

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/lib.typ#L1

This argument seems to be part of public function. It is recommended to use kebab-case names.
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) = {

Check warning on line 18 in packages/preview/rcv/0.1.0/lib.typ

View check run for this annotation

Typst package check / @preview/rcv:0.1.0

packages/preview/rcv/0.1.0/lib.typ#L18

This value seems to be public. It is recommended to use kebab-case names.
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
}
Binary file added packages/preview/rcv/0.1.0/media/example.png
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in the template for instructions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, thank you for pointing it out.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/preview/rcv/0.1.0/media/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/preview/rcv/0.1.0/template/main.typ
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 ]))
14 changes: 14 additions & 0 deletions packages/preview/rcv/0.1.0/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "rcv"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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"
Loading