forked from elland/haddock2
Init
This commit is contained in:
commit
c9f61c4e06
16 changed files with 1366 additions and 0 deletions
34
test/Spec.hs
Normal file
34
test/Spec.hs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||
|
||||
import Test.Hspec
|
||||
|
||||
import Data.String (IsString (..))
|
||||
import Data.Text (Text)
|
||||
|
||||
import Identifier (Identifier)
|
||||
import Lexer
|
||||
import Parser
|
||||
import Types
|
||||
|
||||
main :: IO ()
|
||||
main = hspec $ do
|
||||
describe "Lexer" do
|
||||
it "lexes" do
|
||||
lexer "This is string" `shouldBe` undefined
|
||||
describe "Parser" do
|
||||
it "Bold" do
|
||||
"__bold__" `shouldParseTo` (DocBold (DocString "bold"))
|
||||
it "Emphasis" do
|
||||
"/emphasis/" `shouldParseTo` (DocEmphasis (DocString "emphasis"))
|
||||
|
||||
shouldParseTo :: Text -> DocMarkup mod Identifier -> Expectation
|
||||
shouldParseTo input ast = parseText input `shouldBe` ast
|
||||
|
||||
type Doc id = DocMarkup () id
|
||||
|
||||
instance IsString (Doc String) where
|
||||
fromString = DocString
|
||||
|
||||
file :: IO String
|
||||
file = readFile "test/markup.md"
|
||||
89
test/markup.md
Normal file
89
test/markup.md
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/emphasized text/
|
||||
|
||||
__bold text__
|
||||
|
||||
@monospace text@
|
||||
|
||||
"Module.Name"
|
||||
"Module.Name#anchor"
|
||||
"Module.Name#anchor"
|
||||
|
||||
[http://example.com](http://example.com)
|
||||
<[http://example.com](http://example.com) label text>
|
||||
|
||||
[http://example.com](http://example.com)
|
||||
[https://example.com](https://example.com)
|
||||
ftp\://example.com
|
||||
|
||||
[link text](http://example.com)
|
||||
[link text]("Module.Name")
|
||||
|
||||
#anchor-name#
|
||||
|
||||
'identifier'
|
||||
|
||||
<<image.png>>
|
||||
<<image.png title text>>
|
||||
|
||||

|
||||
|
||||
\(mathematical expression\)
|
||||
\[mathematical expression\]
|
||||
|
||||
@
|
||||
code block content
|
||||
with multiple lines
|
||||
@
|
||||
|
||||
> code line 1
|
||||
> code line 2
|
||||
|
||||
>>> expression
|
||||
result line 1
|
||||
result line 2
|
||||
|
||||
>>> another expression
|
||||
result
|
||||
|
||||
prop> property description
|
||||
|
||||
* item 1
|
||||
* item 2
|
||||
continued content
|
||||
|
||||
- item 1
|
||||
- item 2
|
||||
|
||||
1. item 1
|
||||
2. item 2
|
||||
|
||||
(1) item 1
|
||||
(2) item 2
|
||||
|
||||
[term] definition content
|
||||
[another term] more definition content
|
||||
|
||||
+----------+----------+
|
||||
| Header 1 | Header 2 |
|
||||
+==========+==========+
|
||||
| Cell 1 | Cell 2 |
|
||||
+----------+----------+
|
||||
| Cell 3 | Cell 4 |
|
||||
+----------+----------+
|
||||
|
||||
= Level 1 Header
|
||||
== Level 2 Header
|
||||
=== Level 3 Header
|
||||
==== Level 4 Header
|
||||
===== Level 5 Header
|
||||
====== Level 6 Header
|
||||
|
||||
@since package-name-1.2.3
|
||||
@since 1.2.3
|
||||
|
||||
A (decimal)
|
||||
A (hexadecimal)
|
||||
A (hexadecimal)
|
||||
|
||||
|
||||
This \@escapes\@ at signs
|
||||
Loading…
Add table
Add a link
Reference in a new issue