Skip to content

Commit

Permalink
Org writer: prefix footnote numbers with fn:
Browse files Browse the repository at this point in the history
Unprefixed numbers where used by older org-mode versions, but are no
longer supported.
  • Loading branch information
tarleb committed Dec 21, 2016
1 parent b5ce963 commit d27188a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Text/Pandoc/Writers/Org.hs
Expand Up @@ -92,7 +92,7 @@ notesToOrg notes =
noteToOrg :: Int -> [Block] -> State WriterState Doc
noteToOrg num note = do
contents <- blockListToOrg note
let marker = "[" ++ show num ++ "] "
let marker = "[fn:" ++ show num ++ "] "
return $ hang (length marker) (text marker) contents

-- | Escape special characters for Org.
Expand Down Expand Up @@ -373,7 +373,7 @@ inlineToOrg (Note contents) = do
notes <- get >>= (return . stNotes)
modify $ \st -> st { stNotes = contents:notes }
let ref = show $ (length notes) + 1
return $ "[" <> text ref <> "]"
return $ "[fn:" <> text ref <> "]"

orgPath :: String -> String
orgPath src =
Expand Down
38 changes: 19 additions & 19 deletions tests/writer.org
Expand Up @@ -819,37 +819,37 @@ Here is a movie [[file:movie.jpg]] icon.
:CUSTOM_ID: footnotes
:END:

Here is a footnote reference,[1] and another.[2] This should /not/ be a
Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be a
footnote reference, because it contains a space.[\^my note] Here is an inline
note.[3]
note.[fn:3]

#+BEGIN_QUOTE
Notes can go in quotes.[4]
Notes can go in quotes.[fn:4]
#+END_QUOTE

1. And in list items.[5]
1. And in list items.[fn:5]

This paragraph should not be part of the note, as it is not indented.

[1] Here is the footnote. It can go anywhere after the footnote reference. It
need not be placed at the end of the document.
[fn:1] Here is the footnote. It can go anywhere after the footnote reference.
It need not be placed at the end of the document.

[2] Here's the long note. This one contains multiple blocks.
[fn:2] Here's the long note. This one contains multiple blocks.

Subsequent blocks are indented to show that they belong to the footnote
(as with list items).
Subsequent blocks are indented to show that they belong to the footnote
(as with list items).

#+BEGIN_EXAMPLE
{ <code> }
#+END_EXAMPLE
#+BEGIN_EXAMPLE
{ <code> }
#+END_EXAMPLE

If you want, you can indent every line, but you can also be lazy and just
indent the first line of each block.
If you want, you can indent every line, but you can also be lazy and
just indent the first line of each block.

[3] This is /easier/ to type. Inline notes may contain
[[http://google.com][links]] and =]= verbatim characters, as well as
[bracketed text].
[fn:3] This is /easier/ to type. Inline notes may contain
[[http://google.com][links]] and =]= verbatim characters, as well as
[bracketed text].

[4] In quote.
[fn:4] In quote.

[5] In list.
[fn:5] In list.

0 comments on commit d27188a

Please sign in to comment.