aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-31 01:17:55 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-31 01:17:55 +0000
commitb86710983045ada1fb1baaaeb0041679b555c4de (patch)
treee0b792e3af76e4340783f5f668368465d1d1a756 /src
parent3f53d6f27045576665a6241693fdd4071842806f (diff)
downloadpandoc-b86710983045ada1fb1baaaeb0041679b555c4de.tar.gz
Modified mediawiki writer to use new templates.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1736 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index f3e0c58fa..572308820 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -32,6 +32,7 @@ MediaWiki: <http://www.mediawiki.org/wiki/MediaWiki>
module Text.Pandoc.Writers.MediaWiki ( writeMediaWiki ) where
import Text.Pandoc.Definition
import Text.Pandoc.Shared
+import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.XML ( escapeStringForXML )
import Data.List ( intersect, intercalate )
import Network.URI ( isURI )
@@ -52,21 +53,20 @@ writeMediaWiki opts document =
-- | Return MediaWiki representation of document.
pandocToMediaWiki :: WriterOptions -> Pandoc -> State WriterState String
pandocToMediaWiki opts (Pandoc _ blocks) = do
- return "" -- TODO
--- let before = writerIncludeBefore opts
--- let after = writerIncludeAfter opts
--- let head' = if writerStandalone opts
--- then writerHeader opts
--- else ""
--- let toc = if writerTableOfContents opts
--- then "__TOC__\n"
--- else ""
--- body <- blockListToMediaWiki opts blocks
--- notesExist <- get >>= return . stNotes
--- let notes = if notesExist
--- then "\n== Notes ==\n<references />"
--- else ""
--- return $ head' ++ before ++ toc ++ body ++ after ++ notes
+ let before = writerIncludeBefore opts
+ let after = writerIncludeAfter opts
+ body <- blockListToMediaWiki opts blocks
+ notesExist <- get >>= return . stNotes
+ let notes = if notesExist
+ then "\n== Notes ==\n<references />"
+ else ""
+ let main = before ++ body ++ after ++ notes
+ let context = writerVariables opts ++
+ [ ("body", main) ] ++
+ [ ("toc", "yes") | writerTableOfContents opts ]
+ if writerStandalone opts
+ then return $ renderTemplate context $ writerTemplate opts
+ else return main
-- | Escape special characters for MediaWiki.
escapeString :: String -> String