Merge: lib/github: introduces Github hook events
[nit.git] / lib / html / html.nit
index f58bdf6..8d2de2b 100644 (file)
@@ -84,10 +84,13 @@ class HTMLPage
        end
 end
 
+# An HTML element.
 class HTMLTag
        super Streamable
 
-       # HTML tagname: 'div' for <div></div>
+       # HTML element type.
+       #
+       # `"div"` for `<div></div>`.
        var tag: String
        init do
                self.is_void = (once ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]).has(tag)
@@ -99,6 +102,7 @@ class HTMLTag
        #     assert (new HTMLTag("p")).is_void      == false
        var is_void: Bool is noinit
 
+       # Create a HTML elements with the specifed type and attributes.
        init with_attrs(tag: String, attrs: Map[String, String]) do
                self.tag = tag
                self.attrs = attrs
@@ -119,7 +123,7 @@ class HTMLTag
        # Set a 'value' for 'key'
        #     var img = new HTMLTag("img")
        #     img.attr("src", "./image.png").attr("alt", "image")
-       #     assert img.write_to_string      == """<img src="./image.png" alt="image"/>"""
+       #     assert img.write_to_string      == """<img src=".&#47;image.png" alt="image"/>"""
        fun attr(key: String, value: String): HTMLTag do
                attrs[key] = value
                return self
@@ -325,6 +329,6 @@ end
 private class HTMLRaw
        super HTMLTag
 
-       private var content: String
+       var content: String
        redef fun render_in(res) do res.add content
 end