DotLiquid Module

A module for rendering DotLiquid template with Suave

Functions and values

Function or value Description

ModelKey

Full Usage: ModelKey

Returns: string

The model you pass to your liquid templates will be available under this key.

Returns: string

page fileName model ctx

Full Usage: page fileName model ctx

Parameters:
Returns: Async<HttpContext option>
 Render a page using DotLiquid template. Takes a path (relative to the directory specified
 using `setTemplatesDir` and a value that is exposed as the "model" variable. You can use
 any F# record type, seq<_>, list<_>, and array<_>  and option without having to explicitly 
 register the fields.

     type Page = { Total : int }
     let app = page "index.html" { Total = 42 }
fileName : string
model : 'a
ctx : HttpContext
Returns: Async<HttpContext option>

registerFiltersByName name

Full Usage: registerFiltersByName name

Parameters:
    name : string

 Register functions from a module as filters available in DotLiquid templates.
 For example, the following snippet lets you write `{{ model.Total | nice_num }}`:

     module MyFilters =
       let niceNum i = if i > 10 then "lot" else "not much"

     do registerFiltersByName "MyFilters"
name : string

registerFiltersByType typ

Full Usage: registerFiltersByType typ

Parameters:

Similar to `registerFiltersByName`, but the module is speicfied by its `System.Type` (This is more cumbersome, but safer alternative.)

typ : Type

renderPageFile fileFullPath model

Full Usage: renderPageFile fileFullPath model

Parameters:
    fileFullPath : string
    model : 'm

Returns: Async<string>

Renders the liquid template given a full path.

fileFullPath : string
model : 'm
Returns: Async<string>

renderPageString template model

Full Usage: renderPageString template model

Parameters:
    template : string
    model : 'm

Returns: Async<string>

Renders the liquid template given.

template : string
model : 'm
Returns: Async<string>

setCSharpNamingConvention arg1

Full Usage: setCSharpNamingConvention arg1

Parameters:
    arg0 : 'a

Sets the DotLiquid naming convetion to the CSharp style, will preserve camelCase and should preserve whatever case convention you use

arg0 : 'a

setRubyNamingConvention arg1

Full Usage: setRubyNamingConvention arg1

Parameters:
    arg0 : 'a

Sets the DotLiquid naming convention to the Ruby style. F# values in camelCase will be converted to not_camel_case in templates. This is the default

arg0 : 'a

setTemplatesDir dir

Full Usage: setTemplatesDir dir

Parameters:
    dir : string

 Set the root directory where DotLiquid is looking for templates. For example, you can
 write something like this:

     DotLiquid.setTemplatesDir (__SOURCE_DIRECTORY__ + "/templates")

 The current directory is a global variable and so it should not change
 between multiple HTTP requests. This is a DotLiquid limitation.
dir : string