% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.

\documentclass[12pt,a4paper]{article}

\usepackage[colorlinks]{hyperref}
\usepackage[record,% using bib2gls
nostyles,% don't load default styles
stylemods={bookindex},% load glossary-bookindex and patch styles
style=bookindex]{glossaries-extra}

\GlsXtrLoadResources[
  src=no-interpret-preamble,
  interpret-preamble=false
]

\GlsXtrLoadResources[
  src={interpret-preamble2,people,books},
  write-preamble=false,
  interpret-label-fields,
  field-aliases={identifier=category,author=parent},
  check-end-punctuation={name},
  replicate-fields={name={first}}
]

\newcommand*{\bookfont}[1]{\emph{#1}}
\glssetcategoryattribute{book}{textformat}{bookfont}
\glssetcategoryattribute{book}{glossnamefont}{bookfont}

% requires glossaries-extra v1.23
\renewcommand*{\glsxtrifcustomdiscardperiod}[2]{%
 \GlsXtrIfFieldUndef{nameendpunc}{\glslabel}{#2}{#1}%
}

\begin{document}
\section{Sample}

\gls{ataleoftwocities}. \gls{bleakhouse}. \gls{thebigsleep}.
\gls{thelonggoodbye}. \gls{redharvest}.
\gls{murderontheorientexpress}. \gls{whydidnttheyaskevans}.
\gls{icecoldinalex}. \gls{thehobbit}. \gls{thelordoftherings}.
\gls{thewonderfulwizardofoz}. \gls{whiskygalore}.
\gls{whereeaglesdare}. \gls{icestationzebra}. \gls{ubik}.
\gls{doandroidsdreamofelectricsheep}. \gls{thetroublewithharry}.
\gls{brightonrock}.

\printunsrtglossary[title={Author and Book List}]

\end{document}
