Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding more generic method to add content to head

  • Loading branch information...
commit 75da6c27015c77bd990dc3f00275864becb320cd 1 parent 7f2b518
@mikian mikian authored
Showing with 12 additions and 8 deletions.
  1. +9 −5 lib/alula/plugins.rb
  2. +3 −3 lib/alula/plugins/assets.rb
View
14 lib/alula/plugins.rb
@@ -12,13 +12,17 @@ def self.attachment_handler(type)
@@handlers[:attachment][type]
end
- def self.register_scripts_for_head(script)
- @@scripts_for_head ||= ""
- @@scripts_for_head << script
+ def self.register_content_for_head(content)
+ @@content_for_head ||= ""
+ if content.kind_of?(Array)
+ @@content_for_head << content.join("\n")
+ else
+ @@content_for_head << content
+ end
end
- def self.scripts_for_head
- @@scripts_for_head ||= ""
+ def self.content_for_head
+ @@content_for_head ||= ""
end
end
end
View
6 lib/alula/plugins/assets.rb
@@ -2,13 +2,13 @@
module Alula
module Plugins
- class ScriptsForHead < Liquid::Tag
+ class ContentForHead < Liquid::Tag
def initialize(tag_name, markup, tokens)
super
end
def render(context)
- Alula::Plugins.scripts_for_head
+ Alula::Plugins.content_for_head
end
end
@@ -136,4 +136,4 @@ def render(context)
Liquid::Template.register_tag('video', Alula::Plugins::VideoAsset)
# Hook for head section scripts
-Liquid::Template.register_tag('scripts_for_head', Alula::Plugins::ScriptsForHead)
+Liquid::Template.register_tag('content_for_head', Alula::Plugins::ContentForHead)
Please sign in to comment.
Something went wrong with that request. Please try again.