module Data.OrgMode.Parse.Attoparsec.Document
( parseDocument
)
where
import Control.Applicative ((<$>), (<*>))
import Data.Attoparsec.Text
import Data.Attoparsec.Types as Attoparsec
import Data.Text (Text)
import qualified Data.Text as Text
import Data.OrgMode.Parse.Attoparsec.Headline
import qualified Data.OrgMode.Parse.Attoparsec.Util as Util
import Data.OrgMode.Types
parseDocument :: [Text] -> Attoparsec.Parser Text Document
parseDocument otherKeywords =
Document
<$> (Text.unlines <$> many' Util.nonHeadline)
<*> many' (headlineBelowDepth otherKeywords 0)