[Bug]: Density conversion not applied with ingredients containing a space in name #27

Closed
opened 2026-09-02 14:35:08 +02:00 by Bassintag · 1 comment

Description

Density conversion is not applied by analysis step when the ingredient name contains a space. For exemple using @Huile{10ml} works but @Huile d'olive{10ml} doesn't and shows ⚠ 1 ingredient missing nutrition data

Minimal reproducible .gram snippet

---
title: Ravioles à la toscane
portions: 2
---


[Cuire] les @Ravioli ricotta-épinards{250g} en suivant les indications du paquet.

[Faire revenir] l'@Ail{1g} finement émincé ou râpé dans une #poêle{} avec un filet d'@Huile d'olive{10ml} pendant ~_{1m} à feu moyen.

[Ajouter] les @Tomates séchées{80g}(émincées) puis mélanger.

[Ajouter] la @Crème fraîche{60g}, les @Épinard frais{80g} et 2 cuillères à soupe d'eau par personne. Mélangez et laissez mijoter ~_{2m} en remuant.

[Égoutter] les @&Ravioli ricotta-épinards{} cuits, puis ajoutez-les dans la #poêle{}. 

[Ajouter] le @Parmesan râpé{16g}, salez, poivrez et mélangez.

Steps to reproduce

  1. Setup ingredients.yaml to contain this ingredient:
  huile-dolive: 
    name: "Huile d'olive"
    tags: 
      - Sans lactose
      - Sans gluten
      - Végétarien
      - Vegan
    physical: 
      density: 1.14
    nutrition: 
      calories: 822
      protein: +0
      carbs: +0
      fat: 91
      fiber: +0
  1. Run the command gram view recipe.gram

Expected behavior

Quantity of Huile d'olive is converted to g

Environment

  • OS: Arch Linux
  • Bun version: 1.4.0
  • Gram CLI version: 1.2.1
### Description Density conversion is not applied by analysis step when the ingredient name contains a space. For exemple using @Huile{10ml} works but @Huile d'olive{10ml} doesn't and shows `⚠ 1 ingredient missing nutrition data` ### Minimal reproducible `.gram` snippet ```gram --- title: Ravioles à la toscane portions: 2 --- [Cuire] les @Ravioli ricotta-épinards{250g} en suivant les indications du paquet. [Faire revenir] l'@Ail{1g} finement émincé ou râpé dans une #poêle{} avec un filet d'@Huile d'olive{10ml} pendant ~_{1m} à feu moyen. [Ajouter] les @Tomates séchées{80g}(émincées) puis mélanger. [Ajouter] la @Crème fraîche{60g}, les @Épinard frais{80g} et 2 cuillères à soupe d'eau par personne. Mélangez et laissez mijoter ~_{2m} en remuant. [Égoutter] les @&Ravioli ricotta-épinards{} cuits, puis ajoutez-les dans la #poêle{}. [Ajouter] le @Parmesan râpé{16g}, salez, poivrez et mélangez. ``` ### Steps to reproduce 1. Setup ingredients.yaml to contain this ingredient: ```yaml huile-dolive: name: "Huile d'olive" tags: - Sans lactose - Sans gluten - Végétarien - Vegan physical: density: 1.14 nutrition: calories: 822 protein: +0 carbs: +0 fat: 91 fiber: +0 ``` 2. Run the command `gram view recipe.gram` ### Expected behavior Quantity of `Huile d'olive` is converted to g ### Environment - OS: Arch Linux - Bun version: 1.4.0 - Gram CLI version: 1.2.1
abiwab self-assigned this 2026-09-28 22:15:13 +02:00
Owner

Thanks for the report ! After investigation, the issue is actually the apostrophe: "Huile d'olive" is identified internally as huile-d-olive, while your database key is huile-dolive, and the lookup didn't match the two. Fixed in PR #40: database keys, names and aliases are now compared the same way as ingredients in recipes. It'll be shipped in the next release.

Thanks for the report ! After investigation, the issue is actually the apostrophe: "Huile d'olive" is identified internally as huile-d-olive, while your database key is huile-dolive, and the lookup didn't match the two. Fixed in PR #40: database keys, names and aliases are now compared the same way as ingredients in recipes. It'll be shipped in the next release.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gram-lang/gram#27
No description provided.