html :: Link :: defaultinit
# 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