Skip to content

Commit

Permalink
Docs at least functional
Browse files Browse the repository at this point in the history
  • Loading branch information
liamoc committed Oct 24, 2015
1 parent b1c1716 commit e95e7be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dixi/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ readers = [ ("native" , const readNative)
, ("docbook" , readDocBook)
, ("opml" , readOPML)
, ("org" , readOrg)
, ("textile" , readTextile)
, ("textile" , readTextile)
, ("html" , readHtml)
, ("latex" , readLaTeX)
, ("haddock" , readHaddock)
Expand Down
22 changes: 19 additions & 3 deletions api-docs/Docs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
import Data.Proxy
import Data.Patch(HunkStatus (..))
import Dixi.API
import Dixi.Forms()
import Dixi.Markup()
Expand All @@ -17,6 +18,7 @@ import Dixi.Page
import Data.Time
import Data.Monoid
import Control.Lens
import qualified Data.Vector as V
import Text.Hamlet

instance ToSample RevReq RevReq where
Expand All @@ -30,11 +32,25 @@ instance ToSample PrettyPage PrettyPage where
(Last (Just "An optional comment"))
(Last (Just (UTCTime (ModifiedJulianDay 0) 0)))
instance ToSample NewBody NewBody where
toSample _ = Nothing
toSample _ = Just $ NB "Some new content, in input format (e.g org mode)" (Just "An optional comment")

instance ToSample History History where
toSample _ = Nothing
toSample _ = Just $ H defaultRenders "Page_Title"
[ Page (4, 9, 14) (Last (Just "Change 1")) (Last (Just (UTCTime (ModifiedJulianDay 0) 0)))
, Page (12, 3, 1) (Last (Just "Change 2")) (Last (Just (UTCTime (ModifiedJulianDay 1) 0)))
, Page (12, 0, 0) (Last (Just "Change 3")) (Last (Just (UTCTime (ModifiedJulianDay 2) 0)))
]

instance ToSample DiffPage DiffPage where
toSample _ = Nothing
toSample _ = Just $ DP defaultRenders "Page_Title" 5 7
(Page [ (V.fromList "This is the ", Unchanged)
, (V.fromList "new", Replaced)
, (V.fromList "ginal", Deleted)
, (V.fromList " document.", Unchanged)
]
(Last (Just "An optional comment"))
(Last (Just (UTCTime (ModifiedJulianDay 0) 0))))

instance ToParam (QueryParam "from" Int) where
toParam _ = DocQueryParam "from" [] "Version to diff from, starting from 0 to N-1" Normal
instance ToParam (QueryParam "to" Int) where
Expand Down
2 changes: 2 additions & 0 deletions dixi.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ test-suite api-docs
, time >= 1.4 && < 1.6
, lens >= 4.7 && < 4.14
, shakespeare >= 2.0 && < 2.1
, vector >= 0.10 && <0.12
, patches-vector >= 0.1.2 && < 0.2
default-language: Haskell2010

0 comments on commit e95e7be

Please sign in to comment.