Skip to content
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

Fix failing case of nested link references by making rawBlockParser recursive #84

Merged
merged 5 commits into from Jul 13, 2021

Conversation

LutSa
Copy link
Collaborator

@LutSa LutSa commented Jun 4, 2021

Exploration to solve the issue of nested link references #60 by using rawBlockParser recursively when a block container is completed/close.

@dillonkearns
Copy link
Owner

Since there is only a single test case in the CommonMark Spec nested link definitions, maybe we can add a few unit tests to get some more coverage and make sure it works for more complicated cases. I added this test module: e970820.

That should be a good start, and the tests all pass 👍 We can add more test cases here if we think of any others.

stepRawBlock : State -> Parser (Step State State)
stepRawBlock revStmts =
-- Some blocks can't immediately follow a body
oneOf
[ Helpers.endOfFile
|> map (\_ -> Done revStmts)
|> map (\_ -> Done (completeBlocks revStmts))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change this to andThen, I believe you could use succeed and fail to pass through the parsed value or error. That would allow you to resolve your todo comment -- TODO return this error.

@dillonkearns dillonkearns merged commit e60b1a9 into dillonkearns:master Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants