mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 21:37:49 -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
|
||||
# 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)
|
||||
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()], '')
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
<generic-multiselect @change="food = $event.val; refreshList()" ref="food_multiselect"
|
||||
:model="Models.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-dropdown no-caret right :disabled="food === null">
|
||||
@@ -39,13 +40,14 @@
|
||||
<div class="col col-md-6">
|
||||
|
||||
<b-input-group>
|
||||
|
||||
<generic-multiselect
|
||||
@change="unit = $event.val; refreshList()"
|
||||
:model="Models.UNIT"
|
||||
ref="unit_multiselect"
|
||||
:initial_single_selection="unit"
|
||||
:multiple="false"></generic-multiselect>
|
||||
|
||||
<generic-multiselect
|
||||
@change="unit = $event.val; refreshList()"
|
||||
:model="Models.UNIT"
|
||||
ref="unit_multiselect"
|
||||
:initial_single_selection="unit"
|
||||
:multiple="false"
|
||||
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"></generic-multiselect>
|
||||
|
||||
<b-input-group-append>
|
||||
<b-dropdown no-caret right :disabled="unit === null">
|
||||
|
||||
Reference in New Issue
Block a user