From 0c286aa029707ee7816e365bb636369d5962e59c Mon Sep 17 00:00:00 2001 From: Gustavo Guerra Date: Sat, 1 Nov 2014 23:40:48 +0000 Subject: [PATCH] Documentation fixes --- build.cmd | 2 +- build.sh | 2 +- docs/tools/generate.fsx | 2 +- src/Csv/CsvExtensions.fs | 5 ++++- src/Html/HtmlOperations.fs | 8 ++++++++ src/Html/HtmlParser.fs | 3 +++ src/Html/HtmlRuntime.fs | 14 +++++++++++--- src/Json/JsonExtensions.fs | 5 ++++- src/Net/Http.fs | 1 + 9 files changed, 34 insertions(+), 8 deletions(-) diff --git a/build.cmd b/build.cmd index 837deea4a..4f9265e2d 100644 --- a/build.cmd +++ b/build.cmd @@ -4,7 +4,7 @@ if errorlevel 1 ( exit /b %errorlevel% ) -.paket\paket.exe restore -v +.paket\paket.exe restore if errorlevel 1 ( exit /b %errorlevel% ) diff --git a/build.sh b/build.sh index d53282462..238ea5840 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ if [ $exit_code -ne 0 ]; then exit $exit_code fi -mono .paket/paket.exe restore -v +mono .paket/paket.exe restore exit_code=$? if [ $exit_code -ne 0 ]; then exit $exit_code diff --git a/docs/tools/generate.fsx b/docs/tools/generate.fsx index 95cc0b4f2..310a99fb3 100644 --- a/docs/tools/generate.fsx +++ b/docs/tools/generate.fsx @@ -139,5 +139,5 @@ let buildDocumentation () = // Generate copyFiles() +buildReference() buildDocumentation() -buildReference() \ No newline at end of file diff --git a/src/Csv/CsvExtensions.fs b/src/Csv/CsvExtensions.fs index c645eb7c1..1533dad0f 100644 --- a/src/Csv/CsvExtensions.fs +++ b/src/Csv/CsvExtensions.fs @@ -10,6 +10,7 @@ open FSharp.Data open FSharp.Data.Runtime [] +/// Extension methods on strings for conversions to other types type StringExtensions = [] @@ -62,6 +63,8 @@ type StringExtensions = | _ -> failwithf "Not a guid: %s" x [] +/// Provides the dynamic operator for getting column values by name from CSV rows module CsvExtensions = - /// Get column of a CsvRow + + /// Get the value of a column by name from a CSV row let (?) (csvRow:CsvRow) (columnName:string) = csvRow.[columnName] \ No newline at end of file diff --git a/src/Html/HtmlOperations.fs b/src/Html/HtmlOperations.fs index 493ce6c08..e911ab91a 100644 --- a/src/Html/HtmlOperations.fs +++ b/src/Html/HtmlOperations.fs @@ -13,6 +13,7 @@ module private Utils = // -------------------------------------------------------------------------------------- [] +/// Operations on HTML attributes module HtmlAttribute = /// Gets the name of the given attribute @@ -28,6 +29,7 @@ module HtmlAttribute = // -------------------------------------------------------------------------------------- [] +/// Extension methods on HTML attributes type HtmlAttributeExtensions = /// Gets the name of the current attribute @@ -43,6 +45,7 @@ type HtmlAttributeExtensions = // -------------------------------------------------------------------------------------- [] +/// Operations on HTML nodes module HtmlNode = /// Gets the given nodes name @@ -238,6 +241,7 @@ module HtmlNode = // -------------------------------------------------------------------------------------- [] +/// Extension methods on HTML nodes type HtmlNodeExtensions = /// Gets the given nodes name @@ -573,6 +577,7 @@ type HtmlNodeExtensions = // -------------------------------------------------------------------------------------- [] +// Operations on HTML documents module HtmlDocument = /// Returns the doctype of the document @@ -645,6 +650,7 @@ module HtmlDocument = | body:: _ -> Some body [] +/// Extension methods on HTML documents type HtmlDocumentExtensions = /// Returns all of the root elements of the current document @@ -801,7 +807,9 @@ type HtmlDocumentExtensions = // -------------------------------------------------------------------------------------- [] +/// Provides the dynamic operator for getting attribute values from HTML elements module HtmlExtensions = + /// Gets the value of an attribute from an HTML element let (?) (node : HtmlNode) name = HtmlNode.attributeValue name node diff --git a/src/Html/HtmlParser.fs b/src/Html/HtmlParser.fs index 3a1fa84bb..f0c95b29f 100644 --- a/src/Html/HtmlParser.fs +++ b/src/Html/HtmlParser.fs @@ -11,6 +11,7 @@ open FSharp.Data.Runtime // -------------------------------------------------------------------------------------- +/// Represents an HTML attribute. The name is always normalized to lowercase type HtmlAttribute = private | HtmlAttribute of name:string * value:string @@ -24,6 +25,7 @@ type HtmlAttribute = HtmlAttribute(name.ToLowerInvariant(), value) [] +/// Represents an HTML node. The names of elements are always normalized to lowercase type HtmlNode = private | HtmlElement of name:string * attributes:HtmlAttribute list * elements:HtmlNode list @@ -132,6 +134,7 @@ type HtmlNode = member x._Print = x.ToString() [] +/// Represents an HTML document type HtmlDocument = private | HtmlDocument of docType:string * elements:HtmlNode list diff --git a/src/Html/HtmlRuntime.fs b/src/Html/HtmlRuntime.fs index 93018fe56..0ca7bdcb8 100644 --- a/src/Html/HtmlRuntime.fs +++ b/src/Html/HtmlRuntime.fs @@ -15,6 +15,7 @@ open FSharp.Data.Runtime.StructuralTypes // -------------------------------------------------------------------------------------- +/// Representation of an HTML table cell type HtmlTableCell = | Cell of bool * string | Empty @@ -27,6 +28,7 @@ type HtmlTableCell = | Empty -> "" | Cell(_, d) -> d +/// Representation of an HTML table cell type HtmlTable = { Name : string HeaderNamesAndUnits : (string * Type option)[] option // always set at designtime, never at runtime @@ -50,16 +52,19 @@ type HtmlTable = wr.WriteLine() sb.ToString() +/// Representation of an HTML list type HtmlList = { Name : string Values : string[] Html : HtmlNode } +/// Representation of an HTML definition list type HtmlDefinitionList = { Name : string Definitions : HtmlList list Html : HtmlNode } +/// Representation of an HTML table, list, or definition list type HtmlObject = | Table of HtmlTable | List of HtmlList @@ -273,6 +278,7 @@ module HtmlRuntime = @ (doc |> getLists |> List.map List) @ (doc |> getDefinitionLists |> List.map DefinitionList) +/// Underlying representation of the root types generated by HtmlProvider type TypedHtmlDocument internal (doc:HtmlDocument, htmlObjects:Map) = member __.Html = doc @@ -297,6 +303,7 @@ type TypedHtmlDocument internal (doc:HtmlDocument, htmlObjects:Map Map.find id +/// Underlying representation of table types generated by HtmlProvider type HtmlTable<'rowType> internal (name:string, headers:string[] option, values:'rowType[], html:HtmlNode) = member __.Name = name @@ -318,7 +325,8 @@ type HtmlTable<'rowType> internal (name:string, headers:string[] option, values: HtmlTable<_>(table.Name, headers, Array.map rowConverter.Invoke rows, table.Html) | _ -> failwithf "Element %s is not a table" id -type HtmlList<'itemType> internal (name:string, values:'itemType[], html) = +/// Underlying representation of list types generated by HtmlProvider +type HtmlList<'ItemType> internal (name:string, values:'ItemType[], html) = member __.Name = name member __.Values = values @@ -326,14 +334,14 @@ type HtmlList<'itemType> internal (name:string, values:'itemType[], html) = [] [] - static member Create(rowConverter:Func, doc:TypedHtmlDocument, id:string) = + static member Create(rowConverter:Func, doc:TypedHtmlDocument, id:string) = match doc.GetObject id with | List list -> HtmlList<_>(list.Name, Array.map rowConverter.Invoke list.Values, list.Html) | _ -> failwithf "Element %s is not a list" id [] [] - static member CreateNested(rowConverter:Func, doc:TypedHtmlDocument, id:string, index:int) = + static member CreateNested(rowConverter:Func, doc:TypedHtmlDocument, id:string, index:int) = let list = match doc.GetObject id with | List list-> list diff --git a/src/Json/JsonExtensions.fs b/src/Json/JsonExtensions.fs index de30a8a07..75c7ae290 100644 --- a/src/Json/JsonExtensions.fs +++ b/src/Json/JsonExtensions.fs @@ -12,6 +12,7 @@ open FSharp.Data.Runtime open Microsoft.FSharp.Core [] +/// Extension methods on JSON values type JsonExtensions = /// Get a sequence of key-value pairs representing the properties of an object @@ -135,8 +136,10 @@ type JsonExtensions = | None -> JsonExtensions.AsArray(x) |> Array.map (fun e -> JsonExtensions.InnerText(e)) |> String.Concat [] +/// Provides the dynamic operator for getting a property of a JSON object module JsonExtensions = - /// Get property of a JSON object (assuming that the value is an object) + + /// Get a property of a JSON object let (?) (jsonObject:JsonValue) propertyName = jsonObject.GetProperty(propertyName) type JsonValue with diff --git a/src/Net/Http.fs b/src/Net/Http.fs index 193947bce..07fd402a4 100644 --- a/src/Net/Http.fs +++ b/src/Net/Http.fs @@ -274,6 +274,7 @@ module HttpContentTypes = type private HeaderEnum = System.Net.HttpRequestHeader +/// Constants for common HTTP encodings module HttpEncodings = let PostDefaultEncoding = Encoding.GetEncoding("ISO-8859-1") // http://stackoverflow.com/questions/708915/detecting-the-character-encoding-of-an-http-post-request/708942#708942