<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row>
        <after>DeleteVerse</after>
        <action>TypesetVersesAtEnd</action>
        <scheme>;;;TypesetVersesAtEnd
(let ((theverses "") (tag "VersesAtEnd"))
	(if (d-Directive-score? tag)
		(begin
			(d-DirectiveDelete-score tag)
			(d-InfoDialog (_ "Verses will no longer be printed at the end of the piece")))
		(let loop ((num 0))
			(define theverse #f)
			(if (zero? num) 
				(begin
					(set! num (d-GetUserInput (_ "Typesetting Verses at End") (_ "Which verse to start at?") "2"))
					(if num (set! num (string-&gt;number num)))))
			(if num
				(begin
					(set! theverse (d-GetVerse num))
					(if theverse
						(let ( (theoutput "\\markup {\\vspace #0.5 }") (thelines (string-split theverse  #\newline)))
							(define (output-line theline)
								(set! theoutput (string-append theoutput "\n\\markup \"" theline "\"\n")))
			
							(for-each output-line thelines)
							(set! theverses (string-append theverses  (string-append "\n\\markup \\bold {\\vspace #3 \"\nVerse " (number-&gt;string num) "\" }\n\n" theoutput)))
							(loop (+ num 1))))
					(if theverses
						(begin
							(d-DirectivePut-score-postfix tag theverses)
							(d-DirectivePut-score-override tag DENEMO_OVERRIDE_AFFIX)
							(d-SetSaved #f))
					(d-WarningDialog (_ "No verses found"))))
				(d-InfoDialog (_ "Cancelled"))))))</scheme>
        <label>Typeset Verses at End</label>
        <tooltip>Let's you choose a number of verses to print at the end of the piece (movement). Use a customized score layout to prevent them from appearing beneath the music in addition.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>
