- Bring help into the application (#51)
- Dependency updates

Reviewed-on: #53
This commit was merged in pull request #53.
This commit is contained in:
2024-06-29 00:22:43 +00:00
parent fdb8f2ebf1
commit bb79b38738
56 changed files with 1814 additions and 1351 deletions

View File

@@ -5,7 +5,7 @@ open System
open Giraffe
/// Parse a short-GUID-based ID from a string
let idFromShort<'T> (f : Guid -> 'T) strValue =
let idFromShort<'T> (f: Guid -> 'T) strValue =
(ShortGuid.toGuid >> f) strValue
/// Format a GUID as a short GUID
@@ -19,19 +19,19 @@ let emptyGuid = shortGuid Guid.Empty
module String =
/// string.Trim()
let trim (str: string) = str.Trim ()
let trim (str: string) = str.Trim()
/// string.Replace()
let replace (find : string) repl (str : string) = str.Replace (find, repl)
let replace (find: string) repl (str: string) = str.Replace(find, repl)
/// Replace the first occurrence of a string with a second string within a given string
let replaceFirst (needle : string) replacement (haystack : string) =
let replaceFirst (needle: string) replacement (haystack: string) =
match haystack.IndexOf needle with
| -1 -> haystack
| idx -> String.concat "" [ haystack[0..idx - 1]; replacement; haystack[idx + needle.Length..] ]
/// Convert a string to an option, with null, blank, and whitespace becoming None
let noneIfBlank (str : string) =
let noneIfBlank (str: string) =
match str with
| null -> None
| it when it.Trim () = "" -> None
@@ -46,7 +46,7 @@ let stripTags allowedTags input =
let stripHtmlExp = Regex @"(<\/?[^>]+>)"
let mutable output = input
for tag in stripHtmlExp.Matches input do
let htmlTag = tag.Value.ToLower ()
let htmlTag = tag.Value.ToLower()
let shouldReplace =
allowedTags
|> List.fold (fun acc t ->
@@ -100,7 +100,7 @@ let ckEditorToText (text : string) =
"</p>", ""
"<p>", ""
]
|> List.fold (fun (txt : string) (x, y) -> String.replace x y txt) text
|> List.fold (fun (txt: string) (x, y) -> String.replace x y txt) text
|> String.trim