git.iko.soy/typeable/pandoc
on master help sign in
Implement conversion of images in dokuwiki writer (#386)
commit18565e149a2de3f6bb83563890cc9e4f65679693 authorClare Macrae <clare.macrae@googlemail.com> dateMon 15 Jul 2013, 19:29 (13 years ago) parentb2a8731
2 files changed+7−6
src/Text/Pandoc/Writers/DokuWiki.hs+5−4 tests/writer.dokuwiki+2−2
src/Text/Pandoc/Writers/DokuWiki.hs+5−4
@@ -87,14 +87,15 @@ blockToDokuWiki opts (Plain inlines) =
8787 inlineListToDokuWiki opts inlines
8888
8989-- title beginning with fig: indicates that the image is a figure
90+-- dokuwiki doesn't support captions - so combine together alt and caption into alt
9091blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
9192 capt <- if null txt
9293 then return ""
93− else ("|caption " ++) `fmap` inlineListToDokuWiki opts txt
94+ else (" " ++) `fmap` inlineListToDokuWiki opts txt
9495 let opt = if null txt
9596 then ""
96− else "|alt=" ++ if null tit then capt else tit ++ capt
97− return $ "[[Image:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"
97+ else "|" ++ if null tit then capt else tit ++ capt
98+ return $ "{{:" ++ src ++ opt ++ "}}\n"
9899
99100blockToDokuWiki opts (Para inlines) = do
100101 useTags <- get >>= return . stUseTags
@@ -398,7 +399,7 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
398399 then ""
399400 else "|" ++ alt'
400401 else "|" ++ tit
401− return $ "[[Image:" ++ source ++ txt ++ "]]"
402+ return $ "{{:" ++ source ++ txt ++ "}}"
402403
403404inlineToDokuWiki opts (Note contents) = do
404405 contents' <- blockListToDokuWiki opts contents
tests/writer.dokuwiki+2−2
@@ -624,9 +624,9 @@ Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code>
624624
625625From “Voyage dans la Lune” by Georges Melies (1902):
626626
627−[[Image:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]]
627+{{:lalune.jpg|Voyage dans la Lune lalune}}
628628
629−Here is a movie [[Image:movie.jpg|movie]] icon.
629+Here is a movie {{:movie.jpg|movie}} icon.
630630
631631
632632----