bridgetown-builder 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bridgetown-builder/dsl/helpers.rb +27 -0
- data/lib/bridgetown-builder/dsl/liquid.rb +11 -3
- data/lib/bridgetown-builder/plugin.rb +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ba3bc394020ff46104b6f2e53a0d1ed42da8916bda4749af4129f1822dbbac2
|
4
|
+
data.tar.gz: 6064d7a134ffc22770e4099c9612e9daa4aa5eeda1a517c12972b3de069a4897
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84eea01bca2ab9c38f010f1aeaaf6930baee8091e505db1bfedcbaf0526638ffcdbb41b078c6053e9d945904b981ebe53fd37bf9ebb30d9b29f8aa57a0f5047c
|
7
|
+
data.tar.gz: 9ee94851ec8c5f83487c0ed0916bab1e31a84f6cec1a138f708452df20230ebc2681394f10ef2023c7a05b58f367efdc4f78c75f8d3295f591be9d7ae2abc7de
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bridgetown
|
4
|
+
module Builders
|
5
|
+
module DSL
|
6
|
+
module Helpers
|
7
|
+
def helper(helper_name, method_name = nil, helpers_scope: false, &block)
|
8
|
+
builder_self = self
|
9
|
+
m = Module.new
|
10
|
+
|
11
|
+
if block && !helpers_scope
|
12
|
+
m.define_method helper_name do |*args|
|
13
|
+
builder_self.instance_exec(*args, &block)
|
14
|
+
end
|
15
|
+
else
|
16
|
+
block = method(method_name) if method_name
|
17
|
+
m.define_method helper_name, &block
|
18
|
+
end
|
19
|
+
|
20
|
+
Bridgetown::RubyTemplateView::Helpers.include(m)
|
21
|
+
|
22
|
+
functions << { name: name, filter: m }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,10 +5,18 @@ module Bridgetown
|
|
5
5
|
module DSL
|
6
6
|
module Liquid
|
7
7
|
def liquid_filter(filter_name, method_name = nil, &block)
|
8
|
-
|
9
|
-
|
8
|
+
builder_self = self
|
10
9
|
m = Module.new
|
11
|
-
|
10
|
+
|
11
|
+
if block
|
12
|
+
m.define_method filter_name do |*args|
|
13
|
+
builder_self.instance_exec(*args, &block)
|
14
|
+
end
|
15
|
+
elsif method_name
|
16
|
+
block = method(method_name)
|
17
|
+
m.define_method filter_name, &block
|
18
|
+
end
|
19
|
+
|
12
20
|
::Liquid::Template.register_filter(m)
|
13
21
|
|
14
22
|
functions << { name: name, filter: m }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bridgetown-builder/dsl/generators"
|
4
|
+
require "bridgetown-builder/dsl/helpers"
|
4
5
|
require "bridgetown-builder/dsl/hooks"
|
5
6
|
require "bridgetown-builder/dsl/http"
|
6
7
|
require "bridgetown-builder/dsl/liquid"
|
@@ -8,6 +9,7 @@ module Bridgetown
|
|
8
9
|
module Builders
|
9
10
|
class PluginBuilder
|
10
11
|
include DSL::Generators
|
12
|
+
include DSL::Helpers
|
11
13
|
include DSL::Hooks
|
12
14
|
include DSL::HTTP
|
13
15
|
include DSL::Liquid
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.17.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.17.0
|
27
27
|
description:
|
28
28
|
email: maintainers@bridgetownrb.com
|
29
29
|
executables: []
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/bridgetown-builder/document.rb
|
39
39
|
- lib/bridgetown-builder/documents_generator.rb
|
40
40
|
- lib/bridgetown-builder/dsl/generators.rb
|
41
|
+
- lib/bridgetown-builder/dsl/helpers.rb
|
41
42
|
- lib/bridgetown-builder/dsl/hooks.rb
|
42
43
|
- lib/bridgetown-builder/dsl/http.rb
|
43
44
|
- lib/bridgetown-builder/dsl/liquid.rb
|