1
1
mirror of https://github.com/Yvee1/hascard.git synced 2024-11-22 04:33:06 +03:00

Add possibility to escape underscores

This commit is contained in:
Steven van den Broek 2020-07-18 15:13:34 +02:00
parent f5a7d2d844
commit 516bc2d21f
2 changed files with 10 additions and 6 deletions

View File

@ -32,9 +32,9 @@ For any closed surface in D, the domain enclosed by S is completely in D. Exs: s
---
# Second derivative test
f_xx * f_yy - f_xy^2 > 0 && f_xx > 0 => local min
f_xx * f_yy - f_xy^2 > 0 && f_xx < 0 => local max
f_xx * f_yy - f_xy^2 < 0 => saddle point
f\_xx * f\_yy - f\_xy^2 > 0 && f\_xx > 0 => local min
f\_xx * f\_yy - f\_xy^2 > 0 && f\_xx < 0 => local max
f\_xx * f\_yy - f\_xy^2 < 0 => saddle point
---

View File

@ -83,9 +83,12 @@ pSentence = try pPerforated
pPerforated = do
(pre, gap) <- pGap
Perforated pre gap <$> pSentence
chars = escaped <|> anyChar
escaped = char '\\' >> char '_'
pGap = do
pre <- manyTill anyChar $ lookAhead (try gappedSpecialChars)
pre <- manyTill chars $ lookAhead (try gappedSpecialChars)
char '_'
gaps <- manyTill (noneOf "_|") (lookAhead (try gappedSpecialChars)) `sepBy1` string "|"
char '_'
@ -102,7 +105,7 @@ pNormal = do
pDef = do
header <- pHeader
many eol
descr <- manyTill anyChar $ lookAhead (try seperator)
descr <- manyTill chars $ lookAhead (try seperator)
return (header, descr)
eol = try (string "\n\r")
@ -123,6 +126,7 @@ makeMultipleChoice options = makeMultipleChoice' [] [] 0 options
makeMultipleChoice' _ _ _ [] = error ("multiple choice had multiple correct answers: \n" ++ show options)
makeMultipleChoice' cs ics i (('-', text) : opts) = makeMultipleChoice' cs (IncorrectOption text : ics) (i+1) opts
makeMultipleChoice' cs ics i (('*', text) : opts) = makeMultipleChoice' (CorrectOption i text : cs) ics (i+1) opts
makeMultipleChoice' _ _ _ _ = error "impossible"
makeOption :: Char -> String -> Option
makeOption kind text