Skip to content

[BUG] testMultiLineDirections test does not follow the spec #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
paul-louyot opened this issue Mar 17, 2025 · 2 comments
Open

[BUG] testMultiLineDirections test does not follow the spec #30

paul-louyot opened this issue Mar 17, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@paul-louyot
Copy link

Describe the bug

The spec states that separate steps should be separated with an empty line: "Each paragraph in your recipe file is a cooking step. Separate steps with an empty line.", but the test called testMultiLineDirections shows that two directions separated by a single line return are interpreted as two different steps.

To Reproduce

Check content of testMultiLineDirections in tests/canonical.yaml, which is about parsing the string "Add a bit of chilli\nAdd a bit of hummus"

Current behavior

The result section of the test reads:

      steps:
        -
          - type: text
            value: "Add a bit of chilli"
        -
          - type: text
            value: "Add a bit of hummus"
      metadata: []

Expected behavior

The result of the test should be

    result:
      steps:
        -
          - type: text
            value: "Add a bit of chilli\nAdd a bit of hummus"
      metadata: []
@paul-louyot paul-louyot added the bug Something isn't working label Mar 17, 2025
@genehack
Copy link

I'm very interested in seeing this fixed — would be happy to help out with a patch, but I'm not quite sure where to start — seems like the part in Parser.ts where the input is split into lines would be the right place to deal with this, but I'm not sure I understand the logic behind the overall parsing process correctly?

@dubadub
Copy link
Member

dubadub commented Mar 24, 2025

There's an effort to migrate this parser to be powered by Rust parser via WASM and there's no sense patching current version. I pushed my latest changes and it parses recipe but because the return is just a big JS object it's not handy working with it. So as next step I wanted to create wrapper objects for better dev experience and TS definitions. I don't have much time to work on this, and it's not priority right now. If you want to take it from there I can give you as much support as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants