markly 0.4.0 → 0.6.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/extconf.rb +10 -2
- data/ext/markly/markly.c +1 -1
- data/lib/markly/renderer/html_renderer.rb +16 -6
- data/lib/markly/version.rb +1 -1
- metadata +3 -4
- data/lib/markly/markly.bundle +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2985f6cac16bb57171c4b817c596683ec8d35afd6d0691f8aa0dd285e2eabb24
|
4
|
+
data.tar.gz: 98a0c5839f327c8204e66e714cf1801071541a20e68ace606d28b573af632b0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15789683e9e8f7d6ec5ce6ceed4f293a0e86b695b9453f80ed4f57149d4406f495dd8a232cdc311827f67e78c41337404db0a4a84d4a976b813da0c16431597f
|
7
|
+
data.tar.gz: 6aaa28e6a472e36b6af85774a2dd33292dfc3967ffa575fb9bfee3309712ffec58128866011aef42d7c64455b4cfac69195e9e454a25555733e8c5e05e7b7a9e
|
data/ext/markly/extconf.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Loads mkmf which is used to make makefiles for Ruby extensions
|
3
4
|
require 'mkmf'
|
4
5
|
|
5
|
-
$CFLAGS <<
|
6
|
+
$CFLAGS << " -O3 -std=c99"
|
6
7
|
|
7
|
-
|
8
|
+
gem_name = File.basename(__dir__)
|
9
|
+
extension_name = 'markly'
|
10
|
+
|
11
|
+
# The destination:
|
12
|
+
dir_config(extension_name)
|
13
|
+
|
14
|
+
# Generate the makefile to compile the native binary into `lib`:
|
15
|
+
create_makefile(File.join(gem_name, extension_name))
|
data/ext/markly/markly.c
CHANGED
@@ -333,7 +333,7 @@ static VALUE rb_node_set_string_content(VALUE self, VALUE s) {
|
|
333
333
|
static VALUE rb_node_get_type(VALUE self) {
|
334
334
|
int node_type = 0;
|
335
335
|
cmark_node *node = NULL;
|
336
|
-
VALUE symbol =
|
336
|
+
VALUE symbol = Qnil;
|
337
337
|
const char *s = NULL;
|
338
338
|
|
339
339
|
TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
|
@@ -4,15 +4,19 @@ require 'cgi'
|
|
4
4
|
|
5
5
|
module Markly
|
6
6
|
class HTMLRenderer < Renderer
|
7
|
-
def initialize(ids: false, **options)
|
7
|
+
def initialize(ids: false, tight: false, **options)
|
8
8
|
super(**options)
|
9
9
|
|
10
10
|
@ids = ids
|
11
|
+
@section = nil
|
12
|
+
@tight = tight
|
11
13
|
end
|
12
14
|
|
13
15
|
def document(_)
|
16
|
+
@section = false
|
14
17
|
super
|
15
18
|
out("</ol>\n</section>\n") if @written_footnote_ix
|
19
|
+
out("</section>") if @section
|
16
20
|
end
|
17
21
|
|
18
22
|
def id_for(node)
|
@@ -25,13 +29,19 @@ module Markly
|
|
25
29
|
|
26
30
|
def header(node)
|
27
31
|
block do
|
28
|
-
|
32
|
+
if @ids
|
33
|
+
out('</section>') if @section
|
34
|
+
@section = true
|
35
|
+
out("<section#{id_for(node)}>")
|
36
|
+
end
|
37
|
+
|
38
|
+
out('<h', node.header_level, "#{source_position(node)}>", :children,
|
29
39
|
'</h', node.header_level, '>')
|
30
40
|
end
|
31
41
|
end
|
32
42
|
|
33
43
|
def paragraph(node)
|
34
|
-
if @
|
44
|
+
if @tight && node.parent.type != :blockquote
|
35
45
|
out(:children)
|
36
46
|
else
|
37
47
|
block do
|
@@ -47,8 +57,8 @@ module Markly
|
|
47
57
|
end
|
48
58
|
|
49
59
|
def list(node)
|
50
|
-
|
51
|
-
@
|
60
|
+
old_tight = @tight
|
61
|
+
@tight = node.list_tight
|
52
62
|
|
53
63
|
block do
|
54
64
|
if node.list_type == :bullet_list
|
@@ -67,7 +77,7 @@ module Markly
|
|
67
77
|
end
|
68
78
|
end
|
69
79
|
|
70
|
-
@
|
80
|
+
@tight = old_tight
|
71
81
|
end
|
72
82
|
|
73
83
|
def list_item(node)
|
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.6.0
|
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:
|
13
|
+
date: 2021-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bake
|
@@ -150,7 +150,6 @@ files:
|
|
150
150
|
- ext/markly/xml.c
|
151
151
|
- lib/markly.rb
|
152
152
|
- lib/markly/flags.rb
|
153
|
-
- lib/markly/markly.bundle
|
154
153
|
- lib/markly/node.rb
|
155
154
|
- lib/markly/node/inspect.rb
|
156
155
|
- lib/markly/renderer.rb
|
@@ -176,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
175
|
- !ruby/object:Gem::Version
|
177
176
|
version: '0'
|
178
177
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.2.22
|
180
179
|
signing_key:
|
181
180
|
specification_version: 4
|
182
181
|
summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.
|
data/lib/markly/markly.bundle
DELETED
Binary file
|