Modified mediawiki writer to use new templates.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1736 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2009-12-31 01:17:55 +00:00
parent 3f53d6f270
commit b867109830
3 changed files with 23 additions and 89 deletions

View file

@ -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

View file

@ -1,75 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
><head
><title
>title</title
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/><meta name="generator" content="pandoc"
/><meta name="author" content="$authors$"
/><meta name="date" content="$date$"
/>$header-includes$
</head
><body
>
<h1 class="title"
><span class="math"
><em
>title</em
></span
></h1
><div id="TOC"
><ul
><li
><a href="#section-oen"
>section oen</a
></li
></ul
></div
><div id="section-oen"
><h1
><a href="#TOC"
>section oen</a
></h1
><ol style="list-style-type: decimal;"
><li
>one<ol style="list-style-type: lower-alpha;"
><li
>two<ol start="3" style="list-style-type: lower-roman;"
><li
>three</li
></ol
></li
></ol
></li
></ol
><pre class="haskell"
><code
>hi
</code
></pre
><p
>footnote<a href="#fn1" class="footnoteRef" id="fnref1"
><sup
>1</sup
></a
></p
></div
><div class="footnotes"
><hr
/><ol
><li id="fn1"
><p
>with code</p
><pre
><code
>code
</code
></pre
> <a href="#fnref1" class="footnoteBackLink" title="Jump back to footnote 1">&#8617;</a></li
></ol
></div
>
</body
></html
>
$if(legacy-header)$
$legacy-header$
$endif$
$if(toc)$
__TOC__
$endif$
$body$

View file

@ -661,3 +661,4 @@ This paragraph should not be part of the note, as it is not indented.
== Notes ==
<references />