September 22, 2017
- Fixed an extension that was adding a
description
property to all types that conformed toRenderable
, instead of just totag
, that was causing duplication in standard types likeString
andInt
thank you @briancprice for #28
January 21st, 2017
- Custom tags now, by default, render their tags with HTML-appropriate hyphenation if given a camel case name.
public class myNewTag: tag {}
myNewTag().render()
// <my-new-tag/>
thank you @stupergenius for #23
November 9th, 2016
- Creating a custom tag is easier. The
name
andisSelfClosing
attributes oftag
have been changed to computed properties. By default,name
takes the name of the subclass andisSelfClosing
returns false. To override either, like we do to create theimg
tag, is simple:
public class img : tag {
override public var isSelfClosing: Bool {
return true
}
}
thank you @Evertt for #6
- Initializing a tag with both attributes and children is easier. The order of attributes and children has been flipped so that you can set the attributes first and then set the children off the end of the initializer. Initializing a tag with both attributes and children now looks like:
p(["class": "greeting"]) { "Well hello there..." }
thank you @Evertt for #10
- Anything that is
Renderable
now also conforms toCustomStringConvertible
so you can print and usetag
subclasses and your ownRenderable
types in String outputs and see them rendered automatically.
- The
Renderable
protocol's method for rendering formatted, indented HTML has a new signature takes an integer value that lets you specify the number of spaces to use when indenting.
func render(startingWithSpaces: Int, indentingWithSpaces: Int) -> String
- A new class called
doctype
that can be used to render the most common HTML doctypes. To render a doctype:
doctype(.html5).render()
// used in context
let document: Renderable = [
doctype(.html5),
html {[
head {
title { "Hello there" }
},
body { "blabla" }
]}
]
thank you @Evertt for #16
October 31st, 2016
attributes
being optional, even though it was being initialized to an empty dictionary. It is now guaranteed to be there and still initialized empty. thank you @Evertt for #7
- code around rendering
children
intag
to use the nil-coalescing operator. thank you @Evertt for #7