diff --git a/README.org b/README.org index 44e48b4..ed6bcee 100644 --- a/README.org +++ b/README.org @@ -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 diff --git a/app/Main.hs b/app/Main.hs index 20e5402..6655efb 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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 ] diff --git a/example text.org b/example text.org new file mode 100644 index 0000000..7cb2e50 --- /dev/null +++ b/example text.org @@ -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