markly 0.2.1 → 0.2.2

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: 27b98de3f04fbba3681df9356148129c3adb335740846ba638a4fb2790029e9e
4
- data.tar.gz: c6bdd14cff454a313050128e4b4f32e1b7db2306581d8fde7475ccd9021fac36
3
+ metadata.gz: 955e2db3a2000c5172b062923678f0eaaca4b509a6141289dc3173681942b299
4
+ data.tar.gz: 69b8c19e5e15d4c8596ccebd40a8cbbb491cefc7a1b8a1649711e635b9ec7af3
5
5
  SHA512:
6
- metadata.gz: 69a8a8366b7b3eb19d08c1cedd839c5a0a3ec15d3c0e3be1f80e9adcd4a7849704a733249aebb86771a822a3e4b0dbb4a5643b208597be9316c7282f5b6d471a
7
- data.tar.gz: 1540db6af546c59fff663ab5f056519fdf48523e56c35a28281e3d5c34f75b4c2d0e0176666af4453b87b16faefeb19880da511067468a34d648d97c15d1a2ff
6
+ metadata.gz: e1401692edab6e63a114894fabbca6b95a5af6c2a50583bfcd858a85ac16622d1442324f3df2dc412e084b11869001afd3b5feedb2ba75a2e5c9c9762540ef76
7
+ data.tar.gz: e484546eae62ca19662b5853c5d1fe2356843a52e82568c00391e0f5aed954345d4eacea6478d3481757b83e95d3c31c541880f47cb001f95a468cbc6751f3b2
Binary file
@@ -1,15 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markly
4
- class HtmlRenderer < Renderer
4
+ class HTMLRenderer < Renderer
5
+ def initialize(ids: false, **options)
6
+ super(**options)
7
+
8
+ @ids = ids
9
+ end
10
+
5
11
  def document(_)
6
12
  super
7
13
  out("</ol>\n</section>\n") if @written_footnote_ix
8
14
  end
9
15
 
16
+ def id_for(node)
17
+ if @ids
18
+ id = node.to_plaintext.chomp.downcase.gsub(/\s+/, '-')
19
+
20
+ return " id=\"#{id}\""
21
+ end
22
+ end
23
+
10
24
  def header(node)
11
25
  block do
12
- out('<h', node.header_level, "#{source_position(node)}>", :children,
26
+ out('<h', node.header_level, "#{id_for(node)}#{source_position(node)}>", :children,
13
27
  '</h', node.header_level, '>')
14
28
  end
15
29
  end
@@ -249,4 +263,7 @@ module Markly
249
263
  node.tasklist_item_checked?
250
264
  end
251
265
  end
266
+
267
+ # Legacy.
268
+ HtmlRenderer = HTMLRenderer
252
269
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markly
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
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.2.1
4
+ version: 0.2.2
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-06-14 00:00:00.000000000 Z
13
+ date: 2020-06-17 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