aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-08-16 13:22:27 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-08-16 13:22:27 -0700
commit89a7703260703599a033be16e1581a0494326c2b (patch)
treee6acb7e1482bef9bf274cad2a33fca85434025ab /src/Text
parent399c75da448dc0f90855b43ee44e9d7cf8009f1c (diff)
downloadpandoc-89a7703260703599a033be16e1581a0494326c2b.tar.gz
Shared: Changed stringify so it ignores notes.
Also documented this in README.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Shared.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 72b467da5..eef150351 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -384,8 +384,10 @@ consolidateInlines (x : xs) = x : consolidateInlines xs
consolidateInlines [] = []
-- | Convert list of inlines to a string with formatting removed.
+-- Footnotes are skipped (since we don't want their contents in link
+-- labels).
stringify :: [Inline] -> String
-stringify = query go
+stringify = query go . walk deNote
where go :: Inline -> [Char]
go Space = " "
go (Str x) = x
@@ -393,6 +395,8 @@ stringify = query go
go (Math _ x) = x
go LineBreak = " "
go _ = ""
+ deNote (Note _) = Str ""
+ deNote x = x
-- | Change final list item from @Para@ to @Plain@ if the list contains
-- no other @Para@ blocks.