File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed
FSharp.Formatting.ApiDocs Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,11 @@ module String =
108108 let removeSpaces ( lines : string list ) =
109109 let spaces =
110110 lines
111- |> Seq.filter ( String.IsNullOrWhiteSpace >> not )
112- |> Seq.map ( fun line -> line |> Seq.takeWhile Char.IsWhiteSpace |> Seq.length)
111+ |> Seq.choose ( fun line ->
112+ if not <| String.IsNullOrWhiteSpace line then
113+ line |> Seq.takeWhile Char.IsWhiteSpace |> Seq.length |> Some
114+ else
115+ None)
113116 |> fun xs -> if Seq.isEmpty xs then 0 else Seq.min xs
114117
115118 lines
Original file line number Diff line number Diff line change @@ -2264,8 +2264,11 @@ module internal SymbolReader =
22642264 do
22652265 replacedParagraphs
22662266 |> Seq.collect collectParagraphIndirectLinks
2267- |> Seq.filter ( linkNotDefined doc)
2268- |> Seq.map ( getTypeLink ctx)
2267+ |> Seq.choose ( fun line ->
2268+ if linkNotDefined doc line then
2269+ getTypeLink ctx line |> Some
2270+ else
2271+ None)
22692272 |> Seq.iter ( addLinkToType doc)
22702273
22712274 doc.With( paragraphs = replacedParagraphs)
Original file line number Diff line number Diff line change @@ -48,10 +48,15 @@ type FrontMatterFile =
4848 // Allow empty lines in frontmatter
4949 let isBlankLine = String.IsNullOrWhiteSpace line
5050 isBlankLine || line.Contains( " :" ))
51- |> Seq.filter ( String.IsNullOrWhiteSpace >> not )
52- |> Seq.map ( fun line ->
53- let parts = line.Split( " :" )
54- parts.[ 0 ]. ToLowerInvariant(), parts.[ 1 ])
51+ |> Seq.choose ( fun line ->
52+ let parts = line.Split( " :" ) |> Array.toList
53+
54+ if not <| String.IsNullOrWhiteSpace line then
55+ match parts with
56+ | first :: second :: _ -> Some( first.ToLowerInvariant(), second)
57+ | _ -> None
58+ else
59+ None)
5560 |> Map.ofSeq
5661
5762 match
You can’t perform that action at this time.
0 commit comments