git.iko.soy/typeable/pandoc
on master help sign in
Implement conversion of images in dokuwiki writer (#386)
18565e1Clare Macrae
src/Text/Pandoc/Writers/DokuWiki.hs+5−4
@@ -87,14 +87,15 @@ blockToDokuWiki opts (Plain inlines) =
87 inlineListToDokuWiki opts inlines
87 inlineListToDokuWiki opts inlines
88
88
89-- title beginning with fig: indicates that the image is a figure
89-- 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
90blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
91blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
91 capt <- if null txt
92 capt <- if null txt
92 then return ""
93 then return ""
93− else ("|caption " ++) `fmap` inlineListToDokuWiki opts txt
94+ else (" " ++) `fmap` inlineListToDokuWiki opts txt
94 let opt = if null txt
95 let opt = if null txt
95 then ""
96 then ""
96− else "|alt=" ++ if null tit then capt else tit ++ capt
97+ else "|" ++ if null tit then capt else tit ++ capt
97− return $ "[[Image:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"
98+ return $ "{{:" ++ src ++ opt ++ "}}\n"
98
99
99blockToDokuWiki opts (Para inlines) = do
100blockToDokuWiki opts (Para inlines) = do
100 useTags <- get >>= return . stUseTags
101 useTags <- get >>= return . stUseTags
@@ -398,7 +399,7 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
398 then ""
399 then ""
399 else "|" ++ alt'
400 else "|" ++ alt'
400 else "|" ++ tit
401 else "|" ++ tit
401− return $ "[[Image:" ++ source ++ txt ++ "]]"
402+ return $ "{{:" ++ source ++ txt ++ "}}"
402
403
403inlineToDokuWiki opts (Note contents) = do
404inlineToDokuWiki opts (Note contents) = do
404 contents' <- blockListToDokuWiki opts contents
405 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>
624
624
625From “Voyage dans la Lune” by Georges Melies (1902):
625From “Voyage dans la Lune” by Georges Melies (1902):
626
626
627−[[Image:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]]
627+{{:lalune.jpg|Voyage dans la Lune lalune}}
628
628
629−Here is a movie [[Image:movie.jpg|movie]] icon.
629+Here is a movie {{:movie.jpg|movie}} icon.
630
630
631
631
632----
632----