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

Update to 0290gfm6 #190

Merged
merged 2 commits into from Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/commonmarker/cmark-gfm_version.h
@@ -1,7 +1,7 @@
#ifndef CMARK_GFM_VERSION_H
#define CMARK_GFM_VERSION_H

#define CMARK_GFM_VERSION ((0 << 24) | (29 << 16) | (0 << 8) | 5)
#define CMARK_GFM_VERSION_STRING "0.29.0.gfm.5"
#define CMARK_GFM_VERSION ((0 << 24) | (29 << 16) | (0 << 8) | 6)
#define CMARK_GFM_VERSION_STRING "0.29.0.gfm.6"

#endif
2 changes: 1 addition & 1 deletion ext/commonmarker/cmark-upstream
33 changes: 29 additions & 4 deletions ext/commonmarker/inlines.c
Expand Up @@ -41,6 +41,8 @@ typedef struct bracket {
bool image;
bool active;
bool bracket_after;
bool in_bracket_image0;
bool in_bracket_image1;
} bracket;

typedef struct subject{
Expand Down Expand Up @@ -516,6 +518,8 @@ static void push_bracket(subject *subj, bool image, cmark_node *inl_text) {
bracket *b = (bracket *)subj->mem->calloc(1, sizeof(bracket));
if (subj->last_bracket != NULL) {
subj->last_bracket->bracket_after = true;
b->in_bracket_image0 = subj->last_bracket->in_bracket_image0;
b->in_bracket_image1 = subj->last_bracket->in_bracket_image1;
}
b->image = image;
b->active = true;
Expand All @@ -524,6 +528,11 @@ static void push_bracket(subject *subj, bool image, cmark_node *inl_text) {
b->previous_delimiter = subj->last_delim;
b->position = subj->pos;
b->bracket_after = false;
if (image) {
b->in_bracket_image1 = true;
} else {
b->in_bracket_image0 = true;
}
subj->last_bracket = b;
}

Expand Down Expand Up @@ -1254,6 +1263,17 @@ static cmark_node *handle_close_bracket(cmark_parser *parser, subject *subj) {
}
opener = opener->previous;
}
bool in_bracket_image1 = false;
if (opener) {
in_bracket_image1 = opener->in_bracket_image1;
}
bracket *opener2 = subj->last_bracket;
while (opener2 != opener) {
if (opener2->image) {
opener2->in_bracket_image1 = in_bracket_image1;
}
opener2 = opener2->previous;
}
}

return NULL;
Expand Down Expand Up @@ -1662,10 +1682,15 @@ cmark_chunk *cmark_inline_parser_get_chunk(cmark_inline_parser *parser) {
}

int cmark_inline_parser_in_bracket(cmark_inline_parser *parser, int image) {
for (bracket *b = parser->last_bracket; b; b = b->previous)
if (b->active && b->image == (image != 0))
return 1;
return 0;
bracket *b = parser->last_bracket;
if (!b) {
return 0;
}
if (image != 0) {
return b->in_bracket_image1;
} else {
return b->in_bracket_image0;
}
}

void cmark_node_unput(cmark_node *node, int n) {
Expand Down
2 changes: 1 addition & 1 deletion lib/commonmarker/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CommonMarker
VERSION = "0.23.5"
VERSION = "0.23.6"
end