git.iko.soy/typeable/pandoc
on master help sign in
Hlint suggestions.
commit8c90f34d15a002d9269ef0371db7d6f7bf44168c authorJohn MacFarlane <jgm@berkeley.edu> dateThu 22 Nov 2018, 22:41 (8 years ago) parentcc4ec3f
5 files changed+26−30
src/Text/Pandoc/Readers/LaTeX.hs+1−1 src/Text/Pandoc/Readers/Odt/Arrows/State.hs−2 src/Text/Pandoc/Writers/DokuWiki.hs+23−23 src/Text/Pandoc/Writers/ODT.hs+1−2 src/Text/Pandoc/XML.hs+1−2
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -899,7 +899,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
899899 , ("(", mathInline . toksToString <$> manyTill anyTok (controlSeq ")"))
900900 , ("[", mathDisplay . toksToString <$> manyTill anyTok (controlSeq "]"))
901901 , ("ensuremath", mathInline . toksToString <$> braced)
902− , ("texorpdfstring", (\x _ -> x) <$> tok <*> tok)
902+ , ("texorpdfstring", const <$> tok <*> tok)
903903 , ("P", lit "¶")
904904 , ("S", lit "§")
905905 , ("$", lit "$")
src/Text/Pandoc/Readers/Odt/Arrows/State.hs−2
@@ -39,8 +39,6 @@ faster and easier to implement this way.
3939module Text.Pandoc.Readers.Odt.Arrows.State where
4040
4141import Prelude
42−import Prelude hiding (foldl, foldr)
43−
4442import Control.Arrow
4543import qualified Control.Category as Cat
4644import Control.Monad
src/Text/Pandoc/Writers/DokuWiki.hs+23−23
@@ -42,7 +42,7 @@ DokuWiki: <https://www.dokuwiki.org/dokuwiki>
4242module Text.Pandoc.Writers.DokuWiki ( writeDokuWiki ) where
4343import Prelude
4444import Control.Monad (zipWithM)
45−import Control.Monad.Reader (ReaderT, ask, local, runReaderT)
45+import Control.Monad.Reader (ReaderT, asks, local, runReaderT)
4646import Control.Monad.State.Strict (StateT, evalStateT)
4747import Data.Default (Default (..))
4848import Data.List (intercalate, intersect, isPrefixOf, transpose)
@@ -135,8 +135,8 @@ blockToDokuWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
135135 return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
136136
137137blockToDokuWiki opts (Para inlines) = do
138− indent <- stIndent <$> ask
139− useTags <- stUseTags <$> ask
138+ indent <- asks stIndent
139+ useTags <- asks stUseTags
140140 contents <- inlineListToDokuWiki opts inlines
141141 return $ if useTags
142142 then "<HTML><p></HTML>" ++ contents ++ "<HTML></p></HTML>"
@@ -211,9 +211,9 @@ blockToDokuWiki opts (Table capt aligns _ headers rows) = do
211211 unlines (map (renderRow "|") rows')
212212
213213blockToDokuWiki opts x@(BulletList items) = do
214− oldUseTags <- stUseTags <$> ask
215− indent <- stIndent <$> ask
216− backSlash <- stBackSlashLB <$> ask
214+ oldUseTags <- asks stUseTags
215+ indent <- asks stIndent
216+ backSlash <- asks stBackSlashLB
217217 let useTags = oldUseTags || not (isSimpleList x)
218218 if useTags
219219 then do
@@ -227,9 +227,9 @@ blockToDokuWiki opts x@(BulletList items) = do
227227 return $ vcat contents ++ if null indent then "\n" else ""
228228
229229blockToDokuWiki opts x@(OrderedList attribs items) = do
230− oldUseTags <- stUseTags <$> ask
231− indent <- stIndent <$> ask
232− backSlash <- stBackSlashLB <$> ask
230+ oldUseTags <- asks stUseTags
231+ indent <- asks stIndent
232+ backSlash <- asks stBackSlashLB
233233 let useTags = oldUseTags || not (isSimpleList x)
234234 if useTags
235235 then do
@@ -246,9 +246,9 @@ blockToDokuWiki opts x@(OrderedList attribs items) = do
246246-- is a specific representation of them.
247247-- TODO This creates double '; ; ' if there is a bullet or ordered list inside a definition list
248248blockToDokuWiki opts x@(DefinitionList items) = do
249− oldUseTags <- stUseTags <$> ask
250− indent <- stIndent <$> ask
251− backSlash <- stBackSlashLB <$> ask
249+ oldUseTags <- asks stUseTags
250+ indent <- asks stIndent
251+ backSlash <- asks stBackSlashLB
252252 let useTags = oldUseTags || not (isSimpleList x)
253253 if useTags
254254 then do
@@ -278,7 +278,7 @@ listAttribsToString (startnum, numstyle, _) =
278278listItemToDokuWiki :: PandocMonad m
279279 => WriterOptions -> [Block] -> DokuWiki m String
280280listItemToDokuWiki opts items = do
281− useTags <- stUseTags <$> ask
281+ useTags <- asks stUseTags
282282 if useTags
283283 then do
284284 contents <- blockListToDokuWiki opts items
@@ -288,8 +288,8 @@ listItemToDokuWiki opts items = do
288288 let contents = case items of
289289 [_, CodeBlock _ _] -> concat bs
290290 _ -> vcat bs
291− indent <- stIndent <$> ask
292− backSlash <- stBackSlashLB <$> ask
291+ indent <- asks stIndent
292+ backSlash <- asks stBackSlashLB
293293 let indent' = if backSlash then drop 2 indent else indent
294294 return $ indent' ++ "* " ++ contents
295295
@@ -298,12 +298,12 @@ listItemToDokuWiki opts items = do
298298orderedListItemToDokuWiki :: PandocMonad m => WriterOptions -> [Block] -> DokuWiki m String
299299orderedListItemToDokuWiki opts items = do
300300 contents <- blockListToDokuWiki opts items
301− useTags <- stUseTags <$> ask
301+ useTags <- asks stUseTags
302302 if useTags
303303 then return $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>"
304304 else do
305− indent <- stIndent <$> ask
306− backSlash <- stBackSlashLB <$> ask
305+ indent <- asks stIndent
306+ backSlash <- asks stBackSlashLB
307307 let indent' = if backSlash then drop 2 indent else indent
308308 return $ indent' ++ "- " ++ contents
309309
@@ -315,13 +315,13 @@ definitionListItemToDokuWiki :: PandocMonad m
315315definitionListItemToDokuWiki opts (label, items) = do
316316 labelText <- inlineListToDokuWiki opts label
317317 contents <- mapM (blockListToDokuWiki opts) items
318− useTags <- stUseTags <$> ask
318+ useTags <- asks stUseTags
319319 if useTags
320320 then return $ "<HTML><dt></HTML>" ++ labelText ++ "<HTML></dt></HTML>\n" ++
321321 intercalate "\n" (map (\d -> "<HTML><dd></HTML>" ++ d ++ "<HTML></dd></HTML>") contents)
322322 else do
323− indent <- stIndent <$> ask
324− backSlash <- stBackSlashLB <$> ask
323+ indent <- asks stIndent
324+ backSlash <- asks stBackSlashLB
325325 let indent' = if backSlash then drop 2 indent else indent
326326 return $ indent' ++ "* **" ++ labelText ++ "** " ++ concat contents
327327
@@ -403,7 +403,7 @@ blockListToDokuWiki :: PandocMonad m
403403 -> [Block] -- ^ List of block elements
404404 -> DokuWiki m String
405405blockListToDokuWiki opts blocks = do
406− backSlash <- stBackSlashLB <$> ask
406+ backSlash <- asks stBackSlashLB
407407 let blocks' = consolidateRawBlocks blocks
408408 if backSlash
409409 then backSlashLineBreaks <$> mapM (blockToDokuWiki opts) blocks'
@@ -486,7 +486,7 @@ inlineToDokuWiki _ il@(RawInline f str)
486486 | otherwise = "" <$ report (InlineNotRendered il)
487487
488488inlineToDokuWiki _ LineBreak = do
489− backSlash <- stBackSlashLB <$> ask
489+ backSlash <- asks stBackSlashLB
490490 return $ if backSlash
491491 then "\n"
492492 else "\\\\\n"
src/Text/Pandoc/Writers/ODT.hs+1−2
@@ -51,11 +51,10 @@ import Text.Pandoc.MIME (extensionFromMimeType, getMimeType)
5151import Text.Pandoc.Options (WrapOption (..), WriterOptions (..))
5252import Text.Pandoc.Pretty
5353import Text.Pandoc.Shared (stringify, normalizeDate)
54−import Text.Pandoc.Writers.Shared (lookupMetaString)
54+import Text.Pandoc.Writers.Shared (lookupMetaString, fixDisplayMath)
5555import Text.Pandoc.UTF8 (fromStringLazy, fromTextLazy, toStringLazy)
5656import Text.Pandoc.Walk
5757import Text.Pandoc.Writers.OpenDocument (writeOpenDocument)
58−import Text.Pandoc.Writers.Shared (fixDisplayMath)
5958import Text.Pandoc.XML
6059import Text.TeXMath
6160import Text.XML.Light
src/Text/Pandoc/XML.hs+1−2
@@ -42,10 +42,9 @@ import Prelude
4242import Data.Char (isAscii, isSpace, ord)
4343import Data.Text (Text)
4444import qualified Data.Text as T
45−import Text.HTML.TagSoup.Entity (lookupEntity)
45+import Text.HTML.TagSoup.Entity (lookupEntity, htmlEntities)
4646import Text.Pandoc.Pretty
4747import qualified Data.Map as M
48−import Text.HTML.TagSoup.Entity (htmlEntities)
4948
5049-- | Escape one character as needed for XML.
5150escapeCharForXML :: Char -> String