Added beginnings of Parse module
Getty Ritter
9 years ago
| 1 | module Text.Pandoc.Parse where | |
| 2 | ||
| 3 | import Data.Text (Text) | |
| 4 | import qualified Data.Text as T | |
| 5 | ||
| 6 | import Text.Pandoc.Types | |
| 7 | ||
| 8 | pNewline :: [Text] -> [Element] | |
| 9 | pNewline [] = [] | |
| 10 | pNewline (t:ts) | |
| 11 | -- First let's look for all the forced lines: | |
| 12 | -- Actions can be forced by ! | |
| 13 | | "!" `T.isPrefixOf` t = [] | |
| 14 | -- Characters can be forced by @ | |
| 15 | | "@" `T.isPrefixOf` t = [] | |
| 16 | -- Headers can be forced by a dot, but not by two | |
| 17 | | "." `T.isPrefixOf` t && | |
| 18 | not (".." `T.isPrefixOf` t) = [] | |
| 19 | -- Lyrics are always forced by a ~ | |
| 20 | | "~" `T.isPrefixOf` t = [] | |
| 21 | -- Transitions are forced by a > | |
| 22 | | ">" `T.isPrefixOf` t && | |
| 23 | not ("<" `T.isSuffixOf` t) = [] |