@@ -97,6 +97,7 @@ module Text.Pandoc.Shared (
9797 compactify,
9898 Element (..),
9999 hierarchicalize,
100+ uniqueIdent,
100101 isHeaderBlock,
101102 -- * Writer options
102103 HTMLMathMethod (..),
@@ -902,7 +903,7 @@ inlineListToIdentifier' [] = ""
902903inlineListToIdentifier' (x:xs) =
903904 xAsText ++ inlineListToIdentifier' xs
904905 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)) $
906907 intercalate "-" $ words $ map toLower s
907908 Emph lst -> inlineListToIdentifier' lst
908909 Strikeout lst -> inlineListToIdentifier' lst
@@ -952,6 +953,8 @@ headerLtEq :: Int -> Block -> Bool
952953headerLtEq level (Header l _) = l <= level
953954headerLtEq _ _ = False
954955
956+-- | Generate a unique identifier from a list of inlines.
957+-- Second argument is a list of already used identifiers.
955958uniqueIdent :: [Inline] -> [String] -> String
956959uniqueIdent title' usedIdents =
957960 let baseIdent = inlineListToIdentifier title'