parent
0d72237e27
commit
c75faac1b5
1 changed files with 4 additions and 5 deletions
|
@ -646,18 +646,17 @@ dimenarg :: PandocMonad m => LP m Text
|
||||||
dimenarg = try $ do
|
dimenarg = try $ do
|
||||||
optional sp
|
optional sp
|
||||||
ch <- option False $ True <$ symbol '='
|
ch <- option False $ True <$ symbol '='
|
||||||
|
minus <- option "" $ "-" <$ symbol '-'
|
||||||
Tok _ _ s1 <- satisfyTok isWordTok
|
Tok _ _ s1 <- satisfyTok isWordTok
|
||||||
s2 <- option "" $ try $ do
|
s2 <- option "" $ try $ do
|
||||||
symbol '.'
|
symbol '.'
|
||||||
Tok _ _ t <- satisfyTok isWordTok
|
Tok _ _ t <- satisfyTok isWordTok
|
||||||
return ("." <> t)
|
return ("." <> t)
|
||||||
let s = s1 <> s2
|
let s = s1 <> s2
|
||||||
guard $ T.takeEnd 2 s `elem`
|
let (num, rest) = T.span (\c -> isDigit c || c == '.') s
|
||||||
["pt","pc","in","bp","cm","mm","dd","cc","sp"]
|
|
||||||
let num = T.dropEnd 2 s
|
|
||||||
guard $ T.length num > 0
|
guard $ T.length num > 0
|
||||||
guard $ T.all (\c -> isDigit c || c == '.') num
|
guard $ rest `elem` ["", "pt","pc","in","bp","cm","mm","dd","cc","sp"]
|
||||||
return $ T.pack ['=' | ch] <> s
|
return $ T.pack ['=' | ch] <> minus <> s
|
||||||
|
|
||||||
ignore :: (Monoid a, PandocMonad m) => String -> ParserT s u m a
|
ignore :: (Monoid a, PandocMonad m) => String -> ParserT s u m a
|
||||||
ignore raw = do
|
ignore raw = do
|
||||||
|
|
Loading…
Reference in a new issue