Also copy original images
This commit is contained in:
		
							parent
							
								
									fa2e3c144a
								
							
						
					
					
						commit
						5d5dbbec74
					
				| @ -25,6 +25,7 @@ module DependencyGenerator | |||||||
|   , readTemplate |   , readTemplate | ||||||
|   , convertImage |   , convertImage | ||||||
|   , saveFile |   , saveFile | ||||||
|  |   , copyFile | ||||||
|   , makeDir |   , makeDir | ||||||
|   , runPandoc |   , runPandoc | ||||||
|   ) where |   ) where | ||||||
| @ -197,6 +198,12 @@ saveFile (a, b) = do | |||||||
|   b' <- toToken b |   b' <- toToken b | ||||||
|   runFunctionIO' SaveFile $ TupleToken (a', b') |   runFunctionIO' SaveFile $ TupleToken (a', b') | ||||||
| 
 | 
 | ||||||
|  | copyFile :: (TokenableTo FilePath a, TokenableTo FilePath b) => (a, b) -> DepGenM () | ||||||
|  | copyFile (a, b) = do | ||||||
|  |   a' <- toToken a | ||||||
|  |   b' <- toToken b | ||||||
|  |   runFunctionIO' CopyFile $ TupleToken (a', b') | ||||||
|  | 
 | ||||||
| makeDir :: TokenableTo FilePath a => a -> DepGenM () | makeDir :: TokenableTo FilePath a => a -> DepGenM () | ||||||
| makeDir a = runFunctionIO' MakeDir =<< toToken a | makeDir a = runFunctionIO' MakeDir =<< toToken a | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,6 +18,9 @@ evalFunctionIO f x = case (f, x) of | |||||||
|   (SaveFile, Tuple (String _, String _)) -> |   (SaveFile, Tuple (String _, String _)) -> | ||||||
|     pure $ Empty |     pure $ Empty | ||||||
| 
 | 
 | ||||||
|  |   (CopyFile, Tuple (String _, String _)) -> | ||||||
|  |     pure $ Empty | ||||||
|  | 
 | ||||||
|   (MakeDir, String _) -> |   (MakeDir, String _) -> | ||||||
|     pure $ Empty |     pure $ Empty | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -15,7 +15,9 @@ handleRecipeDir outputDir template indexName dir = do | |||||||
|   exts <- unzipSndDepGenM (mapDepGenM fileComponents dirContents) |   exts <- unzipSndDepGenM (mapDepGenM fileComponents dirContents) | ||||||
|   areImageFilenames <- mapDepGenM isImageExtension exts |   areImageFilenames <- mapDepGenM isImageExtension exts | ||||||
|   imageFilenames <- filterDepGenM areImageFilenames dirContents |   imageFilenames <- filterDepGenM areImageFilenames dirContents | ||||||
|   imagePaths <- mapDepGenM (curry joinPaths outputDir) imageFilenames |   imagePaths <- mapDepGenM (curry joinPaths dir) imageFilenames | ||||||
|  |   imagePathsOut <- mapDepGenM (curry joinPaths outputDir) imageFilenames | ||||||
|  |   mapDepGenM_ ((copyFile =<<) . untupleDepGenM) (ZipToken (imagePaths, imagePathsOut)) | ||||||
|   thumbnailImagePaths <- mapDepGenM (thumbnailImagePath outputDir) imageFilenames |   thumbnailImagePaths <- mapDepGenM (thumbnailImagePath outputDir) imageFilenames | ||||||
|   mapDepGenM_ |   mapDepGenM_ | ||||||
|     (\files -> convertImage (files, inject $ ResizeToWidth 800)) |     (\files -> convertImage (files, inject $ ResizeToWidth 800)) | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ data FunctionIO = ListDirectory | |||||||
|                 | ReadTemplate |                 | ReadTemplate | ||||||
|                 | ConvertImage |                 | ConvertImage | ||||||
|                 | SaveFile |                 | SaveFile | ||||||
|  |                 | CopyFile | ||||||
|                 | MakeDir |                 | MakeDir | ||||||
|                 | RunPandoc |                 | RunPandoc | ||||||
|   deriving (Show, Lift) |   deriving (Show, Lift) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user