From 5769f178e1d5d0dcbdd9d97e968579b30c74e275 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 8 Jul 2014 21:18:31 +0100 Subject: Put myself as maintainer (#1398) --- src/Text/Pandoc/Writers/DokuWiki.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index ea56ac393..c5f09db5a 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Copyright : Copyright (C) 2008-2014 John MacFarlane License : GNU GPL, version 2 or above - Maintainer : John MacFarlane + Maintainer : Clare Macrae Stability : alpha Portability : portable -- cgit v1.2.3 From c7431283d673829741cbfdcd5d5e548077648e5b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 8 Jul 2014 22:05:04 +0100 Subject: DokuWiki writer: Remove broken formatting from headings (#1398) --- src/Text/Pandoc/Writers/DokuWiki.hs | 12 +++++++++++- tests/writer.dokuwiki | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc') 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" diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki index eff4bed7b..ea27699cb 100644 --- a/tests/writer.dokuwiki +++ b/tests/writer.dokuwiki @@ -5,9 +5,9 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber’s ====== Headers ====== -===== Level 2 with an [[url|embedded link]] ===== +===== Level 2 with an embedded link ===== -==== Level 3 with //emphasis// ==== +==== Level 3 with emphasis ==== === Level 4 === @@ -15,7 +15,7 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber’s ====== Level 1 ====== -===== Level 2 with //emphasis// ===== +===== Level 2 with emphasis ===== ==== Level 3 ==== -- cgit v1.2.3