Parsing: toKey: strip off outer brackets.
This makes keys with extra space at the beginning and end work: e.g. [foo]: bar [ foo ] will now be a link to bar (it wasn't before).
This commit is contained in:
parent
5db4787330
commit
35e6c893ec
1 changed files with 4 additions and 2 deletions
|
@ -178,7 +178,7 @@ import Text.Parsec hiding (token)
|
|||
import Text.Parsec.Pos (newPos)
|
||||
import Data.Char ( toLower, toUpper, ord, chr, isAscii, isAlphaNum,
|
||||
isHexDigit, isSpace )
|
||||
import Data.List ( intercalate, transpose )
|
||||
import Data.List ( intercalate, transpose, isSuffixOf )
|
||||
import Text.Pandoc.Shared
|
||||
import qualified Data.Map as M
|
||||
import Text.TeXMath.Readers.TeX.Macros (applyMacros, Macro,
|
||||
|
@ -1063,7 +1063,9 @@ type NoteTable' = [(String, F Blocks)] -- used in markdown reader
|
|||
newtype Key = Key String deriving (Show, Read, Eq, Ord)
|
||||
|
||||
toKey :: String -> Key
|
||||
toKey = Key . map toLower . unwords . words
|
||||
toKey = Key . map toLower . unwords . words . unbracket
|
||||
where unbracket ('[':xs) | "]" `isSuffixOf` xs = take (length xs - 1) xs
|
||||
unbracket xs = xs
|
||||
|
||||
type KeyTable = M.Map Key Target
|
||||
|
||||
|
|
Loading…
Reference in a new issue