diff --git a/elm.json b/elm.json index f135688..7443f40 100644 --- a/elm.json +++ b/elm.json @@ -9,12 +9,15 @@ "elm/browser": "1.0.2", "elm/core": "1.0.5", "elm/html": "1.0.0", - "elm/url": "1.0.0" + "elm/url": "1.0.0", + "hecrj/html-parser": "2.4.0" }, "indirect": { "elm/json": "1.1.3", + "elm/parser": "1.1.0", "elm/time": "1.0.0", - "elm/virtual-dom": "1.0.3" + "elm/virtual-dom": "1.0.3", + "rtfeldman/elm-hex": "1.0.0" } }, "test-dependencies": { diff --git a/src/Blog.elm b/src/Blog.elm index a906a90..ebbdf37 100644 --- a/src/Blog.elm +++ b/src/Blog.elm @@ -2,6 +2,8 @@ module Blog exposing (..) import Html exposing (..) import Html.Attributes exposing (class) +import Html.Parser +import Html.Parser.Util @@ -33,15 +35,7 @@ view model = div [ class "foo-interface" ] [ div [ class "max-width mx-auto px3 ltr" ] [ div [ class "content index py4" ] - [ article [ class "post" ] - [ h1 [ class "posttitle" ] [ text model.blog.title ] - , div [ class "meta" ] - [ div [ class "article-tag" ] - [ a [ class "tag-link" ] [ text "tag" ] ] - ] - , div [ class "content" ] [ text model.blog.content ] - ] - ] + (textToHtml testString) ] ] @@ -71,3 +65,80 @@ update msg model = case msg of Nothing -> ( model, Cmd.none ) + + +textToHtml : String -> List (Html.Html msg) +textToHtml text = + case Html.Parser.run text of + Ok nodes -> + Html.Parser.Util.toVirtualDom nodes + + Err _ -> + [] + + +testString : String +testString = + """ + +
+

+ Find me on + + + + + + + + + + + + and + + + +

+
+
+ Writing + +
+ """ diff --git a/src/Main.elm b/src/Main.elm index 337021f..3e027ac 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -147,7 +147,11 @@ update msg model = GotBlogMsg blogMsg -> case model.page of BlogPage blog -> - toBlog model (Blog.update blogMsg blog) + toBlog + { model + | title = blog.blog.title ++ " | " ++ model.title + } + (Blog.update blogMsg blog) _ -> ( model, Cmd.none )