Skip to content

Commit 298a450

Browse files
committed
delegis:0.4.0
1 parent e56a583 commit 298a450

File tree

12 files changed

+559
-0
lines changed

12 files changed

+559
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.pdf
2+
.DS_Store
3+
4+
# demo assets
5+
demo-*.png
6+
!demo-1.png
7+
!demo-2.png
8+
!demo-3.png
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 WüSpace e. V.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# delegis
2+
3+
<table>
4+
<tr>
5+
<td><img src="demo-1.png" alt="Page containing a logo at the top-right and a geric (example) title"></td>
6+
<td><img src="demo-2.png" alt="Page containing an outline"></td>
7+
<td><img src="demo-3.png" alt="Page containing a German-style legislative content including a preamble, division titles, sections, paragraph and sentence numbering, etc."></td>
8+
</tr>
9+
</table>
10+
11+
A package and template for drafting legislative content in a German-style structuring, such as for bylaws, etc.
12+
13+
While the template is designed to be used in German documents, all strings are customizable. You can have a look at the `delegis.typ` to see all available parameters.
14+
15+
## General Usage
16+
17+
While this `README.md` gives you a brief overview of the package's usage, we recommend that you use the template (in the `template` folder) as a starting point instead.
18+
19+
### Importing the Package
20+
21+
```typst
22+
#import "@preview/delegis:0.3.0": *
23+
```
24+
25+
### Initializing the template
26+
27+
```typst
28+
#show: delegis.with(
29+
// Metadata
30+
title: "Vereinsordnung zu ABCDEF", // title of the law/bylaw/...
31+
abbreviation: "ABCDEFVO", // abbreviation of the law/bylaw/... (can be none)
32+
resolution: "3. Beschluss des Vorstands vom 24.01.2024", // resolution number and date
33+
in-effect: "24.01.2024", // date when it comes into effect
34+
draft: false, // whether this is a draft
35+
// Template
36+
logo: image("wuespace.jpg", alt: "WüSpace e. V."), // logo of the organization, shown on the first page
37+
)
38+
```
39+
40+
### Sections
41+
42+
Sections are auto-detected as long as they follow the pattern `§ 1 ...` or `§ 1a ...` in its own paragraph:
43+
44+
```typst
45+
§ 1 Geltungsbereich
46+
47+
(1)
48+
Diese Ordnung gilt für alle Mitglieder des Vereins.
49+
50+
(2)
51+
Sie regelt die Mitgliedschaft im Verein.
52+
53+
§ 2 Mitgliedschaft
54+
55+
(1)
56+
Die Mitgliedschaft im Verein ist freiwillig.
57+
58+
(2)
59+
Sie kann jederzeit gekündigt werden.
60+
61+
§ 2a Ehrenmitgliedschaft
62+
63+
(1)
64+
Die Ehrenmitgliedschaft wird durch den Vorstand verliehen.
65+
```
66+
67+
Alternatively (or if you want to use special characters otherwise not supported, such as `*`), you can also use the `#section[number][title]` function:
68+
69+
```typst
70+
#section[§ 3][Administrator*innen]
71+
```
72+
73+
### Hierarchical Divisions
74+
75+
If you want to add more structure to your sections, you can use normal Typst headings. Note that only the level 6 headings are reserved for the section numbers:
76+
77+
```typst
78+
= Allgemeine Bestimmungen
79+
80+
§ 1 ABC
81+
82+
§ 2 DEF
83+
84+
= Besondere Bestimmungen
85+
86+
§ 3 GHI
87+
88+
§ 4 JKL
89+
```
90+
91+
Delegis will automatically use a numbering scheme for the divisions that is in line with the "Handbuch der Rechtsförmlichkeit", Rn. 379 f. If you want to customize the division titles, you can do so by setting the `division-prefixes` parameter in the `delegis` function:
92+
93+
```typst
94+
#show: delegis.with(
95+
division-prefixes: ("Teil", "Kapitel", "Abschnitt", "Unterabschnitt")
96+
)
97+
```
98+
99+
### Sentence Numbering
100+
101+
If a paragraph contains multiple sentences, you can number them by adding a `#s~` at the beginning of the sentences:
102+
103+
```typst
104+
§ 3 Mitgliedsbeiträge
105+
106+
#s~Die Mitgliedsbeiträge sind monatlich zu entrichten.
107+
#s~Sie sind bis zum 5. des Folgemonats zu zahlen.
108+
```
109+
110+
This automatically adds corresponding sentence numbers in superscript.
111+
112+
### Referencing other Sections
113+
114+
Referencing works manually by specifying the section number. While automations would be feasible, we have found that in practice, they're not as useful as they might seem for legislative documents.
115+
116+
In some cases, referencing sections using `§ X` could be mis-interpreted as a new section. To avoid this, use the non-breaking space character `~` between the `§` and the number:
117+
118+
```typst
119+
§ 5 Inkrafttreten
120+
121+
Diese Ordnung tritt am 24.01.2024 in Kraft. §~4 bleibt unberührt.
122+
```
123+
124+
## Changelog
125+
126+
### v0.4.0
127+
128+
#### Features
129+
130+
- Improve heading levels to follow accessibility best practices (no longer skipping levels)
131+
- Make the `abbreviation` metadata field optional (can be `none` now)
132+
133+
#### Bug Fixes
134+
135+
- Fix sentence numbering for newer Typst versions (that require `context` for the numbering to work properly)
136+
137+
### v0.3.0
138+
139+
#### Features
140+
141+
- Adjust numbered list / enumeration numbering to be in line with "Handbuch der Rechtsförmlichkeit", Rn. 374
142+
- Make division titles (e.g., "Part", "Chapter", "Division") customizable and conform to the "Handbuch der Rechtsförmlichkeit", Rn. 379 f.
143+
144+
### v0.2.0
145+
146+
#### Features
147+
148+
- Add `#metadata` fields for usage with `typst query`. You can now use `typst query file.typ "<field>" --field value --one` with `<field>` being one of the following to query metadata fields in the command line:
149+
- `<title>`
150+
- `<abbreviation>`
151+
- `<resolution>`
152+
- `<in-effect>`
153+
- Add `#section[§ 1][ABC]` function to enable previously unsupported special chars (such as `*`) in section headings. Note that this was previously possible using `#unnumbered[§ 1\ ABC]`, but the new function adds a semantically better-fitting alternative to this fix.
154+
- Improve heading style rules. This also fixes an incompatibility with `pandoc`, meaning it's now possible to use `pandoc` to convert delegis documents to HTML, etc.
155+
- Set the footnote numbering to `[1]` to not collide with sentence numbers.
156+
157+
#### Bug Fixes
158+
159+
- Fix a typo in the `str-draft` variable name that lead to draft documents resulting in a syntax error.
160+
- Fix hyphenation issues with the abbreviation on the title page (hyphenation between the parentheses and the abbreviation itself)
161+
162+
### v0.1.0
163+
164+
Initial Release
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024 WüSpace e. V.
3+
#
4+
# This software is released under the MIT License.
5+
# https://opensource.org/licenses/MIT
6+
#
7+
# This script creates preview assets for the template.
8+
# It compiles the template using typst and generates demo-{1-3}.png files as well as a thumbnail.png file.
9+
10+
# Check if typst command is available
11+
if ! command -v typst >/dev/null 2>&1; then
12+
echo "typst is not installed"
13+
exit 1
14+
fi
15+
16+
# Check if git command is available
17+
if ! command -v git >/dev/null 2>&1; then
18+
echo "git is not installed"
19+
exit 1
20+
fi
21+
22+
# Ensure the working directory is the folder containing the .sh
23+
cd "$(dirname "$0")"
24+
25+
# Ensure git status is clean and up-to-date
26+
if ! git diff-index --quiet HEAD --; then
27+
echo "There are uncommitted changes in the repository"
28+
exit 1
29+
fi
30+
31+
git fetch
32+
if [[ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]]; then
33+
echo "The local branch is not up-to-date with the remote branch"
34+
exit 1
35+
fi
36+
37+
# Run typst compile command
38+
typst compile --root . template/main.typ demo-{n}.png
39+
40+
# Delete demo-{n}.png with {n} > 3 if they exist
41+
for ((n=4; n<=10; n++)); do
42+
if [[ -f "demo-$n.png" ]]; then
43+
rm "demo-$n.png"
44+
fi
45+
done
46+
47+
# Copy demo-3.png to thumbnail.png
48+
cp demo-3.png thumbnail.png
49+
50+
# Commit and push changes
51+
git add .
52+
if git diff-index --quiet HEAD --; then
53+
echo "No changes to commit"
54+
else
55+
git commit -m "Update preview assets"
56+
git push
57+
echo "Changes were committed and pushed"
58+
fi

0 commit comments

Comments
 (0)