@@ -399,6 +399,11 @@ stringify = queryWith go
399399 go (Str x) = x
400400 go (Code x) = x
401401 go (Math _ x) = x
402+ go EmDash = "--"
403+ go EnDash = "-"
404+ go Apostrophe = "'"
405+ go Ellipses = "..."
406+ go LineBreak = " "
402407 go _ = ""
403408
404409-- | Change final list item from @Para@ to @Plain@ if the list contains
@@ -432,34 +437,12 @@ data Element = Blk Block
432437-- letters, digits, and the characters _-.
433438inlineListToIdentifier :: [Inline] -> String
434439inlineListToIdentifier =
435− dropWhile (not . isAlpha) . intercalate "-" . words . map toLower .
436− filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
437− concatMap extractText
438− where extractText x = case x of
439− Str s -> map nbspToSp s
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
448− Code s -> s
449− Space -> " "
450− EmDash -> "---"
451− EnDash -> "--"
452− Apostrophe -> ""
453− Ellipses -> "..."
454− LineBreak -> " "
455− Math _ s -> s
456− TeX _ -> ""
457− HtmlInline _ -> ""
458− Link lst _ -> concatMap extractText lst
459− Image lst _ -> concatMap extractText lst
460− Note _ -> ""
461− nbspToSp '\160' = ' '
462− nbspToSp x = x
440+ dropWhile (not . isAlpha) . intercalate "-" . words .
441+ map (nbspToSp . toLower) .
442+ filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
443+ stringify
444+ where nbspToSp '\160' = ' '
445+ nbspToSp x = x
463446
464447-- | Convert list of Pandoc blocks into (hierarchical) list of Elements
465448hierarchicalize :: [Block] -> [Element]