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 +4 -4
- data/lib/booklab/toc/content.rb +7 -7
- data/lib/booklab/toc/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 937c004dd1f93821fe8ed5b0f23d9289fd60167e4ecb30e99da110713a416528
|
4
|
+
data.tar.gz: 541a01ccbb9a11cb84bb21839cb8a557cff2d7e97cd550f82bb962b12ee301b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7230821f100ecf6a34bef965c6e41d0ecab48a9274678b0446ee91d5f6de94a3f834e2908e5a4e433b31dfad92c4136a79f5b0b52700f65835b85b4ccc3c43f6
|
7
|
+
data.tar.gz: b343854454470d3b2c78a50282788922f3ea53c7616895381d46a887031eefccde34c67f5ceb0e3c080a2aee72098b698d03cac7863eeb9e8ebcbf91dc854045
|
data/lib/booklab/toc/content.rb
CHANGED
@@ -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
|
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
|
data/lib/booklab/toc/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
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
|