You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -222,10 +224,19 @@ function package:registerCommands ()
222
224
else
223
225
SU.error("Unknown filler: " ..self.config.filler)
224
226
end
225
-
SILE.process(options.pageno)
227
+
SILE.call("index:pages:style", options, pages)
226
228
SILE.call("smallskip")
227
229
end)
228
-
end, "Output an index item")
230
+
end, "Output an index item (normally an internal command)")
231
+
232
+
-- Hooks for styling the index
233
+
self:registerCommand("index:entry:style", function (_, content)
234
+
SILE.process(content)
235
+
end, "Hook for styling an index entry")
236
+
237
+
self:registerCommand("index:pages:style", function (_, content)
238
+
SILE.process(content)
239
+
end, "Hook for styling index pages")
229
240
end
230
241
231
242
package.documentation=[[
@@ -254,12 +265,18 @@ Possible values are:
254
265
255
266
This package provides the \autodoc:command{\indexentry} command, which can be called as either \autodoc:command{\indexentry[label=<text>]} or \autodoc:command{\indexentry{<text>}} (so that it can be called from a macro).
256
267
Index entries are collated at the end of each page, and the command \autodoc:command{\printindex} will deposit them in a list.
257
-
The entry can be styled using the \autodoc:command{\index:item} command.
258
268
259
269
Multiple indexes are available and an index can be selected by passing the \autodoc:parameter{index=<name>} parameter to \autodoc:command{\indexentry} and \autodoc:command{\printindex}.
260
270
261
271
If the \autodoc:package{pdf} package is loaded, then pages in the index will be hyperlinked to the relevant references.
262
272
273
+
The following commands just process their content by default, but can be overridden to style the index at your convenience:
274
+
\begin{itemize}
275
+
\item{\autodoc:command{\index:entry:style}: Hook for styling the index entry.}
276
+
\item{\autodoc:command{\index:pages:style}: Hook for styling the page numbers.}
277
+
\end{itemize}
278
+
When called, they are being passed, as parameters, the index name and the content to be styled.
0 commit comments