Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
super Template
# CSS classes to add on this element.
super Template
# CSS classes to add on this element.
- var css_classes = new Array[String]
+ var css_classes = new Array[String] is optional
# Render `self` css clases as a `class` attribute.
fun render_css_classes: String do
# Render `self` css clases as a `class` attribute.
fun render_css_classes: String do
#
# Creates a link with a title attribute:
# ~~~
#
# Creates a link with a title attribute:
# ~~~
-# lnk = new Link.with_title("http://nitlanguage.org", "Nit", "Nit homepage")
+# 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
# 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
# URL pointed by this link.
var href: String is writable
var text: Writable is writable
# Optional title.
var text: Writable is writable
# Optional title.
- var title: nullable String is noinit, writable
-
- # Creates a link with a `title` attribute.
- init with_title(href: String, text: Writable, title: nullable String) do
- init(href, text)
- self.title = title
- end
+ var title: nullable String = null is optional, writable
redef fun rendering do
add "<a{render_css_classes} href=\"{href}\""
redef fun rendering do
add "<a{render_css_classes} href=\"{href}\""
-# var h6 = new Header.with_subtext(6, "Title", "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
# 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
# Header level between 1 and 6.
var level: Int
var text: Writable
# Optional subtext.
var text: Writable
# Optional subtext.
- var subtext: nullable Writable is noinit, writable
+ var subtext: nullable Writable = null is optional, writable
- # Creates a link with a `title` attribute.
- init with_subtext(level: Int, text: Writable, subtext: String) do
- init(level, text)
- self.subtext = subtext
- end
+ # Optional id.
+ var id: nullable String = null is optional, writable
redef fun rendering do
add "<h{level}{render_css_classes}>{text.write_to_string}"
redef fun rendering do
add "<h{level}{render_css_classes}>{text.write_to_string}"
# Used to factorize behavior between OrderedList and UnorderedList.
abstract class HTMLList
super BSComponent
# Used to factorize behavior between OrderedList and UnorderedList.
abstract class HTMLList
super BSComponent
+ autoinit(items, css_classes)
# A list contains `<li>` tags as children.
#
# See ListItem.
# A list contains `<li>` tags as children.
#
# See ListItem.
- var items = new Array[ListItem]
+ var items = new Array[ListItem] is optional
# Adds a new ListItem to `self`.
fun add_li(item: ListItem) do items.add item
# Adds a new ListItem to `self`.
fun add_li(item: ListItem) do items.add item
# A `<li>` tag.
class ListItem
super BSComponent
# A `<li>` tag.
class ListItem
super BSComponent
+ autoinit(text, css_classes)
# Content to display in this list item.
var text: Writable is writable
# Content to display in this list item.
var text: Writable is writable
# ~~~
class BSIcon
super BSComponent
# ~~~
class BSIcon
super BSComponent
+ autoinit(icon, css_classes)
# Glyphicon name to display.
#
# Glyphicon name to display.
#
# ~~~
class BSLabel
super BSComponent
# ~~~
class BSLabel
super BSComponent
+ autoinit(color, text, css_classes)
# Class used to change the color of the label.
#
# Class used to change the color of the label.
#
# ~~~
class BSBadge
super BSComponent
# ~~~
class BSBadge
super BSComponent
+ autoinit(text, css_classes)
# Text to display in the label.
var text: Writable
# Text to display in the label.
var text: Writable
# ~~~
class BSPageHeader
super BSComponent
# ~~~
class BSPageHeader
super BSComponent
+ autoinit(text, css_classes)
# Text to display as title.
var text: Writable
# Text to display as title.
var text: Writable
# ~~~
class BSAlert
super BSComponent
# ~~~
class BSAlert
super BSComponent
+ autoinit(color, text, is_dismissible, css_classes)
# Class used to change the color of the alert.
#
# Class used to change the color of the alert.
#
# See http://getbootstrap.com/components/#alerts-dismissible
#
# Default is `false`.
# See http://getbootstrap.com/components/#alerts-dismissible
#
# Default is `false`.
- var is_dismissible = false
+ var is_dismissible = false is optional, writable
init do css_classes.add "alert alert-{color}"
init do css_classes.add "alert alert-{color}"
-# var p = new BSPanel("default", "Panel content")
+# var p = new BSPanel("default", body = "Panel content")
#
# assert p.write_to_string == """
# <div class="panel panel-default">
#
# assert p.write_to_string == """
# <div class="panel panel-default">
# Panel with heading:
#
# ~~~
# Panel with heading:
#
# ~~~
-# p = new BSPanel("danger", "Panel content")
-# p.heading = "Panel heading"
+# p = new BSPanel("danger", heading = "Panel heading", body = "Panel content")
#
# assert p.write_to_string == """
# <div class="panel panel-danger">
#
# assert p.write_to_string == """
# <div class="panel panel-danger">
# ~~~
class BSPanel
super BSComponent
# ~~~
class BSPanel
super BSComponent
+ autoinit(color, heading, body, footer, css_classes)
# Panel color.
#
# Can be one of `default`, `primary`, `success`, `info`, `warning` or `danger`.
# Panel color.
#
# Can be one of `default`, `primary`, `success`, `info`, `warning` or `danger`.
+ var color: String is writable
- var heading: nullable Writable is noinit, writable
+ var heading: nullable Writable = null is optional, writable
# Body to display in the panel.
# Body to display in the panel.
+ var body: nullable Writable = null is optional, writable
- var footer: nullable Writable is noinit, writable
+ var footer: nullable Writable = null is optional, writable
init do css_classes.add "panel panel-{color}"
init do css_classes.add "panel panel-{color}"
addn heading.write_to_string
addn "</div>"
end
addn heading.write_to_string
addn "</div>"
end
- addn "<div class=\"panel-body\">"
- addn body.write_to_string
- addn "</div>"
+ var body = self.body
+ if body != null then
+ addn "<div class=\"panel-body\">"
+ addn body.write_to_string
+ addn "</div>"
+ end
var footer = self.footer
if footer != null then
addn "<div class=\"panel-footer\">"
var footer = self.footer
if footer != null then
addn "<div class=\"panel-footer\">"
# A component that display tabbed data.
class DocTabs
super BSComponent
# A component that display tabbed data.
class DocTabs
super BSComponent
+ autoinit(html_id, drop_text, css_classes)
# HTML id of this component.
var html_id: String
# HTML id of this component.
var html_id: String
# A list of tab regrouped in a dropdown
class DocTabsDrop
super UnorderedList
# A list of tab regrouped in a dropdown
class DocTabsDrop
super UnorderedList
+ autoinit(html_id, html_title, items, css_classes)
# HTML id used by the tabs group.
var html_id: String
# HTML id used by the tabs group.
var html_id: String
# A panel that goes in a DocTabs.
class DocTabPanel
super BSComponent
# A panel that goes in a DocTabs.
class DocTabPanel
super BSComponent
+ autoinit(html_id, tab_title, html_content, is_active, css_classes)
# HTML id of this panel.
var html_id: String
# HTML id of this panel.
var html_id: String
var html_content: Writable is writable
# Is this panel visible by default?
var html_content: Writable is writable
# Is this panel visible by default?
+ var is_active = false is optional
redef fun rendering do
var active = ""
redef fun rendering do
var active = ""
# A ListItem that goes in a DocTabsDrop.
private class DocTabItem
super ListItem
# A ListItem that goes in a DocTabsDrop.
private class DocTabItem
super ListItem
+ autoinit(text, target_id, css_classes)
# Panel id to trigger when the link is clicked.
var target_id: String
# Panel id to trigger when the link is clicked.
var target_id: String
redef class MParameterType
redef fun html_link do
redef class MParameterType
redef fun html_link do
- return new Link.with_title("{mclass.nitdoc_url}#FT_{name.to_cmangle}", name, "formal type")
+ return new Link("{mclass.nitdoc_url}#FT_{name.to_cmangle}", name, "formal type")
private fun html_concern_item: ListItem do
var lnk = html_link
var tpl = new Template
private fun html_concern_item: ListItem do
var lnk = html_link
var tpl = new Template
- tpl.add new Link.with_title("#{nitdoc_id}.concern", lnk.text, lnk.title)
+ tpl.add new Link("#{nitdoc_id}.concern", lnk.text, lnk.title)
var comment = html_synopsis
if comment != null then
tpl.add ": "
var comment = html_synopsis
if comment != null then
tpl.add ": "
redef class DocSection
super BSComponent
redef class DocSection
super BSComponent
+ redef fun css_classes do return new Array[String]
+
redef fun rendering do
if is_hidden then
addn "<a id=\"{html_id}\"></a>"
redef fun rendering do
if is_hidden then
addn "<a id=\"{html_id}\"></a>"
redef class DocArticle
super BSComponent
redef class DocArticle
super BSComponent
+ redef fun css_classes do return new Array[String]
+
redef fun rendering do
if is_hidden then return
addn "<article{render_css_classes} id=\"{html_id}\">"
redef fun rendering do
if is_hidden then return
addn "<article{render_css_classes} id=\"{html_id}\">"
redef fun html_short_signature do
var lnk = html_link
var tpl = new Template
redef fun html_short_signature do
var lnk = html_link
var tpl = new Template
- tpl.add new Link.with_title(lnk.href, mclass.name.html_escape, lnk.title)
+ tpl.add new Link(lnk.href, mclass.name.html_escape, lnk.title)
tpl.add "["
for i in [0..arguments.length[ do
tpl.add arguments[i].html_short_signature
tpl.add "["
for i in [0..arguments.length[ do
tpl.add arguments[i].html_short_signature
redef fun html_signature do
var lnk = html_link
var tpl = new Template
redef fun html_signature do
var lnk = html_link
var tpl = new Template
- tpl.add new Link.with_title(lnk.href, mclass.name.html_escape, lnk.title)
+ tpl.add new Link(lnk.href, mclass.name.html_escape, lnk.title)
tpl.add "["
for i in [0..arguments.length[ do
tpl.add arguments[i].html_signature
tpl.add "["
for i in [0..arguments.length[ do
tpl.add arguments[i].html_signature