lua-filters icon indicating copy to clipboard operation
lua-filters copied to clipboard

Minimal working example of Lilypond lua filter with markdown

Open dalbandea opened this issue 4 years ago • 3 comments

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?

dalbandea avatar Feb 20 '21 20:02 dalbandea

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.

tarleb avatar Feb 20 '21 21:02 tarleb

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. :)

dalbandea avatar Feb 20 '21 22:02 dalbandea

Lets keep this issue open until the documentation is fixed.

alerque avatar Feb 21 '21 06:02 alerque

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>

ratnanil avatar Jan 17 '23 13:01 ratnanil

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

tarleb avatar Jan 17 '23 16:01 tarleb

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

Oh sorry, completely missed that one :sleepy:

ratnanil avatar Jan 17 '23 18:01 ratnanil

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

tarleb avatar Jan 17 '23 19:01 tarleb