aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClare Macrae <clare.macrae@googlemail.com>2013-07-15 19:29:39 +0100
committerClare Macrae <clare.macrae@googlemail.com>2013-07-15 19:29:39 +0100
commit18565e149a2de3f6bb83563890cc9e4f65679693 (patch)
tree3d82197fd132bf6d6f23da63e84ce9e370f4bf12
parentb2a8731e32c27a230a970b747df13ad84d473b5d (diff)
downloadpandoc-18565e149a2de3f6bb83563890cc9e4f65679693.tar.gz
Implement conversion of images in dokuwiki writer (#386)
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs9
-rw-r--r--tests/writer.dokuwiki4
2 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index b6929ad1e..0651a8177 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -87,14 +87,15 @@ blockToDokuWiki opts (Plain inlines) =
inlineListToDokuWiki opts inlines
-- title beginning with fig: indicates that the image is a figure
+-- dokuwiki doesn't support captions - so combine together alt and caption into alt
blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- if null txt
then return ""
- else ("|caption " ++) `fmap` inlineListToDokuWiki opts txt
+ else (" " ++) `fmap` inlineListToDokuWiki opts txt
let opt = if null txt
then ""
- else "|alt=" ++ if null tit then capt else tit ++ capt
- return $ "[[Image:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"
+ else "|" ++ if null tit then capt else tit ++ capt
+ return $ "{{:" ++ src ++ opt ++ "}}\n"
blockToDokuWiki opts (Para inlines) = do
useTags <- get >>= return . stUseTags
@@ -398,7 +399,7 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
then ""
else "|" ++ alt'
else "|" ++ tit
- return $ "[[Image:" ++ source ++ txt ++ "]]"
+ return $ "{{:" ++ source ++ txt ++ "}}"
inlineToDokuWiki opts (Note contents) = do
contents' <- blockListToDokuWiki opts contents
diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki
index 2a006f817..b3f3b3dd2 100644
--- a/tests/writer.dokuwiki
+++ b/tests/writer.dokuwiki
@@ -624,9 +624,9 @@ Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code>
From “Voyage dans la Lune” by Georges Melies (1902):
-[[Image:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]]
+{{:lalune.jpg|Voyage dans la Lune lalune}}
-Here is a movie [[Image:movie.jpg|movie]] icon.
+Here is a movie {{:movie.jpg|movie}} icon.
----