From ae6ba1533bbe79bc82d2b3fc47dc3cde55bf7370 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 7 Jan 2018 18:41:01 -0800 Subject: Use latest skylighting and omit the 'missingincludes' check. If you use a custom syntax definition that refers to a syntax you haven't loaded, pandoc will now complain when it is highlighting the text, rather than at the start. This saves a huge performance hit from the `missingIncludes` check. Closes #4226. --- pandoc.cabal | 2 +- src/Text/Pandoc/App.hs | 12 +----------- stack.lts9.yaml | 2 +- stack.yaml | 3 ++- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/pandoc.cabal b/pandoc.cabal index c006a90cd..43dcfd186 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -365,7 +365,7 @@ library tagsoup >= 0.14.2 && < 0.15, base64-bytestring >= 0.1 && < 1.1, zlib >= 0.5 && < 0.7, - skylighting >= 0.5 && < 0.6, + skylighting >= 0.5.1 && < 0.6, data-default >= 0.4 && < 0.8, temporary >= 1.1 && < 1.3, blaze-html >= 0.5 && < 0.10, diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index fc0a911ea..ed16b07a5 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -71,8 +71,7 @@ import Data.Aeson.Encode.Pretty (encodePretty', Config(..), keyOrder, defConfig, Indent(..), NumberFormat(..)) import Skylighting (Style, Syntax (..), defaultSyntaxMap, parseTheme, pygments) -import Skylighting.Parser (addSyntaxDefinition, missingIncludes, - parseSyntaxDefinition) +import Skylighting.Parser (addSyntaxDefinition, parseSyntaxDefinition) import System.Console.GetOpt import System.Directory (Permissions (..), doesFileExist, findExecutable, getAppUserDataDirectory, getPermissions) @@ -268,15 +267,6 @@ convertWithOpts opts = do syntaxMap <- foldM addSyntaxMap defaultSyntaxMap (optSyntaxDefinitions opts) - unless (null (optSyntaxDefinitions opts)) $ - case missingIncludes (M.elems syntaxMap) of - [] -> return () - xs -> E.throwIO $ PandocSyntaxMapError $ - "Missing syntax definitions:\n" ++ - unlines (map - (\(syn,dep) -> (T.unpack syn ++ " requires " ++ - T.unpack dep ++ " through IncludeRules.")) xs) - -- We don't want to send output to the terminal if the user -- does 'pandoc -t docx input.txt'; though we allow them to -- force this with '-o -'. On posix systems, we detect diff --git a/stack.lts9.yaml b/stack.lts9.yaml index bccf315bf..3684cbdbb 100644 --- a/stack.lts9.yaml +++ b/stack.lts9.yaml @@ -16,7 +16,7 @@ extra-deps: - pandoc-types-1.17.3 - hslua-0.9.5 - hslua-module-text-0.1.2 -- skylighting-0.5 +- skylighting-0.5.1 - texmath-0.10.1 - cmark-gfm-0.1.1 - QuickCheck-2.10.0.1 diff --git a/stack.yaml b/stack.yaml index 72ec5afab..135f2651b 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,4 +15,5 @@ packages: extra-deps: - pandoc-citeproc-0.12.2.5 - hslua-0.9.5 -resolver: lts-10.1 +- skylighting-0.5.1 +resolver: lts-10.2 -- cgit v1.2.3