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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 770b81ed57426a591eaa4335ad913df94f61017e08f5e19872766e59ec3d33db
4
- data.tar.gz: 45f5295c1fae1747c841a85b8f17f1442d47ad91194a38874e1313e8c95313f4
3
+ metadata.gz: 2985f6cac16bb57171c4b817c596683ec8d35afd6d0691f8aa0dd285e2eabb24
4
+ data.tar.gz: 98a0c5839f327c8204e66e714cf1801071541a20e68ace606d28b573af632b0b
5
5
  SHA512:
6
- metadata.gz: 75bdb5b83d6ca7685fb659d27f45bfaaefe1241f306ec21281bbbd5906612663c8e4ba7ad3abf59069ff6501c72933c6770d09176dd119de946e5baea0b826ff
7
- data.tar.gz: 0c0aa153efcbbb7914a805e52bf80fdda4bdc5d1ddb0352f7bb00c334f2730d8cd342a19fa273082c07597c16166c666b8f86be66a197729f902e0539903af8f
6
+ metadata.gz: 15789683e9e8f7d6ec5ce6ceed4f293a0e86b695b9453f80ed4f57149d4406f495dd8a232cdc311827f67e78c41337404db0a4a84d4a976b813da0c16431597f
7
+ data.tar.gz: 6aaa28e6a472e36b6af85774a2dd33292dfc3967ffa575fb9bfee3309712ffec58128866011aef42d7c64455b4cfac69195e9e454a25555733e8c5e05e7b7a9e
@@ -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 << ' -std=c99'
6
+ $CFLAGS << " -O3 -std=c99"
6
7
 
7
- create_makefile('markly/markly')
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 = NULL;
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
- out('<h', node.header_level, "#{id_for(node)}#{source_position(node)}>", :children,
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 @in_tight && node.parent.type != :blockquote
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
- old_in_tight = @in_tight
51
- @in_tight = node.list_tight
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
- @in_tight = old_in_tight
80
+ @tight = old_tight
71
81
  end
72
82
 
73
83
  def list_item(node)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markly
4
- VERSION = '0.4.0'
4
+ VERSION = '0.6.0'
5
5
  end
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.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: 2020-07-13 00:00:00.000000000 Z
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.1.2
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.
Binary file