Public instance methods
Builds a head tag. Adds a meta tag inside with Content-Type set to text/html; charset=utf-8.
# File lib/markaby/builder_tags.rb, line 30 30: def head(*args, &block) 31: tag!(:head, *args) do 32: tag!(:meta, "http-equiv" => "Content-Type", "content" => "text/html; charset=utf-8") if @output_meta_tag 33: instance_eval(&block) 34: end 35: end
Every HTML tag method goes through an html_tag call. So, calling div is equivalent to calling html_tag(:div). All HTML tags in Markaby’s list are given generated wrappers for this method.
If the @auto_validation setting is on, this method will check for many common mistakes which could lead to invalid XHTML.
# File lib/markaby/builder_tags.rb, line 18 18: def html_tag(sym, *args, &block) 19: if @auto_validation && @tagset.self_closing.include?(sym) && block 20: raise InvalidXhtmlError, "the `#{sym}' element is self-closing, please remove the block" 21: elsif args.empty? && !block 22: CssProxy.new(self, @streams.last, sym) 23: else 24: tag!(sym, *args, &block) 25: end 26: end
Builds an html tag with XHTML 1.0 Frameset doctype instead.
# File lib/markaby/builder_tags.rb, line 52 52: def xhtml_frameset(attrs = {}, &block) 53: self.tagset = Markaby::XHTMLFrameset 54: xhtml_html(attrs, &block) 55: end
Builds an html tag with XHTML 1.0 Strict doctype instead.
# File lib/markaby/builder_tags.rb, line 46 46: def xhtml_strict(attrs = {}, &block) 47: self.tagset = Markaby::XHTMLStrict 48: xhtml_html(attrs, &block) 49: end
Builds an html tag. An XML 1.0 instruction and an XHTML 1.0 Transitional doctype are prepended. Also assumes :xmlns => "www.w3.org/1999/xhtml", :lang => "en".
# File lib/markaby/builder_tags.rb, line 40 40: def xhtml_transitional(attrs = {}, &block) 41: self.tagset = Markaby::XHTMLTransitional 42: xhtml_html(attrs, &block) 43: end