aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/DokuWiki.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/DokuWiki.hs')
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index c5f09db5a..61f548b0c 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -44,6 +44,7 @@ import Text.Pandoc.Options
import Text.Pandoc.Shared
import Text.Pandoc.Writers.Shared
import Text.Pandoc.Templates (renderTemplate')
+import Text.Pandoc.Walk (query)
import Data.List ( intersect, intercalate )
import Network.URI ( isURI )
import Control.Monad.State
@@ -85,6 +86,15 @@ pandocToDokuWiki opts (Pandoc meta blocks) = do
escapeString :: String -> String
escapeString str = substitute "__" "%%__%%" ( substitute "**" "%%**%%" ( substitute "//" "%%//%%" str ) )
+-- | Remove unsupported formatting from headings
+unfancy :: [Inline] -> [Inline]
+unfancy = query plainContent
+
+plainContent :: Inline -> [Inline]
+plainContent (Str x) = [Str x]
+plainContent Space = [Space]
+plainContent _ = []
+
-- | Convert Pandoc block element to DokuWiki.
blockToDokuWiki :: WriterOptions -- ^ Options
-> Block -- ^ Block element
@@ -126,7 +136,7 @@ blockToDokuWiki _ (RawBlock f str)
blockToDokuWiki _ HorizontalRule = return "\n----\n"
blockToDokuWiki opts (Header level _ inlines) = do
- contents <- inlineListToDokuWiki opts inlines
+ contents <- inlineListToDokuWiki opts ( unfancy inlines )
let eqs = replicate ( 7 - level ) '='
return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"