A peer-to-peer stack for code collaboration
Render reference to RST instead. (#183)
James Haydonbca46f22a406
diff --git a/docs/source/index.rst b/docs/source/index.rstindex c2f4db8..9b28b3a 100644--- a/docs/source/index.rst+++ b/docs/source/index.rst@@ -13,7 +13,7 @@ radicleguide/GettingStarted.rstguide/Basics.lradguide/Chains.lrad- reference.md+ reference.rstdiff --git a/exe/ReferenceDoc.hs b/exe/ReferenceDoc.hsindex 7f4c553..fa2804e 100644--- a/exe/ReferenceDoc.hs+++ b/exe/ReferenceDoc.hs@@ -6,17 +6,18 @@ module ReferenceDoc whereimport Protolude+import qualified Data.Default as Defaultimport Data.Listimport qualified Data.Map.Strict as Map-import Data.String.Interpolateimport qualified Data.Text as Timport qualified GHC.Exts as GhcExtsimport Radicleimport Radicle.Internal.Doc (md)-import qualified Radicle.Internal.Doc as Docimport System.Console.Haskeline (defaultSettings, runInputT)+import Text.Pandoc-main :: IO ()+main ::+ IO ()main = dores_ <- runInputT defaultSettings $interpret@@ -30,14 +31,20 @@ main = docheckAllDocumented undocdlet e = Map.fromList [ (fromIdent iden, d) | (iden, Just d, _) <- vars ]checkAllInReference e- d <- Doc.cleanupPandocMd (doc e) `lPanic` "Invalid markdown."- writeFile "docs/source/reference.md" d+ rst <- runPure (writeRST Default.def $ Pandoc nullMeta (doc e)) `lPanic` "Couldn't generate RST"+ writeFile "docs/source/reference.rst" rstwheredoc e =- let sec (tit :: Text) fns p = toS [i|## #{tit}\n\n#{p}\n\n#{funs e fns}|] in- T.intercalate "\n\n"- [ "# Radicle reference"- , "These are the functions that are available in a new radicle chain after the prelude has been loaded."+ let sec tit fns p =+ [ Header 2 nullAttr (inlinePandoc tit)+ , Para (inlinePandoc p)+ ] ++ funs e fns in+ mconcat+ [ [ Header 1 nullAttr (inlinePandoc "Radicle Reference") ]+ , [ Para $ inlinePandoc $+ "These are the functions that are available in a new radicle chain after"+ <> " the prelude has been loaded."+ ], sec "Basics" basics"Basic function used for checking equality, determining the type of a value, etc.", sec "Numerical functions" maths "Operations on numbers."@@ -102,7 +109,10 @@ main = do++ doNotInclude-- Function symbol followed by a hard line break, followed by it's doc.- funs e fns = T.intercalate "\n\n\n" $ [ toS [i|`#{f}` \n#{getDoc e f}|] | f <- fns ]+ funs e fns = mconcat+ [ [ Header 3 nullAttr [Code nullAttr (toS f) ]+ , Para (inlinePandoc (getDoc e f)) ]+ | f <- fns ]getDoc e f = case Map.lookup f e ofJust d -> d@@ -120,3 +130,8 @@ main = dolPanic (Left _) m = panic mlPanic (Right r) _ = pure r++ inlinePandoc t = case runPure (readMarkdown Default.def t) of+ Right (Pandoc _ [Para is]) -> is+ Right _ -> panic $ "Expecting inline markdown but got blocks: " <> t+ Left err -> panic $ "Invalid markdown: " <> show errdiff --git a/package.yaml b/package.yamlindex 2e19ea1..bf1e5a4 100644--- a/package.yaml+++ b/package.yaml@@ -32,7 +32,6 @@ dependencies:- generics-eot- uuid- data-default-- pandoc-types- pandocwhen:- condition: impl(ghcjs)@@ -169,7 +168,8 @@ executables:buildable: falsedependencies:- radicle- - interpolate+ - pandoc+ - data-defaultghc-options: -main-is ReferenceDocdefault-extensions: