-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’ #13
Comments
Same here. With pandoc 2.1.1 |
The solution I found is to stick with pandoc below version 2. To do a clean reinstall, first get rid of all your old packages (WARNING: this will remove all you cabal packages):
Then install pandoc and all your other pandoc related packages with the constraint of keeping pandoc below version 2. In my case:
If you install further pandoc related packages, don't forget the flag |
Here's a patch to Once the patch below has been applied, you should get a clean build of the
You'll actually find 4 new files in your bin directory, after executing the two commands above:
And you'd, probably, be wise to copy them to whatever local The needed patch:
|
Patch for pandoc 2 API, works fine for me, but I haven't tested it properly though. diff --git a/IncludeFilter.hs b/IncludeFilter.hs
index 6aa3387..3dc1606 100644
--- a/IncludeFilter.hs
+++ b/IncludeFilter.hs
@@ -55,6 +55,7 @@ Note: the metadata from the included source files are discarded.
import Control.Monad
import Data.List
+import Data.Text.IO (readFile)
import System.Directory
import Text.Pandoc
@@ -67,13 +68,10 @@ stripPandoc p =
Left _ -> [Null]
Right (Pandoc _ blocks) -> blocks
-ioReadMarkdown :: String -> IO(Either PandocError Pandoc)
-ioReadMarkdown content = return $! readMarkdown def content
-
getContent :: String -> IO [Block]
getContent file = do
- c <- readFile file
- p <- ioReadMarkdown c
+ c <- Data.Text.IO.readFile file
+ p <- runIO $ readMarkdown def c
return $! stripPandoc p
getProcessableFileList :: String -> IO [String] |
Could we get this merged, please? |
Hey folks, this is my first hour with Pandoc. Looks good so far, then I hit this speed bump. Any chance this fix could be merged sometime soon? |
I had to add a little bit to @ply 's patch, above: diff --git a/IncludeFilter.hs b/IncludeFilter.hs
index 6aa3387..da5ad6b 100644
--- a/IncludeFilter.hs
+++ b/IncludeFilter.hs
@@ -55,6 +55,8 @@ Note: the metadata from the included source files are discarded.
import Control.Monad
import Data.List
+import Data.Text (unpack)
+import Data.Text.IO (readFile)
import System.Directory
import Text.Pandoc
@@ -67,13 +69,10 @@ stripPandoc p =
Left _ -> [Null]
Right (Pandoc _ blocks) -> blocks
-ioReadMarkdown :: String -> IO(Either PandocError Pandoc)
-ioReadMarkdown content = return $! readMarkdown def content
-
getContent :: String -> IO [Block]
getContent file = do
- c <- readFile file
- p <- ioReadMarkdown c
+ c <- Data.Text.IO.readFile file
+ p <- runIO $ readMarkdown def c
return $! stripPandoc p
getProcessableFileList :: String -> IO [String]
@@ -88,8 +87,8 @@ processFiles toProcess =
doInclude :: Block -> IO [Block]
doInclude (CodeBlock (_, classes, _) list)
- | "include" `elem` classes = do
- let toProcess = getProcessableFileList list
+ | "include" `elem` (map unpack classes) = do
+ let toProcess = getProcessableFileList (unpack list)
processFiles =<< toProcess
doInclude x = return [x] |
Can anyone help?
cabal install pandoc-include
failed with the above error.Above mentined cabal installation provided pandoc2.06. Piping IncludeFilter.hs (as described in the README) within my pandoc call leeds to the same error message.
Any help is highly appreciated.
The text was updated successfully, but these errors were encountered: