OGOGOG commited on
Commit
2f6e139
·
verified ·
1 Parent(s): 106a582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -242,13 +242,19 @@ def _split_measure_name_line(line: str):
242
  return "", line.strip()
243
 
244
  def _format_ingredients_markdown(lines):
 
 
 
245
  if not lines:
246
  return "—"
247
  formatted = []
248
  for ln in lines:
 
 
249
  meas, name = _split_measure_name_line(ln)
250
- if meas and name:
251
- formatted.append(f"- **{meas}** {name}")
 
252
  elif name:
253
  formatted.append(f"- {name}")
254
  else:
 
242
  return "", line.strip()
243
 
244
  def _format_ingredients_markdown(lines):
245
+ """
246
+ Bullet points with 'Ingredient (amount)'. Also removes any [ or ].
247
+ """
248
  if not lines:
249
  return "—"
250
  formatted = []
251
  for ln in lines:
252
+ # Strip any square brackets the dataset might include
253
+ ln = ln.replace("[", "").replace("]", "")
254
  meas, name = _split_measure_name_line(ln)
255
+ # Flip to Ingredient (amount)
256
+ if name and meas:
257
+ formatted.append(f"- {name} ({meas})")
258
  elif name:
259
  formatted.append(f"- {name}")
260
  else: