git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #3012 from tarleb/org-drop-ugly-pragma
46f3debJohn MacFarlane
src/Text/Pandoc/Readers/Org/Blocks.hs+4−5
@@ -1,6 +1,6 @@
1{-# LANGUAGE FlexibleContexts #-}
1{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3−{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
3+{-# LANGUAGE ViewPatterns #-}
4{-
4{-
5Copyright (C) 2014-2016 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
5Copyright (C) 2014-2016 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
6
6
@@ -54,7 +54,6 @@ import Data.Char ( isSpace, toLower, toUpper)
54import Data.List ( foldl', intersperse, isPrefixOf )
54import Data.List ( foldl', intersperse, isPrefixOf )
55import qualified Data.Map as M
55import qualified Data.Map as M
56import Data.Maybe ( fromMaybe, isNothing )
56import Data.Maybe ( fromMaybe, isNothing )
57−import qualified Data.Sequence as S
58import Network.HTTP ( urlEncode )
57import Network.HTTP ( urlEncode )
59
58
60--
59--
@@ -142,7 +141,7 @@ headlineToBlocks hdln@(Headline {..}) = do
142 _ | any isArchiveTag headlineTags -> archivedHeadlineToBlocks hdln
141 _ | any isArchiveTag headlineTags -> archivedHeadlineToBlocks hdln
143 _ | isCommentTitle headlineText -> return mempty
142 _ | isCommentTitle headlineText -> return mempty
144 _ | headlineLevel >= maxHeadlineLevels -> headlineToHeaderWithList hdln
143 _ | headlineLevel >= maxHeadlineLevels -> headlineToHeaderWithList hdln
145− _ -> headlineToHeaderWithContents hdln
144+ _ | otherwise -> headlineToHeaderWithContents hdln
146
145
147isNoExportTag :: Tag -> Bool
146isNoExportTag :: Tag -> Bool
148isNoExportTag = (== toTag "noexport")
147isNoExportTag = (== toTag "noexport")
@@ -154,8 +153,8 @@ isArchiveTag = (== toTag "ARCHIVE")
154-- FIXME: This accesses builder internals not intended for use in situations
153-- FIXME: This accesses builder internals not intended for use in situations
155-- like these. Replace once keyword parsing is supported.
154-- like these. Replace once keyword parsing is supported.
156isCommentTitle :: Inlines -> Bool
155isCommentTitle :: Inlines -> Bool
157−isCommentTitle xs = (B.Many . S.take 1 . B.unMany) xs == B.str "COMMENT"
156+isCommentTitle (B.toList -> (Str "COMMENT":_)) = True
158−isCommentTitle _ = False
157+isCommentTitle _ = False
159
158
160archivedHeadlineToBlocks :: Headline -> OrgParser Blocks
159archivedHeadlineToBlocks :: Headline -> OrgParser Blocks
161archivedHeadlineToBlocks hdln = do
160archivedHeadlineToBlocks hdln = do