Shake.hs, site/site.tmpl: build website completely with pandoc, no hakyll-std
This commit is contained in:
parent
bac12543df
commit
567a86b810
45
Shake.hs
45
Shake.hs
@ -9,7 +9,6 @@
|
|||||||
--package time
|
--package time
|
||||||
ghc
|
ghc
|
||||||
-}
|
-}
|
||||||
-- --package pandoc
|
|
||||||
{-
|
{-
|
||||||
One of two project scripts files (Makefile, Shake.hs).
|
One of two project scripts files (Makefile, Shake.hs).
|
||||||
This one provides a stronger programming language and more
|
This one provides a stronger programming language and more
|
||||||
@ -138,9 +137,27 @@ main = do
|
|||||||
-- manuals rendered to info, ready for info (hledger/hledger.info)
|
-- manuals rendered to info, ready for info (hledger/hledger.info)
|
||||||
infomanpages = [manualDir m </> m <.> "info" | m <- manualNames]
|
infomanpages = [manualDir m </> m <.> "info" | m <- manualNames]
|
||||||
|
|
||||||
-- manuals rendered to markdown, ready for web output by hakyll (site/hledger.md)
|
-- manuals rendered to markdown, ready for web output by pandoc (site/hledger.md)
|
||||||
webmanpages = ["site" </> manpageNameToUri m <.> "md" | m <- manpageNames]
|
webmanpages = ["site" </> manpageNameToUri m <.> "md" | m <- manpageNames]
|
||||||
|
|
||||||
|
-- versions of documentation (excluding 0.27)
|
||||||
|
docversions = [ "1.0" , "1.1" , "1.2" , "1.3" , "1.4" , "1.5" , "1.9" ]
|
||||||
|
|
||||||
|
-- manuals rendered to html by pandoc
|
||||||
|
webhtmlpages
|
||||||
|
= map (normalise . ("site/_site" </>))
|
||||||
|
$ ( [ prefix </> manpageNameToUri mPage <.> "html"
|
||||||
|
| prefix <- "" : [ "doc" </> v | v <- docversions ]
|
||||||
|
, mPage <- manpageNames
|
||||||
|
]
|
||||||
|
++ [ mPage <.> "html"
|
||||||
|
| mPage <- [ "contributors" , "download" , "ledgertips" , "index" , "intro" , "release-notes" ]
|
||||||
|
]
|
||||||
|
++ [ prefix </> "manual" <.> "html"
|
||||||
|
| prefix <- "" : "doc/0.27" : [ "doc" </> v | v <- docversions ]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
-- manuals rendered to markdown and combined, ready for web output by hakyll
|
-- manuals rendered to markdown and combined, ready for web output by hakyll
|
||||||
webmanall = "site/manual.md"
|
webmanall = "site/manual.md"
|
||||||
|
|
||||||
@ -222,13 +239,7 @@ main = do
|
|||||||
-- web site
|
-- web site
|
||||||
|
|
||||||
phony "website" $ do
|
phony "website" $ do
|
||||||
need $
|
need $ [ "website-copy" , "website-render" ]
|
||||||
webmanpages ++
|
|
||||||
[webmanall
|
|
||||||
,hakyllstd
|
|
||||||
,"website-copy"
|
|
||||||
]
|
|
||||||
cmd Shell (Cwd "site") "hakyll-std/hakyll-std" "build"
|
|
||||||
-- website also links to old manuals, which are generated manually
|
-- website also links to old manuals, which are generated manually
|
||||||
-- with ./Shake websnapshot and committed
|
-- with ./Shake websnapshot and committed
|
||||||
-- TODO: when pandoc filters are missing, ./Shake website complains about them before building them
|
-- TODO: when pandoc filters are missing, ./Shake website complains about them before building them
|
||||||
@ -306,11 +317,27 @@ main = do
|
|||||||
,"and try again."
|
,"and try again."
|
||||||
])
|
])
|
||||||
|
|
||||||
|
phony "website-render" $ do
|
||||||
|
need webhtmlpages
|
||||||
|
|
||||||
pandocSiteFilter %> \out -> do
|
pandocSiteFilter %> \out -> do
|
||||||
let source = out <.> "hs"
|
let source = out <.> "hs"
|
||||||
need [source]
|
need [source]
|
||||||
cmd "stack --stack-yaml=stack-ghc8.2.yaml ghc --package pandoc -- -o" out source
|
cmd "stack --stack-yaml=stack-ghc8.2.yaml ghc --package pandoc -- -o" out source
|
||||||
|
|
||||||
|
"site/_site//*.html" %> \out -> do
|
||||||
|
let source = "site" </> dropDirectory2 out -<.> "md"
|
||||||
|
pageTitle = takeBaseName out
|
||||||
|
template = "site/site.tmpl"
|
||||||
|
siteRoot = if "site/_site/doc//*" ?== out then "../.." else "."
|
||||||
|
need [source, template, pandocSiteFilter]
|
||||||
|
cmd Shell pandoc "--from markdown --to html" source
|
||||||
|
"--template" template
|
||||||
|
("--metadata=siteRoot:" ++ siteRoot)
|
||||||
|
("--metadata=title:" ++ pageTitle)
|
||||||
|
"--filter" pandocSiteFilter
|
||||||
|
"--output" out
|
||||||
|
|
||||||
-- cleanup
|
-- cleanup
|
||||||
|
|
||||||
phony "clean" $ do
|
phony "clean" $ do
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
|
||||||
<head profile="http://www.w3.org/2005/10/profile">
|
<head profile="http://www.w3.org/2005/10/profile">
|
||||||
<link rel="icon" type="image/png" href="/images/coins2.ico">
|
<link rel="icon" type="image/png" href="$siteRoot$/images/coins2.ico">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>hledger: $title$</title>
|
<title>hledger: $title$</title>
|
||||||
@ -16,17 +15,17 @@
|
|||||||
<!-- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> -->
|
<!-- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> -->
|
||||||
|
|
||||||
<!-- get resources from same host (except readable theme), works offline -->
|
<!-- get resources from same host (except readable theme), works offline -->
|
||||||
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
<link href="$siteRoot$/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<script src="/js/jquery-1.11.0.min.js"></script>
|
<script src="$siteRoot$/js/jquery-1.11.0.min.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="$siteRoot$/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
<script src="/js/site.js"></script>
|
<script src="$siteRoot$/js/site.js"></script>
|
||||||
<script src="/js/highslide/highslide.js"></script>
|
<script src="$siteRoot$/js/highslide/highslide.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
hs.graphicsDir = 'js/highslide/graphics/';
|
hs.graphicsDir = 'js/highslide/graphics/';
|
||||||
</script>
|
</script>
|
||||||
<link href="/js/highslide/highslide.css" rel="stylesheet">
|
<link href="$siteRoot$/js/highslide/highslide.css" rel="stylesheet">
|
||||||
<link href="/css/style.css" rel="stylesheet">
|
<link href="$siteRoot$/css/style.css" rel="stylesheet">
|
||||||
<!-- <link href="/css/syntax.css" rel="stylesheet"> -->
|
<!-- <link href="/css/syntax.css" rel="stylesheet"> -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -44,11 +43,11 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="/index.html">hledger.org</a>
|
<a class="navbar-brand" href="$siteRoot$/index.html">hledger.org</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="/download.html">Download</a>
|
<li><a href="$siteRoot$/download.html">Download</a>
|
||||||
<li><a href="https://github.com/simonmichael/hledger/wiki/Dev-Zone">Contribute</a>
|
<li><a href="https://github.com/simonmichael/hledger/wiki/Dev-Zone">Contribute</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user