pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
602 stars 165 forks source link

Minimal working example of Lilypond lua filter with markdown #167

Closed dalbandea closed 1 year ago

dalbandea commented 3 years ago

Hi, I'm trying to use the lilypond filter to try to convert lilypond code inside a .md file into embedded images.

I'm tryind to test it with a simple example, but I cannot make it to work. I downloaded lilypond.lua into my working directory and this is my file test.md

# Markdown file

Hi

\version "2.20.0"
{
  c' e' g' e'
}

And I call pandoc using pandoc --lua-filter=lilypond.lua test.md -o test.pdf. The error mesage is

Error producing PDF.
! Undefined control sequence.
l.60 \version

I also tried removing the \version line. Then it compiles and generated a pdf, but without image. My pandoc version is 2.11.4, and mi lilypond version si 2.20.0, running on Ubuntu 20.04.

Sorry if the question is stupid (I'm a newbie on both pandoc and lilypond), but I read lilypond's filter README.md and I cannot figure it out. Could you provide a minimal working example?

tarleb commented 3 years ago

The lilypond directory has two sample files used for testing, oboe.md and appoggiaturas.md. The exact test command can be found in Makefile. I agree that this should be made easier to find.

dalbandea commented 3 years ago

Thank you! Now that you say it, it was deducible, but probably a line in the readme briefly mentioning that those files are examples that can be compiled with make would be nice for the next newbie coming here. :)

alerque commented 3 years ago

Lets keep this issue open until the documentation is fixed.

ratnanil commented 1 year ago

I'm not sure what I'm missing. But following the advice from PR #249 I run:

pandoc --to=html --lua-filter=lilypond.lua --output="test.html" appoggiaturas.md 

whereas I get the following error message:

Error running filter lilypond.lua:
PandocIOError "pipe" lilypond: createProcess: posix_spawnp: does not exist (No such file or directory)
stack traceback:
        lilypond.lua:49: in upvalue 'generate_image'
        lilypond.lua:83: in upvalue 'process_lilypond'
        lilypond.lua:143: in function <lilypond.lua:138>
tarleb commented 1 year ago

Looks like pandoc cannot find the lilypond binary; it has to be installed separately.

ratnanil commented 1 year ago

The lilypond executable must be installed to a location on your PATH

Oh sorry, completely missed that one :sleepy:

tarleb commented 1 year ago

You are right though: the error message is rather cryptic and should probably be improved.