diff --git a/src/Docster/Compiler.hs b/src/Docster/Compiler.hs index 21e61a8..cd4fb15 100644 --- a/src/Docster/Compiler.hs +++ b/src/Docster/Compiler.hs @@ -36,7 +36,7 @@ data CompilationStrategy = CompilationStrategy -- | Pandoc writer function , csWriter :: WriterOptions -> Pandoc -> PandocIO Text -- | Post-processing function for the generated content - , csProcessOutput :: Text -> String -> IO (Either DocsterError ()) + , csProcessOutput :: String -> Text -> IO (Either DocsterError ()) -- | Success message formatter , csSuccessMessage :: String -> Text } @@ -60,8 +60,8 @@ htmlStrategy = CompilationStrategy } -- | Process PDF output: LaTeX template application and direct XeLaTeX compilation -processPDFOutput :: Text -> String -> IO (Either DocsterError ()) -processPDFOutput latexOutput outputPath = do +processPDFOutput :: String -> Text -> IO (Either DocsterError ()) +processPDFOutput outputPath latexOutput = do let completeLatex = latexTemplate latexOutput -- Use temporary directory for LaTeX compilation @@ -108,8 +108,8 @@ processPDFOutput latexOutput outputPath = do T.pack stderr <> "\n\nLaTeX log:\n" <> logContent -- | Process HTML output: file writing and browser opening -processHTMLOutput :: Text -> String -> IO (Either DocsterError ()) -processHTMLOutput html outputPath = do +processHTMLOutput :: String -> Text -> IO (Either DocsterError ()) +processHTMLOutput outputPath html = do TIO.writeFile outputPath html -- Open the generated HTML file in browser for verification @@ -144,7 +144,7 @@ compileWithStrategy strategy sourceDir (OutputPath inputPath) (OutputPath output output <- liftEitherIO $ generateOutput strategy transformed -- Step 5: Process output and write to file - liftEitherIO $ csProcessOutput strategy output outputPath + liftEitherIO $ csProcessOutput strategy outputPath output -- Step 6: Print success message liftIO $ putStrLn $ T.unpack $ csSuccessMessage strategy outputPath @@ -184,4 +184,4 @@ compileWithFormat strategy extension path = do result <- compileWithStrategy strategy sourceDir (OutputPath path) outputPath case result of Left err -> throwIO err - Right _ -> return () \ No newline at end of file + Right _ -> return ()