diff options
-rw-r--r-- | appveyor.yml | 10 | ||||
-rw-r--r-- | osx/stack.yaml | 2 | ||||
-rw-r--r-- | pandoc.cabal | 7 | ||||
-rw-r--r-- | pandoc.hs | 27 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/EPUB.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 2 | ||||
-rw-r--r-- | stack.full.yaml | 5 | ||||
-rw-r--r-- | windows/stack-appveyor.yaml | 5 | ||||
-rw-r--r-- | windows/stack.yaml | 2 |
9 files changed, 31 insertions, 35 deletions
diff --git a/appveyor.yml b/appveyor.yml index 05aa0c268..0303a9ddf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,8 @@ cache: - "c:\\sr" # stack root, short paths == fewer problems - '%LOCALAPPDATA%\Programs\stack' # even less to install... -# build: off # this disables automatic builds +# We don't do a normal C build, but build in test_script via stack +build: off install: - curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386 @@ -27,11 +28,12 @@ before_test: test_script: # The ugly echo "" hack is to avoid complaints about 0 being an invalid file # descriptor - - echo "" | stack --no-terminal test + - echo "" | stack --no-terminal test + - echo "" | stack --local-bin-path . install pandoc after_test: - - ps: | - 7z a pandoc.zip $(.\stack.exe path --local-install-root)\bin\pandoc*.exe + # .\ in the stack commandline seems to be .\windows\ (where the stack-appveyor.yaml is) + - 7z a "pandoc.zip" windows\pandoc.exe" artifacts: - path: pandoc.zip diff --git a/osx/stack.yaml b/osx/stack.yaml index c29a7f45b..79143c15a 100644 --- a/osx/stack.yaml +++ b/osx/stack.yaml @@ -11,6 +11,8 @@ flags: unicode_collation: false test_citeproc: false debug: false + texmath: + network-uri: true ghc-options: pandoc-citeproc: '-pgmP cpphs -optP--cpp' highlighting-kate: '-pgmP cpphs -optP--cpp' diff --git a/pandoc.cabal b/pandoc.cabal index 540e519ef..d38754dcd 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -254,7 +254,7 @@ Library parsec >= 3.1 && < 3.2, mtl >= 1.1 && < 2.3, filepath >= 1.1 && < 1.5, - process >= 1.2.1 && < 1.5, + process >= 1 && < 1.5, directory >= 1 && < 1.3, bytestring >= 0.9 && < 0.11, text >= 0.11 && < 1.3, @@ -425,8 +425,7 @@ Executable pandoc aeson >= 0.7.0.5 && < 0.12, yaml >= 0.8.8.2 && < 0.9, containers >= 0.1 && < 0.6, - HTTP >= 4000.0.5 && < 4000.4, - process >= 1.2.1 && < 1.5 + HTTP >= 4000.0.5 && < 4000.4 if flag(network-uri) Build-Depends: network-uri >= 2.6 && < 2.7, network >= 2.6 else @@ -477,7 +476,7 @@ Test-Suite test-pandoc text >= 0.11 && < 1.3, directory >= 1 && < 1.3, filepath >= 1.1 && < 1.5, - process >= 1.2.1 && < 1.5, + process >= 1 && < 1.5, highlighting-kate >= 0.6.1 && < 0.7, Diff >= 0.2 && < 0.4, test-framework >= 0.3 && < 0.9, @@ -52,9 +52,7 @@ import Data.Char ( toLower, toUpper ) import Data.List ( delete, intercalate, isPrefixOf, isSuffixOf, sort ) import System.Directory ( getAppUserDataDirectory, findExecutable, doesFileExist, Permissions(..), getPermissions ) -import System.Process ( shell, CreateProcess(..), createProcess_, - waitForProcess, StdStream(CreatePipe) ) -import System.IO ( stdout, stderr, hClose ) +import System.IO ( stdout, stderr ) import System.IO.Error ( isDoesNotExistError ) import qualified Control.Exception as E import Control.Exception.Extensible ( throwIO ) @@ -1403,8 +1401,8 @@ convertWithOpts opts args = do _ | html5Output -> "wkhtmltopdf" _ -> latexEngine -- check for pdf creating program - progExists <- checkProg pdfprog - when (not progExists) $ + mbPdfProg <- findExecutable pdfprog + when (isNothing mbPdfProg) $ err 41 $ pdfprog ++ " not found. " ++ pdfprog ++ " is needed for pdf output." @@ -1426,22 +1424,3 @@ convertWithOpts opts args = do handleEntities = if htmlFormat && ascii then toEntities else id - --- Check for existence of prog by doing prog --version. -checkProg :: String -> IO Bool -checkProg "" = return False -checkProg prog = E.handle handleErr $ do - (_,Just o,Just e,p) <- createProcess_ "system" - (shell (prog ++ " --version")){ - delegate_ctlc = True, - std_out = CreatePipe, - std_err = CreatePipe - } - ec <- waitForProcess p - hClose o - hClose e - if ec == ExitSuccess - then return True - else return False - where handleErr :: E.SomeException -> IO Bool - handleErr _ = return False diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index 144ba9ca2..149a7c00b 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -14,6 +14,7 @@ import Text.Pandoc.Walk (walk, query) import Text.Pandoc.Readers.HTML (readHtml) import Text.Pandoc.Options ( ReaderOptions(..), readerTrace) import Text.Pandoc.Shared (escapeURI, collapseFilePath, addMetaField) +import Network.URI (unEscapeString) import Text.Pandoc.MediaBag (MediaBag, insertMedia) import Text.Pandoc.Compat.Except (MonadError, throwError, runExcept, Except) import Text.Pandoc.Compat.Monoid ((<>)) @@ -74,14 +75,15 @@ archiveToEPUB os archive = do let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty return $ docSpan <> doc mimeToReader :: MonadError PandocError m => MimeType -> FilePath -> FilePath -> m Pandoc - mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do + mimeToReader "application/xhtml+xml" (unEscapeString -> root) + (unEscapeString -> path) = do fname <- findEntryByPathE (root </> path) archive html <- either throwError return . readHtml os' . UTF8.toStringLazy $ fromEntry fname return $ fixInternalReferences path html - mimeToReader s _ path + mimeToReader s _ (unEscapeString -> path) | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 9284d18ee..be9fd7ad7 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -310,7 +310,7 @@ toLabel z = go `fmap` stringToLaTeX URLString z where go [] = "" go (x:xs) | (isLetter x || isDigit x) && isAscii x = x:go xs - | elem x ("-+=:;." :: String) = x:go xs + | elem x ("_-+=:;." :: String) = x:go xs | otherwise = "ux" ++ printf "%x" (ord x) ++ go xs -- | Puts contents into LaTeX command. diff --git a/stack.full.yaml b/stack.full.yaml index 892598860..2f5dc0647 100644 --- a/stack.full.yaml +++ b/stack.full.yaml @@ -7,6 +7,11 @@ flags: embed_data_files: false old-locale: false network-uri: true + pandoc-citeproc: + bibutils: true + embed_data_files: true + texmath: + network-uri: true packages: - '.' - '../pandoc-citeproc' diff --git a/windows/stack-appveyor.yaml b/windows/stack-appveyor.yaml index e5a2b138e..99eca438b 100644 --- a/windows/stack-appveyor.yaml +++ b/windows/stack-appveyor.yaml @@ -5,6 +5,11 @@ flags: embed_data_files: true old-locale: false network-uri: true + pandoc-citeproc: + bibutils: true + embed_data_files: true + texmath: + network-uri: true packages: - '..' extra-deps: diff --git a/windows/stack.yaml b/windows/stack.yaml index 312b39e3b..22f127c8d 100644 --- a/windows/stack.yaml +++ b/windows/stack.yaml @@ -11,6 +11,8 @@ flags: unicode_collation: false test_citeproc: false debug: false + texmath: + network-uri: true packages: - '..' - '../../pandoc-citeproc' |