mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 23:28:16 -05:00
ingredient editor and parser
This commit is contained in:
@@ -221,7 +221,7 @@ class IngredientParser:
|
|||||||
|
|
||||||
# some people/languages put amount and unit at the end of the ingredient string
|
# some people/languages put amount and unit at the end of the ingredient string
|
||||||
# if something like this is detected move it to the beginning so the parser can handle it
|
# if something like this is detected move it to the beginning so the parser can handle it
|
||||||
if re.search(r'^([A-z])+(.)*[1-9](\d)*\s([A-z])+', ingredient):
|
if len(ingredient) < 1000 and re.search(r'^([A-z])+(.)*[1-9](\d)*\s([A-z])+', ingredient):
|
||||||
match = re.search(r'[1-9](\d)*\s([A-z])+', ingredient)
|
match = re.search(r'[1-9](\d)*\s([A-z])+', ingredient)
|
||||||
print(f'reording from {ingredient} to {ingredient[match.start():match.end()] + " " + ingredient.replace(ingredient[match.start():match.end()], "")}')
|
print(f'reording from {ingredient} to {ingredient[match.start():match.end()] + " " + ingredient.replace(ingredient[match.start():match.end()], "")}')
|
||||||
ingredient = ingredient[match.start():match.end()] + ' ' + ingredient.replace(ingredient[match.start():match.end()], '')
|
ingredient = ingredient[match.start():match.end()] + ' ' + ingredient.replace(ingredient[match.start():match.end()], '')
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
<generic-multiselect @change="food = $event.val; refreshList()" ref="food_multiselect"
|
<generic-multiselect @change="food = $event.val; refreshList()" ref="food_multiselect"
|
||||||
:model="Models.FOOD"
|
:model="Models.FOOD"
|
||||||
:initial_single_selection="food"
|
:initial_single_selection="food"
|
||||||
:multiple="false"></generic-multiselect>
|
:multiple="false"
|
||||||
|
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"></generic-multiselect>
|
||||||
|
|
||||||
<b-input-group-append>
|
<b-input-group-append>
|
||||||
<b-dropdown no-caret right :disabled="food === null">
|
<b-dropdown no-caret right :disabled="food === null">
|
||||||
@@ -45,7 +46,8 @@
|
|||||||
:model="Models.UNIT"
|
:model="Models.UNIT"
|
||||||
ref="unit_multiselect"
|
ref="unit_multiselect"
|
||||||
:initial_single_selection="unit"
|
:initial_single_selection="unit"
|
||||||
:multiple="false"></generic-multiselect>
|
:multiple="false"
|
||||||
|
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"></generic-multiselect>
|
||||||
|
|
||||||
<b-input-group-append>
|
<b-input-group-append>
|
||||||
<b-dropdown no-caret right :disabled="unit === null">
|
<b-dropdown no-caret right :disabled="unit === null">
|
||||||
|
|||||||
Reference in New Issue
Block a user