Skip to content

Commit

Permalink
Merge pull request #190 from anticomputer/main
Browse files Browse the repository at this point in the history
Update to 0290gfm6
  • Loading branch information
phillmv authored Sep 21, 2022
2 parents 7aaeb37 + ac91634 commit a8f8d76
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ext/commonmarker/cmark-gfm_version.h
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

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

0 comments on commit a8f8d76

Please sign in to comment.