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

make_spec.lua: fix migration of children nodes in create_anchors #536

Merged
merged 2 commits into from
Oct 4, 2018

Conversation

zmwangx
Copy link
Contributor

@zmwangx zmwangx commented Oct 3, 2018

Currently, when migrating the children of a node to a new one, children are moved as they are iterated via cmark_node_next; however, when a child is moved under the new node, its next relationship with its sibling is broken, so in fact at most one child is migrated, and the rest are lost. This resulted in cases like

[Decimal numeric character
references](@)
consist of...

(note the softbreak) being eventually rendered as

<a ...>Decimal numeric character</a>
consist of...

The bug is fixed in this PR.

Naming a variable "children" when it holds one child is confusing, and blocks
naming actual children.
Prior to this commit, when migrating the children of a node to a new one,
children are moved as they are iterated via `cmark_node_next`; however, when a
child is moved under the new node, its next relationship with its sibling is
broken, so in fact at most one child is migrated, and the rest are lost. This
resulted in cases like

    [Decimal numeric character
    references](@)
    consist of...

(note the softbreak) being eventually rendered as

    <a ...>Decimal numeric character</a>
    consist of...
@jgm jgm merged commit 5dc2aed into commonmark:master Oct 4, 2018
@jgm
Copy link
Member

jgm commented Oct 4, 2018

Thanks for noticing the bug, and for the fix!

@zmwangx zmwangx deleted the fix-children-migration branch October 4, 2018 16:49
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.

2 participants