Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use superscript on folgezettel links to denote connection #346

Merged
merged 2 commits into from
Aug 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions neuron/src/lib/Neuron/Web/Query/View.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ renderZettelLink conn (fromMaybe def -> linkView) Zettel {..} = do
classes :: [Text] = catMaybes $ [Just "zettel-link-container"] <> [connClass, rawClass]
elClass "span" (T.intercalate " " classes) $ do
forM_ mextra $ \extra ->
elAttr "span" ("class" =: "extra monoFont" <> noSnippet) $ do
elNoSnippetSpan ("class" =: "extra monoFont") $ do
extra
-- The extra space is so that double clicking on this extra text
-- doesn't select the title next.
Expand All @@ -121,11 +121,15 @@ renderZettelLink conn (fromMaybe def -> linkView) Zettel {..} = do
else Just $ "Tags: " <> T.intercalate "; " (unTag <$> zettelTags)
elAttr "span" ("class" =: "zettel-link" <> withTooltip linkTooltip) $ do
neuronRouteLink (Some $ Route_Zettel zettelID) mempty $ text zettelTitle
case conn of
Just Folgezettel -> elNoSnippetSpan mempty $ do
elAttr "sup" ("title" =: "Branching link (folgezettel)") $ text "ᛦ"
_ -> pure mempty
where
-- Prevent this element from appearing in Google search results
-- https://developers.google.com/search/reference/robots_meta_tag#data-nosnippet-attr
noSnippet :: Map Text Text
noSnippet = "data-nosnippet" =: ""
elNoSnippetSpan :: DomBuilder t m => Map Text Text -> NeuronWebT t m a -> NeuronWebT t m a
elNoSnippetSpan attrs = elAttr "span" ("data-nosnippet" =: "" <> attrs)
withTooltip :: Maybe Text -> Map Text Text
withTooltip = \case
Nothing -> mempty
Expand Down Expand Up @@ -192,9 +196,6 @@ zettelLinkCss = do
C.textDecoration C.none
"span.zettel-link-container span.extra" ? do
C.color C.auto
"span.zettel-link-container.folgezettel::after" ? do
C.paddingLeft $ em 0.3
C.content $ C.stringContent "ᛦ"
"span.zettel-link-container.raw" ? do
C.border C.solid (C.px 1) C.red
"[data-tooltip]:after" ? do
Expand Down