breakSentence xs =
  let isSentenceEndInline (Str ".") = True
      isSentenceEndInline (Str "?") = True
      isSentenceEndInline _         = False
      (as, bs) = break isSentenceEndInline xs
  in  case bs of
           []             -> (as, [])
           [c]            -> (as ++ [c], [])
           (c:Space:cs)   -> (as ++ [c], cs)
           (Str ".":Str ")":cs) -> (as ++ [Str ".", Str ")"], cs)
           (c:cs)         -> (as ++ [c] ++ ds, es)
              where (ds, es) = breakSentence cs

-- | Split a list of inlines into sentences.
breakSentence xs =
  let isSentenceEndInline (Str ".") = True
      isSentenceEndInline (Str "?") = True
      isSentenceEndInline _         = False
      (as, bs) = break isSentenceEndInline xs
  in  case bs of
           []             -> (as, [])
           [c]            -> (as ++ [c], [])
           (c:Space:cs)   -> (as ++ [c], cs)
           (Str ".":Str ")":cs) -> (as ++ [Str ".", Str ")"], cs)
           (c:cs)         -> (as ++ [c] ++ ds, es)
              where (ds, es) = breakSentence cs

-- | Split a list of inlines into sentences.
breakSentence xs =
  let isSentenceEndInline (Str ".") = True
      isSentenceEndInline (Str "?") = True
      isSentenceEndInline _         = False
      (as, bs) = break isSentenceEndInline xs
  in  case bs of
           []             -> (as, [])
           [c]            -> (as ++ [c], [])
           (c:Space:cs)   -> (as ++ [c], cs)
           (Str ".":Str ")":cs) -> (as ++ [Str ".", Str ")"], cs)
           (c:cs)         -> (as ++ [c] ++ ds, es)
              where (ds, es) = breakSentence cs

-- | Split a list of inlines into sentences.