Skip to content

Commit

Permalink
Display the zettel tags: #69
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Apr 7, 2020
2 parents 7c61fe0 + 7779455 commit 078b2d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Neuron/Zettelkasten/View.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Neuron.Zettelkasten.Link (linkActionExt)
import Neuron.Zettelkasten.Link.Action (LinkTheme (..))
import Neuron.Zettelkasten.Link.View (renderZettelLink)
import Neuron.Zettelkasten.Markdown (neuronMMarkExts)
import Neuron.Zettelkasten.Meta
import Neuron.Zettelkasten.Route
import Neuron.Zettelkasten.Store
import Neuron.Zettelkasten.Type
Expand Down Expand Up @@ -91,9 +92,11 @@ renderIndex (store, graph) = do
renderZettel :: forall m. Monad m => Config -> (ZettelStore, ZettelGraph) -> ZettelID -> HtmlT m ()
renderZettel config@Config {..} (store, graph) zid = do
let Zettel {..} = lookupStore zid store
zettelTags = getMeta zettelContent >>= tags
div_ [class_ "zettel-view"] $ do
div_ [class_ "ui raised segment"] $ do
h1_ [class_ "header"] $ toHtml zettelTitle
renderTags `mapM_` zettelTags
let mmarkExts = neuronMMarkExts config
MMark.render $ useExtensions (linkActionExt store : mmarkExts) zettelContent
div_ [class_ "ui inverted teal top attached connections segment"] $ do
Expand Down Expand Up @@ -125,6 +128,13 @@ renderZettel config@Config {..} (store, graph) zid = do
" "
code_ $ toHtml @Text neuronVersionFull

renderTags :: Monad m => [Text] -> HtmlT m ()
renderTags tags = do
div_ [class_ "ui tiny labels"] $ do
forM_ tags $ \tag -> do
div_ [class_ "ui lightgrey label"] $ toHtml @Text tag
div_ [class_ "ui divider"] $ mempty

-- | Font awesome element
fa :: Monad m => Text -> HtmlT m ()
fa k = with i_ [class_ k] mempty
Expand Down

0 comments on commit 078b2d2

Please sign in to comment.