Am 30.04.2014 10:00, schrieb David Kastrup:
Urs Liska <address@hidden> writes:
I've tried around for quite some time now to no avail, probably having
tried _everything_ except the right solution ;-) so I have to come
back here and ask.
I now have this implementation:
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))
#(define (strsystem_internal cmd)
(let* ((port (open-input-pipe cmd))
(str (read-delimited "" port)))
(close-pipe port)
str))
#(define-markup-command (gitCommand layout props cmd) (markup?)
(let* ((result (string-split
(strsystem_internal (string-append "git " cmd))
#\newline)))
(interpret-markup layout props
(car result))))
If I feed it a command returning multiple lines, e.g.
\gitCommand "status"
this will create a markup with the first line of "git status"' result.
What way do I have to go to return either a \markuplist with all the
lines or a number of \markups, one for each line?
You use define-markup-command-list instead of define-markup-command,
interpret-markup-list instead of interpret-markup, and result instead of
(car result).
Thank you for that. However,
(interpret-markup-list layout props result)
returns all strings concatenated to one line. In the documentation on
http://www.lilypond.org/doc/v2.18/Documentation/extending/new-markup-list-command-definition.html
the function
make-justified-lines-markup-list
is used. Is there something similar that I can use here?
Urs