
use json
use fs

+ fn render_path(path: String, data: $T, options: ?RenderOptions (null)) String !FileNotFound {
    let d = json:value(data)
    let content = fs:read(path) ! throw FileNotFound, "File not found: " + path
    let p = Parser{
        path: path
        content: content
        data: d
        options: options
    }
    return p.render()
}

+ fn render(content: String, data: $T, options: ?RenderOptions (null)) String {
    let d = json:value(data)
    let p = Parser{
        content: content
        data: d
        options: options
    }
    return p.render()
}
