Merge: lib/github: introduces Github hook events
[nit.git] / src / doc / doc_templates.nit
index 7624626..cbb625e 100644 (file)
@@ -23,7 +23,7 @@ import json::static
 class TplPage
        super Template
 
-       # Page title in HTML header
+       # The unescaped page title to put in the HTML header.
        var title: String is writable, noinit
 
        # Page url
@@ -70,7 +70,7 @@ class TplPage
                addn " <link rel='stylesheet' href='{css}/Nitdoc.QuickSearch.css'/>"
                addn " <link rel='stylesheet' href='{css}/Nitdoc.ModalBox.css'/>"
                addn " <link rel='stylesheet' href='{css}/Nitdoc.GitHub.css'/>"
-               addn " <title>{title}</title>"
+               addn " <title>{title.html_escape}</title>"
                addn "</head>"
                add "<body"
                for attr in body_attrs do add attr
@@ -567,8 +567,6 @@ class TplClassDefinition
        var intros = new Array[TplListElt]
        var redefs = new Array[TplListElt]
 
-       init do end
-
        redef fun rendering do
                addn "<div class='definition'>"
                render_comment
@@ -652,10 +650,10 @@ class TplLink
        # Link href
        var href: String is writable
 
-       # Text to display in the link
+       # The raw HTML content to display in the link
        var text: Streamable is writable
 
-       # Optional title
+       # The unescaped optional title.
        var title: nullable String = null is writable
 
        init with_title(href, text, title: String) do
@@ -665,11 +663,11 @@ class TplLink
 
        redef fun rendering do
                add "<a href=\""
-               add href
+               add href.html_escape
                add "\""
                if title != null then
                        add " title=\""
-                       add title.as(not null)
+                       add title.as(not null).html_escape
                        add "\""
                end
                add ">"
@@ -692,8 +690,6 @@ class TplList
        # Add content wrapped in a <li> element
        fun add_li(item: TplListItem) do elts.add item
 
-       init do end
-
        init with_classes(classes: Array[String]) do self.css_classes = classes
 
        fun is_empty: Bool do return elts.is_empty
@@ -721,8 +717,6 @@ class TplListItem
        # CSS classes of the <li> element
        var css_classes = new Array[String]
 
-       init do end
-
        init with_content(content: Streamable) do append(content)
 
        init with_classes(content: Streamable, classes: Array[String]) do