menus/README.md

125 lines
4 KiB
Markdown
Raw Permalink Normal View History

2020-09-18 19:41:59 +02:00
# HLDS data format
HLDS is the Haldis Language for Describing Servings. It defines the menu you see when ordering in
Haldis.
2021-06-18 23:00:35 +02:00
There is syntax highlighting support for editors in [`etc/` in the Haldis
repository](https://git.zeus.gent/haldis/haldis/-/tree/master/etc). For VSCode there is a plug-in
in the standard repository.
2020-09-18 19:41:59 +02:00
## Tabs and spaces
Indentation at the beginning of the line requires hard **tabs** (spaces will not work).
2021-06-18 23:00:35 +02:00
For alignment (putting things in the same column between lines) **spaces** are required (tabs will
not work). Example (`↦` for tab and `·` for space):
2021-06-18 23:00:35 +02:00
```
dish·fries:·Frietjes
↦ single_choice·size:·Formaat
↦ ↦ extra_small:·Extra small·€·1.8
↦ ↦ small:·······Small·······€·2
↦ ↦ medium:······Medium······€·2.5
↦ ↦ large:·······Large·······€·3.3
2021-06-18 23:00:35 +02:00
```
2020-09-18 19:41:59 +02:00
## Identifiers
You must choose an identifier for each location, dish, choice, option and tag. Identifiers may
consist of numbers, hyphens, underscores and lowercase letters of the alphabet (a through z).
* Allowed: `0-my_identifier`
* Disallowed: ~~`0 My Identifié`~~
## Locations
A HLDS file consists of one or more locations. Each location starts with a header, which is enclosed
in "fences" of at least three equal signs. The first line of the header contains the ID and name of
the location. Further lines contain the metadata of the location, such as the phone number and
OpenStreetMap element. In the future, the phone number and such will be fetched from OpenStreetMap.
```hlds
==========================
ocean_garden: Ocean Garden
osm https://www.openstreetmap.org/node/2275105003
phone +32 9 222 72 74
address Zwijnaardsesteenweg 399, 9000 Gent
website http://oceangarden.byethost3.com/
# Comments are allowed too!
==========================
```
## Dishes
A location consists of dishes. Spaces can be used to align the elements of your dish (but that's
not required).
```hlds
dish cheeseburger: Cheeseburger € 2.9
dish assortment: Twijfelaar € 3
2020-09-18 19:41:59 +02:00
```
## Inline choices
Dishes can contain choices. There are two types:
* `single_choice` is a required choice where the user must choose one option.
* `multi_choice` is an optional choice where the user can choose zero or more options.
```hlds
dish fries: Frietjes
single_choice size: Formaat
extra_small: Extra small € 1.8
small: Small € 2
medium: Medium € 2.5
large: Large € 3.3
2020-09-18 19:41:59 +02:00
multi_choice sauce: Saus
ketchup: Ketchup € 1.4
mayo: Mayonaise € 1.4
bicky: Bickysaus € 1.4
stew: Stoofvleessaus € 1.9
2020-09-18 19:41:59 +02:00
```
## Common choices
Choices that are used more than once, can be declared once and referenced in multiple dishes.
```hlds
bami_nasi: Bami of nasi
bami: Bami
nasi: Nasi
dish wok3: Studentenwok 3 kip bami/nasi zonder saus € 6
single_choice bami_nasi
dish wok5: Studentenwok 5 babi pangang € 6
single_choice bami_nasi
```
## Descriptions
You can add descriptions to dishes, choices and options. Separate name and description with ` -- `.
```hlds
dish dishid: Name -- This is a description € 3
2020-09-18 19:41:59 +02:00
```
## Tags and price
2020-09-18 19:41:59 +02:00
**Note:** Only the `{no_text}` tag is supported at this moment. You can ignore other tags for now.
Tags are `{identifier}`. You can use tags to attach more information about a dish or option in a
structured way. For example: `{has_meat}` signals to vegetarians that they should avoid this.
The order is always id, name, description, ` `, tags, price (not all have to be present of course).
2020-09-18 19:41:59 +02:00
```hlds
dish dishid: Name -- This is a description {has_meat} € 3
2020-09-18 19:41:59 +02:00
```
The special `{no_text}` tag signals that an option is to be hidden when showing a dish in an
order's list of dishes. This is useful for choices that have an implicit default that need not be
read by the person making the order.
2020-09-18 19:41:59 +02:00
```hlds
veggie: Vegetarische opties
meat: Niet vegetarisch {has_meat} {no_text}
2020-09-18 19:41:59 +02:00
tofu: Vegetarisch met tofu
falafel: Vegetarisch met falafel
vegan: Veganistisch
```