Merge pull request #2763 from smilerz/fix_long_description

truncated long description
This commit is contained in:
vabene1111 2023-12-02 18:11:59 +01:00 committed by GitHub
commit 2cb010c8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,10 +163,9 @@ def get_from_scraper(scrape, request):
if len(recipe_json['steps']) == 0: if len(recipe_json['steps']) == 0:
recipe_json['steps'].append({'instruction': '', 'ingredients': [], }) recipe_json['steps'].append({'instruction': '', 'ingredients': [], })
recipe_json['description'] = recipe_json['description'][:512]
if len(recipe_json['description']) > 256: # split at 256 as long descriptions don't look good on recipe cards if len(recipe_json['description']) > 256: # split at 256 as long descriptions don't look good on recipe cards
recipe_json['steps'][0]['instruction'] = f"*{recipe_json['description']}* \n\n" + recipe_json['steps'][0]['instruction'] recipe_json['steps'][0]['instruction'] = f"*{recipe_json['description']}* \n\n" + recipe_json['steps'][0]['instruction']
else:
recipe_json['description'] = recipe_json['description'][:512]
try: try:
for x in scrape.ingredients(): for x in scrape.ingredients():