Class: Cheri::Html::HtmlElem

Inherits:
Elem
  • Object
show all
Defined in:
lib/cheri/builder/html/element.rb

Overview

TODO: special handling for these:

Constant Summary collapse

LOOSE1 =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"
LOOSE2 =
"        \"http://www.w3.org/TR/html4/loose.dtd\">\n"
STRICT1 =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
STRICT2 =
"        \"http://www.w3.org/TR/html4/strict.dtd\">\n"
Markup =
Cheri::Builder::Markup

Instance Method Summary collapse

Methods inherited from Elem

#indent, #initialize, #margin, #mod

Methods included from HtmlBuilder

#esc

Constructor Details

This class inherits a constructor from Cheri::Html::Elem

Instance Method Details

#to_io(ios) ⇒ Object



217
218
219
220
221
222
223
224
225
226
# File 'lib/cheri/builder/html/element.rb', line 217

def to_io(ios)
  if @opt[:doctype]
    strict = @opt[:strict]
    ios << Markup.sp(margin) if @fmt
    ios << (strict ? STRICT1 : LOOSE1)
    ios << Markup.sp(margin) if @fmt
    ios << (strict ? STRICT2 : LOOSE2)
  end
  super(ios)
end

#to_s(str = '') ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
# File 'lib/cheri/builder/html/element.rb', line 205

def to_s(str='')
  return to_io(str) unless String === str
  if @opt[:doctype]
    strict = @opt[:strict]
    str << Markup.sp(margin) if @fmt
    str << (strict ? STRICT1 : LOOSE1)
    str << Markup.sp(margin) if @fmt
    str << (strict ? STRICT2 : LOOSE2)
  end
  super(str)
end