commonmarker 0.23.10 → 0.23.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8197daf1b6113b658c30459c0c4436ee688bfdd2381d3f541ff31bf3c3177bae
4
- data.tar.gz: 25761b81607e28e9f569a61f502913c55f88319023b7d12e362d87dd37a935f7
3
+ metadata.gz: e070ea3105d17c7c6aea2bed32918bf8f31eaf7fb70106e7c025bbce1c600bf9
4
+ data.tar.gz: f15ac1f428763032f711a799823ad865bdae33e7c1c671876201d690090170bb
5
5
  SHA512:
6
- metadata.gz: 822690178eaaedc1e173e81e1d7c302d1670b95d362ca056ac9552df81a46861f582e4624698325e7d9bac347079fb4af6f99d88fbd832d40b84c4cbaff16cfc
7
- data.tar.gz: 19150ccc6ec605f469e09fcf56a4dcb40f5b6e1125ca890bad8a2e6dc8931abcf82c533535222340c6377b16f243dd95717b7158bf2836118b8e1542802a6afe
6
+ metadata.gz: 96a4195b535ebcff926773f0ea0b2b9b06b49cbf2b250e84ded16df5001805278482e22a89f30a2ede940453ca4a31b32eb9dbc7c315153bcdb40ae8c8294a3e
7
+ data.tar.gz: d9d781435db9096282da3a75dc8dca6eccc69ac3f23e37f23e0fc8f1f9eb1403f381d78db0bb5f24810222730a7968f041f3df0ed5027fe7251278f44747e840
@@ -45,11 +45,10 @@ static VALUE encode_utf8_string(const char *c_string) {
45
45
  return string;
46
46
  }
47
47
 
48
- /* Encode a C string using the encoding from Ruby string +source+. */
49
- static VALUE encode_source_string(const char *c_string, VALUE source) {
50
- VALUE string = rb_str_new2(c_string);
51
- rb_enc_copy(string, source);
52
- return string;
48
+ static VALUE commonmarker_cstr_adopt(const char *str, rb_encoding *enc) {
49
+ VALUE ret = rb_enc_str_new_cstr(str, enc);
50
+ cmark_get_default_mem_allocator()->free(str);
51
+ return ret;
53
52
  }
54
53
 
55
54
  static void rb_mark_c_struct(void *data) {
@@ -175,7 +174,7 @@ static VALUE rb_markdown_to_html(VALUE self, VALUE rb_text, VALUE rb_options, VA
175
174
  cmark_parser_free(parser);
176
175
  cmark_node_free(doc);
177
176
 
178
- return rb_utf8_str_new_cstr(html);
177
+ return commonmarker_cstr_adopt(html, rb_utf8_encoding());
179
178
  }
180
179
 
181
180
  /*
@@ -204,7 +203,7 @@ static VALUE rb_markdown_to_xml(VALUE self, VALUE rb_text, VALUE rb_options, VAL
204
203
  cmark_parser_free(parser);
205
204
  cmark_node_free(doc);
206
205
 
207
- return rb_utf8_str_new_cstr(xml);
206
+ return commonmarker_cstr_adopt(xml, rb_utf8_encoding());
208
207
  }
209
208
 
210
209
  /*
@@ -1178,7 +1177,7 @@ static VALUE rb_html_escape_href(VALUE self, VALUE rb_text) {
1178
1177
  if (houdini_escape_href(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1179
1178
  RSTRING_LEN(rb_text))) {
1180
1179
  result = (char *)cmark_strbuf_detach(&buf);
1181
- return encode_source_string(result, rb_text);
1180
+ return commonmarker_cstr_adopt(result, rb_enc_get(rb_text));
1182
1181
 
1183
1182
  }
1184
1183
 
@@ -1199,7 +1198,7 @@ static VALUE rb_html_escape_html(VALUE self, VALUE rb_text) {
1199
1198
  if (houdini_escape_html0(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1200
1199
  RSTRING_LEN(rb_text), 0)) {
1201
1200
  result = (char *)cmark_strbuf_detach(&buf);
1202
- return encode_source_string(result, rb_text);
1201
+ return commonmarker_cstr_adopt(result, rb_enc_get(rb_text));
1203
1202
  }
1204
1203
 
1205
1204
  return rb_text;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CommonMarker
4
- VERSION = "0.23.10"
4
+ VERSION = "0.23.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.10
4
+ version: 0.23.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-31 00:00:00.000000000 Z
12
+ date: 2024-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: awesome_print
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.3.26
258
+ rubygems_version: 3.3.27
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.