I posted a question on here about two different coding techniques on how to add a table of contents to a LilyPond Book. I am kind of stuck with the solution in the first example, since it gives me the possibility to add multiple table of contents into my book.

First Example (without dotted line):

#(define-markup-command (toc-line layout props label text)
(symbol? markup?)
(interpret-markup layout props
(markup #:fill-line (text #:page-ref label "8" "?"))))

%Table of Contens
\label #'toc
\markup {
\column {
\toc-line #'firstPart "First Score"
\toc-line #'secondPart "Second Score"
}
}

\label #'firstPart
\label #'secondPart


(Reference: taken from the LilyPond Documetory)

Second Example (with dotted line):

\header { tagline = ##f }
\paper {
tocItemMarkup = \tocItemWithDotsMarkup
}

\book {
\markuplist \table-of-contents
\tocItem \markup { Allegro }
\tocItem \markup { Largo }
\markup \null
}


(Reference: taken from the LilyPond Documetory)

My question is: How do I add dotted lines using the code in the first example, so I would get an output with dotted lines as shown in the second example?

I can draw a dotted line like this using a postscript:

\markup {
\postscript #"0.3 setlinewidth 1 setlinecap [0 1] 0 setdash 1 1 moveto 60 0 rlineto stroke"
}


How can I add this postscript to fill the space between the text and the page number in the toc definition of the first example?

#(define-markup-command (toc-line layout props label text)
(symbol? markup?)
(interpret-markup layout props
(markup #:fill-line (text #:page-ref label "8" "?"))))


This Project can be found here on GitHub.com