Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Releases: sahandnayebaziz/Hypertext

2.1.1

22 Sep 21:24
Compare
Choose a tag to compare

September 22nd, 2017

Fixed

  • Fixed an extension that was adding a description property to all types that conformed to Renderable, instead of just to tag, that was causing duplication in standard types like String and Int

thank you @briancprice for #28

2.1.0

21 Jan 23:39
Compare
Choose a tag to compare

January 21st, 2017

Added

  • 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

2.0.0

09 Nov 18:21
Compare
Choose a tag to compare

November 9th, 2016

Improved

  • Creating a custom tag is easier. The name and isSelfClosing attributes of tag have been changed to computed properties. By default, name takes the name of the subclass and isSelfClosing returns false. To override either, like we do to create the img 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 to CustomStringConvertible so you can print and use tag subclasses and your own Renderable types in String outputs and see them rendered automatically.

thank you @Evertt for #9/#17

  • 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

thank you @Evertt for #9/#18

Added

  • 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

1.0.1

31 Oct 12:32
Compare
Choose a tag to compare

October 31st, 2016

Fixed

  • 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

Updated

  • code around rendering children in tag to use the nil-coalescing operator. thank you @Evertt for #7