Deal with empty strings.

This commit is contained in:
Louis Cordier 2020-06-27 21:56:05 +02:00
parent 24d88449c2
commit 139ed61916

View file

@ -155,10 +155,12 @@ def main():
recipe.write('\n')
recipe.write('## Instructions\n')
for instruction in scraper.instructions().split('\n'):
if instruction.strip()[0].isdigit():
recipe.write('{instruction}\n'.format(instruction=instruction))
else:
recipe.write('1. {instruction}\n'.format(instruction=instruction))
instruction = instruction.strip()
if instruction:
if instruction[0].isdigit():
recipe.write('{instruction}\n'.format(instruction=instruction))
else:
recipe.write('1. {instruction}\n'.format(instruction=instruction))
recipe.write('\n')
recipe.write('[{url}]({url})\n'.format(url=url))