mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	fix clean_string error (#481)
This commit is contained in:
		| @@ -36,13 +36,16 @@ def clean(recipe_data: dict, url=None) -> dict: | |||||||
|  |  | ||||||
|  |  | ||||||
| def clean_string(text: str) -> str: | def clean_string(text: str) -> str: | ||||||
|     cleaned_text = html.unescape(text) |     if text == "" or text is None: | ||||||
|     cleaned_text = re.sub("<[^<]+?>", "", cleaned_text) |         return "" | ||||||
|     cleaned_text = re.sub(" +", " ", cleaned_text) |     else: | ||||||
|     cleaned_text = re.sub("</p>", "\n", cleaned_text) |         cleaned_text = html.unescape(text) | ||||||
|     cleaned_text = re.sub(r"\n\s*\n", "\n\n", cleaned_text) |         cleaned_text = re.sub("<[^<]+?>", "", cleaned_text) | ||||||
|     cleaned_text = cleaned_text.replace("\xa0", " ").replace("\t", " ").strip() |         cleaned_text = re.sub(" +", " ", cleaned_text) | ||||||
|     return cleaned_text |         cleaned_text = re.sub("</p>", "\n", cleaned_text) | ||||||
|  |         cleaned_text = re.sub(r"\n\s*\n", "\n\n", cleaned_text) | ||||||
|  |         cleaned_text = cleaned_text.replace("\xa0", " ").replace("\t", " ").strip() | ||||||
|  |         return cleaned_text | ||||||
|  |  | ||||||
|  |  | ||||||
| def category(category: str): | def category(category: str): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user