class Webgen::Context::HtmlHead::Proxy
Proxy
object for working with the data structure needed by Webgen::ContentProcessor::HtmlHead
.
Public Instance Methods
inline_fragment(type, content)
click to toggle source
Add inline CSS or JS fragments to the HTML head section.
The type can either be :css for a CSS fragment or :js for a javascript fragment.
# File lib/webgen/context/html_head.rb 44 def inline_fragment(type, content) 45 type_check!(type) 46 (cp_hash["#{type}_inline".intern] ||= []) << content 47 end
link_file(type, file)
click to toggle source
Add a link to the given file in the HTML head section.
The type can either be :css for CSS files or :js for javascript files. The path to the file is resolved using the “relocatable” tag (see Webgen::Tag::Relocatable
).
# File lib/webgen/context/html_head.rb 36 def link_file(type, file) 37 type_check!(type) 38 (cp_hash["#{type}_file".intern] ||= []) << @context.tag('relocatable', file) 39 end
meta(name, content)
click to toggle source
Set the meta tag to the provided value.
Note that some meta information keys may not be specified multiple times!
# File lib/webgen/context/html_head.rb 21 def meta(name, content) 22 (cp_hash[:meta] ||= {})[name] = content 23 end
meta_property(name, content)
click to toggle source
Set the meta tag to the provided value, using property
instead of name
.
Note that some meta information keys may not be specified multiple times!
# File lib/webgen/context/html_head.rb 28 def meta_property(name, content) 29 (cp_hash[:meta_property] ||= {})[name] = content 30 end