CGI interface to lilypond

View: New views
5 Messages — Rating Filter:   Alert me  

CGI interface to lilypond

by Ichiro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I am new to lilypond.
I am wondering if there exists an interface like mathtex, for lilypond.
For those who don't know mathtex, it's a way of embedding rendered TeX
images directly and easily in an HTML page (and therefore in wikis, in
blogs etc), through a relatively simple CGI service.
So, in your web page, you can just type your formula like this

   <img src="http://www.forkosh.dreamhost.com/mathtex.cgi?x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}">

and voila, the image is rendered and embedded. (You would of course
prefer to build the service locally and use that, instead of using a
publicly available service, but that's the idea.)
I think it's quite clever and neat. You can read the whole story here

   http://www.forkosh.dreamhost.com/source_mathtex.html

My understanding is that it should not be difficult to implement
something like this for lilypond. Perhaps through lilypond-book and
latex, or maybe just via lilypond directly.
I am keen to develop this (or at least give it a try), but first I
would like to make sure that I wouldn't be reinventing the wheel.
Any other input from you guys would also be welcome, of course.

Thank you, and anyway thanks for this superlative tool.
Ichiro


_______________________________________________
lilypond-devel mailing list
lilypond-devel@...
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Re: CGI interface to lilypond

by Graham Percival-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For an individual person, lilypond-book can already process html
files, so there is nothing extra needed.

If you want to have it for a multi-user situation like a wiki,
then search for "lilypond wiki" or "mediawiki" or similar terms on
the mailist; it has been discussed before.  Be warned that there
are serious security issues involved -- it is not impossible to
mitigate the risks, but be prepared for an amount of work.


There has been some discussion about developing safer and easier
ways of doing these things, but so far nobody has been seriously
interested.  (I define "seriously interested" as "willing to spend
over 20 hours working on it, not counting time on emails")

If you're seriously interested in such things, then please search
the mailist for "lilypond server" and "safe mode"; you should be
able to get an idea of what's involved.

Cheers,
- Graham


On Tue, Nov 10, 2009 at 06:40:54AM +0900, Ichiro Watanabe wrote:

> Hi there,
>
> I am new to lilypond.
> I am wondering if there exists an interface like mathtex, for lilypond.
> For those who don't know mathtex, it's a way of embedding rendered TeX
> images directly and easily in an HTML page (and therefore in wikis, in
> blogs etc), through a relatively simple CGI service.
> So, in your web page, you can just type your formula like this
>
>    <img src="http://www.forkosh.dreamhost.com/mathtex.cgi?x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}">
>
> and voila, the image is rendered and embedded. (You would of course
> prefer to build the service locally and use that, instead of using a
> publicly available service, but that's the idea.)
> I think it's quite clever and neat. You can read the whole story here
>
>    http://www.forkosh.dreamhost.com/source_mathtex.html
>
> My understanding is that it should not be difficult to implement
> something like this for lilypond. Perhaps through lilypond-book and
> latex, or maybe just via lilypond directly.
> I am keen to develop this (or at least give it a try), but first I
> would like to make sure that I wouldn't be reinventing the wheel.
> Any other input from you guys would also be welcome, of course.
>
> Thank you, and anyway thanks for this superlative tool.
> Ichiro
>
>
> _______________________________________________
> lilypond-devel mailing list
> lilypond-devel@...
> http://lists.gnu.org/mailman/listinfo/lilypond-devel


_______________________________________________
lilypond-devel mailing list
lilypond-devel@...
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Re: CGI interface to lilypond

by Ichiro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> For an individual person, lilypond-book can already process html
> files, so there is nothing extra needed.

Thank you.
I think I didn't explain myself very well.
My goal is to embed the lilypond source in HTML source. Something like this

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
This is my new song: <img
src="localorpublic/cgi-bin/lilypondmagic.cgi?\relative c { \clef bass
c d e c }">
  </body>
</html>

My understanding from

    http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program/HTML#HTML

is that lilypond-book by itself does not work like this and it not
support this - a wrapper CGI application is required.
To prove how this can work with LaTeX (and a CGI wrapper called
mathtex), load this into your browser.

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
This is my new theorem: <img
src="http://www.forkosh.dreamhost.com/mathtex.cgi?\sqrt{x^2}=x">
  </body>
</html>

> If you want to have it for a multi-user situation like a wiki,
> then search for "lilypond wiki" or "mediawiki" or similar terms on
> the mailist; it has been discussed before.

This is slightly off-topic, but for everyone's benefit, this is what I
know about the MediaWiki situation.
An unsecure extension is available here

    http://www.mediawiki.org/wiki/Extension:LilyPond

This works fine for private (intranet) wikis and for public wikis that
are not notable enough to be subject to DoS attacks.
For bigger, public wikis (notably Wikipedia), someone has implemented
a secure, generic framework that renders music and other stuff

    http://wikisophia.org/wiki/Wikitex
    http://modtex.org

My understanding is that development is almost done, but the project
is currently on a hiatus.

Thanks


_______________________________________________
lilypond-devel mailing list
lilypond-devel@...
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Re: CGI interface to lilypond

by Graham Percival-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 10, 2009 at 10:50:43PM +0900, Ichiro Watanabe wrote:

> > For an individual person, lilypond-book can already process html
> > files, so there is nothing extra needed.
>
> My goal is to embed the lilypond source in HTML source. Something like this
>
> <html>
>   <head>
>     <title>Example</title>
>   </head>
>   <body>
> This is my new song: <img
> src="localorpublic/cgi-bin/lilypondmagic.cgi?\relative c { \clef bass
> c d e c }">
>   </body>
> </html>

If you are writing the html yourself, then why do you want a cgi
call?  You get the desired output by running lilypond-book with
the [verbose] option.

It doesn't make any sense to regenerate the output every time
somebody looks at the webpage.

> > If you want to have it for a multi-user situation like a wiki,
> > then search for "lilypond wiki" or "mediawiki" or similar terms on
> > the mailist; it has been discussed before.
>
> This is slightly off-topic, but for everyone's benefit, this is what I
> know about the MediaWiki situation.

If you don't want a multi-user situation, then I don't see the
point of a cgi script...?

> This works fine for private (intranet) wikis and for public wikis that
> are not notable enough to be subject to DoS attacks.

Yes, which is why I suggested that you look into "safe mode".

Cheers,
- Graham


_______________________________________________
lilypond-devel mailing list
lilypond-devel@...
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Re: CGI interface to lilypond

by Ichiro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> If you are writing the html yourself, then why do you want a cgi
> call?

I'm not necessarily writing the html myself.
A CGI interface is useful for the same use cases that mathtex enables
with LaTeX.

> It doesn't make any sense to regenerate the output every time
> somebody looks at the webpage.

Images are not regenerated, they are generated once and then cached.
For more details, see

    http://www.forkosh.dreamhost.com/source_mathtex.html

Anyway, I take it that no such CGI interface exists then.
I'll let you know of any developments on my side, thanks for now.

Regards,
Ichiro


_______________________________________________
lilypond-devel mailing list
lilypond-devel@...
http://lists.gnu.org/mailman/listinfo/lilypond-devel