forked from jgm/pandoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PDF: On Windows, create temdir in working directory.
Reason: the path to the system temp directory may contain tildes, which causes problems in LaTeX when the username is more than eight characters. Closes jgm#777.
- Loading branch information
Showing
2 changed files
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE OverloadedStrings, CPP #-} | ||
{- | ||
Copyright (C) 2012 John MacFarlane <[email protected]> | ||
|
@@ -45,10 +45,18 @@ import Text.Pandoc.UTF8 as UTF8 | |
import Control.Monad (unless) | ||
import Data.List (isInfixOf) | ||
|
||
withTempDir :: String -> (FilePath -> IO a) -> IO a | ||
withTempDir = | ||
#ifdef _WINDOWS | ||
withTempDirectory "." | ||
#else | ||
withSystemTempDirectory | ||
#endif | ||
|
||
tex2pdf :: String -- ^ tex program (pdflatex, lualatex, xelatex) | ||
-> String -- ^ latex source | ||
-> IO (Either ByteString ByteString) | ||
tex2pdf program source = withSystemTempDirectory "tex2pdf" $ \tmpdir -> | ||
tex2pdf program source = withTempDir "tex2pdf." $ \tmpdir -> | ||
tex2pdf' tmpdir program source | ||
|
||
tex2pdf' :: FilePath -- ^ temp directory for output | ||
|