<a>
tag.Not really a Bootstrap component but used in other components that it required its own abstraction.
Example:
var lnk = new Link("http://nitlanguage.org", "Nit")
assert lnk.write_to_string == "<a href=\"http://nitlanguage.org\">Nit</a>"
Creates a link with a title attribute:
lnk = new Link("http://nitlanguage.org", "Nit", "Nit homepage")
assert lnk.write_to_string == "<a href=\"http://nitlanguage.org\" title=\"Nit homepage\">Nit</a>"
html :: Link :: defaultinit
html :: BSComponent :: _css_classes
CSS classes to add on this element.template :: Template :: _is_frozen
Is the template allowing more modification (add
)
template :: Template :: _is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: _render_done
Flag to avoid multiple renderingcore :: 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.core :: Object :: defaultinit
html :: Link :: defaultinit
html :: BSComponent :: defaultinit
core :: Writable :: defaultinit
template :: Template :: 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.
template :: Template :: is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: is_writing=
Flag to avoid infinite recursivity if a template contains itselfcore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).html :: BSComponent :: render_css_classes
Renderself
css clases as a class
attribute.
template :: Template :: render_done=
Flag to avoid multiple renderingcore :: 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 `<a>` tag.
#
# Not really a Bootstrap component but used in other components
# that it required its own abstraction.
#
# Example:
# ~~~
# var lnk = new Link("http://nitlanguage.org", "Nit")
# assert lnk.write_to_string == "<a href=\"http://nitlanguage.org\">Nit</a>"
# ~~~
#
# Creates a link with a title attribute:
# ~~~
# lnk = new Link("http://nitlanguage.org", "Nit", "Nit homepage")
# assert lnk.write_to_string == "<a href=\"http://nitlanguage.org\" title=\"Nit homepage\">Nit</a>"
# ~~~
class Link
super BSComponent
autoinit(href, text, title, css_classes)
# URL pointed by this link.
var href: String is writable
# Displayed text.
var text: Writable is writable
# Optional title.
var title: nullable String = null is optional, writable
redef fun rendering do
add "<a{render_css_classes} href=\"{href}\""
var title = self.title
if title != null then add " title=\"{title.html_escape}\""
add ">{text}</a>"
end
end
lib/html/bootstrap.nit:43,1--78,3