;Shake webmanuals: add a "generated by" comment (hledger_site/#10)
[ci skip]
This commit is contained in:
		
							parent
							
								
									3aaea1ef4e
								
							
						
					
					
						commit
						eb1bb0702d
					
				
							
								
								
									
										14
									
								
								Shake.hs
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Shake.hs
									
									
									
									
									
								
							| @ -331,15 +331,21 @@ main = do | |||||||
|                       in if "hledger_" `isPrefixOf` h |                       in if "hledger_" `isPrefixOf` h | ||||||
|                          then drop 8 h ++ " format" |                          then drop 8 h ++ " format" | ||||||
|                          else h |                          else h | ||||||
|       -- assume all other m4 files in dir are included by this one XXX not true in hledger-lib |       -- assume any 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 |       subfiles <- liftIO $ filter (/= src) . filter (".m4.md" `isSuffixOf`) . map (dir </>) <$> S.getDirectoryContents dir | ||||||
|       need $ [src, commonm4, packagem4] ++ deps |       let deps = [src, commonm4, packagem4] ++ subfiles | ||||||
|  |       need deps | ||||||
|       when (manual=="hledger") $ need commandmds |       when (manual=="hledger") $ need commandmds | ||||||
|       -- add the web page's heading. |       -- add the web page's heading. | ||||||
|       -- XXX Might be nice to do this atomically with the below, so |       -- XXX Might be nice to do this atomically with the below, so | ||||||
|       -- make avoid any double refresh when watch docs with entr/livereload. |       -- make avoid any double refresh when watch docs with entr/livereload. | ||||||
|       -- But cmd Shell doesn't handle arguments containing spaces properly. |       -- But cmd Shell doesn't handle arguments containing spaces properly. | ||||||
|       liftIO $ writeFile out $ "# " ++ heading ++ "\n\n" |       liftIO $ writeFile out $ unlines [ | ||||||
|  |          "<!-- " ++ "Generated by \"Shake webmanuals\" from " ++ unwords deps ++ " -->" | ||||||
|  |         ,"" | ||||||
|  |         ,"# " ++ heading | ||||||
|  |         ,"" | ||||||
|  |         ] | ||||||
|       cmd Shell |       cmd Shell | ||||||
|         "m4 -P -DMAN -DWEB -I" dir commonm4 packagem4 src "|" |         "m4 -P -DMAN -DWEB -I" dir commonm4 packagem4 src "|" | ||||||
|         pandoc fromsrcmd towebmd |         pandoc fromsrcmd towebmd | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user