applied regex_replace automation to food and unit automations
updated automation documentation
This commit is contained in:
parent
30c891abfc
commit
4120adc546
@ -77,7 +77,7 @@ class AutomationEngine:
|
||||
else:
|
||||
if automation := Automation.objects.filter(space=self.request.space, type=Automation.UNIT_ALIAS, param_1__iexact=unit, disabled=False).order_by('order').first():
|
||||
return automation.param_2
|
||||
return unit
|
||||
return self.apply_regex_replace_automation(unit, Automation.UNIT_REPLACE)
|
||||
|
||||
def apply_food_automation(self, food):
|
||||
food = food.strip()
|
||||
@ -102,7 +102,7 @@ class AutomationEngine:
|
||||
else:
|
||||
if automation := Automation.objects.filter(space=self.request.space, type=Automation.FOOD_ALIAS, param_1__iexact=food, disabled=False).order_by('order').first():
|
||||
return automation.param_2
|
||||
return self.apply_regex_replace_automation(food)
|
||||
return self.apply_regex_replace_automation(food, Automation.FOOD_REPLACE)
|
||||
|
||||
def apply_never_unit_automation(self, tokens):
|
||||
"""
|
||||
@ -189,7 +189,6 @@ class AutomationEngine:
|
||||
field_type are Automation.type that apply regex replacements
|
||||
Automation.DESCRIPTION_REPLACE
|
||||
Automation.INSTRUCTION_REPLACE
|
||||
# TODO implement these
|
||||
Automation.FOOD_REPLACE
|
||||
Automation.UNIT_REPLACE
|
||||
Automation.TITLE_REPLACE
|
||||
|
@ -50,10 +50,12 @@ In order to prevent denial of service attacks on the RegEx engine the number of
|
||||
and the length of the inputs that are processed are limited. Those limits should never be reached
|
||||
during normal usage.
|
||||
|
||||
## Instruction Replace
|
||||
## Instructtion Replace, Title Replace, Food Replace & Unit Replace
|
||||
|
||||
This works just like the Description Replace automation but runs against all instruction texts
|
||||
in all steps of a recipe during import.
|
||||
These work just like the Description Replace automation.
|
||||
Instruction, Food and Unit Replace will run against every iteration of the object in a recipe during import.
|
||||
- Instruction Replace will run for the instructions in every step. It will also replace every occurrence, not just the first.
|
||||
- Food & Unit Replace will run for every food and unit in every ingredient in every step.
|
||||
|
||||
Also instead of just replacing a single occurrence of the matched pattern it will replace all.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user