Add option to space to enable plural name usage

* Add option to space to enable usage of plural name
  for food and unit per space

* Respect option per space to use the plural name
This commit is contained in:
Niklas Schwarz
2022-09-11 22:45:18 +02:00
parent 9994b6f9c2
commit b1ad5ef205
40 changed files with 193 additions and 83 deletions

View File

@ -31,13 +31,16 @@ class IngredientObject(object):
self.unit = bleach.clean(str(ingredient.unit))
else:
self.unit = ""
if ingredient.food.plural_name in (None, ""):
self.food = bleach.clean(str(ingredient.food))
else:
if ingredient.always_use_plural_food or ingredient.amount > 1 and not ingredient.no_amount:
self.food = bleach.clean(str(ingredient.food.plural_name))
else:
if ingredient.food:
if ingredient.food.plural_name in (None, ""):
self.food = bleach.clean(str(ingredient.food))
else:
if ingredient.always_use_plural_food or ingredient.amount > 1 and not ingredient.no_amount:
self.food = bleach.clean(str(ingredient.food.plural_name))
else:
self.food = bleach.clean(str(ingredient.food))
else:
self.food = ""
self.note = bleach.clean(str(ingredient.note))
def __str__(self):