Added example, drops until first empty line, todo list

Drops the usually headers of the document until there is a empty line
This commit is contained in:
Pingu 2022-10-29 11:44:52 +02:00
parent 96180d8ffc
commit 2cd0d66bb3
3 changed files with 16 additions and 3 deletions

View File

@ -14,3 +14,7 @@ The name is pronounced like autumn.
| - | [*] | Needs a [LIST] around all |
| [[]] | [IMG][/IMG] or [VIDEO][/VIDEO] or [URL="link"][/URL] | Figure out what type of link it is |
| #+BEGIN #+END | [SPOILER][/SPOILER] | |
* Todo [0/2]
- [ ] Image or Video parser
- [ ] Properly support normal links

View File

@ -56,7 +56,7 @@ parseHelper parser x = case parse parser "" x of
Right text -> text
parseFile :: String -> Post
parseFile = Post . reduce . map (parseHelper fileParser) . lines
parseFile = Post . reduce . map (parseHelper fileParser) . dropWhile (/= "") . lines
fileParser :: Parser Info
fileParser =
@ -70,8 +70,8 @@ fileParser =
Image . URL <$> between (string' "[[") (string' "]]") (takeWhileP Nothing (/= ']')),
Video . URL <$> between (string' "[[") (string' "]]") (takeWhileP Nothing (/= ']')),
-- parseLink,
Spoiler . (: []) . Bread <$> (string' "+BEGIN" >> return ""),
Spoiler . (: []) . Bread <$> (string' "+END" >> return ""),
Spoiler . (: []) . Bread <$> (string' "#+BEGIN" >> return ""),
Spoiler . (: []) . Bread <$> (string' "#+END" >> return ""),
Bread <$> takeRest
]

9
example text.org Normal file
View File

@ -0,0 +1,9 @@
#+title: Example Text
* Hello there
- Zeus has been scummy
- Wisdom is just flopping around
#+Begin
[[https://media.discordapp.net/attachments/866979075360555033/1019126077542629436/Tumblr_l_204100096696723.jpg]]
#+end