dato_dast 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +5 -4
- data/README.md +25 -0
- data/lib/dato_dast/configuration.rb +14 -2
- data/lib/dato_dast/extensions/middleman.rb +10 -2
- data/lib/dato_dast/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c72b8aaf4727201859551e3b1a6bc0db761be538dc4411c3444e56454cde77d9
|
4
|
+
data.tar.gz: e69f5d9cec8ef6b7b6d96318b3fdfdc1be57e947d35d8117c64fdcaaa451b4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18f729ed3d089d9038ecb12c4837e9b3c6bd1916cb7733d8c9ffdc4c59a97f2161079957b445d17171d65e1a3b4a1940bc8f02f6b2038953740ccf5dd370cb6
|
7
|
+
data.tar.gz: 9a06315c442542b0def184a4dbe513cf55a98a222b76eb63669b37e9e7c5aee64abcd0c0613d738a58282dd4550e08d47a7e8a89c9de6c8bd38d92ad334a7a32
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dato_dast (0.
|
4
|
+
dato_dast (0.2.0)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.1.4.
|
10
|
+
activesupport (6.1.4.4)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
@@ -20,7 +20,7 @@ GEM
|
|
20
20
|
i18n (1.8.10)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
22
|
method_source (1.0.0)
|
23
|
-
minitest (5.
|
23
|
+
minitest (5.15.0)
|
24
24
|
pry (0.13.1)
|
25
25
|
coderay (~> 1.1)
|
26
26
|
method_source (~> 1.0)
|
@@ -43,9 +43,10 @@ GEM
|
|
43
43
|
rspec-support (3.10.2)
|
44
44
|
tzinfo (2.0.4)
|
45
45
|
concurrent-ruby (~> 1.0)
|
46
|
-
zeitwerk (2.
|
46
|
+
zeitwerk (2.5.1)
|
47
47
|
|
48
48
|
PLATFORMS
|
49
|
+
ruby
|
49
50
|
x86_64-darwin-20
|
50
51
|
|
51
52
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -66,6 +66,31 @@ config = DastDast::Configuration.new
|
|
66
66
|
DatoDast.structured_text(item, config)
|
67
67
|
```
|
68
68
|
|
69
|
+
### `DatoDast.configuration.duplicate`
|
70
|
+
|
71
|
+
If you want to temporarily override the existing configuration, you can
|
72
|
+
duplicate the current configuration and this method will return a configuration
|
73
|
+
object you can pass to `DatoDast.structured_text(text, configuration)` as the
|
74
|
+
configuration.
|
75
|
+
|
76
|
+
An example below:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
DatoDast.configure do |config|
|
80
|
+
config.host = "https://example.com"
|
81
|
+
end
|
82
|
+
|
83
|
+
new_config = DatoDast.congfiguration.duplicate do |config|
|
84
|
+
config.highlight = false
|
85
|
+
end
|
86
|
+
|
87
|
+
DatoDast.configuration.host # => example.com
|
88
|
+
DatoDast.configuration.highlight # => true
|
89
|
+
|
90
|
+
new_config.host # => example.com
|
91
|
+
new_config.highlight # => false
|
92
|
+
```
|
93
|
+
|
69
94
|
The configuration options are:
|
70
95
|
|
71
96
|
### `config.highlight`, default: `true`
|
@@ -44,6 +44,18 @@ module DatoDast
|
|
44
44
|
@types = TYPE_CONFIG.transform_values { |value| value.dup }
|
45
45
|
end
|
46
46
|
|
47
|
+
def duplicate(&blk)
|
48
|
+
config = DatoDast::Configuration.new
|
49
|
+
|
50
|
+
%w(blocks inline_items highlight host item_links marks smart_links types).each do |method|
|
51
|
+
config.send("#{method}=", send(method))
|
52
|
+
end
|
53
|
+
|
54
|
+
yield config if blk
|
55
|
+
|
56
|
+
config
|
57
|
+
end
|
58
|
+
|
47
59
|
def host=(new_host)
|
48
60
|
return unless new_host
|
49
61
|
|
@@ -59,13 +71,13 @@ module DatoDast
|
|
59
71
|
def blocks=(new_blocks)
|
60
72
|
validate_items_configuration(new_blocks, "blocks")
|
61
73
|
|
62
|
-
@blocks
|
74
|
+
@blocks.merge!(new_blocks)
|
63
75
|
end
|
64
76
|
|
65
77
|
def inline_items=(new_inline_items)
|
66
78
|
validate_items_configuration(new_inline_items, "inline_items")
|
67
79
|
|
68
|
-
@inline_items
|
80
|
+
@inline_items.merge!(new_inline_items)
|
69
81
|
end
|
70
82
|
|
71
83
|
def marks=(new_marks)
|
@@ -11,8 +11,11 @@ module DatoDast
|
|
11
11
|
option :marks, {}, "Configuration hash for a given mark"
|
12
12
|
option :smart_links, true, "Open Link items in new windows and ItemLinks in the same window"
|
13
13
|
option :types, {}, "Configuration hash for a given block node type"
|
14
|
+
option :wrappers, {}, "Wrappers for types without changing specific implementation"
|
14
15
|
|
15
16
|
def after_configuration
|
17
|
+
return if app.mode?(:config)
|
18
|
+
|
16
19
|
DatoDast.configure do |config|
|
17
20
|
config.blocks = options[:blocks]
|
18
21
|
config.highlight = options[:highlight]
|
@@ -22,6 +25,11 @@ module DatoDast
|
|
22
25
|
config.marks = options[:marks]
|
23
26
|
config.smart_links = options[:smart_links]
|
24
27
|
config.types = options[:types]
|
28
|
+
options[:wrappers].each do |type, wrappers|
|
29
|
+
wrappers.each do |wrapper|
|
30
|
+
config.add_wrapper(type, wrapper)
|
31
|
+
end
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
@@ -31,7 +39,7 @@ module DatoDast
|
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
34
|
-
|
35
|
-
::Middleman::Extensions.register(:dato_dast, DatoDast::Extensions::Middleman)
|
36
42
|
end
|
37
43
|
end
|
44
|
+
|
45
|
+
::Middleman::Extensions.register(:dato_dast, DatoDast::Extensions::Middleman)
|
data/lib/dato_dast/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dato_dast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John DeWyze
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- ".gitignore"
|
50
50
|
- ".projections.json"
|
51
51
|
- ".rspec"
|
52
|
+
- ".tool-versions"
|
52
53
|
- CHANGELOG.md
|
53
54
|
- CODE_OF_CONDUCT.md
|
54
55
|
- Gemfile
|
@@ -99,7 +100,7 @@ metadata:
|
|
99
100
|
homepage_uri: https://github.com/dewyze/dato_dast
|
100
101
|
source_code_uri: https://github.com/dewyze/dato_dast
|
101
102
|
changelog_uri: https://github.com/dewyze/dato_dast/blob/main/CHANGELOG.md.
|
102
|
-
post_install_message:
|
103
|
+
post_install_message:
|
103
104
|
rdoc_options: []
|
104
105
|
require_paths:
|
105
106
|
- lib
|
@@ -114,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '0'
|
116
117
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
118
|
+
rubygems_version: 3.1.6
|
119
|
+
signing_key:
|
119
120
|
specification_version: 4
|
120
121
|
summary: Gem for converting DatoCMS Structured Text to Html
|
121
122
|
test_files: []
|