Muse reader: allow "-" in anchors

This commit is contained in:
Alexander Krotov 2018-04-19 14:17:59 +03:00
parent bc9d296e5a
commit ce4326a4f1
2 changed files with 6 additions and 1 deletions

View file

@ -801,7 +801,7 @@ parseAnchor :: PandocMonad m => MuseParser m String
parseAnchor = try $ do
getPosition >>= \pos -> guard (sourceColumn pos == 1)
char '#'
(:) <$> letter <*> many (letter <|> digit)
(:) <$> letter <*> many (letter <|> digit <|> char '-')
anchor :: PandocMonad m => MuseParser m (F Inlines)
anchor = try $ do

View file

@ -637,6 +637,11 @@ tests =
, "#anchor and ends here."
] =?>
para ("Paragraph starts here\n" <> spanWith ("anchor", [], []) mempty <> "and ends here.")
, "Anchor with \"-\"" =:
T.unlines [ "; A comment to make sure anchor is not parsed as a directive"
, "#anchor-id Target"
] =?>
para (spanWith ("anchor-id", [], []) mempty <> "Target")
]
, testGroup "Footnotes"
[ "Simple footnote" =: