Forum How do I...?

Unique page index listing

CrazyTux
We have a situation where we have an index of names that link back using page counting to determine the page in which they are located on. Is there a way to get prince to show unique pages? For example, lets say my name "CrazyTux" is on page 1 three times, page 10, twice

My index may contain and look something like this currently:

CrazyTux(1,1,1, 10, 10)

I wish for it to look like this:

CrazyTux(1, 10) -- removing non-unique page numbers.

Is there a way to do this?

The current code looks something like this:
<div>
CrazyTux (
<a href="#list-item-1" class="xref"></a>,
<a href="#list-item-1" class="xref"></a>,
<a href="#list-item-1" class="xref"></a>,
<a href="#list-item-10" class="xref"></a>,
<a href="#list-item-10" class="xref"></a>)
</div>


To be clear #list-item-N here is not reflective of actual page numbers as prince does this calculation for us and is some arbitrary integer value.

So this below code may make it more clear:

<div>
CrazyTux (
<a href="#list-item-1" class="xref"></a>, <!-- appears on page 1 -->
<a href="#list-item-2" class="xref"></a>, <!-- appears on page 1 -->
<a href="#list-item-3" class="xref"></a>, <!-- appears on page 1 -->
<a href="#list-item-11" class="xref"></a>, <!-- appears on page 10 -->
<a href="#list-item-12" class="xref"></a>) <!-- appears on page 10 -->
</div>


Thank you for your help!

Edited by CrazyTux

howcome
This is possible with a small script, described in this quick little guide:

https://css4.pub/2022/indexes/

The script will weed out duplicates, and also collapse page ranges. E.g., if a term appears on page 1, 2, and 3, the index will show "1-3".

Edited by howcome

CrazyTux
This works perfect, thank you -- !