git.iko.soy/typeable/pandoc
on master help sign in
Implement footnotes in dokuwiki writer (#386)
b14b2d6claremacrae
src/Text/Pandoc/Writers/DokuWiki.hs+3−3
@@ -38,7 +38,6 @@ DokuWiki: <https://www.dokuwiki.org/dokuwiki>
38 [ ] Don't generate <div>
38 [ ] Don't generate <div>
39 [ ] Implement conversion of tables
39 [ ] Implement conversion of tables
40 [ ] Implement comments
40 [ ] Implement comments
41− [ ] Implement footnotes
42 [ ] Work through the Dokuwiki spec, and check I've not missed anything out
41 [ ] Work through the Dokuwiki spec, and check I've not missed anything out
43 [ ] Test the output in Dokuwiki - and compare against the display of another format, e.g. HTML
42 [ ] Test the output in Dokuwiki - and compare against the display of another format, e.g. HTML
44 [ ] Remove dud/duplicate code
43 [ ] Remove dud/duplicate code
@@ -77,7 +76,8 @@ pandocToDokuWiki opts (Pandoc meta blocks) = do
77 body <- blockListToDokuWiki opts blocks
76 body <- blockListToDokuWiki opts blocks
78 notesExist <- get >>= return . stNotes
77 notesExist <- get >>= return . stNotes
79 let notes = if notesExist
78 let notes = if notesExist
80− then "\n<references />"
79+ then "" -- TODO Was "\n<references />" Check whether I can really remove this:
80+ -- if it is definitely to do with footnotes, can remove this whole bit
81 else ""
81 else ""
82 let main = body ++ notes
82 let main = body ++ notes
83 let context = defField "body" main
83 let context = defField "body" main
@@ -438,5 +438,5 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
438inlineToDokuWiki opts (Note contents) = do
438inlineToDokuWiki opts (Note contents) = do
439 contents' <- blockListToDokuWiki opts contents
439 contents' <- blockListToDokuWiki opts contents
440 modify (\s -> s { stNotes = True })
440 modify (\s -> s { stNotes = True })
441− return $ "<ref>" ++ contents' ++ "</ref>"
441+ return $ "((" ++ contents' ++ "))"
442 -- note - may not work for notes with multiple blocks
442 -- note - may not work for notes with multiple blocks
tests/writer.dokuwiki+7−9
@@ -634,21 +634,19 @@ Here is a movie {{:movie.jpg|movie}} icon.
634
634
635====== Footnotes ======
635====== Footnotes ======
636
636
637−Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.
637+Here is a footnote reference,((Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.
638−</ref> and another.<ref>Here’s the long note. This one contains multiple blocks.
638+)) and another.((Here’s the long note. This one contains multiple blocks.
639
639
640Subsequent blocks are indented to show that they belong to the footnote (as with list items).
640Subsequent blocks are indented to show that they belong to the footnote (as with list items).
641
641
642<pre> { &lt;code&gt; }</pre>
642<pre> { &lt;code&gt; }</pre>
643If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
643If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
644−</ref> This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.<ref>This is //easier// to type. Inline notes may contain [[http://google.com|links]] and <code>]</code> verbatim characters, as well as [bracketed text].
644+)) This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.((This is //easier// to type. Inline notes may contain [[http://google.com|links]] and <code>]</code> verbatim characters, as well as [bracketed text].
645−</ref>
645+))
646
646
647−<blockquote>Notes can go in quotes.<ref>In quote.
647+<blockquote>Notes can go in quotes.((In quote.
648−</ref>
648+))
649</blockquote>
649</blockquote>
650− - And in list items.<ref>In list.</ref>
650+ - And in list items.((In list.))
651
651
652This paragraph should not be part of the note, as it is not indented.
652This paragraph should not be part of the note, as it is not indented.
653−
654−<references />