From c4a430facbeaa55a9de8edd69145243475c94087 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris <rhi@rhiannon.website> Date: Tue, 3 Dec 2024 23:56:44 +0100 Subject: [PATCH] handle figure ids better --- langfilter/lib/LangFilter.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/langfilter/lib/LangFilter.hs b/langfilter/lib/LangFilter.hs index 16e3460..34fdbcb 100644 --- a/langfilter/lib/LangFilter.hs +++ b/langfilter/lib/LangFilter.hs @@ -36,8 +36,10 @@ pluck1 (x:xs) ys = (x,) <$> pluck x ys <|> pluck1 xs ys fixFigureClass :: Block -> Block -fixFigureClass (Figure (_, c1, a1) cap [Plain [Image (i, c2, a2) alt path]]) = - Figure (i, c1 ++ c2, a1 ++ a2) cap [Plain [Image ("", [], []) alt path]] +fixFigureClass (Figure (i1, c1, a1) cap [Plain [Image (i2, c2, a2) alt path]]) = + Figure (iF, c1 ++ c2, a1 ++ a2) cap [Plain [Image (iI, [], []) alt path]] + where iF = if Text.null i1 then i2 else i1 + iI = if Text.null i1 then "" else i2 fixFigureClass b = b makeBlocks :: Block -> [Block]