From 89edc4999c9e95936b599ecb15c8197efdd784ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lia?= Date: Mon, 11 Dec 2023 08:56:23 -0300 Subject: [PATCH] =?UTF-8?q?hotfix:=20don't=20fold=20`=E2=9F=A8=E2=9F=A9=20?= =?UTF-8?q?(#309)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Somebody finally complained about it --- support/shake/app/Shake/Markdown.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/support/shake/app/Shake/Markdown.hs b/support/shake/app/Shake/Markdown.hs index a36664301..c66503e89 100644 --- a/support/shake/app/Shake/Markdown.hs +++ b/support/shake/app/Shake/Markdown.hs @@ -17,6 +17,7 @@ import qualified Data.Text.Encoding as Text import qualified Data.Map.Lazy as Map import qualified Data.Text.IO as Text import qualified Data.Text as Text +import qualified Data.Set as Set import Data.Digest.Pure.SHA import Data.Foldable @@ -367,10 +368,16 @@ renderMarkdown authors references modname baseUrl markdown = do setTranslations (Lang "en" Nothing Nothing [] [] []) writeHtml5String options markdown +-- | Simple textual list of starting identifiers not to fold +don'tFold :: Set.Set Text +don'tFold = Set.fromList + [ "`⟨" -- used in CC.Lambda + ] + -- | Removes the RHS of equation reasoning steps?? IDK, ask Amelia. foldEquations :: Bool -> [Tag Text] -> [Tag Text] foldEquations _ (to@(TagOpen "a" attrs):tt@(TagText t):tc@(TagClose "a"):rest) - | Text.length t > 1, Text.last t == '⟨', Just href <- lookup "href" attrs = + | t `Set.notMember` don'tFold, Text.length t > 1, Text.last t == '⟨', Just href <- lookup "href" attrs = [ TagOpen "span" [("class", "reasoning-step")] , TagOpen "span" [("class", "as-written " <> fromMaybe "" (lookup "class" attrs))] , to, tt, tc ] ++ go href rest