aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander <ilabdsf@gmail.com>2019-01-01 08:41:21 +0300
committerJohn MacFarlane <jgm@berkeley.edu>2018-12-31 21:41:21 -0800
commit792f18a7fa64773f7d8466740f8da5e434c2da4f (patch)
treeb732d46ac8023872e42a0b94e4c05d7e44812c2d /src
parentffc2192caffd101666dd6c793631798d7f22878f (diff)
downloadpandoc-792f18a7fa64773f7d8466740f8da5e434c2da4f.tar.gz
Remove unused HasHeaderMap (#5175)
It is updated by some readers, but never actually used.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Parsing.hs17
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs7
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Parsing.hs6
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs7
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs6
-rw-r--r--src/Text/Pandoc/Readers/Org/ParserState.hs10
-rw-r--r--src/Text/Pandoc/Readers/RST.hs1
7 files changed, 4 insertions, 50 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 20c9bdb9b..bc4985168 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -93,7 +93,6 @@ module Text.Pandoc.Parsing ( takeWhileP,
reportLogMessages,
ParserState (..),
HasReaderOptions (..),
- HasHeaderMap (..),
HasIdentifierList (..),
HasMacros (..),
HasLogMessages (..),
@@ -1079,7 +1078,6 @@ data ParserState = ParserState
stateMeta' :: F Meta, -- ^ Document metadata
stateCitations :: M.Map String String, -- ^ RST-style citations
stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
- stateHeaders :: M.Map Inlines String, -- ^ List of headers and ids (used for implicit ref links)
stateIdentifiers :: Set.Set String, -- ^ Header identifiers used
stateNextExample :: Int, -- ^ Number of next example
stateExamples :: M.Map String Int, -- ^ Map from example labels to numbers
@@ -1129,15 +1127,6 @@ instance Monad m => HasQuoteContext ParserState m where
setState newState { stateQuoteContext = oldQuoteContext }
return result
-class HasHeaderMap st where
- extractHeaderMap :: st -> M.Map Inlines String
- updateHeaderMap :: (M.Map Inlines String -> M.Map Inlines String) ->
- st -> st
-
-instance HasHeaderMap ParserState where
- extractHeaderMap = stateHeaders
- updateHeaderMap f st = st{ stateHeaders = f $ stateHeaders st }
-
class HasIdentifierList st where
extractIdentifierList :: st -> Set.Set String
updateIdentifierList :: (Set.Set String -> Set.Set String) -> st -> st
@@ -1198,7 +1187,6 @@ defaultParserState =
stateMeta' = return nullMeta,
stateCitations = M.empty,
stateHeaderTable = [],
- stateHeaders = M.empty,
stateIdentifiers = Set.empty,
stateNextExample = 1,
stateExamples = M.empty,
@@ -1283,12 +1271,11 @@ type SubstTable = M.Map Key Inlines
-- is encountered that duplicates an earlier identifier
-- (explicit or automatically generated).
registerHeader :: (Stream s m a, HasReaderOptions st,
- HasHeaderMap st, HasLogMessages st, HasIdentifierList st)
+ HasLogMessages st, HasIdentifierList st)
=> Attr -> Inlines -> ParserT s st m Attr
registerHeader (ident,classes,kvs) header' = do
ids <- extractIdentifierList <$> getState
exts <- getOption readerExtensions
- let insert' = M.insertWith (\_new old -> old)
if null ident && Ext_auto_identifiers `extensionEnabled` exts
then do
let id' = uniqueIdent exts (B.toList header') ids
@@ -1297,7 +1284,6 @@ registerHeader (ident,classes,kvs) header' = do
else id'
updateState $ updateIdentifierList $ Set.insert id'
updateState $ updateIdentifierList $ Set.insert id''
- updateState $ updateHeaderMap $ insert' header' id'
return (id'',classes,kvs)
else do
unless (null ident) $ do
@@ -1305,7 +1291,6 @@ registerHeader (ident,classes,kvs) header' = do
pos <- getPosition
logMessage $ DuplicateIdentifier ident pos
updateState $ updateIdentifierList $ Set.insert ident
- updateState $ updateHeaderMap $ insert' header' ident
return (ident,classes,kvs)
smartPunctuation :: (HasReaderOptions st, HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index b27840eb5..8d3c1abb4 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -105,7 +105,7 @@ readHtml opts inp = do
result <- flip runReaderT def $
runParserT parseDoc
(HTMLState def{ stateOptions = opts }
- [] Nothing Set.empty M.empty [] M.empty)
+ [] Nothing Set.empty [] M.empty)
"source" tags
case result of
Right doc -> return doc
@@ -126,7 +126,6 @@ data HTMLState =
noteTable :: [(String, Blocks)],
baseHref :: Maybe URI,
identifiers :: Set.Set String,
- headerMap :: M.Map Inlines String,
logMessages :: [LogMessage],
macros :: M.Map Text Macro
}
@@ -1295,10 +1294,6 @@ instance HasIdentifierList HTMLState where
extractIdentifierList = identifiers
updateIdentifierList f s = s{ identifiers = f (identifiers s) }
-instance HasHeaderMap HTMLState where
- extractHeaderMap = headerMap
- updateHeaderMap f s = s{ headerMap = f (headerMap s) }
-
instance HasLogMessages HTMLState where
addLogMessage m s = s{ logMessages = m : logMessages s }
getLogMessages = reverse . logMessages
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
index c5385bedc..9437c23d9 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -131,7 +131,6 @@ data LaTeXState = LaTeXState{ sOptions :: ReaderOptions
, sQuoteContext :: QuoteContext
, sMacros :: M.Map Text Macro
, sContainers :: [String]
- , sHeaders :: M.Map Inlines String
, sLogMessages :: [LogMessage]
, sIdentifiers :: Set.Set String
, sVerbatimMode :: Bool
@@ -153,7 +152,6 @@ defaultLaTeXState = LaTeXState{ sOptions = def
, sQuoteContext = NoQuote
, sMacros = M.empty
, sContainers = []
- , sHeaders = M.empty
, sLogMessages = []
, sIdentifiers = Set.empty
, sVerbatimMode = False
@@ -192,10 +190,6 @@ instance HasIncludeFiles LaTeXState where
addIncludeFile f s = s{ sContainers = f : sContainers s }
dropLatestIncludeFile s = s { sContainers = drop 1 $ sContainers s }
-instance HasHeaderMap LaTeXState where
- extractHeaderMap = sHeaders
- updateHeaderMap f st = st{ sHeaders = f $ sHeaders st }
-
instance HasMacros LaTeXState where
extractMacros st = sMacros st
updateMacros f st = st{ sMacros = f (sMacros st) }
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index ff66da0b2..c7a3bcfc7 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -43,7 +43,6 @@ import Control.Monad.Except (throwError)
import Data.Char (isDigit, isSpace)
import qualified Data.Foldable as F
import Data.List (intercalate, intersperse, isPrefixOf)
-import qualified Data.Map as M
import Data.Maybe (fromMaybe, maybeToList)
import Data.Sequence (ViewL (..), viewl, (<|))
import qualified Data.Set as Set
@@ -72,7 +71,6 @@ readMediaWiki opts s = do
, mwMaxNestingLevel = 4
, mwNextLinkNumber = 1
, mwCategoryLinks = []
- , mwHeaderMap = M.empty
, mwIdentifierList = Set.empty
, mwLogMessages = []
, mwInTT = False
@@ -86,7 +84,6 @@ data MWState = MWState { mwOptions :: ReaderOptions
, mwMaxNestingLevel :: Int
, mwNextLinkNumber :: Int
, mwCategoryLinks :: [Inlines]
- , mwHeaderMap :: M.Map Inlines String
, mwIdentifierList :: Set.Set String
, mwLogMessages :: [LogMessage]
, mwInTT :: Bool
@@ -97,10 +94,6 @@ type MWParser m = ParserT [Char] MWState m
instance HasReaderOptions MWState where
extractReaderOptions = mwOptions
-instance HasHeaderMap MWState where
- extractHeaderMap = mwHeaderMap
- updateHeaderMap f st = st{ mwHeaderMap = f $ mwHeaderMap st }
-
instance HasIdentifierList MWState where
extractIdentifierList = mwIdentifierList
updateIdentifierList f st = st{ mwIdentifierList = f $ mwIdentifierList st }
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 70cd47b58..42d9b539b 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -74,7 +74,6 @@ type F = Future MuseState
data MuseState = MuseState { museMeta :: F Meta -- ^ Document metadata
, museOptions :: ReaderOptions
- , museHeaders :: M.Map Inlines String -- ^ List of headers and ids (used for implicit ref links)
, museIdentifierList :: Set.Set String
, museLastSpacePos :: Maybe SourcePos -- ^ Position after last space or newline parsed
, museLastStrPos :: Maybe SourcePos -- ^ Position after last str parsed
@@ -85,7 +84,6 @@ data MuseState = MuseState { museMeta :: F Meta -- ^ Document metadata
instance Default MuseState where
def = MuseState { museMeta = return nullMeta
, museOptions = def
- , museHeaders = M.empty
, museIdentifierList = Set.empty
, museLastStrPos = Nothing
, museLastSpacePos = Nothing
@@ -108,10 +106,6 @@ type MuseParser m = ParserT Text MuseState (ReaderT MuseEnv m)
instance HasReaderOptions MuseState where
extractReaderOptions = museOptions
-instance HasHeaderMap MuseState where
- extractHeaderMap = museHeaders
- updateHeaderMap f st = st{ museHeaders = f $ museHeaders st }
-
instance HasIdentifierList MuseState where
extractIdentifierList = museIdentifierList
updateIdentifierList f st = st{ museIdentifierList = f $ museIdentifierList st }
diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs
index 59478256f..d57b848da 100644
--- a/src/Text/Pandoc/Readers/Org/ParserState.hs
+++ b/src/Text/Pandoc/Readers/Org/ParserState.hs
@@ -64,11 +64,11 @@ import qualified Data.Map as M
import qualified Data.Set as Set
import Data.Text (Text)
-import Text.Pandoc.Builder (Blocks, Inlines)
+import Text.Pandoc.Builder (Blocks)
import Text.Pandoc.Definition (Meta (..), nullMeta)
import Text.Pandoc.Logging
import Text.Pandoc.Options (ReaderOptions (..))
-import Text.Pandoc.Parsing (Future, HasHeaderMap (..), HasIdentifierList (..),
+import Text.Pandoc.Parsing (Future, HasIdentifierList (..),
HasIncludeFiles (..), HasLastStrPosition (..),
HasLogMessages (..), HasMacros (..),
HasQuoteContext (..), HasReaderOptions (..),
@@ -120,7 +120,6 @@ data OrgParserState = OrgParserState
, orgStateExcludedTags :: Set.Set Tag
, orgStateExcludedTagsChanged :: Bool
, orgStateExportSettings :: ExportSettings
- , orgStateHeaderMap :: M.Map Inlines String
, orgStateIdentifiers :: Set.Set String
, orgStateIncludeFiles :: [String]
, orgStateLastForbiddenCharPos :: Maybe SourcePos
@@ -160,10 +159,6 @@ instance HasIdentifierList OrgParserState where
extractIdentifierList = orgStateIdentifiers
updateIdentifierList f s = s{ orgStateIdentifiers = f (orgStateIdentifiers s) }
-instance HasHeaderMap OrgParserState where
- extractHeaderMap = orgStateHeaderMap
- updateHeaderMap f s = s{ orgStateHeaderMap = f (orgStateHeaderMap s) }
-
instance HasLogMessages OrgParserState where
addLogMessage msg st = st{ orgLogMessages = msg : orgLogMessages st }
getLogMessages st = reverse $ orgLogMessages st
@@ -191,7 +186,6 @@ defaultOrgParserState = OrgParserState
, orgStateExportSettings = def
, orgStateExcludedTags = Set.singleton $ Tag "noexport"
, orgStateExcludedTagsChanged = False
- , orgStateHeaderMap = M.empty
, orgStateIdentifiers = Set.empty
, orgStateIncludeFiles = []
, orgStateLastForbiddenCharPos = Nothing
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 1938ca171..c14628c70 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -179,7 +179,6 @@ parseRST = do
st' <- getState
let reversedNotes = stateNotes st'
updateState $ \s -> s { stateNotes = reverse reversedNotes
- , stateHeaders = mempty
, stateIdentifiers = mempty }
-- now parse it for real...
blocks <- B.toList <$> parseBlocks