Comments (7)
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]
from pandoc-include.
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):
rm -r ~/.ghc
Then install pandoc and all your other pandoc related packages with the constraint of keeping pandoc below version 2. In my case:
cabal install pandoc pandoc-include pandoc-citeproc --constraint 'pandoc < 2'
If you install further pandoc related packages, don't forget the flag --constraint 'pandoc < 2'
from pandoc-include.
Here's a patch to master@50905129593807992b37a2af59d1ce9106234a8c
that will give a clean stack build, using the latest LTS resolver, as of today:
Once the patch below has been applied, you should get a clean build of the panda-include
executable with just:
stack setup
stack build
You'll actually find 4 new files in your bin directory, after executing the two commands above:
Davids-Air-2:pandoc-include dbanas$ ls .stack-work/install/x86_64-osx/lts-11.2/8.2.2/bin/
json2yaml pandoc pandoc-include yaml2json
And you'd, probably, be wise to copy them to whatever local .../bin/
directory you intend, as a group.
The needed patch:
diff --git a/pandoc-include.cabal b/pandoc-include.cabal
index 3469ae6..47a572b 100644
--- a/pandoc-include.cabal
+++ b/pandoc-include.cabal
@@ -36,7 +36,7 @@ Library
Executable pandoc-include
Build-Depends: base >= 4.6,
text >= 0.11,
- pandoc >= 1.13.0.0,
+ pandoc >= 1.13.0.0 && < 2.0,
pandoc-types >= 1.12.0.0,
directory
Hs-Source-Dirs: .
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..eab9527
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,13 @@
+resolver: lts-11.2
+packages:
+- .
+extra-deps:
+- pandoc-1.19.2.4
+- aeson-1.1.2.0
+- doctemplates-0.1.0.2
+- hslua-0.4.1
+- http-types-0.9.1
+- pandoc-types-1.17.0.5
+- skylighting-0.1.1.5
+- texmath-0.9.4.4
+
from pandoc-include.
Same here.
With pandoc 2.1.1
from pandoc-include.
Could we get this merged, please?
from pandoc-include.
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?
from pandoc-include.
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]
from pandoc-include.
Related Issues (11)
- Encoding problems when include cyrillic files HOT 11
- Doesn’t work with pandoc-citeproc HOT 1
- Problem with package csquotes HOT 2
- Nested includes don't work HOT 2
- Include only certain line numbers HOT 4
- How to install on windows? HOT 1
- Pandoc 2 Support Issues
- Does this still work?
- 'cabal update' followed by 'cabal install pandoc-include' fails to build HOT 7
- Will you update this package to support pandoc 2.10.x? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandoc-include.