mirror of
https://github.com/flipstone/orville.git
synced 2024-07-14 15:30:32 +03:00
Fill out documentation sections with possible topics
This commit is contained in:
parent
2d92e721fb
commit
3a7772bbdd
@ -33,7 +33,9 @@ main {
|
||||
}
|
||||
|
||||
nav a {
|
||||
display: block;
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
a {
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Building SQL Expressions (Upcoming)
|
||||
navOrder: 2
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Fighting N+1 Queries with Plans (Upcoming)
|
||||
navOrder: 3
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: The MonadOrville Typeclass (Upcoming)
|
||||
navOrder: 1
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: How To Add Orville to Your Application Monad (Upcoming)
|
||||
navOrder: 1
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: How To Execute Raw SQL (Upcoming)
|
||||
navOrder: 4
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: How To Marshall a Haskell Record (Upcoming)
|
||||
navOrder: 2
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: How To Set Up An Auto-incrementing Id Column (Upcoming)
|
||||
navOrder: 3
|
||||
---
|
||||
|
||||
Coming Soon
|
@ -45,10 +45,29 @@ renderPandocInStyle =
|
||||
{ writerHighlightStyle = Just pandocCodeStyle
|
||||
})
|
||||
|
||||
data Section =
|
||||
Section
|
||||
{ sectionName :: String
|
||||
, sectionPattern :: Pattern
|
||||
}
|
||||
|
||||
sections :: [Section]
|
||||
sections =
|
||||
[ Section "tutorials" "tutorials/**"
|
||||
, Section "how-tos" "how-tos/**"
|
||||
, Section "explanations" "explanations/**"
|
||||
]
|
||||
|
||||
sectionFiles :: Pattern
|
||||
sectionFiles =
|
||||
foldr (.||.) (complement mempty) (map sectionPattern sections)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
hakyllWith config $ do
|
||||
snippetCache <- preprocess newSnippetCache
|
||||
let
|
||||
navContext = mkNavContext snippetCache
|
||||
|
||||
match "images/*" $ do
|
||||
route idRoute
|
||||
@ -65,34 +84,27 @@ main = do
|
||||
match "contact.md" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ pandocCompiler
|
||||
>>= applyDefaultLayout snippetCache defaultContext
|
||||
>>= applyDefaultLayout navContext defaultContext
|
||||
>>= relativizeUrls
|
||||
|
||||
let
|
||||
tutorialsRoute =
|
||||
composeRoutes
|
||||
(gsubRoute "tutorials/" (const ""))
|
||||
(setExtension "html")
|
||||
|
||||
match "tutorials/**" $ do
|
||||
route tutorialsRoute
|
||||
match sectionFiles $ do
|
||||
route (setExtension "html")
|
||||
compile $
|
||||
getResourceBody
|
||||
>>= applyAsTemplate (pageCtx snippetCache)
|
||||
>>= renderPandocInStyle
|
||||
>>= loadAndApplyTemplate "templates/post.html" (pageCtx snippetCache)
|
||||
>>= saveSnapshot navLinksSnapshot
|
||||
>>= applyDefaultLayout snippetCache (pageCtx snippetCache)
|
||||
>>= applyDefaultLayout navContext (pageCtx snippetCache)
|
||||
>>= relativizeUrls
|
||||
|
||||
match "index.md" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ do
|
||||
navContext <- loadNavContex snippetCache
|
||||
getResourceBody
|
||||
>>= applyAsTemplate (mconcat [navContext, pageCtx snippetCache])
|
||||
>>= renderPandocInStyle
|
||||
>>= applyDefaultLayout snippetCache defaultContext
|
||||
>>= applyDefaultLayout navContext defaultContext
|
||||
>>= relativizeUrls
|
||||
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
@ -110,15 +122,14 @@ main = do
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
applyDefaultLayout ::
|
||||
SnippetCache ->
|
||||
Context a ->
|
||||
Context a ->
|
||||
Item a ->
|
||||
Compiler (Item String)
|
||||
applyDefaultLayout snippetCache itemContext item = do
|
||||
navContext <- loadNavContex snippetCache
|
||||
applyDefaultLayout navContext itemContext item = do
|
||||
loadAndApplyTemplate
|
||||
"templates/default.html"
|
||||
(mappend navContext itemContext)
|
||||
(navContext <> itemContext)
|
||||
item
|
||||
|
||||
{- |
|
||||
@ -130,11 +141,18 @@ navLinksSnapshot :: String
|
||||
navLinksSnapshot =
|
||||
"navLinks"
|
||||
|
||||
loadNavContex :: SnippetCache -> Compiler (Context a)
|
||||
loadNavContex snippetCache = do
|
||||
tutorials <- inNavOrder =<< loadAllSnapshots "tutorials/*" navLinksSnapshot
|
||||
pure $
|
||||
listField "tutorials" (pageCtx snippetCache) (return tutorials)
|
||||
mkNavContext :: SnippetCache -> Context a
|
||||
mkNavContext snippetCache = do
|
||||
foldMap (sectionContext snippetCache) sections
|
||||
|
||||
sectionContext :: SnippetCache -> Section -> Context a
|
||||
sectionContext snippetCache section =
|
||||
listField (sectionName section) (pageCtx snippetCache) $
|
||||
inNavOrder =<<
|
||||
loadAllSnapshots
|
||||
(sectionPattern section)
|
||||
navLinksSnapshot
|
||||
|
||||
|
||||
inNavOrder :: (MonadMetadata m, MonadFail m) => [Item a] -> m [Item a]
|
||||
inNavOrder =
|
||||
|
@ -13,7 +13,7 @@
|
||||
<header>
|
||||
<h1 class="logo">
|
||||
<a href="/">
|
||||
<img alt="Orville Logo" src="images/orville-waving-pennant.svg"/>
|
||||
<img alt="Orville Logo" src="/images/orville-waving-pennant.svg"/>
|
||||
</a>
|
||||
</h1>
|
||||
</header>
|
||||
@ -26,6 +26,19 @@
|
||||
<a href="$url$">$title$</a>
|
||||
$endfor$
|
||||
|
||||
<h3>How-To Guides</h3>
|
||||
$for(how-tos)$
|
||||
<a href="$url$">$title$</a>
|
||||
$endfor$
|
||||
|
||||
<h3>Futher Explanation</h3>
|
||||
$for(explanations)$
|
||||
<a href="$url$">$title$</a>
|
||||
$endfor$
|
||||
|
||||
<h3>API Reference</h3>
|
||||
<a href="https://hackage.haskell.org/package/orville-postgresql">See Hackage</a>
|
||||
|
||||
<h3>Other Links</h3>
|
||||
<a href="/contact.html">Contact</a>
|
||||
</nav>
|
||||
|
Loading…
Reference in New Issue
Block a user