Copyright | © 2014 Parnell Springmeyer |
---|---|
License | All Rights Reserved |
Maintainer | Parnell Springmeyer <parnell@digitalmentat.com> |
Stability | stable |
Safe Haskell | None |
Language | Haskell2010 |
Parsing combinators for org-mode active and inactive timestamps.
- parsePlannings :: Parser Text (HashMap PlanningKeyword Timestamp)
- parseClock :: Parser Text (Maybe Timestamp, Maybe Duration)
- parseTimestamp :: Parser Text Timestamp
- type Weekday = Text
- data BracketedDateTime = BracketedDateTime {}
- parseBracketedDateTime :: Parser Text BracketedDateTime
- transformBracketedDateTime :: BracketedDateTime -> (DateTime, Maybe (Hours, Minutes), Bool)
- parseDay :: Parser Text Text
- type AbsoluteTime = (Hours, Minutes)
- type TimestampRange = (AbsoluteTime, AbsoluteTime)
- newtype TimePart = TimePart (Either AbsoluteTime TimestampRange)
- parseTime' :: Parser Text TimePart
- parseDate :: Parser Text YearMonthDay
- parseHM :: Parser Text (Hours, Minutes)
- parseTimeUnit :: Parser Text TimeUnit
- parseRepeater :: Parser Text Repeater
- parseDelay :: Parser Text Delay
Documentation
parsePlannings :: Parser Text (HashMap PlanningKeyword Timestamp) Source
Parse a planning line.
Plannings inhabit a heading section and are formatted as a keyword and a timestamp. There can be more than one, but they are all on the same line e.g:
DEADLINE: <2015-05-10 17:00> CLOSED: <2015-04-1612:00>
parseClock :: Parser Text (Maybe Timestamp, Maybe Duration) Source
Parse a clock line.
A heading's section contains one line per clock entry. Clocks may have a timestamp, a duration, both, or neither e.g.:
CLOCK: [2014-12-10 Fri 2:30]--[2014-12-10 Fri 10:30] => 08:00
parseTimestamp :: Parser Text Timestamp Source
Parse a timestamp.
Timestamps may be timepoints or timeranges, and they indicate whether they are active or closed by using angle or square brackets respectively.
Time ranges are formatted by infixing two timepoints with a double
hyphen, --
; or, by appending two hh:mm
timestamps together in a
single timepoint with one hyphen -
.
Each timepoint includes an optional repeater flag and an optional delay flag.
parseBracketedDateTime :: Parser Text BracketedDateTime Source
Parse a single time part.
[2015-03-27 Fri 10:20 +4h]
Returns:
- The basic timestamp
- Whether there was a time interval in place of a single time (this will be handled upstream by parseTimestamp)
- Whether the time is active or inactive
transformBracketedDateTime :: BracketedDateTime -> (DateTime, Maybe (Hours, Minutes), Bool) Source
type AbsoluteTime = (Hours, Minutes) Source
type TimestampRange = (AbsoluteTime, AbsoluteTime) Source
parseTime' :: Parser Text TimePart Source
Parse the time-of-day part of a time part, as a single point or a time range.
parseDate :: Parser Text YearMonthDay Source
Parse the YYYY-MM-DD part of a time part.
parseTimeUnit :: Parser Text TimeUnit Source
Parse the Timeunit part of a delay or repeater flag.
parseRepeater :: Parser Text Repeater Source
Parse a repeater flag, e.g. .+4w
, or ++1y
.
parseDelay :: Parser Text Delay Source
Parse a delay flag, e.g. --1d
or -2w
.