Shake.hs, site/site.tmpl: build website completely with pandoc, no hakyll-std
This commit is contained in:
		
							parent
							
								
									bac12543df
								
							
						
					
					
						commit
						567a86b810
					
				
							
								
								
									
										47
									
								
								Shake.hs
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								Shake.hs
									
									
									
									
									
								
							| @ -9,7 +9,6 @@ | ||||
|    --package time | ||||
|    ghc | ||||
| -} | ||||
| --   --package pandoc | ||||
| {- | ||||
| One of two project scripts files (Makefile, Shake.hs). | ||||
| This one provides a stronger programming language and more | ||||
| @ -138,8 +137,26 @@ main = do | ||||
|       -- manuals rendered to info, ready for info (hledger/hledger.info) | ||||
|       infomanpages = [manualDir m </> m <.> "info" | m <- manualNames] | ||||
| 
 | ||||
|       -- manuals rendered to markdown, ready for web output by hakyll (site/hledger.md) | ||||
|       webmanpages = ["site" </> manpageNameToUri m <.>"md" | m <- manpageNames] | ||||
|       -- manuals rendered to markdown, ready for web output by pandoc (site/hledger.md) | ||||
|       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 | ||||
|       webmanall = "site/manual.md" | ||||
| @ -222,13 +239,7 @@ main = do | ||||
|     -- web site | ||||
| 
 | ||||
|     phony "website" $ do | ||||
|       need $ | ||||
|         webmanpages ++ | ||||
|         [webmanall | ||||
|         ,hakyllstd | ||||
|         ,"website-copy" | ||||
|         ] | ||||
|       cmd Shell (Cwd "site") "hakyll-std/hakyll-std" "build" | ||||
|       need $ [ "website-copy" , "website-render" ] | ||||
|     -- website also links to old manuals, which are generated manually | ||||
|     -- with ./Shake websnapshot and committed | ||||
|     -- TODO: when pandoc filters are missing, ./Shake website complains about them before building them | ||||
| @ -306,11 +317,27 @@ main = do | ||||
|           ,"and try again." | ||||
|           ]) | ||||
| 
 | ||||
|     phony "website-render" $ do | ||||
|         need webhtmlpages | ||||
| 
 | ||||
|     pandocSiteFilter %> \out -> do | ||||
|         let source = out <.> "hs" | ||||
|         need [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 | ||||
| 
 | ||||
|     phony "clean" $ do | ||||
|  | ||||
| @ -1,10 +1,9 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||||
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||||
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||||
| 
 | ||||
|     <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 name="viewport" content="width=device-width, initial-scale=1"> | ||||
|         <title>hledger: $title$</title> | ||||
| @ -16,17 +15,17 @@ | ||||
|         <!-- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> --> | ||||
| 
 | ||||
|         <!-- get resources from same host (except readable theme), works offline --> | ||||
|         <link href="/css/bootstrap.min.css" rel="stylesheet"> | ||||
|         <script src="/js/jquery-1.11.0.min.js"></script> | ||||
|         <script src="/js/bootstrap.min.js"></script> | ||||
|         <link href="$siteRoot$/css/bootstrap.min.css" rel="stylesheet"> | ||||
|         <script src="$siteRoot$/js/jquery-1.11.0.min.js"></script> | ||||
|         <script src="$siteRoot$/js/bootstrap.min.js"></script> | ||||
| 
 | ||||
|         <script src="/js/site.js"></script> | ||||
|         <script src="/js/highslide/highslide.js"></script> | ||||
|         <script src="$siteRoot$/js/site.js"></script> | ||||
|         <script src="$siteRoot$/js/highslide/highslide.js"></script> | ||||
|         <script type="text/javascript"> | ||||
|             hs.graphicsDir = 'js/highslide/graphics/'; | ||||
|         </script> | ||||
|         <link href="/js/highslide/highslide.css" rel="stylesheet"> | ||||
|         <link href="/css/style.css" rel="stylesheet"> | ||||
|         <link href="$siteRoot$/js/highslide/highslide.css" rel="stylesheet"> | ||||
|         <link href="$siteRoot$/css/style.css" rel="stylesheet"> | ||||
|         <!-- <link href="/css/syntax.css" rel="stylesheet"> --> | ||||
|     </head> | ||||
| 
 | ||||
| @ -44,11 +43,11 @@ | ||||
|                 <span class="icon-bar"></span> | ||||
|                 <span class="icon-bar"></span> | ||||
|               </button> | ||||
|               <a class="navbar-brand" href="/index.html">hledger.org</a> | ||||
|               <a class="navbar-brand" href="$siteRoot$/index.html">hledger.org</a> | ||||
|             </div> | ||||
|             <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | ||||
|               <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> | ||||
|               </ul> | ||||
|             </div> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user