markly 0.2.1 → 0.5.1
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 +6 -4
- data/lib/markly/renderer/html_renderer.rb +26 -1
- data/lib/markly/version.rb +1 -1
- metadata +2 -31
- data/lib/markly/markly.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e93dc6c0b00fb75d248a8631c7861b90feaa4e34b0fc22ca743e3869f591d82
|
4
|
+
data.tar.gz: 611f2ddb2a723f48575fdcde58ac778e44745d5162d580c7732bed05df529a1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bcb920927a44239587688f322891836d73b0c968ae3156776e578b3c80b8e288afd37b1a9f7dc7173852e4779dd22804d8b77e10db78c376cf7338e0883842f
|
7
|
+
data.tar.gz: 4abdfbee670fbff858e1017b9329bcb429a698052d95a860d26dddea1f1ffac9377424aca614e4d39b12d3c4aae2dfceddfb082ebf7337d717f8a67ff38ef1a4
|
data/ext/markly/markly.c
CHANGED
@@ -47,6 +47,8 @@ static void rb_Markly_Node_free(void *data) {
|
|
47
47
|
|
48
48
|
if (cmark_node_parent(node) == NULL) {
|
49
49
|
cmark_node_free(node);
|
50
|
+
} else {
|
51
|
+
cmark_node_set_user_data(node, NULL);
|
50
52
|
}
|
51
53
|
}
|
52
54
|
}
|
@@ -329,10 +331,10 @@ static VALUE rb_node_set_string_content(VALUE self, VALUE s) {
|
|
329
331
|
* Returns a {Symbol} representing the node's type.
|
330
332
|
*/
|
331
333
|
static VALUE rb_node_get_type(VALUE self) {
|
332
|
-
int node_type;
|
333
|
-
cmark_node *node;
|
334
|
-
VALUE symbol;
|
335
|
-
const char *s;
|
334
|
+
int node_type = 0;
|
335
|
+
cmark_node *node = NULL;
|
336
|
+
VALUE symbol = NULL;
|
337
|
+
const char *s = NULL;
|
336
338
|
|
337
339
|
TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
|
338
340
|
|
@@ -1,14 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'cgi'
|
4
|
+
|
3
5
|
module Markly
|
4
|
-
class
|
6
|
+
class HTMLRenderer < Renderer
|
7
|
+
def initialize(ids: false, **options)
|
8
|
+
super(**options)
|
9
|
+
|
10
|
+
@ids = ids
|
11
|
+
@section = nil
|
12
|
+
end
|
13
|
+
|
5
14
|
def document(_)
|
15
|
+
@section = false
|
6
16
|
super
|
7
17
|
out("</ol>\n</section>\n") if @written_footnote_ix
|
18
|
+
out("</section>") if @section
|
19
|
+
end
|
20
|
+
|
21
|
+
def id_for(node)
|
22
|
+
if @ids
|
23
|
+
id = node.to_plaintext.chomp.downcase.gsub(/\s+/, '-')
|
24
|
+
|
25
|
+
return " id=\"#{CGI.escape_html id}\""
|
26
|
+
end
|
8
27
|
end
|
9
28
|
|
10
29
|
def header(node)
|
11
30
|
block do
|
31
|
+
out('</section>') if @section
|
32
|
+
@section = true
|
33
|
+
out("<section #{id_for(node)}>")
|
12
34
|
out('<h', node.header_level, "#{source_position(node)}>", :children,
|
13
35
|
'</h', node.header_level, '>')
|
14
36
|
end
|
@@ -249,4 +271,7 @@ module Markly
|
|
249
271
|
node.tasklist_item_checked?
|
250
272
|
end
|
251
273
|
end
|
274
|
+
|
275
|
+
# Legacy.
|
276
|
+
HtmlRenderer = HTMLRenderer
|
252
277
|
end
|
data/lib/markly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bake
|
@@ -26,34 +26,6 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: bake-bundler
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
36
|
-
type: :development
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: bake-modernize
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
29
|
- !ruby/object:Gem::Dependency
|
58
30
|
name: minitest
|
59
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +150,6 @@ files:
|
|
178
150
|
- ext/markly/xml.c
|
179
151
|
- lib/markly.rb
|
180
152
|
- lib/markly/flags.rb
|
181
|
-
- lib/markly/markly.so
|
182
153
|
- lib/markly/node.rb
|
183
154
|
- lib/markly/node/inspect.rb
|
184
155
|
- lib/markly/renderer.rb
|
data/lib/markly/markly.so
DELETED
Binary file
|