Skip to content

Commit

Permalink
hotfix: don't fold `⟨⟩ (#309)
Browse files Browse the repository at this point in the history
Somebody finally complained about it
  • Loading branch information
plt-amy authored Dec 11, 2023
1 parent c2a125a commit 89edc49
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion support/shake/app/Shake/Markdown.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 89edc49

Please sign in to comment.