diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0a65c6f..44055e7 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 1.1.0 - January 17 2017 +* Output now keeps original case (XAML support) + ### 1.0.0 - January 10 2017 * Public release diff --git a/src/Fue/AssemblyInfo.fs b/src/Fue/AssemblyInfo.fs index 5d21c0d..85efdf9 100644 --- a/src/Fue/AssemblyInfo.fs +++ b/src/Fue/AssemblyInfo.fs @@ -5,13 +5,13 @@ open System.Reflection [] [] [] -[] -[] +[] +[] do () module internal AssemblyVersionInformation = let [] AssemblyTitle = "Fue" let [] AssemblyProduct = "Fue" let [] AssemblyDescription = "F# templating library with simple syntax designed for smooth work with F# types" - let [] AssemblyVersion = "1.0.0" - let [] AssemblyFileVersion = "1.0.0" + let [] AssemblyVersion = "1.1.0" + let [] AssemblyFileVersion = "1.1.0" diff --git a/src/Fue/Compiler.fs b/src/Fue/Compiler.fs index cf5ce0f..7439bbd 100644 --- a/src/Fue/Compiler.fs +++ b/src/Fue/Compiler.fs @@ -7,7 +7,7 @@ open HtmlAgilityPack open Extensions let private asDocument elms = - let doc = HtmlDocument() + let doc = HtmlDocument.Create() elms |> List.iter (doc.DocumentNode.AppendChild >> ignore) match doc.DocumentNode.ChildNodes.Count with | 0 -> "" diff --git a/src/Fue/Extensions.fs b/src/Fue/Extensions.fs index 188a5ad..b37c181 100644 --- a/src/Fue/Extensions.fs +++ b/src/Fue/Extensions.fs @@ -6,8 +6,13 @@ type HtmlNode with member this.TryGetAttribute attr = this.Attributes |> Seq.filter (fun x -> x.Name = attr) |> Seq.tryHead type HtmlDocument with - static member ParseNode html = + static member Create() = let doc = new HtmlDocument() + doc.OptionOutputOriginalCase <- true + doc + + static member ParseNode html = + let doc = HtmlDocument.Create() // fix for http://stackoverflow.com/questions/293342/htmlagilitypack-drops-option-end-tags HtmlNode.ElementsFlags.Remove("option") |> ignore doc.LoadHtml(html) diff --git a/src/Fue/NodeCompiler.fs b/src/Fue/NodeCompiler.fs index 5df438f..8e0adfd 100644 --- a/src/Fue/NodeCompiler.fs +++ b/src/Fue/NodeCompiler.fs @@ -38,7 +38,7 @@ let private compileAttributes data attrs = let private prepareAttributes data cleanFunc = Seq.filter cleanFunc >> compileAttributes data let private newElements name children attributes = - let node = HtmlDocument().CreateElement(name) + let node = HtmlDocument.Create().CreateElement(name) attributes |> Seq.iter (fun (name, value) -> node.SetAttributeValue(name, value) |> ignore) children |> List.iter (fun x -> if x <> null then node.AppendChild(x) |> ignore else ()) node |> asResults @@ -57,9 +57,9 @@ let private compileNode compileFun (source:HtmlNode) data attributesFilter = let elms = source.ChildNodes |> Seq.toList |> List.map (compileFun data) |> Rop.fold match source.Name with | "fs-template" -> elms - | name -> + | _ -> let attrs = source.Attributes |> prepareAttributes data attributesFilter - Rop.bind2 (newElements name) elms attrs + Rop.bind2 (newElements source.OriginalName) elms attrs let private compileIf compileFun (source:HtmlNode) data boolValue = boolValue |> ValueCompiler.compile data diff --git a/tests/Fue.Tests/Compiler.fs b/tests/Fue.Tests/Compiler.fs index bdf23a6..0566d66 100644 --- a/tests/Fue.Tests/Compiler.fs +++ b/tests/Fue.Tests/Compiler.fs @@ -395,4 +395,12 @@ let ``Compiles for with option tag`` () = init |> add "values" values |> fromText """""" - |> should equal """""" \ No newline at end of file + |> should equal """""" + +[] +let ``Keeps case sensitivity``() = + let html = """{{{value}}}""" + init + |> add "value" "It works!" + |> fromText html + |> should equal "It works!" \ No newline at end of file