@@ -97,6 +97,7 @@ module Text.Pandoc.Shared (
97 compactify,
97 compactify,
98 Element (..),
98 Element (..),
99 hierarchicalize,
99 hierarchicalize,
100 isHeaderBlock,
101 isHeaderBlock,
101 -- * Writer options
102 -- * Writer options
102 HTMLMathMethod (..),
103 HTMLMathMethod (..),
@@ -902,7 +903,7 @@ inlineListToIdentifier' [] = ""
902inlineListToIdentifier' (x:xs) =
903inlineListToIdentifier' (x:xs) =
903 xAsText ++ inlineListToIdentifier' xs
904 xAsText ++ inlineListToIdentifier' xs
904 where xAsText = case x of
905 where xAsText = case x of
905− Str s -> filter (\c -> c `elem` "_-.~" || not (isPunctuation c)) $
906+ Str s -> filter (\c -> c `elem` "_-." || not (isPunctuation c)) $
906 intercalate "-" $ words $ map toLower s
907 intercalate "-" $ words $ map toLower s
907 Emph lst -> inlineListToIdentifier' lst
908 Emph lst -> inlineListToIdentifier' lst
908 Strikeout lst -> inlineListToIdentifier' lst
909 Strikeout lst -> inlineListToIdentifier' lst
@@ -952,6 +953,8 @@ headerLtEq :: Int -> Block -> Bool
952headerLtEq level (Header l _) = l <= level
953headerLtEq level (Header l _) = l <= level
953headerLtEq _ _ = False
954headerLtEq _ _ = False
956+-- | Generate a unique identifier from a list of inlines.
957+-- Second argument is a list of already used identifiers.
955uniqueIdent :: [Inline] -> [String] -> String
958uniqueIdent :: [Inline] -> [String] -> String
956uniqueIdent title' usedIdents =
959uniqueIdent title' usedIdents =
957 let baseIdent = inlineListToIdentifier title'
960 let baseIdent = inlineListToIdentifier title'