sigmund_liquid 1.0.2 → 1.0.3
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTc0NzQ4ZGQ2MjRhMWQ2NDg2NTA2NjA3M2VkMTZhNDNiNTZiNTU1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjU5YTIyOWRmYmVhMTdmMDdmNmJkZGFjOWMwYzJkYWRhNWZmNWFmNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZiYTAyZDE2ZmRmNDVlNDkwMjkwODhhNWU0YWUxNGMxMzU4ZDAzYzEzNWFi
|
10
|
+
MjlhOTBmODcyNDY3MTMxYmE3OWFjNTdiMGQ3ZmExYTIzNDcyNmU2MzdmNDE1
|
11
|
+
MWU1NGU5YzFhOWE2ZGQyMjIwNzY3OTA3YmQxMzk4NWEyZDE5Nzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjU0MTdlOGE1NDY4YWQ1M2VhMjhlNDI2MmMxZDM1NmZjNTkyYTdhYTBhMjg4
|
14
|
+
NmRiMjQ3ZjFjZGZjMDVlNzMzODNlMGUzNzMxMDgzODJhNzFmNmU0NzM5MWE3
|
15
|
+
OGYyOGJhNDM1Mjc5OThkMGEzNjM3YzRhYjBkNjg1YzU4MGY2NjI=
|
@@ -10,6 +10,12 @@ module Sigmund
|
|
10
10
|
@options = { id: 'nav', depth: 1, class: '', active_class: 'active'}
|
11
11
|
markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') }
|
12
12
|
@options[:exclude] = Regexp.new(@options[:exclude]) if @options[:exclude]
|
13
|
+
|
14
|
+
if @options[:snippet]
|
15
|
+
template = @options[:snippet].include?('{') ? @options[:snippet] : context[:site].snippets.where(slug: @options[:snippet] ).try(:first).try(:template)
|
16
|
+
@options[:liquid_render] = ::Liquid::Template.parse(template) unless template.blank?
|
17
|
+
end
|
18
|
+
|
13
19
|
else
|
14
20
|
raise ::Liquid::SyntaxError.new("Syntax Error in 'children_nav ' - Valid syntax: children_nav <options>")
|
15
21
|
end
|
@@ -36,11 +42,14 @@ module Sigmund
|
|
36
42
|
end
|
37
43
|
|
38
44
|
# Returns a list element, a link to the page and its children
|
39
|
-
def render_entry_link(context, page, css, depth)
|
45
|
+
def render_entry_link(context, page, css, depth, is_last, is_first )
|
40
46
|
selected = @page.fullpath =~ /^#{page.fullpath}(\/.*)?$/ ? " #{@options[:active_class]}" : ''
|
41
47
|
|
42
48
|
icon = @options[:icon] ? '<span></span>' : ''
|
43
|
-
title = render_title(context, page)
|
49
|
+
title = render_title(context, page, is_first, is_last)
|
50
|
+
if @options[:liquid_render]
|
51
|
+
return title
|
52
|
+
end
|
44
53
|
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
|
45
54
|
|
46
55
|
href = File.join('/', @site.localized_page_fullpath(page))
|
@@ -63,7 +72,7 @@ module Sigmund
|
|
63
72
|
css = []
|
64
73
|
css << 'first' if children.first == c
|
65
74
|
css << 'last' if children.last == c
|
66
|
-
output << render_entry_link(context, c, css.join(' '), depth)
|
75
|
+
output << render_entry_link(context, c, css.join(' '), depth, children.first == c, children.last == c)
|
67
76
|
end
|
68
77
|
output << %{</ul>}
|
69
78
|
end
|
@@ -71,10 +80,12 @@ module Sigmund
|
|
71
80
|
output
|
72
81
|
end
|
73
82
|
|
74
|
-
def render_title(context, page)
|
83
|
+
def render_title(context, page, is_first, is_last)
|
75
84
|
if @options[:liquid_render]
|
76
85
|
context.stack do
|
77
86
|
context['page'] = page
|
87
|
+
context['is_first'] = is_first
|
88
|
+
context['is_last'] = is_last
|
78
89
|
@options[:liquid_render].render(context)
|
79
90
|
end
|
80
91
|
else
|
@@ -85,7 +85,10 @@ module Sigmund
|
|
85
85
|
selected = @page.fullpath =~ /^#{page.fullpath}(\/.*)?$/ ? " #{@options[:active_class]}" : ''
|
86
86
|
|
87
87
|
icon = @options[:icon] ? '<span></span>' : ''
|
88
|
-
|
88
|
+
title = render_title(context, page)
|
89
|
+
if @options[:liquid_render]
|
90
|
+
return title
|
91
|
+
end
|
89
92
|
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
|
90
93
|
|
91
94
|
link_options = caret = ''
|