Compare commits

...

7 Commits

Author SHA1 Message Date
63acdd1397 style(show): use show: lettre.with() instead of unnamed function
- Maybe more idiomatic… not sure actually
2025-02-11 20:03:47 +01:00
1961298f00 style(template): remove useless else 2024-10-20 11:26:16 +02:00
9af1dcb98b fix(template): fix the display of location and date
- extra space
- without the location, the comma still appeared
- docs(readme): add the optional comment for the sending location
2024-10-20 11:24:05 +02:00
be06465111 style(readme): Add a link to lettre.typ 2024-10-19 21:40:23 +02:00
5235b3a891 fix(readme): remove unnecessary line 2024-10-19 21:39:40 +02:00
dccd6c9d6d style(example): wrapping 2024-10-19 21:37:48 +02:00
45a8a53404 docs(readme): add usage + example 2024-10-19 21:37:41 +02:00
4 changed files with 53 additions and 5 deletions

Binary file not shown.

View File

@ -1,7 +1,7 @@
#import "lettre.typ": *
#show link: strong
#show: doc => lettre(
#show: lettre.with(
de: [
Ex Péditeur,\
12 rue des Sept Nains\
@ -21,10 +21,10 @@
post: [
#emph("PS: Finalement, rien.")
],
doc
)
je soussigné, Ex Péditeur, atteste par la présente sur lhonneur que ce document
a été réalisé avec #link("https://typst.app/")[Typst].
Les sources sont disponibles à ladresse suivante: #link("https://git.epheme.re/fmouhart/typst-lettre").
Les sources sont disponibles à ladresse suivante:
#link("https://git.epheme.re/fmouhart/typst-lettre").

View File

@ -17,13 +17,22 @@
show raw: set text(font: "Inconsolata")
show heading: set block(above: 1.4em, below: 1em)
let formatLieuDate(lieu, date) = {
let isDate = date.trim().len() > 0;
let isLieu = lieu.trim().len() > 0;
if isLieu [#lieu]
if isDate {
if isLieu [, ]
[le #date]
}
}
grid(
columns: (2fr, 1fr, 2fr),
par(de),
text[],
text[
#lieu
#if date.trim().len() != 0 [, le #date ]
#formatLieuDate(lieu, date)
] + v(2em),
text[],
text[],

View File

@ -1 +1,40 @@
A simple template for French letters for typst.
## Usage
To create a letter, write a typst document while defining the following
parameters, with the [`lettre.typ`](./lettre.typ) file in the same folder:
```typst
#import "lettre.typ": *
#show: lettre.with(
de: [
Sender\
Address
],
pour: [
Recipient\
Address
],
objet: "subject of the letter", // optional
date: "date of sending", // optional
lieu: "location", // optional
introduction: "opening",
cloture: "closing",
signature: "signature",
post: [
post-letter (e.g., post-scriptum)
],
)
```
Now you can fill the letter afterward, and compile your document with:
```bash
typst compile <filename.typ>
```
## Example
An example file is given in the [`exemple.typ`](./exemple.typ) file in the repository.