From 077636fa622857f63a96f381e60b4dc1b613d650 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 23 Jul 2019 15:53:05 -0700 Subject: [PATCH] Show path for which page has parse error. --- site/gen/Content.elm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/site/gen/Content.elm b/site/gen/Content.elm index fcc5ca89..b79b602c 100644 --- a/site/gen/Content.elm +++ b/site/gen/Content.elm @@ -95,12 +95,15 @@ buildAllData record = Err (renderErrors errors) -renderErrors : List Mark.Error.Error -> Element msg -renderErrors errors = - errors - |> List.map (Mark.Error.toHtml Mark.Error.Light) - |> List.map Element.html - |> Element.column [] +renderErrors : ( List String, List Mark.Error.Error ) -> Element msg +renderErrors ( path, errors ) = + Element.column [] + [ Element.text (path |> String.join "/") + , errors + |> List.map (Mark.Error.toHtml Mark.Error.Light) + |> List.map Element.html + |> Element.column [] + ] combineResults : @@ -117,7 +120,7 @@ combineResults : } ) -> - Result (List Mark.Error.Error) + Result ( List String, List Mark.Error.Error ) (List ( List String , { body : List (Element msg) @@ -135,9 +138,9 @@ combineResults list = Mark.Almost partial -> -- Err "Almost" - Err partial.errors + Err ( path, partial.errors ) Mark.Failure failures -> - Err failures + Err ( path, failures ) ) |> Result.Extra.combine