From 0adea5d06312e0d3c7615111c5089e94f1b905c6 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Thu, 29 Apr 2021 19:02:20 +0200 Subject: [PATCH] pass other classes/id thru with gloss --- langfilter/Glosses.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/langfilter/Glosses.hs b/langfilter/Glosses.hs index 424cf18..2557844 100644 --- a/langfilter/Glosses.hs +++ b/langfilter/Glosses.hs @@ -9,16 +9,20 @@ import Text.Pandoc.Builder import Text.Pandoc.Walk import Data.Maybe import Data.Text (Text) +import qualified Data.Text as Text glosses :: Vars => Block -> IO [Block] glosses = \case - Div (_, cs, _) blocks | "glosses" `elem` cs -> do + Div (i, cs, _) blocks | "glosses" `elem` cs -> do tables <- traverse glossTable blocks pure $ - [RawBlock (Format "html") "
"] ++ + [RawBlock (Format "html") $ " id <> classes <> ">"] ++ catMaybes tables ++ [RawBlock (Format "html") "
"] + where + id = if i == "" then "" else " id=\"" <> i <> "\"" + classes = " class=\"" <> Text.unwords cs <> "\"" b -> pure [b] pattern Gloss l g w t = BulletList [[Plain l], [Plain g], [Plain w], [Plain t]]