sigmund_liquid 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/sigmund/liquid/tags/children_nav.rb +11 -7
- data/lib/sigmund/liquid/tags/custom_nav.rb +16 -13
- data/lib/sigmund/liquid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTE2ZDcyZGJlMjMxOTEwM2JkY2YzNjlhNTJkNDEyNGMyY2JkN2U1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjBlM2E3Y2Y5ZjUxZjZmNDYwNmYxOWNkNTJlYTJlODg0MGFhOGQ5OA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGVjZWJjMDQ0NWQ3YTYyOTc5ODYzOWQ1NzI2MjNjM2RiYTUzYjMyZTEwMDk3
|
10
|
+
M2FkNGVjNTk1MTI5OGNkYTEyMDk2NzQ1MzliZjJjZWE3NGY2ZTEwNTFjMTk2
|
11
|
+
ZjEzNmZiY2E0ODM0YzUzODc0MTg5YzIyYzJkOWE2NGE4NGU0NGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTEzMWYxYTI3YjU3ZDA0Y2U4ZTNmMDI1ZjRjZjhmMDk5MTgyZmQ3Nzc3ODAy
|
14
|
+
OWRkNWQyOTg5MjNiNjI0ZTBlNTE3ZTg2ZWI0Mjk1NzQ4YjZiZTY4ZTQwYTdh
|
15
|
+
MTA2ODAzN2ZhZmU0NDI1ZDlhYzBjYzU0NmFjZTFjYmNiOWE4M2M=
|
@@ -7,13 +7,17 @@ module Sigmund
|
|
7
7
|
|
8
8
|
def initialize(tag_name, markup, tokens, context)
|
9
9
|
if markup =~ Syntax
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
begin
|
11
|
+
@options = { id: 'nav', depth: 1, class: '', active_class: 'active'}
|
12
|
+
markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') }
|
13
|
+
@options[:exclude] = Regexp.new(@options[:exclude]) if @options[:exclude]
|
14
|
+
|
15
|
+
if @options[:snippet]
|
16
|
+
template = @options[:snippet].include?('{') ? @options[:snippet] : context[:site].snippets.where(slug: @options[:snippet] ).try(:first).try(:template)
|
17
|
+
@options[:liquid_render] = ::Liquid::Template.parse(template) unless template.blank?
|
18
|
+
end
|
19
|
+
rescue
|
20
|
+
nil
|
17
21
|
end
|
18
22
|
else
|
19
23
|
raise ::Liquid::SyntaxError.new("Syntax Error in 'children_nav ' - Valid syntax: children_nav <options>")
|
@@ -18,21 +18,24 @@ module Sigmund
|
|
18
18
|
|
19
19
|
def initialize(tag_name, markup, tokens, context)
|
20
20
|
if markup =~ Syntax
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
begin
|
22
|
+
@source = ($1 || 'page').gsub(/"|'/, '')
|
23
|
+
@options = { id: 'nav', depth: 1, class: '', active_class: 'on', bootstrap: false }
|
24
|
+
markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') }
|
25
|
+
|
26
|
+
@options[:exclude] = Regexp.new(@options[:exclude]) if @options[:exclude]
|
27
|
+
|
28
|
+
@options[:add_attributes] = []
|
29
|
+
if @options[:snippet]
|
30
|
+
template = @options[:snippet].include?('{') ? @options[:snippet] : context[:site].snippets.where(slug: @options[:snippet] ).try(:first).try(:template)
|
31
|
+
unless template.blank?
|
32
|
+
@options[:liquid_render] = ::Liquid::Template.parse(template)
|
33
|
+
@options[:add_attributes] = ['editable_elements']
|
34
|
+
end
|
33
35
|
end
|
36
|
+
rescue
|
37
|
+
nil
|
34
38
|
end
|
35
|
-
|
36
39
|
else
|
37
40
|
raise ::Liquid::SyntaxError.new("Syntax Error in 'nav' - Valid syntax: nav <page|site> <options>")
|
38
41
|
end
|