WIP on DotLiquid support

This commit is contained in:
2022-04-16 23:06:38 -04:00
parent 62f7896621
commit 98eb2b1785
78 changed files with 451 additions and 45 deletions

View File

@@ -248,7 +248,7 @@ module WebLog =
subtitle = None
defaultPage = ""
postsPerPage = 10
themePath = "Default"
themePath = "default"
urlBase = ""
timeZone = ""
}

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<Compile Include="SupportTypes.fs" />
<Compile Include="DataTypes.fs" />
<Compile Include="ViewModels.fs" />
</ItemGroup>
</Project>

View File

@@ -9,7 +9,7 @@ module private Helpers =
/// Create a new ID (short GUID)
// https://www.madskristensen.net/blog/A-shorter-and-URL-friendly-GUID
let newId() =
Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Replace('/', '_').Replace('+', '-')[..22]
Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Replace('/', '_').Replace('+', '-').Substring (0, 22)
/// An identifier for a category

View File

@@ -0,0 +1,32 @@
namespace MyWebLog.ViewModels
open MyWebLog
/// Base model class for myWebLog views
type MyWebLogModel (webLog : WebLog) =
/// The details for the web log
member val WebLog = webLog with get
/// The model to use to allow a user to log on
[<CLIMutable>]
type LogOnModel =
{ /// The user's e-mail address
emailAddress : string
/// The user's password
password : string
}
/// The model used to render a single page
type SinglePageModel =
{ /// The page to be rendered
page : Page
/// The web log to which the page belongs
webLog : WebLog
}
/// Is this the home page?
member this.isHome with get () = PageId.toString this.page.id = this.webLog.defaultPage