Class: SimpleNavigation::Adapters::Nanoc Deprecated
- Defined in:
- lib/simple_navigation/adapters/nanoc.rb
Overview
This adapter is for Nanoc3 (circa 2011-2012) and is no longer actively maintained. Nanoc3 is obsolete and has been replaced by Nanoc 4+. This adapter is kept for backward compatibility but should not be used for new projects.
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#content_tag(type, content, options = {}) ⇒ Object
Returns a tag of the specified type, content and options.
-
#context_for_eval ⇒ Object
Returns the context in which the config files will be evaluated.
-
#current_page?(url) ⇒ Boolean
Returns true if the current request’s url matches the specified url.
-
#initialize(ctx) ⇒ Nanoc
constructor
rubocop:disable Lint/MissingSuper.
-
#link_to(name, url, options = {}) ⇒ Object
Returns a link with the specified name, url and options.
Methods inherited from Base
Constructor Details
#initialize(ctx) ⇒ Nanoc
rubocop:disable Lint/MissingSuper
16 17 18 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 16 def initialize(ctx) # rubocop:disable Lint/MissingSuper @context = ctx end |
Class Method Details
.register(root) ⇒ Object
10 11 12 13 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 10 def register(root) SimpleNavigation.set_env(root, 'development') Nanoc3::Context.include SimpleNavigation::Helpers end |
Instance Method Details
#content_tag(type, content, options = {}) ⇒ Object
Returns a tag of the specified type, content and options. Used for rendering.
40 41 42 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 40 def content_tag(type, content, = {}) "<#{type} #{to_attributes()}>#{content}</#{type}>" end |
#context_for_eval ⇒ Object
Returns the context in which the config files will be evaluated
21 22 23 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 21 def context_for_eval context end |
#current_page?(url) ⇒ Boolean
Returns true if the current request’s url matches the specified url. Used to determine if an item should be autohighlighted.
27 28 29 30 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 27 def current_page?(url) path = context.item.path path && path.chop == url end |
#link_to(name, url, options = {}) ⇒ Object
Returns a link with the specified name, url and options. Used for rendering.
34 35 36 |
# File 'lib/simple_navigation/adapters/nanoc.rb', line 34 def link_to(name, url, = {}) "<a href='#{url}' #{to_attributes()}>#{name}</a>" end |