remove html tags from description
This commit is contained in:
parent
7524609cd0
commit
a531d135b5
@ -21,7 +21,7 @@ def get_from_scraper(scrape, space):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
description = ''
|
description = ''
|
||||||
|
|
||||||
recipe_json['description'] = normalize_string(description)
|
recipe_json['description'] = parse_description(description)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
servings = scrape.yields()
|
servings = scrape.yields()
|
||||||
@ -181,6 +181,14 @@ def parse_ingredients(ingredients):
|
|||||||
return ingredients
|
return ingredients
|
||||||
|
|
||||||
|
|
||||||
|
def parse_description(description):
|
||||||
|
description = re.sub(r'\n\s*\n', '\n\n', description)
|
||||||
|
description = re.sub(' +', ' ', description)
|
||||||
|
description = re.sub('</p>', '\n', description)
|
||||||
|
description = re.sub('<[^<]+?>', '', description)
|
||||||
|
return normalize_string(description)
|
||||||
|
|
||||||
|
|
||||||
def parse_instructions(instructions):
|
def parse_instructions(instructions):
|
||||||
instruction_text = ''
|
instruction_text = ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user