module Data.OrgMode.Parse.Attoparsec.Section where
import Data.Attoparsec.Text (many', option, skipSpace)
import Data.Attoparsec.Types as Attoparsec
import Data.Monoid ()
import Data.OrgMode.Parse.Attoparsec.Drawer
import Data.OrgMode.Parse.Attoparsec.Time
import qualified Data.OrgMode.Parse.Attoparsec.Util as Util
import Data.Text (Text)
import qualified Data.Text as Text
import Data.OrgMode.Types
parseSection :: Attoparsec.Parser Text Section
parseSection =
Section
<$> option Nothing (Just <$> (skipSpace *> parseTimestamp <* skipSpace))
<*> (Plns <$> parsePlannings)
<*> many' parseClock
<*> option mempty parseProperties
<*> option mempty parseLogbook
<*> many' parseDrawer
<*> (Text.unlines <$> many' Util.nonHeadline)