cooklang / cooklang-swift

Cooklang parser implementation in Swift
https://cooklang.org
MIT License
38 stars 3 forks source link

Any comment after last step leads to empty Step line #22

Open digital-carver opened 2 years ago

digital-carver commented 2 years ago

Comments at the end of a recipe file lead to an empty line in the recipe, like:

     8. 
        [–]

While testing this, I also discovered that if a comment comes before a metadata line (whether with or without a blank line in between), the metadata line gets treated as an ordinary recipe line and gets added to the list of steps.

Here's a file that illustrates both issues:

-- hello I'm a comment

>> serves: 420

Solve world peace. 

Relax. 

-- I'm a comment too!

When cook recipe read is run on it, the output is:

Ingredients:

Steps:
     1. >> serves: 420
        [–]
     2. Solve world peace.
        [–]
     3. Relax.
        [–]
     4.
        [–]
dubadub commented 2 years ago

Thanks for reporting, moving this parser.