markly 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/markly/markly.c +18 -0
- data/lib/markly/node.rb +2 -0
- data/lib/markly/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93a192bb4cf0e216365ffa17fc619ecc726cb7cbd9a3661ae3357ce5a8dbb1c4
|
4
|
+
data.tar.gz: ec39190db7ad173cdbbcddd73850fc07faa578d37892217cedd329efad060610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5668b9796316e769f73a6d97c495116e3361b9cc0a12fa92c8ec35461954a63d7568e8975af4720d060605ccb2ecdcc96bf123da2074271216a2e55e3afa378d
|
7
|
+
data.tar.gz: 132e25acaad81e6953c4c25a206dc6e37ba0f2cff3176887fb81882817edd81fa6c2a8eb24cf274046635b30f1179832f2daeb00ec78e18f4afb537166e4aab7
|
data/ext/markly/markly.c
CHANGED
@@ -262,6 +262,21 @@ static VALUE rb_node_new(VALUE self, VALUE type) {
|
|
262
262
|
return rb_Markly_Node_wrap(node);
|
263
263
|
}
|
264
264
|
|
265
|
+
static VALUE rb_node_replace(VALUE self, VALUE other) {
|
266
|
+
cmark_node *current_node = NULL, *replacement_node = NULL;
|
267
|
+
|
268
|
+
TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, current_node);
|
269
|
+
TypedData_Get_Struct(other, cmark_node, &rb_Markly_Node_Type, replacement_node);
|
270
|
+
|
271
|
+
int result = cmark_node_replace(current_node, replacement_node);
|
272
|
+
|
273
|
+
if (result == 0) {
|
274
|
+
rb_raise(rb_Markly_Error, "could not replace node");
|
275
|
+
}
|
276
|
+
|
277
|
+
return other;
|
278
|
+
}
|
279
|
+
|
265
280
|
static VALUE encode_utf8_string(const char *c_string) {
|
266
281
|
VALUE string = rb_str_new2(c_string);
|
267
282
|
int enc = rb_enc_find_index("UTF-8");
|
@@ -1182,6 +1197,9 @@ __attribute__((visibility("default"))) void Init_markly() {
|
|
1182
1197
|
|
1183
1198
|
rb_Markly_Node = rb_define_class_under(rb_Markly, "Node", rb_cObject);
|
1184
1199
|
rb_define_singleton_method(rb_Markly_Node, "new", rb_node_new, 1);
|
1200
|
+
|
1201
|
+
rb_define_method(rb_Markly_Node, "replace", rb_node_replace, 1);
|
1202
|
+
|
1185
1203
|
rb_define_method(rb_Markly_Node, "string_content", rb_node_get_string_content, 0);
|
1186
1204
|
rb_define_method(rb_Markly_Node, "string_content=", rb_node_set_string_content, 1);
|
1187
1205
|
rb_define_method(rb_Markly_Node, "type", rb_node_get_type, 0);
|
data/lib/markly/node.rb
CHANGED
data/lib/markly/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
- Ashe Connor
|
9
9
|
- Samuel Williams
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-06-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bake
|
@@ -96,8 +96,8 @@ dependencies:
|
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0.9'
|
99
|
-
description:
|
100
|
-
email:
|
99
|
+
description:
|
100
|
+
email:
|
101
101
|
executables:
|
102
102
|
- markly
|
103
103
|
extensions:
|
@@ -189,7 +189,7 @@ licenses:
|
|
189
189
|
- MIT
|
190
190
|
metadata:
|
191
191
|
funding_uri: https://github.com/sponsors/ioquatix/
|
192
|
-
post_install_message:
|
192
|
+
post_install_message:
|
193
193
|
rdoc_options: []
|
194
194
|
require_paths:
|
195
195
|
- lib
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubygems_version: 3.1.2
|
208
|
-
signing_key:
|
208
|
+
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.
|
211
211
|
test_files: []
|