<h1>
to <h6>
tag.Not really a Bootstrap component but used in other components that it required its own abstraction.
Example:
var h1 = new Header(1, "Title")
assert h1.write_to_string == "<h1>Title</h1>"
With subtext:
var h6 = new Header(6, "Title", "with subtext")
assert h6.write_to_string == "<h6>Title<small>with subtext</small></h6>"
html :: Header :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
html :: BSComponent :: css_classes
CSS classes to add on this element.html :: BSComponent :: css_classes=
CSS classes to add on this element.html :: Header :: defaultinit
html :: BSComponent :: defaultinit
core :: Writable :: defaultinit
template :: Template :: defaultinit
core :: Object :: defaultinit
template :: Template :: is_frozen=
Is the template allowing more modification (add
)
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).html :: BSComponent :: render_css_classes
Renderself
css clases as a class
attribute.
core :: Writable :: write_to_bytes
Likewrite_to
but return a new Bytes (may be quite large)
core :: Writable :: write_to_file
Likewrite_to
but take care of creating the file
core :: Writable :: write_to_string
Likewrite_to
but return a new String (may be quite large).
# A `<h1>` to `<h6>` tag.
#
# Not really a Bootstrap component but used in other components
# that it required its own abstraction.
#
# Example:
# ~~~
# var h1 = new Header(1, "Title")
# assert h1.write_to_string == "<h1>Title</h1>"
# ~~~
#
# With subtext:
# ~~~
# var h6 = new Header(6, "Title", "with subtext")
# assert h6.write_to_string == "<h6>Title<small>with subtext</small></h6>"
# ~~~
class Header
super BSComponent
autoinit(level, text, subtext, id, css_classes)
# Header level between 1 and 6.
var level: Int
# Displayed text.
var text: Writable
# Optional subtext.
var subtext: nullable Writable = null is optional, writable
# Optional id.
var id: nullable String = null is optional, writable
redef fun rendering do
add "<h{level}{render_css_classes}>{text.write_to_string}"
var subtext = self.subtext
if subtext != null then add "<small>{subtext.write_to_string}</small>"
add "</h{level}>"
end
end
lib/html/bootstrap.nit:80,1--118,3