Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: don't fold `⟨⟩ #309

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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