aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-09-25 20:26:38 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-09-25 20:26:38 -0700
commit885ef2072f68fd01137d2eb41d1258932d2134c5 (patch)
tree2d284eb550127110e1b79317f72194b1a2bc6216 /src/Text
parent6ad7ac1239cb384bf830b1692991030735f43e89 (diff)
downloadpandoc-885ef2072f68fd01137d2eb41d1258932d2134c5.tar.gz
Make --id-prefix affect footnote IDs in markdown writer.
Closes #614.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Options.hs1
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs8
2 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index a9c8bf710..359a26768 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -215,6 +215,7 @@ data WriterOptions = WriterOptions
, writerColumns :: Int -- ^ Characters in a line (for text wrapping)
, writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
, writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
+ -- and for footnote marks in markdown
, writerSourceDirectory :: FilePath -- ^ Directory path of 1st source file
, writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory
, writerCiteMethod :: CiteMethod -- ^ How to print cites
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 1a0731710..9bc7cab6a 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -174,7 +174,7 @@ notesToMarkdown opts notes =
noteToMarkdown :: WriterOptions -> Int -> [Block] -> State WriterState Doc
noteToMarkdown opts num blocks = do
contents <- blockListToMarkdown opts blocks
- let num' = text $ show num
+ let num' = text $ writerIdentifierPrefix opts ++ show num
let marker = if isEnabled Ext_footnotes opts
then text "[^" <> num' <> text "]:"
else text "[" <> num' <> text "]"
@@ -655,7 +655,7 @@ inlineToMarkdown opts (Image alternate (source, tit)) = do
inlineToMarkdown opts (Note contents) = do
modify (\st -> st{ stNotes = contents : stNotes st })
st <- get
- let ref = show $ (length $ stNotes st)
+ let ref = text $ writerIdentifierPrefix opts ++ show (length $ stNotes st)
if isEnabled Ext_footnotes opts
- then return $ "[^" <> text ref <> "]"
- else return $ "[" <> text ref <> "]"
+ then return $ "[^" <> ref <> "]"
+ else return $ "[" <> ref <> "]"