Skip to content

Commit

Permalink
tags plugin: Fix inline tags regression
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 1, 2021
1 parent 224e0d4 commit 4687371
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neuron/neuron.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.4
name: neuron
-- This version must be in sync with what's in Default.dhall
version: 1.9.7.1
version: 1.9.8.0
license: AGPL-3.0-only
copyright: 2020 Sridhar Ratnakumar
maintainer: [email protected]
Expand Down
15 changes: 10 additions & 5 deletions neuron/src/lib/Neuron/Plugin/Plugins/Tags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Neuron.Zettelkasten.Graph.Type (ZettelGraph)
import Neuron.Zettelkasten.Zettel
import Reflex.Dom.Core hiding (count, mapMaybe, tag)
import Reflex.Dom.Pandoc (PandocBuilder)
import Relude hiding (trace, traceShow, traceShowId)
import Relude
import Text.Pandoc.Definition (Inline, Pandoc)
import qualified Text.Pandoc.Util as Pandoc
import qualified Text.Parsec as P
Expand Down Expand Up @@ -239,8 +239,9 @@ renderQueryResult = \case
renderTagTree $ TagTree.foldTagTree $ TagTree.tagTree res
TagQuery_TagZettel tag :=> Identity () ->
renderInlineTag tag mempty $ do
text "#"
text $ unTag tag
elClass "code" "inline-tag" $ do
text "#"
text $ unTag tag
where
-- TODO: Instead of doing this here, group the results in runQuery itself.
groupZettelsByTagsMatching pats matches =
Expand Down Expand Up @@ -320,10 +321,14 @@ parseTagQuerys myaml z =
catMaybes $
allUrls <&> \(attrs, url) -> do
parseQueryLink attrs url
tags = fromRight Set.empty $ case myaml of
tagsFromYaml = fromRight Set.empty $ case myaml of
Nothing -> pure Set.empty
Just yaml -> Set.fromList <$> M.runYamlParser (tagsParser yaml)
tagsData = ZettelTags tags tagLinks
inlineTags = Set.fromList $
flip fmapMaybe tagLinks $ \case
Some (TagQuery_TagZettel t) -> Just t
_ -> Nothing
tagsData = ZettelTags (tagsFromYaml <> inlineTags) tagLinks
in z {zettelPluginData = DMap.insert Tags (Identity tagsData) (zettelPluginData z)}

tagsParser :: Y.Node Y.Pos -> Y.Parser [Tag]
Expand Down

0 comments on commit 4687371

Please sign in to comment.