@@ -399,6 +399,11 @@ stringify = queryWith go
399 go (Str x) = x
399 go (Str x) = x
400 go (Code x) = x
400 go (Code x) = x
401 go (Math _ x) = x
401 go (Math _ x) = x
402 go _ = ""
407 go _ = ""
404-- | Change final list item from @Para@ to @Plain@ if the list contains
409-- | Change final list item from @Para@ to @Plain@ if the list contains
@@ -432,34 +437,12 @@ data Element = Blk Block
432-- letters, digits, and the characters _-.
437-- letters, digits, and the characters _-.
433inlineListToIdentifier :: [Inline] -> String
438inlineListToIdentifier :: [Inline] -> String
434inlineListToIdentifier =
439inlineListToIdentifier =
435− dropWhile (not . isAlpha) . intercalate "-" . words . map toLower .
440+ dropWhile (not . isAlpha) . intercalate "-" . words .
441+ map (nbspToSp . toLower) .
436− filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
442+ filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
437− concatMap extractText
443+ stringify
438− where extractText x = case x of
439− Str s -> map nbspToSp s
444+ where nbspToSp '\160' = ' '
440− Emph lst -> concatMap extractText lst
441− Strikeout lst -> concatMap extractText lst
442− Superscript lst -> concatMap extractText lst
443− SmallCaps lst -> concatMap extractText lst
444− Subscript lst -> concatMap extractText lst
445− Strong lst -> concatMap extractText lst
446− Quoted _ lst -> concatMap extractText lst
447− Cite _ lst -> concatMap extractText lst
458− Link lst _ -> concatMap extractText lst
459− Image lst _ -> concatMap extractText lst
461− nbspToSp '\160' = ' '
462− nbspToSp x = x
445+ nbspToSp x = x
464-- | Convert list of Pandoc blocks into (hierarchical) list of Elements
447-- | Convert list of Pandoc blocks into (hierarchical) list of Elements
465hierarchicalize :: [Block] -> [Element]
448hierarchicalize :: [Block] -> [Element]