From 1136cff702c5167cb75202202b0db9300687e1a6 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Mon, 30 Oct 2023 09:43:05 +0100 Subject: [PATCH] add syntax `*hello*` --- langfilter/Spans.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/langfilter/Spans.hs b/langfilter/Spans.hs index 3da9a30..7d1fbfe 100644 --- a/langfilter/Spans.hs +++ b/langfilter/Spans.hs @@ -13,20 +13,22 @@ import qualified Data.Text as Text spans :: Vars => Inline -> IO Inline spans = \case Code attrs txt - | Just ('\\', txt') <- Text.uncons txt -> pure $ Code attrs txt' + | Just ('\\', txt') <- Text.uncons txt -> pure $ Code attrs txt' | Just txt' <- enclosed "⫽" "⫽" txt -> pure $ ipaA txt' | Just txt' <- enclosed "//" "//" txt -> pure $ ipaA txt' | Just _ <- enclosed "/" "/" txt -> pure $ ipaB txt | Just _ <- enclosed "[" "]" txt -> pure $ ipaN txt | Just txt' <- enclosed "{" "}" txt -> lang txt' | Just txt' <- enclosed "!" "!" txt -> pure $ abbr txt' + | Just txt' <- enclosed "*" "*" txt -> pure $ mark txt' i -> pure i -ipaA, ipaB, ipaN, abbr :: Text -> Inline +ipaA, ipaB, ipaN, abbr, mark :: Text -> Inline ipaA = Span (cls ["ipa", "ipa-arch"]) . text' . surround "⫽" ipaB = Span (cls ["ipa", "ipa-broad"]) . text' ipaN = Span (cls ["ipa", "ipa-narrow"]) . text' abbr = Span (cls ["abbr"]) . text' . endash +mark txt = RawInline "html" $ "" <> txt <> "" surround :: Text -> Text -> Text surround s txt = s <> txt <> s