I cannot wrap my head around the existing examples like this.
I am using the ekdosis package, which depends on the verse, and ultimately lineno to generate line numbers for a long verse based document. Now I was helped out with the following command, but I cannot get the right result, which should read "rose, 1, 4, 8". I am getting "rose, 8" instead:
\documentclass{report}
\usepackage{imakeidx}
\usepackage{xpatch}
\usepackage{ekdosis}
\makeindex
\makeatletter
\newcommand{\lineindex}[1]{\linelabel{#1}\index{#1}}
\patchcmd{@wrindex}{\thepage}{\getrefnumber{#2}}{}{}
\makeatother
\begin{document}
\begin{ekdosis}
\begin{ekdverse}
The rose is a rose,\lineindex{rose} \*
And was always a rose. \*
But the theory now goes \*
That the apple's a rose,\lineindex{rose} \*
And the pear is, and so's \*
The plum, I suppose. \*
The dear only knows \*
What will next prove a rose.\lineindex{rose} \*
You, of course, are a rose - \*
But were always a rose.\*
Robert Frost\*
\end{ekdverse}
\end{ekdosis}
\printindex
\end{document}
