aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-15 04:24:57 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-15 04:24:57 +0000
commit539b69b3e3b0c4ffee2323a8fe6239ebda4af48c (patch)
tree60fd3da78d1ffef0db0d8fdd7a588eceaea4adfa /spec
parentf7182fe913d3c31d9be2fd8e929072321620211d (diff)
downloadthermoprint-539b69b3e3b0c4ffee2323a8fe6239ebda4af48c.tar
thermoprint-539b69b3e3b0c4ffee2323a8fe6239ebda4af48c.tar.gz
thermoprint-539b69b3e3b0c4ffee2323a8fe6239ebda4af48c.tar.bz2
thermoprint-539b69b3e3b0c4ffee2323a8fe6239ebda4af48c.tar.xz
thermoprint-539b69b3e3b0c4ffee2323a8fe6239ebda4af48c.zip
predictive documentation
Diffstat (limited to 'spec')
-rw-r--r--spec/src/Thermoprint/Printout/BBCode.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/src/Thermoprint/Printout/BBCode.hs b/spec/src/Thermoprint/Printout/BBCode.hs
index f80f780..cee36b8 100644
--- a/spec/src/Thermoprint/Printout/BBCode.hs
+++ b/spec/src/Thermoprint/Printout/BBCode.hs
@@ -1,6 +1,7 @@
1{-# LANGUAGE OverloadedStrings #-} 1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE DeriveGeneric #-} 2{-# LANGUAGE DeriveGeneric #-}
3 3
4-- | Use 'Text.BBCode' to parse BBCode
4module Thermoprint.Printout.BBCode 5module Thermoprint.Printout.BBCode
5 ( bbcode 6 ( bbcode
6 , BBCodeError(..) 7 , BBCodeError(..)
@@ -14,6 +15,9 @@ import qualified Data.Text as T (unpack)
14import Data.Map (Map) 15import Data.Map (Map)
15import qualified Data.Map as Map (lookup) 16import qualified Data.Map as Map (lookup)
16 17
18import Data.Sequence (Seq)
19import qualified Data.Sequence as Seq ()
20
17import Data.CaseInsensitive (CI) 21import Data.CaseInsensitive (CI)
18import qualified Data.CaseInsensitive as CI 22import qualified Data.CaseInsensitive as CI
19 23
@@ -41,13 +45,14 @@ data BBCodeError = LexerError String -- ^ Error while parsing input to stream of
41 45
42instance Exception BBCodeError 46instance Exception BBCodeError
43 47
44data SemanticError = BlockTagInLineContext Text 48-- ^ An error ocurred while parsing the DOM-Forest (`['DomTree']`)
45 | UnmappedTag Text 49data SemanticError = UnmappedTag Text -- ^ An `Element` does not map to any structure in the context it occurred in
46 deriving (Show, Eq, Generic, Typeable) 50 deriving (Show, Eq, Generic, Typeable)
47 51
48instance Exception SemanticError 52instance Exception SemanticError
49 53
50bbcode :: Text -> Either BBCodeError Printout 54bbcode :: Text -> Either BBCodeError Printout
55-- ^ Parse BBCode
51bbcode = join . fmap (first SemanticError) . bimap morph' morph . Raw.bbcode 56bbcode = join . fmap (first SemanticError) . bimap morph' morph . Raw.bbcode
52 57
53morph' :: Raw.BBCodeError -> BBCodeError 58morph' :: Raw.BBCodeError -> BBCodeError