sigmund_liquid 1.0.5 → 1.0.6

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
- MmIyMmU2ZTk2MTg1NmI2ZTkzODA3ZmQ3OGMwMjg2N2U0OTM2YTgxNg==
4
+ YzY3OWY2OTA5OGUwNTVlZTlmZjk0Y2M2ZjgwNzJjOTg3NjAzNWEyOA==
5
5
  data.tar.gz: !binary |-
6
- OTgxMDE4OTU3NjYyM2EzMTcxMDM3MjNmNjlkY2NmMDlkNzU3Yzc4Mg==
6
+ NzliZjI3ZTZiNTRhNzQ5NTc5ZDY1NTJkNmQyNTAxZTQ3NDU3MmY3Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWUxM2M3ZjQ5OGFmNTliNTNjZWE3ZjE0YWJkMGU3ZTQzNGExNWM3NTliN2Y5
10
- YzkzYzQ5ZDkzZTIyMmM4MzM3MWY1ZmFhYzllYjFlZTVmMTQ4ZWY1NjgyYzdm
11
- MjhlOTA2NTMyZDk3OWI5ZTQ0ZGMzNjc3YWIzYzM1ZDJlMTM4OWM=
9
+ NzI1ZDA0YzcxZGVjYzUzNzQ4MjFiMTY3YjEwNzRiNDNjMjQ2ODc3MWQ2NTJi
10
+ ZDkzOTBiZmU4ZWMzZjM3ZjM4NzYwMjJkNjc3MDczZjQ4ZDMyZmYyMzU5NDUw
11
+ ZTUyMDBlMzc2MWRjOTA0YWU5MWQ3N2EzODQ5OTVmMzVkOWY0MGQ=
12
12
  data.tar.gz: !binary |-
13
- YjQ0Y2JiNDUxNDllOWY5MjQxMWZlYmJiYmRiMmVhZjg1YzJkNzE2MzVmYzI4
14
- NWE5NDJmNWY1ZTViMzhmYjUzNjEzMGVlNGZhMDk0MWFiZDg1NTM3NDZlMWUx
15
- MmUxZDY3NmY0MDM3MjE1YzI5ODhkY2MzZDczOTU4NjU3YjdhZjg=
13
+ MDRiMTViMDZjMWNjYTE1NTRjOGRiY2EzNDgyNzc0NGY3YTdkYzNiYWNjZTQx
14
+ OWMzODdiZmJiMTVkMTg3MmU1YjM1MDM0ZTA4YThjNWM1YmFjMWJhOTYzNWU0
15
+ MDYyOTFkOTk4YzhmNGZhN2I4MzRlYWYxOGEyOTQyYjJjY2JiODE=
@@ -15,7 +15,6 @@ module Sigmund
15
15
  template = @options[:snippet].include?('{') ? @options[:snippet] : context[:site].snippets.where(slug: @options[:snippet] ).try(:first).try(:template)
16
16
  @options[:liquid_render] = ::Liquid::Template.parse(template) unless template.blank?
17
17
  end
18
-
19
18
  else
20
19
  raise ::Liquid::SyntaxError.new("Syntax Error in 'children_nav ' - Valid syntax: children_nav <options>")
21
20
  end
@@ -45,18 +44,15 @@ module Sigmund
45
44
  def render_entry_link(context, page, css, depth, is_last, is_first )
46
45
  selected = @page.fullpath =~ /^#{page.fullpath}(\/.*)?$/ ? " #{@options[:active_class]}" : ''
47
46
 
48
- icon = @options[:icon] ? '<span></span>' : ''
49
47
  href = File.join('/', @site.localized_page_fullpath(page))
50
- title = render_title(context, page, href, is_first, is_last)
48
+ title = render_title(context, page, href, selected, is_first, is_last)
49
+
51
50
  if @options[:liquid_render]
52
51
  return title
53
52
  end
54
- label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
55
-
56
-
57
53
 
58
54
  output = %{<li id="#{page.slug.to_s.dasherize}-link" class="link#{selected} #{css}">}
59
- output << %{<a href="#{href}">#{label}</a>}
55
+ output << %{<a href="#{href}">#{title}</a>}
60
56
  output << render_entry_children(context, page, depth.succ) if (depth.succ <= @options[:depth].to_i)
61
57
  output << %{</li>}
62
58
 
@@ -81,13 +77,14 @@ module Sigmund
81
77
  output
82
78
  end
83
79
 
84
- def render_title(context, page, href, is_first, is_last)
80
+ def render_title(context, page, href, selected, is_first, is_last)
85
81
  if @options[:liquid_render]
86
82
  context.stack do
87
83
  context['page'] = page
88
84
  context['is_first'] = is_first
89
85
  context['is_last'] = is_last
90
86
  context['href'] = href
87
+ context['selected'] = selected
91
88
  @options[:liquid_render].render(context)
92
89
  end
93
90
  else
@@ -81,7 +81,7 @@ module Sigmund
81
81
  end
82
82
 
83
83
  # Returns a list element, a link to the page and its children
84
- def render_entry_link(context, page, css, depth)
84
+ def render_entry_link(context, page, css, depth, is_first, is_last)
85
85
  selected = @page.fullpath =~ /^#{page.fullpath}(\/.*)?$/ ? " #{@options[:active_class]}" : ''
86
86
 
87
87
  icon = @options[:icon] ? '<span></span>' : ''
@@ -127,7 +127,7 @@ module Sigmund
127
127
  css << 'first' if children.first == c
128
128
  css << 'last' if children.last == c
129
129
 
130
- output << render_entry_link(context, c, css.join(' '), depth)
130
+ output << render_entry_link(context, c, css.join(' '), depth, children.first == c, children.last == c)
131
131
  end
132
132
  output << %{</ul>}
133
133
  end
@@ -135,11 +135,14 @@ module Sigmund
135
135
  output
136
136
  end
137
137
 
138
- def render_title(context, page, href)
138
+ def render_title(context, page, href, selected, is_first, is_last)
139
139
  if @options[:liquid_render]
140
140
  context.stack do
141
141
  context['page'] = page
142
+ context['is_first'] = is_first
143
+ context['is_last'] = is_last
142
144
  context['href'] = href
145
+ context['selected'] = selected
143
146
  @options[:liquid_render].render(context)
144
147
  end
145
148
  else
@@ -1,5 +1,5 @@
1
1
  module Sigmund
2
2
  module Liquid
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigmund_liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - amainguy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler