shake: also generate info manuals
This commit is contained in:
		
							parent
							
								
									165bf008da
								
							
						
					
					
						commit
						3d129f6d31
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -31,3 +31,5 @@ ttttt.* | |||||||
| profs/* | profs/* | ||||||
| shake | shake | ||||||
| test.hs | test.hs | ||||||
|  | */doc/*.[0-9].md | ||||||
|  | */doc/*.info | ||||||
|  | |||||||
							
								
								
									
										31
									
								
								Shake.hs
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								Shake.hs
									
									
									
									
									
								
							| @ -47,14 +47,15 @@ usage = [i|Usage: | |||||||
|  ./Shake site             # generate the web site |  ./Shake site             # generate the web site | ||||||
|  ./Shake manpages         # generate nroff files for man |  ./Shake manpages         # generate nroff files for man | ||||||
|  ./Shake txtmanpages      # generate text man pages for embedding |  ./Shake txtmanpages      # generate text man pages for embedding | ||||||
|  |  ./Shake infomanpages     # generate info files for info | ||||||
|  ./Shake webmanpages      # generate web man pages for hakyll |  ./Shake webmanpages      # generate web man pages for hakyll | ||||||
|  ./Shake webmanual        # generate combined web man page for hakyll |  ./Shake webmanual        # generate combined web man page for hakyll | ||||||
| |] | |] | ||||||
| 
 | 
 | ||||||
| pandoc = | pandoc = "pandoc"                   -- pandoc from PATH (faster) | ||||||
|   -- "stack exec -- pandoc" -- use the pandoc required above |          --  "stack exec -- pandoc" -- pandoc from project's stackage snapshot | ||||||
|   "pandoc"                  -- use pandoc in PATH (faster) |  | ||||||
| hakyllstd = "site/hakyll-std/hakyll-std" | hakyllstd = "site/hakyll-std/hakyll-std" | ||||||
|  | makeinfo = "makeinfo" | ||||||
| nroff = "nroff" | nroff = "nroff" | ||||||
| 
 | 
 | ||||||
| main = do | main = do | ||||||
| @ -101,6 +102,8 @@ main = do | |||||||
|       nroffmanpages = [manpageDir m </> m | m <- manpageNames] |       nroffmanpages = [manpageDir m </> m | m <- manpageNames] | ||||||
|       --    manuals rendered to text, ready for embedding (hledger/doc/hledger.1.txt) |       --    manuals rendered to text, ready for embedding (hledger/doc/hledger.1.txt) | ||||||
|       txtmanpages = [manpageDir m </> m <.> "txt" | m <- manpageNames] |       txtmanpages = [manpageDir m </> m <.> "txt" | m <- manpageNames] | ||||||
|  |       --    manuals rendered to info, ready for info (hledger/doc/hledger.info) | ||||||
|  |       infomanpages = [manpageDir m </> m <.> "info" | m <- manpageNames] | ||||||
|       --   manuals rendered to markdown, ready for web output by hakyll (site/hledger.md) |       --   manuals rendered to markdown, ready for web output by hakyll (site/hledger.md) | ||||||
|       webmanpages = ["site" </> manpageNameToUri m <.>"md" | m <- manpageNames] |       webmanpages = ["site" </> manpageNameToUri m <.>"md" | m <- manpageNames] | ||||||
|       --    manuals rendered to markdown and combined, ready for web output by hakyll |       --    manuals rendered to markdown and combined, ready for web output by hakyll | ||||||
| @ -122,6 +125,7 @@ main = do | |||||||
|     phony "docs" $ do |     phony "docs" $ do | ||||||
|       need $ |       need $ | ||||||
|         nroffmanpages |         nroffmanpages | ||||||
|  |         ++ infomanpages | ||||||
|         ++ txtmanpages |         ++ txtmanpages | ||||||
| 
 | 
 | ||||||
|     -- compile pandoc helpers |     -- compile pandoc helpers | ||||||
| @ -162,6 +166,27 @@ main = do | |||||||
|       need [src] |       need [src] | ||||||
|       cmd Shell nroff "-man" src ">" out |       cmd Shell nroff "-man" src ">" out | ||||||
| 
 | 
 | ||||||
|  |     -- use m4 and pandoc to process macros, filter content, and convert to info, suitable for info viewing | ||||||
|  |     phony "infomanpages" $ need infomanpages | ||||||
|  | 
 | ||||||
|  |     infomanpages |%> \out -> do -- hledger/doc/hledger.info | ||||||
|  |       let src = out -<.> "m4.md" | ||||||
|  |           lib = "doc/lib.m4" | ||||||
|  |           dir = takeDirectory out | ||||||
|  |       -- assume all other m4 files in dir are included by this one XXX not true in hledger-lib | ||||||
|  |       deps <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir | ||||||
|  |       need $ src : lib : deps ++ pandocFilters | ||||||
|  |       cmd Shell | ||||||
|  |         "m4 -P -I" dir lib src "|" | ||||||
|  |         pandoc "-f markdown" | ||||||
|  |         -- "--filter doc/pandoc-drop-web-blocks" | ||||||
|  |         "--filter doc/pandoc-drop-html-blocks" | ||||||
|  |         "--filter doc/pandoc-drop-html-inlines" | ||||||
|  |         "--filter doc/pandoc-drop-links" | ||||||
|  |         "--filter doc/pandoc-drop-notes" | ||||||
|  |         "-t texinfo |" | ||||||
|  |         makeinfo "--force --no-split -o" out | ||||||
|  | 
 | ||||||
|     -- web site |     -- web site | ||||||
| 
 | 
 | ||||||
|     phony "site" $ do |     phony "site" $ do | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								hledger-api/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								hledger-api/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +0,0 @@ | |||||||
| doc/*.[0-9].md |  | ||||||
							
								
								
									
										2
									
								
								hledger-lib/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								hledger-lib/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +0,0 @@ | |||||||
| /.dist-buildwrapper/ |  | ||||||
| doc/*.[0-9].md |  | ||||||
							
								
								
									
										1
									
								
								hledger-ui/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								hledger-ui/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +0,0 @@ | |||||||
| doc/*.[0-9].md |  | ||||||
							
								
								
									
										1
									
								
								hledger-web/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								hledger-web/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +0,0 @@ | |||||||
| doc/*.[0-9].md |  | ||||||
							
								
								
									
										2
									
								
								hledger/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								hledger/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +0,0 @@ | |||||||
| /.dist-buildwrapper/ |  | ||||||
| doc/*.[0-9].md |  | ||||||
| @ -97,7 +97,7 @@ $ hledger balance -p 2008/6 expenses -N --flat --drop 1 | |||||||
|                   $1  supplies |                   $1  supplies | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### Depth limiting | ### Depth limited balance reports | ||||||
| 
 | 
 | ||||||
| With `--depth N`, balance shows accounts only to the specified depth. | With `--depth N`, balance shows accounts only to the specified depth. | ||||||
| This is very useful to show a complex charts of accounts in less detail. | This is very useful to show a complex charts of accounts in less detail. | ||||||
|  | |||||||
| @ -1022,7 +1022,7 @@ $\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-N\ \-\-flat\ \-\-drop\ 1 | |||||||
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ supplies | \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ supplies | ||||||
| \f[] | \f[] | ||||||
| .fi | .fi | ||||||
| .SS Depth limiting | .SS Depth limited balance reports | ||||||
| .PP | .PP | ||||||
| With \f[C]\-\-depth\ N\f[], balance shows accounts only to the specified | With \f[C]\-\-depth\ N\f[], balance shows accounts only to the specified | ||||||
| depth. | depth. | ||||||
|  | |||||||
| @ -680,7 +680,7 @@ CCOOMMMMAANNDDSS | |||||||
|                                 $1  food |                                 $1  food | ||||||
|                                 $1  supplies |                                 $1  supplies | ||||||
| 
 | 
 | ||||||
|    DDeepptthh lliimmiittiinngg |    DDeepptthh lliimmiitteedd bbaallaannccee rreeppoorrttss | ||||||
|        With  --depth N,  balance  shows  accounts only to the specified depth. |        With  --depth N,  balance  shows  accounts only to the specified depth. | ||||||
|        This is very useful to show  a  complex  charts  of  accounts  in  less |        This is very useful to show  a  complex  charts  of  accounts  in  less | ||||||
|        detail.   In  flat  mode,  balances from accounts below the depth limit |        detail.   In  flat  mode,  balances from accounts below the depth limit | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user