Module: Malline::XHTML::Tags

Defined in:
lib/malline/view_xhtml.rb

Instance Method Summary collapse

Instance Method Details

#head(*args, &block) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/malline/view_xhtml.rb', line 56

def head *args, &block
	@__xhtml_title = false
	proxy = tag! 'head', *args, &block
	proxy.__yld { title } unless @__xhtml_title
	proxy.__yld do
		meta :content => "text/html; charset=#{malline.options[:encoding] || 'UTF-8'}", 'http-equiv' => 'Content-Type'
	end unless @__xhtml_meta
end

#meta(*args, &block) ⇒ Object



51
52
53
54
# File 'lib/malline/view_xhtml.rb', line 51

def meta *args, &block
	@__xhtml_meta = true
	tag! 'meta', *args, &block
end

#title(*args, &block) ⇒ Object



46
47
48
49
# File 'lib/malline/view_xhtml.rb', line 46

def title *args, &block
	@__xhtml_title = true
	tag! 'title', *args, &block
end

#xhtml(*args, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/malline/view_xhtml.rb', line 35

def xhtml *args, &block
	attrs = { :xmlns => 'http://www.w3.org/1999/xhtml', 'xml:lang' => malline.options[:lang] }
	attrs.merge!(args.pop) if args.last.is_a?(Hash)

	self << "<?xml version=\"1.0\" encoding=\"#{malline.options[:encoding] || 'UTF-8'}\"?>\n"
	self << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 #{malline.options[:xhtml_dtd] || 'Transitional'}//EN\"\n"
	self << "  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-#{(malline.options[:xhtml_dtd] || 'Transitional').downcase}.dtd\">\n"

	tag! 'html', args.join(''), attrs, &block
end