Module: Malline::XHTML::Tags

Defined in:
lib/malline/plugins/xhtml.rb

Instance Method Summary collapse

Instance Method Details

#head(*args, &block) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/malline/plugins/xhtml.rb', line 62

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



57
58
59
60
# File 'lib/malline/plugins/xhtml.rb', line 57

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

#title(*args, &block) ⇒ Object



52
53
54
55
# File 'lib/malline/plugins/xhtml.rb', line 52

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

#xhtml(*args, &block) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/malline/plugins/xhtml.rb', line 41

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