summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-08 23:18:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-08 23:18:19 -0700
commitdfa4b76630837560189844eb79c83abcb619b0f6 (patch)
tree5b7c1f288b16367fcfef56c7b47051098c56da6a /src/Text/Pandoc/Options.hs
parent34f1f9716b620e3c50b7298abb6a78055d300ae8 (diff)
Changes to literate haskell options.
- Removed writerLiterateHaskell from WriterOptions. - Removed readerLiterateHaskell from ReaderOptions. - Added Ext_literate_haskell to Extensions. Test for this instead of the above. - Removed failUnlessLHS from Shared. Note: At this point, +lhs and .lhs extension no longer has any effect. Need to fix.
Diffstat (limited to 'src/Text/Pandoc/Options.hs')
-rw-r--r--src/Text/Pandoc/Options.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index e3dc29215..01a171508 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -38,6 +38,7 @@ module Text.Pandoc.Options ( Extension(..)
, HTMLSlideVariant (..)
, WriterOptions (..)
, def
+ , isEnabled
) where
import Data.Set (Set)
import qualified Data.Set as Set
@@ -77,6 +78,7 @@ data Extension = Ext_footnotes
| Ext_superscript
| Ext_subscript
| Ext_hard_line_breaks
+ | Ext_literate_haskell
deriving (Show, Read, Enum, Eq, Ord, Bounded)
pandocExtensions :: Set Extension
@@ -128,7 +130,6 @@ data ReaderOptions = ReaderOptions{
, readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
-- in parsing dashes; -- is em-dash;
-- - before numerial is en-dash
- , readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
, readerCitations :: [String] -- ^ List of available citations
, readerApplyMacros :: Bool -- ^ Apply macros to TeX math
, readerIndentedCodeClasses :: [String] -- ^ Default classes for
@@ -145,7 +146,6 @@ instance Default ReaderOptions
, readerColumns = 80
, readerTabStop = 4
, readerOldDashes = False
- , readerLiterateHaskell = False
, readerCitations = []
, readerApplyMacros = True
, readerIndentedCodeClasses = []
@@ -201,7 +201,6 @@ data WriterOptions = WriterOptions
, writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
, writerWrapText :: Bool -- ^ Wrap text to line length
, writerColumns :: Int -- ^ Characters in a line (for text wrapping)
- , writerLiterateHaskell :: Bool -- ^ Write as literate haskell
, writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
, writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
, writerSourceDirectory :: FilePath -- ^ Directory path of 1st source file
@@ -240,7 +239,6 @@ instance Default WriterOptions where
, writerReferenceLinks = False
, writerWrapText = True
, writerColumns = 72
- , writerLiterateHaskell = False
, writerEmailObfuscation = JavascriptObfuscation
, writerIdentifierPrefix = ""
, writerSourceDirectory = "."
@@ -262,3 +260,6 @@ instance Default WriterOptions where
, writerReferenceDocx = Nothing
}
+-- | Returns True if the given extension is enabled.
+isEnabled :: Extension -> WriterOptions -> Bool
+isEnabled ext opts = ext `Set.member` (writerExtensions opts)