Replies: 3 comments 5 replies
-
>> "UB" == Uwe Brauer ***@***.***> writes:
Hi
I asked this question years ago (and used it in Ubuntu 16.04 and the corresponding pandoc version). I am now on Ubuntu 24.04
using `pandoc 3.1.3`. I want to strip a latex file: all equations should be replaced by the word formula.
so the following was proposed to me by the pandoc author
```
import Text.Pandoc.JSON
main = toJSONFilter stripmath
where stripmath (Math _ _) = Str "FORMULA"
stripmath x = x
```
or even
```
import Text.Pandoc.JSON
main = toJSONFilter stripmath
where stripmath (Math _ _) = Str "FORMULA"
stripmath x = x
go (Math _ _) = Str "FORMULA"
go (Span (_,_,[("label",_)]) _) = Str "LABEL"
go x = x
```
both `hs` files should be compiled with
```
ghc --make stripmath-ref.hs
ghc --make stripmath.hs
```
however in my case this returns
```
import Text.Pandoc.JSON
main = toJSONFilter stripmath
where stripmath (Math _ _) = Str "FORMULA"
stripmath x = x
go (Math _ _) = Str "FORMULA"
go (Span (_,_,[("label",_)]) _) = Str "LABEL"
go x = x
```
I cannot find file i my Ubuntu distribution. I also pulled the github repository and still cannot find this file
What do I miss
I installed via
sudo apt-get install libghc-pandoc-types-dev
Which seemed to have helped. However then the compilation gave the
following error
```
[1 of 2] Compiling Main ( stripmath.hs, stripmath.o )
stripmath.hs:4:38: error:
• Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
Expected: Data.Text.Internal.Text
Actual: String
• In the first argument of ‘Str’, namely ‘"FORMULA"’
In the expression: Str "FORMULA"
In an equation for ‘stripmath’:
stripmath (Math _ _) = Str "FORMULA"
|
4 | where stripmath (Math _ _) = Str "FORMULA"
| ^^^^^^^^^
```
So I have still problems
|
Beta Was this translation helpful? Give feedback.
5 replies
-
I tried to install pandoc-types via cabal (and stack).
leads to
the force option does not do anything, so I am puzzled |
Beta Was this translation helpful? Give feedback.
0 replies
-
PS. It's now much more convenient to use a Lua filter for this. See the documentation on the pandoc website under "Lua filters." Writing a Lua filter to reproduce what you're doing above should be a fairly simple task. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I asked this question years ago (and used it in Ubuntu 16.04 and the corresponding pandoc version). I am now on Ubuntu 24.04
using
pandoc 3.1.3
. I want to strip a latex file: all equations should be replaced by the word formula.so the following was proposed to me by the pandoc author
or even
both
hs
files should be compiled withhowever in my case this returns
I cannot find file i my Ubuntu distribution. I also pulled the github repository and still cannot find this file
What do I miss
Uwe Brauer
Beta Was this translation helpful? Give feedback.
All reactions