booklab-toc 0.2.0 → 0.3.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: ea470e625314be2d97814f44320f898ae929f23f74f987b3d7fd270b4326b7c4
4
- data.tar.gz: ed7255565a6e2db74af51c7ec58e838075a7af939bcfacc856bb077e19797276
3
+ metadata.gz: 937c004dd1f93821fe8ed5b0f23d9289fd60167e4ecb30e99da110713a416528
4
+ data.tar.gz: 541a01ccbb9a11cb84bb21839cb8a557cff2d7e97cd550f82bb962b12ee301b0
5
5
  SHA512:
6
- metadata.gz: 7a095221f0e51add7a3cf724b2a33ba6710cb82e18f18e02347cd9a1ba88cfa76ea7cd22610a83d567fb5da70ccc0ed0a55f017988c5808986811f5b344097ba
7
- data.tar.gz: e441d32d30403a5719562fc669b1c6360352a3628637550f1b041629c1451560437c8c0200a9af76debf4935b3306884b965596e1d907a357384d215f095c0f3
6
+ metadata.gz: 7230821f100ecf6a34bef965c6e41d0ecab48a9274678b0446ee91d5f6de94a3f834e2908e5a4e433b31dfad92c4136a79f5b0b52700f65835b85b4ccc3c43f6
7
+ data.tar.gz: b343854454470d3b2c78a50282788922f3ea53c7616895381d46a887031eefccde34c67f5ceb0e3c080a2aee72098b698d03cac7863eeb9e8ebcbf91dc854045
@@ -15,26 +15,26 @@ module BookLab
15
15
  _dump
16
16
  end
17
17
 
18
- def to_html(prefix: nil)
19
- _render(format: :html, prefix: prefix)
18
+ def to_html(prefix: nil, suffix: nil)
19
+ _render(format: :html, prefix: prefix, suffix: suffix)
20
20
  end
21
21
 
22
- def to_markdown(prefix: nil)
23
- _render(format: :markdown, prefix: prefix)
22
+ def to_markdown(prefix: nil, suffix: nil)
23
+ _render(format: :markdown, prefix: prefix, suffix: suffix)
24
24
  end
25
25
 
26
26
  def to_json
27
27
  items.to_json
28
28
  end
29
29
 
30
- def _render(format: :html, prefix: nil)
30
+ def _render(format: :html, prefix: nil, suffix: nil)
31
31
  render_items = []
32
32
  items.each do |item|
33
33
  new_item = item.dup
34
34
 
35
35
  new_item.slug = new_item.url
36
- if prefix && new_item.url && !new_item.slug.include?("/")
37
- new_item.url = "#{prefix}#{new_item.slug}"
36
+ if new_item.url && !new_item.slug.include?("/")
37
+ new_item.url = "#{prefix.to_s}#{new_item.slug}#{suffix.to_s}"
38
38
  end
39
39
  render_items << new_item
40
40
  end
@@ -1,5 +1,5 @@
1
1
  module BookLab
2
2
  module Toc
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: booklab-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-17 00:00:00.000000000 Z
11
+ date: 2019-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -76,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubyforge_project:
80
- rubygems_version: 2.7.8
79
+ rubygems_version: 3.0.1
81
80
  signing_key:
82
81
  specification_version: 4
83
82
  summary: Toc format read/write for BookLab