Convert page references to text tags

The script converts all page references in a document to text tags of the form <ix>dog</ix> and inserts these where the page reference occurs in the text. This is usually right before the first character of the indexed word, so that you end up with e.g.

<ix>dog</ix>dog

where the tag shown in red is inserted before the text occurrence dog, shown in black.

Subtopics

Any subtopics are separated from the main topic and other subtopics by #. Example: all page references to the topic dog with subtopic collie which itself has a subtopic border collie are replaced with the text string <ix>dog#collie#border collie</ix>. If a page reference to this topic chain occurred at the phrase border collie in the text, you would see this:

<ix>dog#collie#border collie</ix>border collie

After converting all page references, all topics are deleted and the index is cleared.

Sort order

If a topic has a sort order defined, the sort order is suffixed to the topic's name separated by @. For example, the topic \target with sort order target is inserted as follows:

<ix>\target@target</ix>\target

Use

The script has no interface; just run it. You could change the codes that the script expects with other codes. The index can be rebuilt later using this script.

Problem entries

Problem entries are skipped so that their markers stay in the text. After running the script, if there were any errors an alert is shown. Check the index panel and try to fix the problematic entries.


Version history

11 July 2018: Improved error handling.

26 February 2016: Sort orders are now added to the text tag.

May 2009: First posted.


Useful script? Saved you lots of time?

Consider making a donation. To make a donation, please press the button below. This is Paypal's payment system; you don't need a Paypal account to use it: you can use several types/brands of credit and debit card.

Peter Kahrel's paypal account

Show script (right-click, Save Target/Link As to download)

Back to the main page on indexing

Back to the main script page

Installing and running scripts

Editing a script

Questions, comments? Get in touch