Skip to content

Commit

Permalink
Merge pull request #94 from gjtorikian/bump-dependencies
Browse files Browse the repository at this point in the history
Bump dependencies to support tasklists
  • Loading branch information
gjtorikian authored Apr 3, 2019
2 parents b9e5751 + 623499d commit ae64cf4
Show file tree
Hide file tree
Showing 24 changed files with 990 additions and 543 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ actual.txt
test.txt
test/progit
test/benchinput.md

.vscode
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
inherit_gem:
rubocop-github:
rubocop-standard:
- config/default.yml

Style/StringLiterals:
Expand All @@ -8,3 +8,9 @@ Style/StringLiterals:

Naming/FileName:
Enabled: false

AllCops:
Exclude:
- 'ext/**/*'
- 'vendor/**/*'
- 'tmp/**/*'
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# appveyor.yml
install:
- set PATH=C:\Ruby22\bin;%PATH%
- set PATH=C:\Ruby24\bin;%PATH%
- git submodule init
- git submodule update
- bundle install
Expand Down
2 changes: 1 addition & 1 deletion commonmarker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'awesome_print'
s.add_development_dependency 'rdoc', '~> 5.1'
s.add_development_dependency 'rubocop'
s.add_development_dependency 'rubocop-github'
s.add_development_dependency 'rubocop-standard'
end
3 changes: 3 additions & 0 deletions ext/commonmarker/cmark-gfm-core-extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node);
CMARK_GFM_EXTENSIONS_EXPORT
int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node);

CMARK_GFM_EXTENSIONS_EXPORT
char *cmark_gfm_extensions_get_tasklist_state(cmark_node *node);

#ifdef __cplusplus
}
#endif
Expand Down
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) | (28 << 16) | (3 << 8) | 19)
#define CMARK_GFM_VERSION_STRING "0.28.3.gfm.19"
#define CMARK_GFM_VERSION ((0 << 24) | (28 << 16) | (3 << 8) | 20)
#define CMARK_GFM_VERSION_STRING "0.28.3.gfm.20"

#endif
6 changes: 4 additions & 2 deletions ext/commonmarker/commonmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
int i;
bool entering = (ev_type == CMARK_EVENT_ENTER);
const char *info, *code, *title;
char fencechar[2] = {'\0', '\0'};
size_t info_len, code_len;
char listmarker[LISTMARKER_SIZE];
char *emph_delim;
Expand Down Expand Up @@ -284,6 +285,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
}
info = cmark_node_get_fence_info(node);
info_len = strlen(info);
fencechar[0] = strchr(info, '`') == NULL ? '`' : '~';
code = cmark_node_get_literal(node);
code_len = strlen(code);
// use indented form if no info, and code doesn't
Expand All @@ -303,15 +305,15 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
numticks = 3;
}
for (i = 0; i < numticks; i++) {
LIT("`");
LIT(fencechar);
}
LIT(" ");
OUT(info, false, LITERAL);
CR();
OUT(cmark_node_get_literal(node), false, LITERAL);
CR();
for (i = 0; i < numticks; i++) {
LIT("`");
LIT(fencechar);
}
}
BLANKLINE();
Expand Down
15 changes: 15 additions & 0 deletions ext/commonmarker/commonmarker.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,20 @@ static VALUE rb_node_set_fence_info(VALUE self, VALUE info) {
return Qnil;
}

static VALUE rb_node_get_tasklist_state(VALUE self) {
const char *tasklist_state;
cmark_node *node;
Data_Get_Struct(self, cmark_node, node);

tasklist_state = cmark_gfm_extensions_get_tasklist_state(node);

if (tasklist_state == NULL) {
rb_raise(rb_mNodeError, "could not get tasklist_state");
}

return rb_str_new2(tasklist_state);
}

static VALUE rb_node_get_table_alignments(VALUE self) {
uint16_t column_count, i;
uint8_t *alignments;
Expand Down Expand Up @@ -1189,6 +1203,7 @@ __attribute__((visibility("default"))) void Init_commonmarker() {
rb_define_method(rb_mNode, "fence_info", rb_node_get_fence_info, 0);
rb_define_method(rb_mNode, "fence_info=", rb_node_set_fence_info, 1);
rb_define_method(rb_mNode, "table_alignments", rb_node_get_table_alignments, 0);
rb_define_method(rb_mNode, "tasklist_state", rb_node_get_tasklist_state, 0);

rb_define_method(rb_mNode, "html_escape_href", rb_html_escape_href, 1);
rb_define_method(rb_mNode, "html_escape_html", rb_html_escape_html, 1);
Expand Down
2 changes: 2 additions & 0 deletions ext/commonmarker/core-extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "strikethrough.h"
#include "table.h"
#include "tagfilter.h"
#include "tasklist.h"
#include "registry.h"
#include "plugin.h"

Expand All @@ -12,6 +13,7 @@ static int core_extensions_registration(cmark_plugin *plugin) {
create_strikethrough_extension());
cmark_plugin_register_syntax_extension(plugin, create_autolink_extension());
cmark_plugin_register_syntax_extension(plugin, create_tagfilter_extension());
cmark_plugin_register_syntax_extension(plugin, create_tasklist_extension());
return 1;
}

Expand Down
Loading

0 comments on commit ae64cf4

Please sign in to comment.