gdritter repos fountain / master Text / Fountain / Parse.hs
master

Tree @master (Download .tar.gz)

Parse.hs @masterraw · history · blame

module Text.Pandoc.Parse where

import           Data.Text (Text)
import qualified Data.Text as T

import           Text.Pandoc.Types

pNewline :: [Text] -> [Element]
pNewline [] = []
pNewline (t:ts)
  -- First let's look for all the forced lines:
  -- Actions can be forced by !
  | "!" `T.isPrefixOf` t = []
  -- Characters can be forced by @
  | "@" `T.isPrefixOf` t = []
  -- Headers can be forced by a dot, but not by two
  | "." `T.isPrefixOf` t &&
    not (".." `T.isPrefixOf` t) = []
  -- Lyrics are always forced by a ~
  | "~" `T.isPrefixOf` t = []
  -- Transitions are forced by a >
  | ">" `T.isPrefixOf` t &&
    not ("<" `T.isSuffixOf` t) = []