summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx')
-rw-r--r--macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx3367
1 files changed, 3367 insertions, 0 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx b/macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx
new file mode 100644
index 0000000000..3cdcf29104
--- /dev/null
+++ b/macros/latex/contrib/biblatex-contrib/oscola/oscola.bbx
@@ -0,0 +1,3367 @@
+% Legal Style Citations using OSCOLA
+% Copyright Paul Stanley 2014-2018
+% This work consists of oscola.bbx, english-oscola.lbx, british-oscola.lbx,
+% oscola.cbx, american-oscola.lbx and oscola.ist.
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of the license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status 'maintained'.
+% The current maintainer of this work is Paul Stanley (pstanley@essexcourt.net)
+
+\ProvidesFile{oscola.bbx}[2019/01/20 v1.6 Biblatex bibliography style for OSCOLA standard]
+
+\RequireBibliographyStyle{authortitle}
+
+\RequireBiber[3]
+
+\DeclareBibliographyOption{caseshorthands}[false]{%
+ \ifstrequal{#1}{italic}
+ {\DeclareFieldFormat[jurisdiction]{shorthand}{\textit{##1}}}
+ {}}
+
+\newtoggle{bbx@capibid}% Capitalize Ibid in footnotes
+\DeclareBibliographyOption{ibidstyle}[lc]{%
+ \ifstrequal{#1}{uc}
+ {\global\toggletrue{bbx@capibid}}
+ {\togglefalse{bbx@capibid}}}
+
+\newtoggle{bbx@ecliuse}\newtoggle{bbx@eclionly}
+\DeclareBibliographyOption{ecli}[add]{%
+ \ifstrequal{#1}{no}
+ {\global\togglefalse{bbx@ecliuse}\global\togglefalse{bbx@eclionly}}
+ {\global\toggletrue{bbx@ecliuse}
+ \ifstrequal{#1}{only}
+ {\global\toggletrue{bbx@eclionly}}
+ {}}}
+
+\newcommand{\bbx@juriscitationindexlist}{}
+\listadd{\bbx@juriscitationindexlist}{{eu}{eujuriscitation:index}}
+\listadd{\bbx@juriscitationindexlist}{{echr}{echrjuriscitation}}
+\listadd{\bbx@juriscitationindexlist}{{int}{intjuriscitation}}
+\listadd{\bbx@juriscitationindexlist}{{ca}{canjuriscitation}}
+\listadd{\bbx@juriscitationindexlist}{{us}{usjuriscitation}}
+\newcommand{\bbx@defaultjuriscitationindex}{enjuriscitation}
+
+\newtoggle{bbx@shortindex}
+
+\DeclareBibliographyOption{shortindex}[true]{%
+ \toggletrue{bbx@shortindex}%
+ \renewcommand{\bbx@juriscitationindexlist}{}%
+ \listadd{\bbx@juriscitationindexlist}{{eu}{eujuriscitation:index:short}}%
+ \renewcommand{\bbx@defaultjuriscitationindex}{juriscitation:index:short}}
+
+% We ensure that there will always be a trash index
+\AtEndPreamble{%
+ \@ifpackageloaded{imakeidx}{\makeindex[name=trash]}
+ {\@ifclassloaded{memoir}{\PackageWarning{biblatex-oscola}{To use indexing with OSCOLA and the memoir class, you need to load imakeidx.}}
+ {\@ifpackageloaded{index}{\newindex{trash}{tdx}{tnd}{Miscellaneous}}
+ {\@ifpackageloaded{multind}{\PackageWarning{biblatex-oscola}{Multind is incompatible with biblatex-oscola. Use imakeidx or index}}
+ {\iftoggle{blx@citeindex}
+ {\PackageWarning{biblatex-oscola}
+ {You need to load imakeidx or index. Indexing will probably fail:}}{}}}}}}
+
+% The bibliography and citation styles use different forms of name
+\AtBeginBibliography{%
+ \toggletrue{abx@bool@giveninits}%
+ \DeclareNameAlias{default}{family-given}%
+ \DeclareNameAlias{editor}{given-family}}
+
+% Github issue 5 refers: Moewe points out that I don't need a redefinition of
+% the name:family-given bibmacro, but can simply do the following
+\renewcommand*{\revsdnamepunct}{}
+
+\DeclareNameAlias{sortname}{family-given}
+
+% This deals with initials: we need to format them without dots
+% and close together: HLA not H.L.A. or H. L. A. or H L A
+% The terseinits=true setting is not sufficient
+\renewcommand*\bibinitperiod{}
+\renewcommand*\bibinitdelim{}
+\let\oldbibnamedelima\bibnamedelima
+\let\oldbibnamedelimb\bibnamedelimb
+\let\oldbibnamedelimc\bibnamedelimc
+\let\oldbibnamedelimd\bibnamedelimd
+\let\oldbibnamedelimi\bibnamedelimi
+\global\newtoggle{bbx@initsep}
+\renewcommand\bibnamedelima{%
+ \iftoggle{bbx@initsep}
+ {\togglefalse{bbx@initsep}}
+ {\oldbibnamedelima}}
+\renewcommand\bibnamedelimb{%
+ \iftoggle{bbx@initsep}
+ {\togglefalse{bbx@initsep}}
+ {\oldbibnamedelimb}}
+\renewcommand\bibnamedelimc{%
+ \togglefalse{bbx@initsep}%
+ \oldbibnamedelimc}
+\renewcommand\bibnamedelimd{%
+ \togglefalse{bbx@initsep}%
+ \oldbibnamedelimd}
+\renewcommand\bibnamedelimi{%
+ \togglefalse{bbx@initsep}%
+ \oldbibnamedelimi}
+
+\def\bbxinitsep{%
+ \toggletrue{bbx@initsep}}
+
+% Standardised options
+\ExecuteBibliographyOptions{urldate=long,
+ dateabbrev=false,
+ doi=false,
+ eprint=false,
+ usetranslator=true,
+ sorting=niyt}
+
+\urlstyle{rm}% We don't want monospaced urls
+
+% If books are earlier than this year, the location gets printed
+% instead of the publisher
+\def\bibyearwatershed{1800}
+
+% Various toggles used for entry options
+
+\newtoggle{bbx:scotstyle}
+\newtoggle{bbx:suppressibid}
+\newtoggle{bbx:looseleaf}
+\newboolean{bbx@year-essential}\setboolean{bbx@year-essential}{false}
+
+% Entry options
+\DeclareEntryOption{url}[true]{%
+ \settoggle{bbx:url}{#1}}
+\DeclareEntryOption{doi}[true]{%
+ \settoggle{bbx:doi}{#1}}
+\DeclareEntryOption{eprint}[true]{%
+ \settoggle{bbx:eprint}{#1}}
+\DeclareEntryOption{scottish-style}[true]{%
+ \settoggle{bbx:scotstyle}{#1}}
+\DeclareEntryOption{no-ibid}[true]{%
+ \settoggle{bbx:suppressibid}{#1}}
+\DeclareEntryOption{looseleaf}[true]{%
+ \settoggle{bbx:looseleaf}{#1}}
+\DeclareEntryOption{year-essential}[true]{%
+ \setboolean{bbx@year-essential}{#1}}
+
+\DeclareLanguageMappingSuffix{-oscola}
+
+% Various aliases
+\DeclareBibliographyAlias{inproceedings}{book}
+\DeclareBibliographyAlias{booklet}{book}
+\DeclareBibliographyAlias{collection}{book}
+\DeclareBibliographyAlias{incollection}{inbook}
+\DeclareBibliographyAlias{techreport}{report}
+\DeclareBibliographyAlias{manual}{report}
+\DeclareBibliographyAlias{proceedings}{book}
+\DeclareBibliographyAlias{unpublished}{misc}
+\DeclareBibliographyAlias{mvbook}{book}
+\DeclareBibliographyAlias{bookinbook}{inbook}
+\DeclareBibliographyAlias{supbook}{inbook}
+\DeclareBibliographyAlias{mvcollection}{book}
+\DeclareBibliographyAlias{supcollection}{inbook}
+
+% This deals with suppression of the postnote delimiter after brackets. It
+% should be refactored to use a toggle rather than a counter
+
+\newcounter{bbx@suppresspostnotedelim}
+\newcommand{\bbx@resetpostnotedelim}{\setcounter{bbx@suppresspostnotedelim}{0}}
+\newcommand{\bbx@unsetpostnotedelim}{\setcounter{bbx@suppresspostnotedelim}{1}}
+\setcounter{bbx@suppresspostnotedelim}{0}
+
+% This is a package-specific temporary counter
+\newcounter{blx@tmpcnt}
+
+% This is used in constructing publication information
+
+\newboolean{bbx@pubinfopunct}
+\newcommand{\bbx@pubinfostart}
+{\setboolean{bbx@pubinfopunct}{false}}
+
+\newcommand{\bbx@pubinfoprint}{%
+ \ifthenelse{\(\boolean{bbx@pubinfopunct}\)}%
+ {\printtext{\addcomma\space}}%
+ {\setboolean{bbx@pubinfopunct}{true}%
+ \printtext{(}}}
+
+\newcommand{\bbx@pubinfostop}{%
+ \ifthenelse{\( \boolean{bbx@pubinfopunct} \)}%
+ {\printtext{)}\bbx@unsetpostnotedelim}
+ {}}
+
+% Many of these are "legacies" and probably not really required. I haven't been able
+% to work out why I seem always to need the starred form to get this to work
+\newcommand\nameaddonpseud{pseudonym}
+\newcommand\subtypemag{magazine}
+\newcommand*\subtypenewsp{newspaper}
+\newcommand\subtypeclassic{classic}
+\newcommand\subtypebiblical{biblical}
+\newcommand\subtypeearlybook{canon}
+\newcommand\subtypevideo{video}
+\newcommand\entrytypearchive{customa}
+\newcommand\subtypevolume{volume}
+\newcommand\subtypeonline{online}
+\newcommand\subtypedatabase{database}
+\newcommand\subtypeblog{blog}
+\newcommand\subtypelistmessage{listmessage}
+\newcommand\subtypebooklike{book}
+\newcommand\subtypepublicdocument{gov}
+\newcommand\authortypeanon{anonymous}
+\newcommand\authortypeunsure{anonymous?}
+\newcommand\authortyperedundant{redundant}
+\newcommand\authortypealternate{alternate}
+\newcommand\authortypejournal{journal}
+\newcommand\subtypeintro{to}
+\newcommand\subtypeexcerpt{from}
+\newcommand\subtypenone{none}
+\newcommand\edtypecorp{corporate}
+\newcommand\entrytypeper{periodical}
+\newcommand\entrytypemanual{manual}
+\newcommand\entrytypecoll{collection}
+\newcommand\entrytypebook{book}
+\newcommand*\subtypeprimarylegislation{primary}
+\newcommand*\subtypesecondarylegislation{secondary}
+\newcommand*\subtypecourtrules{procedure-rule}
+\newcommand\entrytyperef{reference}
+\newcommand\entrytypeproc{proceedings}
+\newcommand\entrytypereport{report}
+\newcommand\entrytypebooklet{booklet}
+\newcommand\entrytypemisc{misc}
+\newcommand\entrytypeonline{online}
+\newcommand\entrytypevideo{video}
+\newcommand\entrytypeaudio{audio}
+\newcommand\entrytypebookinbook{bookinbook}
+\newcommand\entrytypearticle{article}
+\newcommand\entrytypelegislation{legislation}
+\newcommand\entrytypeletter{letter}
+\newcommand\entrytypeperformance{performance}
+\newcommand\optionaddoriginal{addorig}
+\newcommand\optionnoreprints{none}
+\newcommand\optionorigfirst{origfirst}
+\newcommand\optiontransfromorig{transfrom}
+\newcommand\optionorigtransas{transas}
+\newcommand\optiondoubledate{doubledate}
+\newcommand\noplace{np}
+\newcommand\nopublisher{np}
+\newcommand*\officialjournaltitle{OJ}
+\newcommand*\ojspecedtitle{OJ Spec Ed}
+\newcommand*\ecrreporttitle{ECR}
+\newcommand*\commission{commission}
+\newcommand*\Commission{Commission}
+\newcommand*\pcijrep{PCIJ Rep}
+\newcommand*\explanatorynote{explanatory note}
+\newcommand*\eudirective{directive}
+\newcommand*\euregulation{regulation}
+\newcommand*\eudecision{decision}
+\newcommand*\treatysubtype{piltreaty}
+\newcommand*\comdocsubtype{comdoc}
+\newcommand*{\jurisechr}{echr}
+\providecommand*\eutreaty{eu-treaty}
+\newcommand*\casenote{casenote}
+\newcommand*\pagemarkings{page}
+\newcommand*\paragraphmarkings{[]}
+\newcommand*\paragraphtext{paragraph}
+\newcommand*\seriesa{Series A}
+\newcommand*\echrreports{ECHR}
+\newcommand*\decisionsandreports{DR}
+\newcommand*\collectionofdecisions{CD}
+\newcommand*{\parliamentarytype}{parliamentary}
+\newcommand*{\houseofcommons}{HC}
+\newcommand*{\houseoflords}{HL}
+\newcommand*\undoctype{undoc}
+
+% Some basic redefinitions and formatting
+\renewcommand\newunitpunct{\addspace}
+\renewcommand{\newblockpunct}{\addspace}
+\renewcommand{\subtitlepunct}{\addcolon\addspace}
+\newcommand{\extracitedelim}{\addcomma\space}
+\newcommand\casenotetext{\bibstring{casenote}}
+\newcommand\firstpublishedstr{\bibstring{firstpublished}}
+\newcommand*{\legalstarturl}{\ensuremath{\langle}}
+\newcommand*{\legalendurl}{\ensuremath{\rangle}}
+
+% Data Inheritances
+\DeclareDataInheritance{reference,mvreference}{inreference}{%
+ \inherit{title}{booktitle}
+ \inherit{volume}{userb}
+ \inherit{date}{date}
+ \inherit{edition}{edition}
+ \inherit{pagination}{pagination}
+ \noinherit{editor}
+ \noinherit{author}}
+\DeclareDataInheritance{legal}{legal}{%
+ \inherit{shorttitle}{title}
+ \inherit{indextitle}{indextitle}
+ \inherit{title}{indextitle}
+ \inherit{indexsortitle}{indexsorttitle}
+ \inherit{title}{indexsorttitle}
+ \inherit{pagination}{pagination}
+ \inherit{type}{type}
+ \inherit{entrysubtype}{entrysubtype}}
+\DeclareDataInheritance{jurisdiction}{article}{%
+ \noinherit{volume}
+ \noinherit{series}
+ \noinherit{journaltitle}
+ \noinherit{pages}
+ \noinherit{date}
+ \noinherit{institution}
+ \noinherit{issue}
+ \noinherit{number}
+ \noinherit{url}
+ \noinherit{urldate}}
+
+% These functions are used to identify whether an EU
+% case number is one case or more than one
+
+\def\legal@blank{|}
+\def\legal@optionone{}
+\def\legal@optiontwo{}
+\def\legal@containscommai#1,#2*{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\legal@blank%
+ \relax%
+ \else%
+ \global\let\legal@result\legal@optiontwo%
+ \fi}
+\def\legal@containsandi#1and#2*{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\legal@blank%
+ \relax%
+ \else%
+ \global\let\legal@result\legal@optiontwo%
+ \fi}
+\def\legal@containshypheni#1--#2*{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\legal@blank%
+ \relax%
+ \else%
+ \global\let\legal@result\legal@optiontwo%
+ \fi}%
+
+\def\legal@containscomma#1{\edef\legal@tempa{#1}\expandafter\legal@containscommai\legal@tempa,|*}
+\def\legal@containsand#1{\edef\legal@tempa{#1}\expandafter\legal@containsandi\legal@tempa and|*}
+\def\legal@containshyphen#1{\edef\legal@tempa{#1}\expandafter\legal@containshypheni\legal@tempa--|*}
+
+\newbibmacro{seteucases}{%
+ \iffieldundef{type}
+ {\global\def\legal@result{\bibstring{eucase}}%
+ \global\def\legal@optiontwo{\bibstring{eujoinedcases}}%
+ \legal@containscomma{\thefield{number}}%
+ \legal@containsand{\thefield{number}}%
+ \legal@containshyphen{\thefield{number}}%
+ \legal@result}
+ {\strfield{type}}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Various commands
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand\paratextformatted[1]{%
+ \ifnumeral{#1}
+ {\bibstring{paragraph}\addspace\printtext{#1}}
+ {\ifnumerals{#1}
+ {\bibstring{paragraphs}\addspace\printtext{#1}}
+ {\printtext{#1}}}}
+
+% Field Formats
+
+\DeclareFieldFormat{paragraph:text}{\paratextformatted{#1}}
+\DeclareFieldFormat{url}{\legalstarturl\url{#1}\legalendurl}
+\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
+\DeclareFieldFormat{postnote:old}{%
+ \ifentrytype{legislation}%
+ {\usebibmacro{legref}}%
+ {\mkpageprefix[pagination]{#1}}}
+\DeclareFieldFormat{paragraphed}{\formatpostnote{#1}}
+\DeclareFieldFormat{postnote}{#1}
+\DeclareFieldFormat{multipostnote}{#1}
+\DeclareFieldFormat{note}{\mkbibparens{#1}}
+\DeclareFieldFormat[article]{pages}{%
+ \mkfirstpage*{#1}}
+\DeclareFieldFormat[legislation]{pages}{%
+ \mkfirstpage*{#1}}
+\DeclareFieldFormat[jurisdiction]{pages}{%
+ \mkfirstpage*{#1}}
+\DeclareFieldFormat[jurisdiction]{usere}{%
+ \mkfirstpage*{#1}}
+\DeclareFieldFormat[jurisdiction]{title}{\mkbibemph{#1}}
+\DeclareFieldFormat[jurisdiction]{subtitle}{\mkbibemph{#1}}
+\DeclareFieldFormat[legal]{pages}{\mkfirstpage{#1}}
+\DeclareFieldFormat[inreference]{title}{\mkbibquote{#1}}
+\DeclareFieldFormat{newstitle}{\emph{#1}}
+\DeclareFieldFormat{intsubtitle}{\mkbibemph{#1}}
+\DeclareFieldFormat{journaltitle}{#1} % Journal Titles: Roman Type
+\DeclareFieldFormat{day}{#1}
+\DeclareFieldFormat{international}{%
+ \iffieldequals{journaltitle}{\pcijrep}
+ {\bibcpstring{jourser}\space #1}
+ {#1}}
+\DeclareFieldFormat{romanvol}{%
+ \RN{#1}}
+\DeclareFieldFormat[jurisdiction]{volume}{#1}
+\DeclareFieldFormat{quoted}{\mkbibquote{#1}}
+\DeclareFieldFormat[online]{title}{\mkbibquote{#1}}
+\DeclareFieldFormat[online]{note}{#1}
+\DeclareFieldFormat[online]{journaltitle}{\textit{#1}}
+\DeclareFieldFormat[thesis]{title}{\mkbibquote{#1}}
+\DeclareFieldFormat[misc]{title}{#1}
+\DeclareFieldFormat[misc]{journaltitle}{\mkbibquote{#1}}
+\DeclareFieldFormat[misc]{pages}{\mkfirstpage*{#1}}
+\DeclareFieldFormat[misc]{volume}{#1}
+\DeclareFieldFormat{casenotetitle}{\mkbibquote{\mkbibemph{#1}}}
+\DeclareFieldFormat{usseries}{\ifinteger{#1}{\mkusbibordinal{#1}}{#1}}
+\DeclareFieldFormat[legislation]{title}{#1}
+\DeclareFieldFormat[legal]{title}{#1}
+\DeclareFieldFormat{untitle}{#1}
+\DeclareFieldFormat{verba}{#1}
+
+\DeclareListFormat[jurisdiction]{extracites}{%
+ \extracitedelim #1}
+
+\DeclareListFormat[jurisdiction]{listb}{}
+
+\DeclareListFormat{ecthr}{%
+ \ifboolexpr{ (test {\ifdefstring{\Commission}{#1}} or
+ test {\ifdefstring{\commission}{#1}} ) }%
+ {\printtext{\mkbibparens{\bibstring{commissiondecision}}}\bbx@unsetpostnotedelim}%
+ {}}
+
+\DeclareListFormat[jurisdiction]{institution}{%
+ \ifthenelse{\( \value{listtotal}=1 \or \value{listcount}=\value{listtotal} \)}%
+ {#1}%
+ {\setcounter{blx@tmpcnt}{\value{listcount}}\addtocounter{blx@tmpcnt}{1}%
+ \ifthenelse {\( \value{blx@tmpcnt}=\value{listtotal}\)}%
+ {#1\space\bibstring{and}\addspace}%
+ {#1\addcomma\space}}}%
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Principal Drivers
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\DeclareBibliographyDriver{article}{%
+ \bbx@resetpostnotedelim%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \setunit{\addcomma\space}\newblock
+ \usebibmacro{journaltitle}%
+ \setunit{\addspace}%
+ \printlist{language}%
+ \setunit{\addspace}\newblock
+ \usebibmacro{byauthor}%
+ \setunit{\addspace}\newblock
+ \usebibmacro{bytranslator+others}%
+ \setunit{\addspace}\newblock
+ \printfield{version}%
+ \setunit{\addspace}\newblock%
+ \usebibmacro{journal+issuetitle}%
+ \setunit{\addspace}\newblock
+ \usebibmacro{byeditor+others}%
+ \setunit{\addspace}%
+ \usebibmacro{note+pages}%
+ \setunit{\addspace}%
+ \usebibmacro{doi+eprint+url}%
+ \setunit{\addspace}%
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{book}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+ \setunit{\addcomma\space}\newblock
+ \usebibmacro{maintitle+title}%
+ \newunit
+ \usebibmacro{publicationinfo}%
+ \newunit\newblock%
+ \usebibmacro{revisedbookvolume}%
+ \newunit\newblock%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \newunit%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}%
+
+\DeclareBibliographyDriver{commentary}{%
+ \usebibmacro{begentry}%
+ \ifkeyword{sc}%
+ {\usebibmacro{scotscommentary}}
+ {\usebibmacro{encommentary}}%
+ \bbx@unsetpostnotedelim%
+ \setunit{\bibpagerefpunct}%
+ \newunit\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{commentary:index}{%
+ \usebibmacro{begentry}%
+ \printfield[default]{indextitle}}
+
+\DeclareBibliographyDriver{inbook}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \setunit{\addcomma\space}\newblock
+ \usebibmacro{title}%
+ \usebibmacro{byauthor}%
+ \usebibmacro{in:}%
+ \newunit\newblock%
+ \usebibmacro{bybookauthor/editor/translator}%
+ \newblock%
+ \usebibmacro{maintitle+booktitle}%
+ \newunit\newblock
+ \newunit\newblock
+ \usebibmacro{publicationinfo}%
+ \newunit\newblock
+ \usebibmacro{revisedbookvolume}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{inreference}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \clearlist{publisher}%
+ \newunit\newblock
+ \usebibmacro{title}%
+ \usebibmacro{byauthor}%
+ \setunit{\addcomma\space}%
+ \setunit{\addcomma\space}%
+ \usebibmacro{maintitle+booktitle}%
+ \newunit
+ \usebibmacro{publicationinfo:short}%
+ \usebibmacro{revisedbookvolume}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{jurisdiction}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \bbx@resetpostnotedelim%
+ \usebibmacro{juriscitation}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{jurisdiction:index}{%
+ \usebibmacro{begentry}%
+ \DeclareFieldAlias[jurisdiction]{title}[default]{title}%
+ \DeclareFieldAlias[jurisdiction]{intsubtitle}[default]{title}%
+ \DeclareListAlias[jurisdiction]{listb}[jurisdiction]{extracites}%
+ \usebibmacro{juriscitation:index}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{jurisdiction:refonly}{%
+ \clearfield{title}%
+ \clearfield{titleaddon}%
+ \clearfield{title}%
+ \usedriver{}{jurisdiction}}
+
+\DeclareBibliographyDriver{jurisdiction:reponly}{%
+ \usebibmacro{begentry}%
+ \usebibmacro{altreportvolume}%
+ \newunit\newblock
+ \usebibmacro{altjournaltitle}%
+ \newunit\newblock
+ \usebibmacro{altseries}%
+ \newunit\newblock
+ \usebibmacro{altjurisdictionpages}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{legal}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\explanatorynote}
+ {\printfield[default]{title}\newunit\newblock}
+ {\iffieldequals{entrysubtype}{\parliamentarytype}
+ {\usebibmacro{legal:parliamentary}}
+ {\iffieldequals{entrysubtype}{\treatysubtype}
+ {\usebibmacro{treatycitation}}
+ {\usebibmacro{treatycitation}}}}%
+ \newunit\newblock
+ \usebibmacro{legislation:note}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{legal:index}{%
+ \savefield{indextitle}{\bbx@tempa}%
+ \restorefield{title}{\bbx@tempa}%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\explanatorynote}
+ {\printfield[default]{title}\newunit\newblock}
+ {\iffieldequals{entrysubtype}{\parliamentarytype}
+ {\usebibmacro{legal:parliamentary:index}}
+ {\iffieldequals{entrysubtype}{\treatysubtype}
+ {\usebibmacro{treatycitation}}
+ {\usebibmacro{treatycitation}}}}
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{legislation}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\subtypecourtrules}%
+ {\usebibmacro{courtrules}}
+ {\ifkeyword{draft}%
+ {\usebibmacro{legislation:bill}}%
+ {\ifkeyword{eu}%
+ {\usebibmacro{eulegislation}}%
+ {\printfield[default]{title}%
+ \setunit{\addspace}%
+ \printfield[default]{year}%
+ \setunit*{\addspace}%
+ \usebibmacro{legnumber}%
+ \newunit\newblock
+ \usebibmacro{legsupp}}}}% Adds additional material for welsh statutory instruments
+ \newunit
+ \usebibmacro{legislation:note}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{legislation:index}{%
+ \usebibmacro{begentry}%
+ \ifboolexpr{ test {\ifkeyword{eu}}
+ and not test {\iffieldequals{entrysubtype}{\eutreaty}}}
+ {\usebibmacro{legislation:index:eu}}%
+ {\ifkeyword{draft}
+ {\usebibmacro{legislation:bill}}
+ {\usebibmacro{legislation:index:general}}}%
+ \usebibmacro{finentry}}
+
+\newbibmacro{legislation:index:general}{%
+ \printfield[default]{indextitle}%
+ \newunit
+ \ifkeyword{eu}{}{\printfield[default]{year}}%
+ \newunit
+ \usebibmacro{legnumber}%
+ \newunit
+ \ifkeyword{eu}{\usebibmacro{eulegref}}{}
+ \usebibmacro{legsupp}}
+
+\newbibmacro{legislation:index:eu}{%
+ \iffieldundef{type}
+ {}
+ {\ifbibxstring{\thefield{type}}%
+ {\printtext{\bibcpstring{\thefield{type}}}}
+ {\printtext{\MakeCapital{\thefield{type}}}}}
+ \newunit
+ \printfield{number}%
+ \newunit
+ \usebibmacro{eulegref}}
+
+\DeclareBibliographyDriver{misc}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\undoctype}
+ {\usebibmacro{undoc}}
+ {\usebibmacro{author/editor+others/translator+others}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{misctitle}%
+ \newunit\newblock
+ \usebibmacro{publicationinfo}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+%\DeclareBibliographyDriver{misc:index}{%
+% \printfield{indextitle}}%
+
+\DeclareBibliographyDriver{online}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+ \setunit{\addcomma\space}%
+ \newblock
+ \usebibmacro{online:title}%
+ \newunit
+ \usebibmacro{publicationinfo:online}%
+ \newunit\newblock%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \newunit%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{patent}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+ \setunit{\labelnamepunct}\newblock
+ \usebibmacro{title}%
+ \newunit\newblock
+ \printtext{\bibopenparen}%
+ \printlist{language}%
+ \setunit*{\addspace}%
+ \usebibmacro{byauthor}%
+ \setunit*{\addcomma\space}%
+ \printfield{type}%
+ \ifboolexpr{test {\iffieldundef{byauthor}} and test {\iffieldundef{type}}}
+ {\unspace\setunit{}}
+ {\setunit*{\addspace}}%
+ \printfield{number}%
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext[parens]{%
+ \printlist[][-\value{listtotal}]{location}}}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{byholder}%
+ \setunit*{\addcomma\space}%
+ \printfield{note}%
+ \setunit{\addspace}%
+ \usebibmacro{date}%
+ \printtext{\bibcloseparen}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \usebibmacro{related}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{periodical}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{editor}%
+ \setunit{\addcomma\space}\newblock
+ \printfield{title}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \setunit{\addspace}%
+ \printlist{language}%
+ \setunit{\addspace}\newblock
+ \printfield{version}%
+ \setunit{\addspace}\newblock%
+ \usebibmacro{journaldate}%
+ \newunit
+ \usebibmacro{volume+number+eid}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \setunit{\addspace}
+ \usebibmacro{note+pages}%
+ \setunit{\addspace}
+ \usebibmacro{doi+eprint+url}%
+ \setunit{\addspace}
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{reference}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{maintitle+title}%
+ \newunit
+ \iftoggle{bbx:looseleaf}
+ {\bbx@resetpostnotedelim}
+ {\usebibmacro{publicationinfo:short}%
+ \newunit\newblock%
+ \usebibmacro{revisedbookvolume}%
+ \newunit\newblock%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock}%
+ \setunit{\bibpagerefpunct}%
+ \newunit\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}%
+
+\DeclareBibliographyDriver{report}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\comdocsubtype}%
+ {\usebibmacro{comdoc}}%
+ {\usebibmacro{report:standard}}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{report:refonly}{%
+ \iffieldequals{entrysubtype}{\comdocsubtype}
+ {\usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \printfield{number}%
+ \newunit\newblock
+ \usebibmacro{finentry}}%
+ {\usedriver{}{report}}}%
+
+\DeclareBibliographyDriver{report:index}{%
+ \usebibmacro{begentry}%
+ \iffieldequals{entrysubtype}{\comdocttype}
+ {\printfield{number}}
+ {\printfield[default]{indextitle}%
+ \newunit
+ \usebibmacro{report:index:info}}%
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{thesis}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+ \setunit{\addcomma\space}%
+ \newblock
+ \printfield{title}%
+ \newunit
+ \usebibmacro{thesis:info}%
+ \newunit\newblock%
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \newunit%
+ \usebibmacro{pageref}%
+ \usebibmacro{finentry}}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Bibmacros
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newbibmacro*{altjournaltitle}{%
+ \iffieldundef{userc}
+ {\printfield{journaltitle}\newunit}
+ {\printfield{userc}}}
+
+\newbibmacro*{altjurisdictionpages}{%
+ \iffieldundef{usere}%
+ {\usebibmacro{jurisdictionpages}}
+ {\printfield{usere}}}%
+
+\newbibmacro{altreportdetails}{%
+ \restorefield{prenote}{\postnotesecond}%
+ \iffieldundef{userc}%
+ {}%
+ {\usebibmacro{altreportvolume}%
+ \newunit\newblock
+ \usebibmacro{altjournaltitle}%
+ \newunit\newblock
+ \usebibmacro{altseries}%
+ \newunit\newblock
+ \usebibmacro{altjurisdictionpages}%
+ \iffieldundef{prenote}
+ {}
+ {\addcomma\space\printfield[postnote]{prenote}}}}
+
+\newbibmacro*{altreportvolume}{%
+ \iffieldundef{userb}
+ {\usebibmacro{reportvolume}}
+ {\printfield{userb}}}
+
+\newbibmacro*{altseries}{%
+ \iffieldundef{userd}%
+ {\iffieldundef{series}%
+ {}%
+ {\printfield{series}}}%
+ {\printfield{userd}}}
+
+\newbibmacro*{author/editor/institution}{%
+ \ifnameundef{author}%
+ {\ifnameundef{editor}%
+ {\iflistundef{institution}
+ {}
+ {\printlist{institution}\clearlist{institution}}}
+ {\usebibmacro{editor+others}}}
+ {\usebibmacro{author}}}
+
+\newbibmacro{bookauthor}{%
+ \ifnameundef{bookauthor}
+ {}
+ {\printnames{bookauthor}}}
+
+\newbibmacro{bookeditor}{%
+ \ifnameundef{editor}
+ {}
+ \printnames{editor}}
+
+\newbibmacro{booktranslator}{%
+ \ifnameundef{translator}
+ {}
+ \printnames{translator}}
+
+\renewbibmacro*{byauthor}{%
+ \ifboolexpr{
+ test \ifuseauthor
+ or
+ test {\ifnameundef{author}}
+ }%
+ {}%
+ {\bbx@pubinfoprint%
+ \usebibmacro{bytypestrg}{author}{author}%
+ \setunit{\addspace}%
+ \printnames[byauthor]{author}}}
+
+\newbibmacro{bookvolume}{%
+ \iffieldundef{volume}%
+ {}%
+ {\setunit{\addspace}%
+ \printfield{volume}\newunit}}
+
+\newbibmacro{bybookauthor/editor/translator}{%
+ \ifnameundef{bookauthor}
+ {\ifnameundef{editor}
+ {\ifnameundef{translator}
+ {}
+ {\usebibmacro{translator+others}\setunit{\addcomma\space}}}
+ {\usebibmacro{editor+others}\setunit{\addcomma\space}}}
+ {\usebibmacro{bookauthor}\setunit{\addcomma\space}}}
+
+\renewbibmacro*{byeditor+others}{%
+ \ifnameundef{editor}%
+ {}%
+ {\bbx@pubinfoprint%
+ \printnames[byeditor]{editor}%
+ \setunit{\addspace}%
+ \usebibmacro{editorstrg}%
+ \clearname{editor}}%
+ \usebibmacro{byeditorx}%
+ \newunit
+ \usebibmacro{bytranslator+others}}
+
+\renewbibmacro*{bytypestrg}[2]{%
+ \iffieldundef{#1type}
+ {\bibstring{by#2}}
+ {\ifbibxstring{by\thefield{#1type}}
+ {\bibstring{by\thefield{#1type}}}
+ {\printtext{\thefield{#1type}}}}}
+
+\renewbibmacro*{bytranslator+others}{%
+ \ifnameundef{translator}%
+ {}
+ {\bbx@pubinfoprint%
+ \printnames[bytranslator]{translator}%
+ \setunit{\addspace}%
+ \usebibmacro{translator+othersstrg}%
+ \clearname{translator}}%
+ \usebibmacro{withothers}}
+
+\newbibmacro{canjuriscitation}{%
+ \usebibmacro{title}%
+ \newunit\newblock%
+ \usebibmacro{neutralcite}%
+ \setunit{\addcomma\space}%
+ \iffieldundef{journaltitle}%
+ {}%
+ {\usebibmacro{year+vol+report:can}}%
+ \usebibmacro{jurisdictionpages}%
+ \usebibmacro{pcitenote}%
+ \usebibmacro{altreportdetails}%
+ \unspace\printlist[jurisdiction][1-\value{listtotal}]{listb}%
+ \newunit\newblock
+ \usebibmacro{courtid}%
+ \newunit%
+ \usebibmacro{court-note}%
+ \newblock%
+ \newunit}
+
+\newbibmacro*{comdoc}{%
+ \usebibmacro{author/editor/institution}%
+ \setunit{\addcomma\space}%
+ \printfield[quoted]{title}%
+ \newunit\newblock%
+ \usebibmacro{commission:report:type}%
+ \newunit\newblock%
+ \printfield{number}%
+ \newunit}
+
+\newbibmacro*{commission:report:type}{%
+ \iffieldundef{type}%
+ {}
+ {\printtext{\mkbibparens{\printfield{type}}}}}
+
+\newbibmacro{conferencedate}{%
+ \iffieldundef{eventyear}%
+ {}
+ {\bbx@pubinfoprint\printeventdate}}
+
+\newbibmacro{conferencetitle}{%
+ \iffieldundef{eventtitle}
+ {}
+ {\bbx@pubinfoprint\printfield{eventtitle}}}
+
+\newbibmacro{convenue}{%
+ \iffieldundef{venue}
+ {}
+ {\bbx@pubinfoprint\printfield{venue}}}
+
+\newbibmacro{court-note}{%
+ \iffieldundef{note}%
+ {}%
+ {\printfield{note}%
+ \bbx@unsetpostnotedelim}}
+
+\newbibmacro*{courtid}{%
+ \iffieldundef{number}%
+ {\ifboolexpr {test {\iflistundef{institution}}
+ and test {\iffieldundef{location}}}%
+ {\bbx@resetpostnotedelim}%
+ {\printtext{\mkbibparens{\printfield{location}%
+ \newunit
+ \printlist{institution}%
+ \usebibmacro{unrep:date}}}%
+ \bbx@unsetpostnotedelim}%
+ }%
+ {\bbx@resetpostnotedelim}}
+
+\newbibmacro*{courtrules}{%
+ \restorefield{prenote}{\postnotesecond}%
+ \iffieldequalstr{shorttitle}{PD}%
+ {\printfield{postnote}%
+ \clearfield{postnote}%
+ \addspace
+ \newunit}%
+ {}%
+ \iffieldundef{shorttitle}%
+ {\printfield[default]{title}}%
+ {\printfield[default]{shorttitle}}%
+ \newblock\newunit
+ \iffieldundef{postnote}%
+ {\bbx@unsetpostnotedelim}
+ {\iffieldequalstr{shorttitle}{CPR}
+ {\printfield{postnote}\newunit}
+ {\printtext{\bibstring{order}\space%
+ \printfield{postnote}\setunit{\addcomma\space}}}}%
+ \restorefield{postnote}{\postnotesecond}%
+ \usebibmacro{postnote}%
+ \global\toggletrue{cbx@postnoteprinted}%
+ \newunit\newblock}
+
+\renewbibmacro*{doi+eprint+url}{%
+ \iftoggle{bbx:doi}
+ {\printfield{doi}}
+ {}%
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ \ifboolexpr{ test {\iftoggle{bbx:url}}
+ or test {\ifentrytype{online}}}
+ {\usebibmacro{url+urldate}}
+ {}}
+
+
+\newbibmacro*{echrreports}{%
+ \printfield{journaltitle}%
+ \newunit
+ \usebibmacro{year}%
+ \iffieldundef{volume}
+ {}
+ {\printtext{--}\printfield[romanvol]{volume}}
+ \newunit
+ \printfield{pages}}
+
+\newbibmacro{echrjuriscitation}{%
+ \usebibmacro{echrtitle}%
+ \newunit\newblock
+ \iffieldundef{journaltitle}
+ {\usebibmacro{echr:unreported}}
+ {\usebibmacro{echr:year+vol+report}% Which also deals with pages
+ \newunit\newblock
+ \usebibmacro{echr:courtid}}%
+ \newunit
+ \usebibmacro{court-note}%
+ \newblock
+ \newunit}
+
+\newbibmacro*{echr:courtid}{%
+ \ifboolexpr{ (test {\iffieldequals{journaltitle}{\decisionsandreports}}
+ or test {\iffieldequals{journaltitle}{\collectionofdecisions}} )}
+ {}
+ {\printlist[ecthr]{institution}}}
+
+\DeclareListFormat{echrinst}{%
+ \ifthenelse{\( \value{listtotal}=1 \or \value{listcount}=\value{listtotal} \)}%
+ {\ifboolexpr{ (test {\ifdefstring{\Commission}{#1}}
+ or test {\ifdefstring{\commission}{#1}} )}
+ {\bibstring{commissiondecision}}%
+ {#1}}%
+ {\setcounter{blx@tmpcnt}{\value{listcount}}\addtocounter{blx@tmpcnt}{1}%
+ \ifthenelse {\( \value{blx@tmpcnt}=\value{listtotal}\)}%
+ {#1\space\bibstring{and}\addspace}%
+ {#1\addcomma\space}}}%
+
+
+\newbibmacro{echr:unreported}{%
+ \iffieldundef{number}%
+ {}%
+ {\printtext{\bibstring{application}\space\bibstring{number}\space}\printfield{number}\addspace}%
+ \newunit\newblock
+ \ifboolexpr{( test {\iflistundef{institution}}
+ and test {\iffieldundef{date}}
+ and test {\iffieldundef{year}} )}
+ {}
+ {\ifboolexpr{( test {\iffieldundef{date}} and test {\iffieldundef{year}} )}
+ {\mkbibparens{\printlist[jurisdiction]{institution}}}
+ {\bbx@unsetpostnotedelim\iflistundef{institution}%
+ {\mkbibparens{\usebibmacro{date}}}%
+ {\printtext{\bibopenparen\printlist[echrinst]{institution}\addcomma\space}\usebibmacro{date}\bibcloseparen}}}}
+
+\newbibmacro*{echr:year+vol+report}{%
+ \iffieldequals{journaltitle}{\seriesa}
+ {\usebibmacro{seriesareport}}
+ {\iffieldequals{journaltitle}{\echrreports}
+ {\usebibmacro{echrreports}}
+ {\usebibmacro{year+vol+report}
+ \newunit
+ \printfield{pages}}}}
+
+\newbibmacro*{echrtitle}{%
+ \ifboolexpr{
+ test {\iffieldundef{title}}
+ and
+ test {\iffieldundef{subtitle}}
+ }
+ {}
+ {\printtext[title]{%
+ \printfield[titlecase]{title}%
+ \iffieldundef{subtitle}{}{\setunit{\subtitlepunct}}%
+ \printfield[titlecase]{subtitle}}}%
+ \iffieldundef{titleaddon}
+ {}
+ {\newunit\printtext{\mkbibparens{\printfield{titleaddon}}}}}
+
+\newbibmacro{editionpubinfo}{%
+ \iffieldundef{edition}%
+ {}
+ {\bbx@pubinfoprint%
+ \printfield{edition}}}
+
+\renewbibmacro*{editor+others}{%
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }%
+ {\printnames{editor}\addspace%
+ \printtext{\mkbibparens{%
+ \usebibmacro{editor+othersstrg}}}%
+ \clearname{editor}}
+ {}}
+
+\newbibmacro{encommentary}{%
+ \iffieldundef{shorttitle}
+ {\iffieldundef{maintitle}%
+ {\iffieldundef{booktitle}%
+ {\printfield[default]{title}}%
+ {\printfield[default]{booktitle}}}%
+ {\printfield[default]{maintitle}}}%
+ {\printfield[default]{shorttitle}}%
+ \newunit\newblock}
+
+\newbibmacro{enjuriscitation}{%
+ \iffieldundef{title}%
+ {}%
+ {\usebibmacro{title}%
+ \newunit\newblock}%
+ \usebibmacro{neutralcite}%
+ \iffieldundef{journaltitle}% UNREPORTED CASE
+ {}%
+ {\usebibmacro{year+vol+report}}%
+ \usebibmacro{jurisdictionpages}%
+ \usebibmacro{pcitenote}%
+ \usebibmacro{altreportdetails}%
+ \unspace\printlist[jurisdiction][1-\value{listtotal}]{listb}%
+ \newunit\newblock
+ \usebibmacro{courtid}%
+ \newunit%
+ \usebibmacro{court-note}%
+ \newblock%
+ \newunit%
+}
+
+\newbibmacro{eucasenumber}{%
+ \usebibmacro{seteucases}%
+ \addnbspace
+ \printfield{number}%
+ \newunit}
+
+\newbibmacro{eucommissiondecision}{%
+ \iffieldundef{userb}
+ {}
+ {\mkbibparens{\printfield{userb}}}%
+ \newunit
+ \iffieldundef{type}
+ {\setunit{\addspace\printtext{\bibstring{commissiondecision}\addspace}}}
+ {\setunit{\addspace\printfield{type}\addspace}}%
+ \printfield{number}}
+
+\newbibmacro{eujuriscitation}{%
+ \iflistcontains{institution}{\commission}%
+ {}
+ {\usebibmacro{eucasenumber}}%
+ \usebibmacro{title}%
+ \newunit
+ \iflistcontains{institution}{\commission}
+ {\usebibmacro{eucommissiondecision}}
+ {}%
+ \newunit%
+ \usebibmacro{eu:reportinfo}%
+ \newunit%
+ \usebibmacro{court-note}%
+}
+
+\newbibmacro{eujuriscitation:index:short}{%
+ \iftoggle{bbx@numcite}
+ {\iffieldundef{userb}{}{\printfield{userb}\newunit}
+ \printfield{number}}
+ {\usebibmacro{title}%
+ \newunit
+ \iffieldundef{userb}
+ {}
+ {\printtext{\mkbibparens{\printfield{userb}}\newunit}}%
+ \printtext{\mkbibparens{\usebibmacro{euparenthetical}}}}%
+ \newunit%
+ \usebibmacro{court-note}}
+
+\newbibmacro{eujuriscitation:index}{%
+ \iftoggle{bbx@numcite}
+ {\iffieldundef{userb}{}{\printfield{userb}\newunit}
+ \printfield{number}%
+ \newunit
+ \usebibmacro{title}}
+ {\usebibmacro{title}%
+ \newunit
+ \iffieldundef{userb}
+ {}
+ {\printtext{\mkbibparens{\printfield{userb}}\newunit}}%
+ \printtext{\mkbibparens{\usebibmacro{euparenthetical}}}}%
+ \newunit%
+ \iftoggle{bbx@shortindex}
+ {}
+ {\usebibmacro{eu:reportinfo}%
+ \newunit}%
+ \usebibmacro{court-note}%
+}
+
+\newbibmacro{eulegislation}{%
+ \printfield[default]{title}%
+ \newunit\newblock%
+ \usebibmacro{eulegref}%
+ \newunit\newblock%
+ \usebibmacro{doi+eprint+url}}
+
+\newbibmacro{eulegref}{%
+ \ifboolexpr{test {\iffieldequals{journaltitle}{\officialjournaltitle}}
+ or test {\iffieldequals{journaltitle}{\ojspecedtitle}}}%
+ {\printfield[brackets]{year}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit{\addspace}
+ \iffieldundef{series}
+ {\printtext{L}}%
+ {\printfield[default]{series}}%
+ \usebibmacro{issue/volume}%
+ \printtext{\slash}%
+ \printfield{pages}%
+ \bbx@resetpostnotedelim}
+ {\usebibmacro{year+vol+report}}}
+
+\newbibmacro{euparenthetical}{%
+ \iffieldundef{type}%
+ {}%
+ {\printfield{type}\setunit{\addspace}}%
+ \printfield{number}}
+
+\newbibmacro*{eu:reportinfo}{%
+ \iftoggle{bbx@eclionly}
+ {\iffieldundef{verba}
+ {\usebibmacro{eu:osreport}}%
+ {\printfield{verba}}}
+ {\usebibmacro{eu:osreport}}}
+
+
+\newbibmacro*{eu:osreport}{%
+ \iftoggle{bbx@ecliuse}
+ {\iffieldundef{verba}
+ {}
+ {\printfield{verba}%
+ \setunit{\addcomma\space}}}%
+ {}%
+ \iffieldundef{journaltitle}%
+ {\usebibmacro{eu:unreported}}%
+ {\usebibmacro{eu:year+vol+report}}}
+
+\newbibmacro*{eu:unreported}{%
+ \iffieldundef{verba}
+ {\ifboolexpr{( test {\iflistundef{institution}}
+ and test {\iffieldundef{date}}
+ and test {\iffieldundef{year}} )}
+ {}%
+ {\ifboolexpr{( test {\iffieldundef{date}} and test {\iffieldundef{year}} )}
+ {\mkbibparens{\printlist[jurisdiction]{institution}}}
+ {\bbx@unsetpostnotedelim\iflistundef{institution}%
+ {\mkbibparens{\usebibmacro{date}}}%
+ {\printtext{\bibopenparen%
+ \printlist[jurisdiction]{institution}\addcomma\space}\usebibmacro{date}\bibcloseparen}}}}
+ {\iftoggle{bbx@ecliuse}
+ {}
+ {\printfield{verba}}}}
+
+\newbibmacro*{eu:year+vol+report}{%
+ \iffieldequals{journaltitle}{\ecrreporttitle}%
+ {\printfield[brackets]{year}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit{\addspace}%
+ \printfield{volume}%
+ \iffieldundef{volume}{}{\printtext{--\allowbreak}}%
+ \printfield{pages}}%
+ {\iffieldequals{journaltitle}{\officialjournaltitle}%
+ {\printfield[brackets]{year}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit{\addspace}
+ \printfield[default]{series}%
+ \usebibmacro{issue/volume}%
+ \printtext{\slash}%
+ \printfield{pages}}
+ {\usebibmacro{year+vol+report}}}}
+
+\newbibmacro*{hansard-ref}{%
+% Print column entry if there is not postnote
+ \iffieldundef{postnote}{%
+ \iffieldundef{pages}%
+ {}%
+ {\printfield{pages}}}%
+ {}}%
+
+\newbibmacro{hc:or:hl}{%
+ \printfield[parlt:num]{number}}
+
+\renewbibmacro*{in:}{%
+{\printtext{\space\midsentence\bibstring{in}\addspace}}}
+
+\newbibmacro{institution+date}{%
+ \iflistundef{institution}
+ {\iffieldundef{year}
+ {}
+ {\bbx@pubinfoprint
+ \usebibmacro{year}}}
+ {\bbx@pubinfoprint
+ \printlist{institution}%
+ \iffieldundef{year}
+ {}
+ {\addspace
+ \usebibmacro{year}}}}
+
+
+\newbibmacro{intjuriscitation}{%
+ \iflistundef{institution}
+ {\setunit{}\printtext{}}
+ {\printlist{institution}%
+ \setunit{\addcomma\space}}%
+ \usebibmacro{int:title}%
+ \usebibmacro{int:subtitle}%
+ \usebibmacro{int:titleaddon}%
+ \newunit\newblock
+ \iffieldundef{journaltitle}%
+ {\printfield{number}%
+ \newunit\newblock
+ \printtext{\mkbibparens{\printdate}}
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}}%
+ {\usebibmacro{int:year+vol+report}}%
+ \newunit%
+ \usebibmacro{int:jurisdictionpages}%
+ \newunit\newblock
+ \usebibmacro{court-note}%
+}
+
+\newbibmacro*{int:jurisdictionpages}{%
+ \iffieldequals{journaltitle}{\pcijrep}
+ {\printtext{\bibcpstring{number}\addspace}%
+ \iffieldundef{pages}
+ {\printfield{number}}
+ {\printfield{pages}}}
+ {\printfield{pages}}}
+
+\newbibmacro{int:subtitle}{%
+ \iffieldundef{subtitle}%
+ {}%
+ {\printtext{\space}%
+ \mkbibparens{\printfield[intsubtitle]{subtitle}}}}
+
+\newbibmacro{int:title}{%
+ \iffieldundef{title}%
+ {}
+ {\printfield{title}}}
+
+\newbibmacro{int:titleaddon}{%
+ \iffieldundef{titleaddon}%
+ {}%
+ {\printtext{\space}%
+ \mkbibparens{\printfield[default]{titleaddon}}}}
+
+\newbibmacro*{int:year+vol+report}{%
+ \usebibmacro{journaldate}%
+ \newunit
+ \usebibmacro{reportvolume}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield[international]{series}%
+ \setunit{\addspace}}}%
+
+\newbibmacro*{issue/volume}{%
+ \iffieldundef{volume}%
+ {\iffieldundef{issue}%
+ {}%
+ {\printfield{issue}}}%
+ {\printfield[default]{volume}}}
+
+\renewbibmacro*{journal+issuetitle}{%
+ \iffieldequals{entrysubtype}{\subtypenewsp}
+ {\printfield[newstitle]{journaltitle}%
+ \newunit
+ \printtext{\mkbibparens{%
+ \iflistundef{location}
+ {}%
+ {\printlist{location}%
+ \setunit{\addcomma\space}}%
+ \usebibmacro{date}}}\newunit}
+ {\usebibmacro{journaldate}%
+ \newunit
+ \usebibmacro{volume+number+eid}%
+ \setunit{\addspace}%
+ \usebibmacro{journal}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \newunit}}
+
+\newbibmacro*{journaldate}{%
+ \ifthenelse{ \(%
+ \iffieldundef{volume}%
+ \or%
+ \boolean{bbx@year-essential}%
+ \) }%
+ {\ifboolexpr{ test {\ifkeyword{sc}} or
+ test {\iftoggle{bbx:scotstyle}}}%
+ {\usebibmacro{year}}%
+ {\usebibmacro{year}[brackets]}}%
+ {\usebibmacro{year}[parens]}%
+}
+
+\newbibmacro{journaltitle}{%
+ \iffieldequals{entrysubtype}{\casenote}
+ {\iffieldundef{crossref}
+ {\usebibmacro{title}}
+ {\iffieldundef{note}
+ {\restorefield{note}{\casenotetext}}
+ {}
+ \ifboolexpr{ test {\iffootnote}
+ and test {\iftoggle{bbx@samefootnote}}
+ and test {\iffieldequals{crossref}{\blx@lastkey@foot}}}
+ {}
+ {\printfield[casenotetitle]{title}}}}
+ {\usebibmacro{title}}}
+
+\newcommand{\csusebibmacro}[1]{%
+ \edef\bbx@tempcsname{%
+ \noexpand\usebibmacro{#1}}%
+ \bbx@tempcsname}
+
+\newtoggle{bbx@juriscitedone}
+
+\newcommand{\bbx@juriscitationlist}{}
+\listadd{\bbx@juriscitationlist}{{eu}{eujuriscitation}}
+\listadd{\bbx@juriscitationlist}{{echr}{echrjuriscitation}}
+\listadd{\bbx@juriscitationlist}{{int}{intjuriscitation}}
+\listadd{\bbx@juriscitationlist}{{ca}{canjuriscitation}}
+\listadd{\bbx@juriscitationlist}{{us}{usjuriscitation}}
+
+\global\edef\bbx@defaultjuriscitation{enjuriscitation}
+
+\newbibmacro{juriscitation}{%
+ \togglefalse{bbx@juriscitedone}%
+ \renewcommand{\do}[1]{%
+ \edef\@tempa{\noexpand\ifkeyword{\expandafter\@firstoftwo ##1}}%
+ \edef\@tempb{\expandafter\@secondoftwo ##1}%
+ \@tempa
+ {\toggletrue{bbx@juriscitedone}\csusebibmacro{\@tempb}}
+ {}}%
+ \dolistloop{\bbx@juriscitationlist}%
+ \iftoggle{bbx@juriscitedone}
+ {}
+ {\csusebibmacro{\bbx@defaultjuriscitation}}}
+
+\newbibmacro{juriscitation:index}{%
+ \savefield{indextitle}{\bbx@tempa}%
+ \restorefield{title}{\bbx@tempa}%
+ \ifkeyword{eu}%
+ {\usebibmacro{eujuriscitation:index}}%
+ {\iftoggle{bbx@shortindex}
+ {\printfield{title}%
+ \setunit{\addspace}
+ \iffieldundef{year}
+ {}
+ {\printtext{\mkbibparens{\printfield{year}}}}}
+ {\ifkeyword{echr}%
+ {\usebibmacro{echrjuriscitation}}%
+ {\ifkeyword{int}%
+ {\usebibmacro{intjuriscitation}}%
+ {\ifkeyword{us}
+ {\usebibmacro{usjuriscitation}}
+ {\usebibmacro{enjuriscitation}}}}}}}
+
+\renewbibmacro{juriscitation:index}{%
+ \togglefalse{bbx@juriscitedone}%
+ \renewcommand{\do}[1]{%
+ \edef\@tempa{\noexpand\ifkeyword{\expandafter\@firstoftwo ##1}}%
+ \edef\@tempb{\expandafter\@secondoftwo ##1}%
+ \@tempa
+ {\toggletrue{bbx@juriscitedone}\csusebibmacro{\@tempb}}
+ {}}%
+ \dolistloop{\bbx@juriscitationindexlist}%
+ \iftoggle{bbx@juriscitedone}
+ {}
+ {\csusebibmacro{\bbx@defaultjuriscitationindex}}}
+
+\newbibmacro{juriscitation:index:short}{%
+ \printfield{title}%
+ \setunit*{\addspace}%
+ \iffieldundef{year}
+ {}
+ {\printtext{\mkbibparens{\printfield{year}}}}}
+
+\newbibmacro*{jurisdictionpages}{%
+ \iffieldequals{entrysubtype}{\subtypenewsp}%
+ {}
+ {\newunit\printfield{pages}}}
+
+\newbibmacro*{legnumber}{%
+ \iffieldequals{entrysubtype}{\subtypeprimarylegislation}%
+ {\ifboolexpr {(test {\iffieldundef{number}}
+ or not test {\iffieldundef{title}})
+ and not
+ ( test {\ifkeyword{cy}}
+ or test {\ifkeyword{sc}}
+ or test {\ifkeyword{ni}} )}%
+ {}%
+ {\printtext{\mkbibparens{\printfield{number}}}\bbx@unsetpostnotedelim}}
+ {\iffieldundef{number}%
+ {}%
+ {\setunit{\addcomma\addspace}%
+ \printfield{number}\bbx@resetpostnotedelim}}}
+
+\newbibmacro{legal:parliamentary}{%
+ \printfield[default]{title}%
+ \newblock\newunit
+ \usebibmacro{date}%
+ \setunit{\addcomma\space}%
+ \printfield{volume}%
+ \setunit{\addcomma\space}%
+ \usebibmacro{hansard-ref}%
+ \bbx@resetpostnotedelim}
+
+\newbibmacro{legal:parliamentary:index}{%
+ \printfield[default]{title}%
+ \newunit
+ \usebibmacro{date}}
+
+\newbibmacro{legislation:bill}{%
+ \printfield[draftleg]{title}%
+ \newunit
+ \iflistundef{institution}
+ {}
+ {\printlist{institution}\setunit{\addspace}}%
+ \iffieldequals{entrysubtype}{\subtypeprimarylegislation}
+ {\printtext{\bibcpstring{bill}}%
+ \newunit
+ \printtext{\mkbibparens{\usebibmacro{sessionyear}}}%
+ \newunit%
+ \iffieldundef{number}
+ {}%
+ {\printlist[billprinting]{institution}}%
+ }%
+ {\printtext{\bibopenparen{\bibstring{draft}}
+ \addspace\printdate\bibcloseparen}}}
+
+\newbibmacro{legislation:note}{%
+ \iffieldundef{note}
+ {}
+ {\setunit{\addcomma\space}%
+ \printfield[default]{note}}}
+
+\newbibmacro{legref}{%
+ \ifboolexpr{ (test {\iffieldundef{pagination}}
+ or (not test {\iffieldbibstring{pagination}} ) ) }%
+ {\iffieldbibstring{pagination}{}{\BibliographyWarning{Pagination type \strfield{pagination} undefined}}\printfield{postnote}}
+ {\ifnumeralfirst{\thefield{postnote}}
+ {\ifnumeralsfirst{\thefield{postnote}}
+ {\bibstring{\thefield{pagination}s}\addnbspace\printfield{postnote}}
+ {\bibstring{\thefield{pagination}}\addnbspace\printfield{postnote}}}
+ {\printfield{postnote}}}}
+
+\newbibmacro*{legsupp}{%
+ \ifkeyword{cy}
+ {\iffieldundef{userb}
+ {}
+ {\printtext{\mkbibparens{\printfield{userb}}}\bbx@unsetpostnotedelim}}
+ {}}
+
+\renewbibmacro*{maintitle+title}{%
+ \iffieldsequal{maintitle}{title}%
+ {\clearfield{maintitle}%
+ \clearfield{mainsubtitle}%
+ \clearfield{maintitleaddon}}%
+ {\iffieldundef{maintitle}%
+ {}%
+ {\usebibmacro{maintitle}%
+ \newunit\newblock%
+ \iffieldundef{volume}%
+ {}%
+ {\iffieldundef{crossref}
+ {\ifboolexpr{test {\iffieldundef{volume}}
+ and test {\iffieldundef{part}}}
+ {}
+ {\setunit{\addcomma\space}%
+ \printfield{volume}%
+ \printfield{part}%
+ \clearfield{volume}%
+ \clearfield{part}%
+ \setunit{\addcomma\space}}}
+ {}}}}%
+ \usebibmacro{title}%
+ \newunit}%
+
+\renewbibmacro*{maintitle+booktitle}{%
+ \iffieldsequal{maintitle}{title}%
+ {\clearfield{maintitle}%
+ \clearfield{mainsubtitle}%
+ \clearfield{maintitleaddon}}%
+ {\iffieldundef{maintitle}%
+ {}%
+ {\usebibmacro{maintitle}%
+ \newunit\newblock%
+ \iffieldundef{volume}%
+ {}%
+ {\iffieldundef{crossref}
+ {\printfield{volume}%
+ \clearfield{volume}%
+ \printfield{part}%
+ \newunit}
+ {}}}}%
+ \usebibmacro{booktitle}%
+ \newunit}
+
+\newbibmacro{misctitle}{%
+ \iffieldundef{title}
+ {\iffieldundef{journaltitle}
+ {}
+ {\printfield{journaltitle}%
+ \newunit}}
+ {\iffieldundef{journaltitle}
+ {\printfield{title}%
+ \newunit}
+ {\printfield{title}%
+ \setunit{\addcomma\space}%
+ \printfield{journaltitle}%
+ \newunit}}}
+
+\newbibmacro{neutralcite}{%
+ \iffieldundef{number}%
+ {}%
+ {\printfield{number}\setunit{\addcomma\space}}}
+
+\newbibmacro{newspaperdate}{\printdate}%
+
+\renewbibmacro{note+pages}{%
+ \printfield{pages}%
+ \setunit{\addspace}%
+ \printfield{note}%
+ \newunit}
+
+\newbibmacro{online:title}{%
+ \iffieldundef{title}%
+ {\iffieldundef{note}
+ {}
+ {\printfield{note}%
+ \clearfield{note}}}
+ {\printfield{title}}}
+
+\newbibmacro{origyear}{%
+ \iffieldundef{origyear}%
+ {}
+ {\bbx@pubinfoprint%
+ \printtext{\firstpublishedstr\addspace}%
+ \printfield{origyear}}}
+
+\newbibmacro*{parltnum}{%
+ \iffieldundef{number}
+ {}
+ {\bbx@pubinfoprint\printfield[parlt:postnum]{number}}}
+
+\newbibmacro*{parltvol}{%
+ \iffieldundef{volume}
+ {}
+ {\iffieldundef{number}
+ {}
+ {\printtext{--\printfield[romanvol]{volume}}%
+ \clearfield{volume}}}}
+
+\newbibmacro{pcitenote}{%
+ \iffieldundef{userc}
+ {}
+ {\iffieldundef{postnote}
+ {\setunit{\addcomma\space}}
+ {\addcomma\space\printfield{postnote}%
+ \global\toggletrue{cbx@postnoteprinted}%
+ \setunit{\addsemicolon\space}}}}
+
+\renewbibmacro*{postnote}{%
+ \ifboolexpr {test {\iffieldundef{postnote}} or
+ test {\iftoggle{cbx@postnoteprinted}}}%
+ {}%<--- this used to read \midsentence
+ {\ifboolexpr{test {\ifnumequal{\value{bbx@suppresspostnotedelim}}{1}}}
+ {\setunit{\addspace}%
+ \bbx@resetpostnotedelim}%
+ {\setunit{\postnotedelim}}%
+ \usebibmacro{postnotepagination}}%
+ \global\toggletrue{cbx@postnoteprinted}}
+
+\newbibmacro{postnote:us}{%
+ \iffieldundef{postnote}
+ {}
+ {\setunit{\addcomma\space}%
+ \printfield{postnote}%
+ \global\toggletrue{cbx@postnoteprinted}}}
+
+\newbibmacro*{postnotepagination}{%
+ \ifboolexpr{ (
+ test {\ifkeyword{eu}}
+ or test {\ifkeyword{echr}} )}
+ {\usebibmacro{postnotepaginationpara}}% Default is "para" for EU and ECHR
+ {\usebibmacro{postnotepaginationpage}}} % Default is "page"
+
+\newbibmacro*{postnotepaginationpara}{%
+ \ifboolexpr{ (
+ test {\iffieldundef{pagination}}
+ or
+ test {\iffieldequals{pagination}{\paragraphtext}} )}
+ {\printfield[paragraph:text]{postnote}}%
+ {\iffieldequals{pagination}{\paragraphmarkings}%
+ {\nopunct\addspace\printfield[paragraphed]{postnote}}
+ {\printfield[postnote:old]{postnote}}}}
+
+\newbibmacro*{postnotepaginationpage}{%
+ \ifboolexpr{ (
+ test {\iffieldundef{pagination}}
+ or
+ test {\iffieldequals{pagination}{\pagemarkings}} )}
+ {\printfield{postnote}}%
+ {\iffieldequals{pagination}{\paragraphmarkings}
+ {\nopunct\addspace\printfield[paragraphed]{postnote}}
+ {\printfield[postnote:old]{postnote}}}}
+
+\newbibmacro*{publicationinfo}{%
+ \newunit
+ \bbx@pubinfostart
+ \usebibmacro{byauthor}%
+ \usebibmacro{byeditor+others}%
+ \usebibmacro{convenue}%
+ \usebibmacro{conferencetitle}%
+ \usebibmacro{editionpubinfo}%
+ \usebibmacro{pubinfo:note+addendum+pubstate}%
+ \usebibmacro{origyear}%
+ \usebibmacro{conferencedate}%
+ \usebibmacro{pubinfo:series+number}%
+ \usebibmacro{pubinfo:volume}%
+ \usebibmacro{publisher+location+date}%
+ \bbx@pubinfostop
+ \newunit\newblock}
+
+\newbibmacro{publicationinfo:online}{%
+ \addspace
+ \bbx@pubinfostart%
+ \usebibmacro{websitetitle}%
+ \usebibmacro{publisher+location+date}%
+ \bbx@pubinfostop%
+}
+
+\newbibmacro*{publicationinfo:short}{% This is for reference works
+ \newunit
+ \iffieldundef{edition}%
+ {\iffieldundef{year}%
+ {\bbx@resetpostnotedelim}%
+ {\bbx@unsetpostnotedelim\printtext{\mkbibparens{\usebibmacro{year}}}}}%
+ {\bbx@unsetpostnotedelim\printtext{\bibopenparen\printfield{edition}}%
+ \iffieldundef{year}%
+ {}%
+ {\printtext{\addspace\usebibmacro{year}}}%
+ \printtext{\bibcloseparen}}}
+
+\newbibmacro*{pubinfo:note+addendum+pubstate}{%
+ \ifboolexpr{(
+ test{\iffieldundef{note}}
+ and test {\iffieldundef{addendum}}
+ and test {\iffieldundef{pubstate}} )}%
+ {}
+ {\bbx@pubinfoprint%
+ \printfield[default]{note}%
+ \setunit{\addcomma\space}%
+ \printfield{addendum}%
+ \setunit{\addcomma\space}%
+ \printfield{pubstate}}}
+
+\newbibmacro*{pubinfo:series+number}{%
+ \iffieldundef{series}
+ {\iffieldundef{number}
+ {}
+ {\bbx@pubinfoprint
+ \printfield{number}}}
+ {\iffieldundef{number}
+ {\bbx@pubinfoprint
+ \printfield{series}}
+ {\bbx@pubinfoprint
+ \printfield{series}%
+ \newunit
+ \printfield{number}}}}
+
+\newbibmacro{pubinfo:volume}{%
+ \ifboolexpr{ test {\ifentrytype{book}}
+ or test {\ifentrytype{collection}}}
+ {\iffieldundef{volume}
+ {}
+ {\bbx@pubinfoprint
+ \printfield{volume}%
+ \clearfield{volume}}}
+ {\iffieldundef{userb}
+ {}
+ {\bbx@pubinfoprint
+ \printfield{userb}%
+ \clearfield{userb}}}}
+
+\renewbibmacro*{publisher+location+date}{%
+ \iffieldundef{year}
+ {}%
+ {\ifboolexpr{test {\iflistundef{location}}
+ or test {\ifnumgreater{\thefield{year}}{\bibyearwatershed}}}
+ {}%
+ {\clearlist{publisher}}}
+ \ifboolexpr{(
+ test {\iflistundef{publisher}}
+ and test {\iflistundef{location}}
+ and test {\iffieldundef{date}}
+ and test {\iffieldundef{year}} )}%
+ {}% NOTHING TO DO
+ {%
+ \bbx@pubinfoprint
+ \iflistundef{publisher}
+ {\iflistundef{location}%
+ {}%
+ {\printlist{location}%
+ \iffieldundef{year}
+ {}%
+ {\setunit{\addcomma\space}}}}%
+ {\printlist{publisher}\setunit{\addspace}}%
+ \usebibmacro{spaceddate}}}%
+
+\newbibmacro*{reportvolume}{%
+ \iffieldundef{volume}%
+ {}%
+ {\printfield{volume}}}
+
+\newbibmacro{report:index:info}{%
+ \bbx@pubinfostart
+ \usebibmacro{report:index:author}%
+ \iffieldequals{entrysubtype}{\parliamentarytype}%
+ {\bbx@pubinfoprint%
+ \usebibmacro{hc:or:hl}%
+ \usebibmacro{sessionyear}%
+ \usebibmacro{parltnum}%
+ \usebibmacro{parltvol}}%
+ {\usebibmacro{rep:type}%
+ \usebibmacro{rep:series+number}%
+ \usebibmacro{rep:year}}%
+ \bbx@pubinfostop}
+
+\newbibmacro{report:index:author}{%
+ \ifnameundef{author}
+ {\ifnameundef{editor}
+ {\iflistundef{institution}
+ {}
+ {\bbx@pubinfoprint
+ \printlist{institution}
+ \clearlist{institution}}}
+ {\bbx@pubinfoprint
+ \usebibmacro{byedtor+others}}}
+ {\bbx@pubinfoprint%
+ \printnames{author}}}
+
+\newbibmacro*{report:standard}{%
+ \usebibmacro{author/editor/institution}%
+ \setunit*{\addcomma\space}\newblock
+ \usebibmacro{title}%
+ \usebibmacro{reportinfo}%
+ \newunit\newblock
+ \usebibmacro{revisedbookvolume}%
+ \newunit\newblock}%
+
+\newbibmacro{reportinfo}{%
+ \newunit
+ \bbx@pubinfostart
+ \iffieldequals{entrysubtype}{\parliamentarytype}%
+ {\bbx@pubinfoprint%
+ \usebibmacro{hc:or:hl}%
+ \usebibmacro{sessionyear}%
+ \usebibmacro{parltnum}%
+ \usebibmacro{parltvol}}%
+ {\usebibmacro{rep:type}%
+ \usebibmacro{rep:series+number}%
+ \usebibmacro{rep:year}}%
+ \bbx@pubinfostop}
+
+\newbibmacro*{rep:institution/publisher}{%
+ \iflistundef{institution}%
+ {}%
+ {\bbx@pubinfoprint%
+ \printlist{institution}}%
+ \iflistundef{publisher}%
+ {}%
+ {\bbx@pubinfoprint%
+ \printlist{publisher}\addspace}%
+ \ifboolexpr{test {\iflistundef{institution}}
+ and test {\iflistundef{publisher}}}
+ {}
+ {\newunit}}
+
+\newbibmacro*{rep:type}{%
+ \iffieldundef{type}%
+ {}%
+ {\bbx@pubinfoprint%
+ \printfield{type}}}
+
+\newbibmacro*{rep:series+number}{%
+ \iffieldundef{series}%
+ {\iffieldundef{number}
+ {}%
+ {\bbx@pubinfoprint
+ \printfield{number}}}%
+ {\iffieldundef{series}
+ {}
+ {\bbx@pubinfoprint%
+ \printfield{series}}%
+ \iffieldundef{number}
+ {}%
+ {\setunit{\addspace}\printfield{number}}}}
+
+\newbibmacro{revisedbookvolume}{%
+ \iffieldundef{volume}%
+ {}
+ {\usebibmacro{bookvolume}%
+ \bbx@resetpostnotedelim}}
+
+\newbibmacro*{rep:year}{%
+ \ifboolexpr{ test{\iffieldundef{year}}
+ and test {\iffieldundef{date}}
+ and test {\iflistundef{publisher}}
+ and test {\iflistundef{institution}}}%
+ {}%
+ {\bbx@pubinfoprint
+ \usebibmacro{rep:institution/publisher}%
+ \usebibmacro{year}}}
+
+\newbibmacro*{seriesareport}{%
+ \usebibmacro{year}[parens]%
+ \newunit
+ \printfield{journaltitle}%
+ \newunit%
+ \printtext{\bibstring{number}\addspace}%
+ \printfield{pages}}
+
+\newbibmacro*{sessionyear}{%
+ \iffieldundef{year}%
+ {}%
+ {\iffieldundef{endyear}%
+ {\printfield{year}}%
+ {\printtext{\printfield{year}\bibdatedash{\usebibmacro{year:lastdigits}}}}}}
+
+\newbibmacro{scotscommentary}{%
+ \printnames{author}%
+ \newunit\newblock%
+ \usebibmacro{maintitle+title}%
+ \newunit\newblock}
+
+\renewbibmacro*{shorthandintro}{%
+ \bbx@ifnottrackingcites
+ {}
+ {\iffieldundef{shorthandintro}
+ {\iffieldundef{shorthand}
+ {}
+ {\bbx@unsetpostnotedelim\setunit{\addspace}%
+ \printtext[parens]{\unspace\printfield{shorthand}}}}
+ {\bbx@unsetpostnotedelim\setunit{\addspace}%
+ \printtext[parens]{\printfield{shorthandintro}}}}}
+
+\newbibmacro{spaceddate}{%
+ \ifboolexpr{ ( test {\iffieldundef{year}}
+ and test {\iffieldundef{date}} ) }
+ {\unspace}%
+ {\usebibmacro{date}}}
+
+\newbibmacro{thesis:type}{%
+ \iffieldundef{type}
+ {}
+ {\bbx@pubinfoprint
+ \printfield{type}}}
+
+\newbibmacro{thesis:info}{%
+ \bbx@pubinfostart
+ \usebibmacro{thesis:type}%
+ \usebibmacro{institution+date}%
+ \bbx@pubinfostop}
+
+\renewbibmacro*{title}{%
+ \ifboolexpr{
+ test {\iffieldundef{title}}
+ and
+ test {\iffieldundef{subtitle}}
+ }
+ {}
+ {\printtext[title]{%
+ \printfield[titlecase]{title}%
+ \iffieldundef{subtitle}{}{\setunit{\subtitlepunct}}%
+ \printfield[titlecase]{subtitle}}}%
+ \iffieldundef{titleaddon}{}{\newunit\printfield{titleaddon}}}
+
+\renewbibmacro*{translator+others}{%
+ \ifboolexpr{
+ test \ifusetranslator
+ and
+ not test {\ifnameundef{translator}}
+ }
+ {\printnames{translator}\addspace%
+ \printtext{\mkbibparens{%
+ \usebibmacro{translator+othersstrg}}}%
+ \clearname{translator}}
+ {}}
+
+\newbibmacro*{undoc}{%
+ \iffieldundef{title}
+ {}
+ {\ifnameundef{author}%
+ {}
+ {\usebibmacro{author/editor+others/translator+others}%
+ \setunit*{\addcomma\space}}%
+ \printfield[untitle]{title}%
+ \setunit{\addcomma\space}}%
+ \printlist{institution}%
+ \newunit
+ \printfield{titleaddon}%
+ \newunit\newblock
+ \iffieldundef{number}
+ {\usebibmacro{undoc:year+vol+report}}
+ {\iffieldundef{year}
+ {\setunit{\addcomma\space}}
+ {\printtext{\mkbibparens{\usebibmacro{date}}}%
+ \newunit}%
+ \printfield{number}}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{legislation:note}}
+
+\newbibmacro*{undoc:index}{%
+ \clearname{author}%
+ \clearname{editor}%
+ \usebibmacro{undoc}}
+
+\newbibmacro*{undoc:year+vol+report}{%
+ \usebibmacro{journaldate}%
+ \newunit
+ \usebibmacro{reportvolume}%
+ \setunit{\addspace}%
+ \printfield[default]{journaltitle}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \printfield{pages}}
+
+\newbibmacro*{unrep:date}{%
+ \ifboolexpr{ test {\iffieldundef{journaltitle}}%
+ and test {\iffieldundef{number}}}%
+ {\setunit{\addcomma\space}%
+ \usebibmacro{date}}%
+ {}}
+
+\renewbibmacro*{url+urldate}{%
+ \iffieldundef{url}
+ {}
+ {\printfield{url}%
+ \iffieldundef{urlyear}
+ {}%
+ {\setunit*{\addspace}%
+ \bbx@resetpostnotedelim%
+ \printtext{\printurldate}}}}
+
+\newbibmacro{usjuriscitation}{%
+ \usebibmacro{title}%
+ \newunit\newblock%
+ \iffieldundef{journaltitle}%
+ {\printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield[default]{eprint}}
+ {\usebibmacro{vol+report:us}}%
+ \newunit
+ \usebibmacro{jurisdictionpages}%
+ \usebibmacro{postnote:us}%
+ \usebibmacro{altreportdetails}%
+ \newunit\newblock
+ \unspace\printlist[jurisdiction][1-\value{listtotal}]{listb}%
+ \newunit
+ \usebibmacro{us:courtid+date}%
+ \newunit%
+ \usebibmacro{court-note}%
+ \newblock
+ \newunit}
+
+\newbibmacro{us:courtid+date}{%
+ \ifboolexpr{test {\iflistundef{institution}}
+ and test {\iflistundef{location}}
+ and test {\iffieldundef{year}}}
+ {}
+ {\printtext{\mkbibparens{%
+ \iflistundef{location}
+ {\printlist{institution}}
+ {\printlist{location}%
+ \newunit
+ \printlist{institution}}%
+ \newunit
+ \printfield{year}%
+ \setunit{}}}}}
+
+\newbibmacro{vol+report:us}{%
+ \usebibmacro{reportvolume}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield[usseries]{series}}}
+
+\renewbibmacro*{volume+number+eid}{%
+ \printfield{volume}%
+ \iffieldundef{issue}%
+ {\printfield[parens]{number}}%
+ {\iffieldundef{number}%
+ {\printfield[parens]{issue}}
+ {\printtext[parens]{\printfield{number}\addspace\printfield{issue}}}}
+ \setunit{\addcomma\space}%
+ \printfield{eid}}
+
+\newbibmacro{websitetitle}{%
+ \iffieldundef{journaltitle}
+ {}
+ {\bbx@pubinfoprint
+ \printfield{journaltitle}}}
+
+
+\newbibmacro*{year}[1][]{%
+ \iffieldundef{year}%
+ {}%
+ {\printfield[#1]{year}}}
+
+\newbibmacro*{year+vol+report}{%
+ \iffieldequals{entrysubtype}{\subtypenewsp}
+ {}%
+ {\usebibmacro{journaldate}%
+ \newunit}%
+ \usebibmacro{reportvolume}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \iffieldequals{entrysubtype}{\subtypenewsp}
+ {\setunit{\addcomma\space}\usebibmacro{newspaperdate}}%
+ {}}
+
+\newbibmacro*{year+vol+report:can}{%
+ \iffieldundef{number}
+ {\newunit}
+ {\ifthenelse{ \(%
+ \iffieldundef{volume}%
+ \or%
+ \boolean{bbx@year-essential}%
+ \) }%
+ {}
+ {\clearfield{year}}}%
+ \iffieldequals{entrysubtype}{\subtypenewsp}
+ {}%
+ {\iffieldundef{year}
+ {}
+ {\usebibmacro{journaldate}%
+ \newunit}}
+ \usebibmacro{reportvolume}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\setunit{\addspace}%
+ \printtext{\mkbibparens{\printfield[usseries]{series}}}%
+ \setunit{\addspace}}%
+ \iffieldequals{entrysubtype}{\subtypenewsp}
+ {\setunit{\addcomma\space}\usebibmacro{newspaperdate}}%
+ {}}
+
+
+%%%%%% END %%%%%
+
+% This infuriating spaghetti (largely taken from biblatex.sty) deals with
+% formatting postnotes of the [1]--[2] variety
+
+\def\bbx@legalpostnotea#1 {\def\bbx@savedargone{{#1}}%
+ \futurelet\bbx@next\bbx@legalpostnoteX}
+\def\bbx@legalpostnoteX{%
+ \ifx(\bbx@next \expandafter\bbx@legalpostnoteXX%)
+ \else \expandafter\bbx@legalpostnoteXXX \fi}
+\def\bbx@legalpostnoteXXX{\expandafter\rangesplit\bbx@savedargone}
+\def\bbx@legalpostnoteXX{\expandafter\bbx@legalpostnoteY\bbx@savedargone}
+\def\bbx@legalpostnoteY#1(#2{%)
+ \rangesplit{#1} (#2}
+\def\bbx@legalpostnote#1{\bbx@legalpostnotea#1 }
+
+\newtoggle{bbx@inrangetog}\newtoggle{bbx@pnotetog}
+\DeclareListParser*{\forbbxrange}{--}
+\def\rangesplit#1{\togglefalse{bbx@inrangetog}\forbbxrange{\bbx@legal@addbrackets}{#1}}
+\def\bbx@legal@addbrackets#1{\iftoggle{bbx@inrangetog}{\printtext{--}}{\toggletrue{bbx@inrangetog}}\printtext{[#1]}}
+\def\formatpostnote#1{\togglefalse{bbx@pnotetog}\let\do\bbx@splitformat\docsvlist{#1}}
+\def\bbx@splitformat#1{\iftoggle{bbx@pnotetog}{\addcomma\space}{\toggletrue{bbx@pnotetog}}\bbx@legalpostnote{#1}}
+
+% This tests whether the *first* character of a postnote is a numeral. I originally had a more elegant way
+% of doing this (I thought), but I couldn't get it to work or diagnose the trouble
+
+\def\bbx@legal@ifnumeralfirst#1#2|#3#4{%
+ \ifboolexpr{ test {\ifstrequal{#1}{0}}
+ or test {\ifstrequal{#1}{1}}
+ or test {\ifstrequal{#1}{2}}
+ or test {\ifstrequal{#1}{3}}
+ or test {\ifstrequal{#1}{4}}
+ or test {\ifstrequal{#1}{5}}
+ or test {\ifstrequal{#1}{6}}
+ or test {\ifstrequal{#1}{7}}
+ or test {\ifstrequal{#1}{8}}
+ or test {\ifstrequal{#1}{9}} }
+ {#3}
+ {#4}}
+
+\def\ifnumeralfirst#1#2#3{%
+ \edef\legal@tempa{#1|}% REMOVE ME
+ \expandafter\bbx@legal@ifnumeralfirst\legal@tempa{#2}{#3}}
+
+\def\ifnumeralsfirst#1#2#3{%
+ \ifnumeralfirst{#1}%
+ {\numeraljustfirst{#1}{#2}{#3}}%
+ {#3}}
+
+\def\numeraljustfirst#1#2#3{%
+ \def\legal@result{#3}%
+ \def\legal@optiontwo{#2}%
+ \legal@containscomma{#1}%
+ \legal@containsand{#1}%
+ \legal@containshyphen{#1}%
+ \legal@result}
+
+% This all deals with formatting HL and HC numbers correctly
+
+\newcounter{bbx@legal@tempcounter}
+
+\DeclareFieldFormat{parlt:num}{%
+ \setcounter{bbx@legal@tempcounter}{0}%
+ \renewcommand*\do[1]{\stepcounter{bbx@legal@tempcounter}}%
+ \docsvlist{#1}%
+ \ifnum\value{bbx@legal@tempcounter} < 2\relax%
+ \printtext{\bbx@legal@chamberpart{#1}\addspace}%
+ \fi}
+
+\DeclareFieldFormat{parlt:postnum}{%
+ \setcounter{bbx@legal@tempcounter}{0}%
+ \renewcommand*\do[1]{\stepcounter{bbx@legal@tempcounter}}%
+ \docsvlist{#1}%
+ \ifnum\value{bbx@legal@tempcounter} < 2\relax
+ \printtext{\bbx@legal@numberpart{#1}}%
+ \else
+ \printtext{#1}%
+ \fi}
+
+\def\bbx@legal@@chamberpart#1 #2\relax{%
+ #1}
+
+\def\bbx@legal@chamberpart#1{%
+ \begingroup
+ \edef\bbx@legal@tempa{#1\space}%
+ \expandafter\endgroup
+ \expandafter\bbx@legal@@chamberpart\bbx@legal@tempa\relax}
+
+\newbibmacro{year:lastdigits}{%
+ \iffieldequalstr{endyear}{2000}%
+ {2000}%
+ {\printtext{\bbx@legal@lasttwo{\strfield{endyear}}}}}
+
+\def\bbx@legal@@lasttwo#1#2#3#4\relax{%
+ #3#4}
+
+\def\bbx@legal@lasttwo#1{%
+ \begingroup
+ \edef\bbx@legal@tempa{#1}%
+ \expandafter\endgroup
+ \expandafter\bbx@legal@@lasttwo\bbx@legal@tempa\relax}
+
+\def\bbx@legal@@numberpart#1 #2\relax{
+ \bbx@legal@chamberpart{#2}}
+
+\def\bbx@legal@numberpart#1{%
+ \begingroup
+ \edef\bbx@legal@tempa{#1\space}%
+ \expandafter\endgroup
+ \expandafter\bbx@legal@@numberpart\bbx@legal@tempa\relax}
+
+% This stuff inserts institutional information into draft legislation
+% titles
+
+\DeclareFieldFormat{draftleg}{%
+ \bbx@billsplit{#1}}
+
+\def\bbx@billspliti#1 Bill#2/relax{#1}
+\def\bbx@billsplit#1{%
+ \expandafter\bbx@billspliti#1 Bill/relax}
+
+\DeclareListFormat{billprinting}{%
+ \ifstrequal{#1}{HC}
+ {\mkbibbrackets{\strfield{number}}\bbx@unsetpostnotedelim}
+ {\strfield{number}\bbx@resetpostnotedelim}}
+
+% TREATIES
+% Because there is some complexity here, I'm keeping this stuff together
+
+\newbibmacro{treatycitation}{%
+ \printfield[default]{title}%
+ \newunit\newblock%
+ \printlist[treaty]{institution}
+ \newunit\newblock
+ \usebibmacro{treatyinfo}%
+ \newunit\newblock
+ \usebibmacro{treaty:year+vol+report}}
+
+\newbibmacro{treaty:year+vol+report}{%
+ \iffieldequals{journaltitle}{\officialjournaltitle}
+ {\usebibmacro{eulegref}}
+ {\usebibmacro{treaty:date}%
+ \newunit
+ \printfield[default]{volume}%
+ \setunit{\addspace}%
+ \printfield{journaltitle}%
+ \setunit*{\addspace}%
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \printfield{pages}}}%
+
+\newbibmacro*{treaty:date}{%
+ \ifthenelse{ \(%
+ \iffieldundef{volume}%
+ \or%
+ \boolean{bbx@year-essential}%
+ \) }%
+ {\ifboolexpr{ test {\ifkeyword{sc}} or
+ test {\iftoggle{bbx:scotstyle}}}
+ {\usebibmacro{year}}
+ {\usebibmacro{year}[brackets]}}%
+ {}}
+
+
+\def\makebbx@datei#1-#2-#3-{%
+ \makebbx@dateii{#1}{#2}{#3}}
+
+\def\makebbx@dateii#1#2#3{%
+ \blx@imc@stripzeros{#3}~\mkbibmonth{#2}%
+ \space
+ #1}
+
+\def\siganddate#1{%
+ \def\bbx@tempa{#1}%
+ \expandafter\bbx@signeddatei#1/relax}
+
+\def\bbx@signeddatei#1=#2/relax{%
+ \def\bbx@tempa{#2-}%
+ \bibstring{#1}\space\expandafter\makebbx@datei\bbx@tempa}
+
+\newbibmacro{treatyinfo}{%
+ \iflistundef{lista}%
+ {\iffieldundef{year}
+ {}
+ {\iffieldundef{volume}
+ {}
+ {\printtext{\mkbibparens{\printdate}}}}}
+ {\printtext{\mkbibparens{\printlist[treatydates]{lista}}}}}
+
+\newcommand*\treatypartysep{\allowbreak ---\allowbreak}
+
+\DeclareListFormat{treaty}{%
+ \ifmoreitems{}{%
+ \ifthenelse {\value{listcount} = 1}
+ {\bibopenparen}%
+ {}%
+ \ifthenelse {\value{liststop} > \value{listcount} }%
+ {#1\treatypartysep}%
+ {#1\bibcloseparen}}}
+
+\DeclareListFormat{treatydates}{%
+ \ifthenelse {\value{listcount} = 1}
+ {\siganddate{#1}}
+ {\addcomma\space\siganddate{#1}}}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Indexing
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% STANDARD INDICES
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def\bbx@trash{trash}
+
+\let\bbx@gbcases\bbx@trash
+\let\bbx@encases\bbx@trash
+\let\bbx@sccases\bbx@trash
+\let\bbx@nicases\bbx@trash
+\let\bbx@echrcases\bbx@trash
+\let\bbx@aucases\bbx@trash
+\let\bbx@uscases\bbx@trash
+\let\bbx@nzcases\bbx@trash
+\let\bbx@cacases\bbx@trash
+\let\bbx@echrcommcases\bbx@trash
+\let\bbx@eucases\bbx@trash
+\let\bbx@eucasesnum\bbx@trash
+\let\bbx@eucaseschron\bbx@trash
+\let\bbx@eucommcases\bbx@trash
+\let\bbx@eucommcasesnum\bbx@trash
+\let\bbx@eucommcaseschron\bbx@trash
+\let\bbx@pilcases\bbx@trash
+\let\bbx@othercases\bbx@trash
+\let\bbx@gbprimleg\bbx@trash
+\let\bbx@gbsecleg\bbx@trash
+\let\bbx@ensecleg\bbx@trash
+\let\bbx@enprimleg\bbx@trash
+\let\bbx@scprimleg\bbx@trash
+\let\bbx@scsecleg\bbx@trash
+\let\bbx@cyprimleg\bbx@trash
+\let\bbx@cysecleg\bbx@trash
+\let\bbx@niprimleg\bbx@trash
+\let\bbx@nisecleg\bbx@trash
+\let\bbx@eutreaty\bbx@trash
+\let\bbx@euregs\bbx@trash
+\let\bbx@eudirs\bbx@trash
+\let\bbx@eudecs\bbx@trash
+\let\bbx@echrtreaty\bbx@trash
+\let\bbx@piltreaty\bbx@trash
+\let\bbx@otherprimleg\bbx@trash
+\let\bbx@othersecleg\bbx@trash
+\let\bbx@otherconleg\bbx@trash
+\let\bbx@enroc\bbx@trash
+\let\bbx@gbdraftleg\bbx@trash
+\let\bbx@gbparltmat\bbx@trash
+\let\bbx@commentaries\bbx@trash
+\let\bbx@euoffdoc\bbx@trash
+\let\bbx@namesindex\bbx@trash
+
+\newcommand\SetStandardIndices{%
+\renewcommand\bbx@gbcases{cases}
+\renewcommand\bbx@encases{cases}
+\renewcommand\bbx@sccases{cases}
+\renewcommand\bbx@nicases{cases}
+\renewcommand\bbx@echrcases{cases}
+\renewcommand\bbx@echrcommcases{cases}
+\renewcommand\bbx@eucases{cases}
+\renewcommand\bbx@cacases{cases}
+\renewcommand\bbx@uscases{cases}
+\renewcommand\bbx@aucases{cases}
+\renewcommand\bbx@nzcases{cases}
+\renewcommand\bbx@eucasesnum{trash}
+\renewcommand\bbx@eucaseschron{trash}
+\renewcommand\bbx@eucommcases{cases}
+\renewcommand\bbx@eucommcasesnum{trash}
+\renewcommand\bbx@eucommcaseschron{trash}
+\renewcommand\bbx@pilcases{cases}
+\renewcommand\bbx@othercases{cases}
+\renewcommand\bbx@gbprimleg{legislation}
+\renewcommand\bbx@gbsecleg{legislation}
+\renewcommand\bbx@ensecleg{legislation}
+\renewcommand\bbx@enprimleg{legislation}
+\renewcommand\bbx@scprimleg{legislation}
+\renewcommand\bbx@scsecleg{legislation}
+\renewcommand\bbx@cyprimleg{legislation}
+\renewcommand\bbx@cysecleg{legislation}
+\renewcommand\bbx@nisecleg{legislation}
+\renewcommand\bbx@niprimleg{legislation}
+\renewcommand\bbx@eutreaty{eutreaty}
+\renewcommand\bbx@euregs{eulegislation}
+\renewcommand\bbx@eudirs{eulegislation}
+\renewcommand\bbx@eudecs{eulegislation}
+\renewcommand\bbx@echrtreaty{echrtreaty}
+\renewcommand\bbx@piltreaty{piltreaty}
+\renewcommand\bbx@otherprimleg{legislation}
+\renewcommand\bbx@othersecleg{legislation}
+\renewcommand\bbx@otherconleg{legislation}
+\renewcommand\bbx@enroc{legislation}
+\renewcommand\bbx@gbparltmat{other}
+\renewcommand\bbx@commentaries{other}
+\renewcommand\bbx@gbdraftleg{other}
+\renewcommand\bbx@euoffdoc{other}
+\renewcommand\bbx@namesindex{trash}}
+
+\newcommand\DeclareIndexAssociation[1]{%
+ \csdef{bbx@#1}}
+
+\newcommand\ShowIndexAssociation[1]{%
+ \csname bbx@#1\endcsname}
+
+\newcommand\bbx@relevantindex{}
+\def\legislationindex{legislation}
+
+\newbibmacro{setrelevantindex}{%
+% DEFAULT IS TRASH INDEX
+ \renewcommand{\bbx@relevantindex}{[\bbx@trash]}%
+ \iffieldundef{usera}{%
+% COURT RULES ALL GO TO ENROC
+ \ifboolexpr{ test {\ifentrytype{legislation}}%
+ and test {\iffieldequals{entrysubtype}{\subtypecourtrules}}}%
+ {\renewcommand\bbx@relevantindex{[\bbx@enroc]}}%
+ {}%
+% THEN WE DEAL WITH PRIMARY
+ \ifboolexpr{ test {\ifentrytype{legislation}}%
+ and test {\iffieldequals{entrysubtype}{\subtypeprimarylegislation}}}%
+ {\ifkeyword{gb}{\renewcommand\bbx@relevantindex{[\bbx@gbprimleg]}}{}%
+ \ifkeyword{en}{\renewcommand\bbx@relevantindex{[\bbx@enprimleg]}}{}%
+ \ifkeyword{sc}{\renewcommand\bbx@relevantindex{[\bbx@scprimleg]}}{}%
+ \ifkeyword{cy}{\renewcommand\bbx@relevantindex{[\bbx@cyprimleg]}}{}%
+ \ifkeyword{ni}{\renewcommand\bbx@relevantindex{[\bbx@niprimleg]}}{}%
+ \iffieldundef{keywords}{\renewcommand\bbx@relevantindex{[\bbx@gbprimleg]}}{}%
+ }%
+ {}% OTHER KINDS OF LEGISLATION
+ \ifboolexpr{ test {\ifentrytype{legislation}}%
+ and test {\iffieldequals{entrysubtype}{\subtypesecondarylegislation}}}%
+ {\ifkeyword{gb}{\renewcommand\bbx@relevantindex{[\bbx@gbsecleg]}}{}%
+ \ifkeyword{en}{\renewcommand\bbx@relevantindex{[\bbx@ensecleg]}}{}%
+ \ifkeyword{sc}{\renewcommand\bbx@relevantindex{[\bbx@scsecleg]}}{}%
+ \ifkeyword{cy}{\renewcommand\bbx@relevantindex{[\bbx@cysecleg]}}{}%
+ \ifkeyword{ni}{\renewcommand\bbx@relevantindex{[\bbx@nisecleg]}}{}%
+ \iffieldundef{keywords}{\renewcommand\bbx@relevantindex{[\bbx@gbsecleg]}}{}%
+ }%
+ {}% OTHER KINDS OF LEGISLATION
+ \ifboolexpr{ test {\ifentrytype{legislation}}%
+ and test {\ifkeyword{eu}}}%
+ {\iffieldequals{entrysubtype}{\eutreaty}%
+ {\renewcommand\bbx@relevantindex{[\bbx@eutreaty]}}{}%
+ \ifboolexpr{ test {\iffieldequals{type}{\euregulation}}%
+ or test {\iffieldequals{entrysubtype}{\euregulation}}}%
+ {\renewcommand\bbx@relevantindex{[\bbx@euregs]}}{}%
+ \ifboolexpr{ test{\iffieldequals{type}{\eudirective}}%
+ or test {\iffieldequals{entrysubtype}{\eudirective}}}%
+ {\renewcommand\bbx@relevantindex{[\bbx@eudirs]}}{}%
+ \ifboolexpr{ test{\iffieldequals{type}{\eudecision}}%
+ or test {\iffieldequals{entrysubtype}{\eudecision}}}%
+ {\renewcommand\bbx@relevantindex{[\bbx@eudecs]}}{}}%
+ {}%
+ \ifboolexpr{ test {\ifentrytype{legislation}}%
+ and test {\ifkeyword{draft}} }%
+ {\ifboolexpr {test {\ifkeyword{gb}} or test {\ifkeyword{en}}%
+ or test {\ifkeyword{sc}} or test {\ifkeyword{cy}}%
+ or test {\ifkeyword{ni}}}%
+ {\renewcommand\bbx@relevantindex{[\bbx@gbdraftleg]}}%
+ {}}%
+ {}%
+ \ifentrytype{jurisdiction}%
+ {\ifkeyword{sc}{\renewcommand{\bbx@relevantindex}{[\bbx@sccases]}}%
+ {\ifkeyword{gb}{\renewcommand{\bbx@relevantindex}{[\bbx@gbcases]}}%
+ {\ifkeyword{en}{\renewcommand{\bbx@relevantindex}{[\bbx@encases]}}%
+ {\ifkeyword{ni}{\renewcommand{\bbx@relevantindex}{[\bbx@nicases]}}%
+ {\ifkeyword{eu}{\renewcommand{\bbx@relevantindex}{[\bbx@eucases]}}%
+ {\ifkeyword{echr}{\renewcommand{\bbx@relevantindex}{[\bbx@echrcases]}}%
+ {\ifkeyword{int}{\renewcommand{\bbx@relevantindex}{[\bbx@pilcases]}}%
+ {\ifkeyword{us}{\renewcommand{\bbx@relevantindex}{[\bbx@uscases]}}% ADDED
+ {\ifkeyword{ca}{\renewcommand{\bbx@relevantindex}{[\bbx@cacases]}}% ADDED
+ {\ifkeyword{au}{\renewcommand{\bbx@relevantindex}{[\bbx@aucases]}}% ADDED
+ {\ifkeyword{nz}{\renewcommand{\bbx@relevantindex}{[\bbx@nzcases]}}% ADDED
+ {\iffieldundef{keywords}{\renewcommand{\bbx@relevantindex}{[\bbx@encases]}}
+ {\renewcommand{\bbx@relevantindex}{[\bbx@othercases]}}}}}}}}}}}}}}%
+ {}%
+ \ifboolexpr{ test {\ifentrytype{legal}}%
+ and test {\iffieldequals{entrysubtype}{\treatysubtype}} }%
+ {\ifkeyword{echr}{\renewcommand{\bbx@relevantindex}{[\bbx@echrtreaty]}}{\renewcommand{\bbx@relevantindex}{[\bbx@piltreaty]}}}{}%
+ \iffieldequals{entrysubtype}{\parliamentarytype}%
+ {\renewcommand{\bbx@relevantindex}{[\bbx@gbparltmat]}}%
+ {}%
+ \iffieldequals{entrysubtype}{\comdocsubtype}%
+ {\renewcommand{\bbx@relevantindex}{[\bbx@euoffdoc]}}%
+ {}%
+ \ifentrytype{commentary}%
+ {\renewcommand{\bbx@relevantindex}{[\bbx@commentaries]}}%
+ {}%
+ \ifboolexpr{ test{\ifentrytype{legal}}
+ and test {\iffieldequals{entrysubtype}{\explanatorynote}}}
+ {\renewcommand{\bbx@relevantindex}{[\bbx@gbparltmat]}}%
+ {}%
+ }%
+ {\renewcommand{\bbx@relevantindex}{[\thefield{usera}]}}}
+
+\newcommand\bbx@istrash{[\bbx@trash]}
+
+ \renewbibmacro*{index:title}[2]{%
+ \ifboolexpr{ test {\ifentrytype{jurisdiction}}
+ and test {\ifkeyword{eu}} and
+ (not test {\iflistcontains{institution}{\commission}})}
+ {\renewcommand\bbx@relevantindex{[\bbx@eucasesnum]}%
+ \usebibmacro{index:field:eu}%
+ {\index}%
+ {\thefield{userf}}%
+ {\thefield{entrykey}}}%
+ {}%
+ \usebibmacro{setrelevantindex}%
+ \ifboolexpr{ test {\ifentrytype{legal}}
+ and test {\iffieldequals{entrysubtype}{\parliamentarytype}}}
+ {\usebibmacro{hansard:index:fields}{#1}{#2}}
+ {\ifboolexpr{ (not test {\ifentrytype{legislation}} )
+ and not
+ ( test {\ifentrytype{legal}}
+ and test {\iffieldequals{entrysubtype}{\treatytype}} ) }%
+ {\usebibmacro{index:field}%
+ {\index}%
+ {\thefield{indexsorttitle}}%
+ {\thefield{entrykey}}}%
+ {\iffieldequals{entrysubtype}{\subtypecourtrules}%
+ {\usebibmacro{index:rules}}%
+ {\usebibmacro{legislation:with:postnote}{#1}{#2}}}}}
+
+\newbibmacro{hansard:index:fields}[2]{%
+ \def\bbx@tempaind{vol }%
+ \iffieldundef{crossref}
+ {\savefield{entrykey}{\bbx@tempa}%
+ \restorefield{crossref}{\bbx@tempa}}%
+ {}%
+ \iffieldundef{volume}
+ {\usebibmacro{index:field:5}%
+ {\index}%
+ {\thefield{indexsorttitle}}
+ {\thefield{crossref}}}
+ {\usebibmacro{index:field:3}%
+ {\index}%
+ {\thefield{indexsorttitle}}
+ {\thefield{crossref}}
+ {\thefield{volume}}}}
+
+\newbibmacro{legislation:with:postnote}[2]{%
+ \ifkeyword{eu}
+ {\def\bbx@tempa{\thefield{indexsorttitle}}}
+ {\def\bbx@tempa{\thefield{indexsorttitle}\thefield{year}}}%
+ \iffieldundef{postnote}%
+ {\usebibmacro{index:field:5}%
+ {\index}%
+ {\bbx@tempa}%
+ {\thefield{entrykey}}}%
+ {\ifnumeralfirst{\thefield{postnote}}%
+ {\usebibmacro{legislation:with:formattedpostnote}{#1}{\bbx@tempa}}%
+ {\usebibmacro{index:field:2}%
+ {#1}%
+ {\bbx@tempa}%
+ {\thefield{entrykey}}%
+ {\thefield{postnote}}%
+ {\thefield{postnote}}}}}
+
+\newbibmacro{set:index:label}{%
+ \iffieldequalstr{pagination}{section}{\gdef\bbx@tempaind{s }}%
+ {\iffieldequalstr{pagination}{article}{\gdef\bbx@tempaind{art }}%
+ {\iffieldequalstr{pagination}{regulation}{\gdef\bbx@tempaind{reg }}%
+ {\iffieldequalstr{pagination}{rule}{\gdef\bbx@tempaind{r }}%
+ {\iffieldequalstr{pagination}{clause}{\gdef\bbx@tempaind{cl }}%
+ {\iffieldequalstr{pagination}{paragraph}{\gdef\bbx@tempaind{para }}%
+ {\ifkeyword{eu}{\gdef\bbx@tempaind{art }}%
+ {\gdef\bbx@tempaind{}}}}}}}}}
+
+\newbibmacro{legislation:with:formattedpostnote}[2]{%
+ \usebibmacro{set:index:label}%
+ \edef\bbx@tempbind{\strfield{postnote}}%
+ \renewcommand{\do}[1]{%
+ \usebibmacro{index:field:2}%
+ {#1}%
+ {#2}%
+ {\thefield{entrykey}}%
+ {##1}%
+ {\bbx@tempaind##1}}%
+ \docsvfield{postnote}}
+
+\def\bbx@secpart#1(#2\relax{#1}%)
+\def\bbx@rangechop#1--#2\relax{#1}
+
+\def\bbx@subsparti#1(#2\relax{#2}
+\def\bbx@subspartii#1)#2\relax{#1}
+\def\bbx@subspart#1{%
+ \def\bbx@tempb{#1}%
+ \expandafter\expandafter\expandafter\bbx@subspartii\expandafter\bbx@subsparti\bbx@tempb(\relax)\relax}
+
+\def\bbx@hassubpart#1{%
+ \def\bbx@temph{#1}%
+ \expandafter\bbx@rangechop\expandafter\bbx@hassubparti\bbx@temph--\relax(\relax}%)
+
+\def\bbx@hassubparti#1(#2\relax{%)
+ \sbox0{#2}%
+ \ifdim\wd0=0pt
+ \expandafter\@secondoftwo
+ \else\expandafter\@firstoftwo
+ \fi}
+
+% This is the macro that does most of the work in relation to legislation.
+% It's rather ghastly, and needs to be exactly as it is in order for expansion to work properly.
+
+\newbibmacro*{index:field:2}[5]{%
+ \begingroup%
+ \bbx@hassubpart{#4}%
+ {\protected@edef\theindexentry{\unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}!\expandafter\bbx@rangechop\expandafter\bbx@secpart#4--\relax(\relax\actualoperator\expandafter\bbx@rangechop\expandafter\bbx@secpart#5--\relax(\relax!\expandafter\expandafter\expandafter\bbx@subspartii\expandafter\bbx@subsparti#4(\relax)\relax\actualoperator(\expandafter\expandafter\expandafter\bbx@subspartii\expandafter\bbx@subsparti#5(\relax)\relax)}}}%))
+ {\protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}!\expandafter\bbx@rangechop\expandafter\bbx@secpart#4--\relax(\relax\actualoperator\expandafter\bbx@rangechop\expandafter\bbx@secpart#5--\relax(\relax%))
+ }}}%
+ \theindexentry%
+ \endgroup}
+
+\renewbibmacro*{index:field}[3]{%
+ \begingroup
+ \protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}}}%
+ \theindexentry
+ \endgroup}
+
+\newtoggle{bbx@numcite}
+
+\newbibmacro*{index:field:eu}[3]{%
+ \begingroup
+ \protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindexnum}{#3}}}%
+ \theindexentry
+ \endgroup}
+
+
+% This is for legislation with neither postnote nor prenote
+
+\newbibmacro*{index:field:5}[3]{%
+ \begingroup
+ \protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}}}%
+ \theindexentry
+ \endgroup}
+
+% This is used for procedural rules with a prenote but no postnote
+
+\newbibmacro*{index:field:3}[4]{%
+ \begingroup
+ \protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}!#4\actualoperator\bbx@tempaind#4}}%
+ \theindexentry
+ \endgroup}
+
+% This is for procedural rules with prenote and postnote
+
+\newbibmacro*{index:field:4}[5]{%
+ \begingroup
+ \protected@edef\theindexentry{%
+ \unexpanded{#1}\bbx@relevantindex{#2\actualoperator\unexpanded{\citeinindex}{#3}!#4\actualoperator\bbx@tempaind#4!#5\actualoperator\bbx@tempbind#5}}%
+ \theindexentry
+ \endgroup}
+
+\newbibmacro*{index:rules}{%
+ \restorefield{prenote}{\postnotesecond}%
+ \iffieldequalstr{shorttitle}{RSC}
+ {\gdef\bbx@tempaind{Ord }%
+ \gdef\bbx@tempbind{r }}%
+ {\iffieldequalstr{shorttitle}{CCR}
+ {\gdef\bbx@tempaind{Ord }%
+ \gdef\bbx@tempbind{r }}%
+ {\gdef\bbx@tempaind{}%
+ \gdef\bbx@tempbind{}}}%
+ \iffieldundef{prenote}%
+ {\iffieldundef{postnote}%
+ {\usebibmacro{index:field:5}%
+ {\index}%
+ {\thefield{indextitle}}%
+ {\thefield{entrykey}}}%
+ {\usebibmacro{index:field:3}%
+ {\index}%
+ {\thefield{indextitle}}%
+ {\thefield{entrykey}}%
+ {\postnotefirst}}}%
+ {\iffieldundef{prenote}%
+ {\usebibmacro{index:field:3}%
+ {\index}%
+ {\thefield{indextitle}}%
+ {\thefield{entrykey}}%
+ {\postnotefirst}}%
+ {\usebibmacro{index:field:4}%
+ {\index}%
+ {\thefield{indextitle}}%
+ {\thefield{entrykey}}%
+ {\postnotefirst}%
+ {\postnotesecond}}}}%
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% INDEX: DRIVERS
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newbibmacro*{default:index}{%
+ \usebibmacro{begentry}%
+ \printfield[default]{title}%
+ \newunit
+ \iffieldundef{year}{}
+ {\printtext{\mkbibparens{\printfield{year}}}}%
+ \newunit
+ \usebibmacro{finentry}}
+
+\DeclareBibliographyDriver{book:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{collection:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{article:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{thesis:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{inbook:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{periodical:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{patent:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{inproceedings:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{incollection:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{mvbook:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{reference:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{mvreference:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{proceedings:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{inmvreference:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{inreference:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{misc:index}{%
+ \iffieldequals{entrysubtype}{\undoctype}
+ {\usebibmacro{undoc:index}}
+ {\usebibmacro{default:index}}}
+\DeclareBibliographyDriver{booklet:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{techreport:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{manual:index}{\usebibmacro{default:index}}
+\DeclareBibliographyDriver{online:index}{\usebibmacro{default:index}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Improved way of checking if list contains something
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\DeclareListFormat{checkcontains}{%
+ \bbx@check{#1}}
+
+\newtoggle{bbx@institutiontoggle}
+
+\newcommand\iflistcontains[2]{%
+ \global\togglefalse{bbx@institutiontoggle}%
+ \def\bbx@check##1{%
+ \ifdefstring{#2}{##1}{\global\toggletrue{bbx@institutiontoggle}}{}}%
+ \printlist[checkcontains]{#1}%
+ \iftoggle{bbx@institutiontoggle}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Index names
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\renewbibmacro*{index:name}[5]{%
+ \begingroup
+ \def\bbxinitsep{}%
+ \ifuseprefix
+ {\protected@edef\theindexentry{%
+ \unexpanded{#1}[\bbx@namesindex]{%
+ \ifblank{#4}{}{#4 }%
+ \@firstofone #2% remove spurious braces
+ \ifblank{#5}{}{ #5}%
+ \ifblank{#3}{}{, #3}%
+ \actualoperator
+ \ifblank{#4}{}{\MakeCapital{#4} }%
+ #2%
+ \ifblank{#5}{}{ #5}%
+ \ifblank{#3}{}{, #3}}}}
+ {\protected@edef\theindexentry{%
+ \unexpanded{#1}[\bbx@namesindex]{%
+ \@firstofone #2% remove spurious brces
+ \ifblank{#5}{}{ #5}%
+ \ifblank{#3#4}{}{,}%
+ \ifblank{#3}{}{ #3}%
+ \ifblank{#4}{}{ #4}}}}%
+ \theindexentry
+ \endgroup}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Sorting Scheme : Sort includes INSTITUTION
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\DeclareSortingTemplate{niyt}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{institution}
+ \field{sorttitle}
+ \field{title}
+ \field{booktitle}
+ \field{maintitle}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}
+ \literal{0000}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Printindex early
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\printindexearly}{}
+
+\AtEndPreamble{%
+ \@ifpackageloaded{imakeidx}{
+ \ifimki@splitindex
+ \renewcommand{\printindexearly}[1][\jobname]{%
+ \@ifundefined{#1@idxfile}{\imki@error{#1}}{\bbx@putimindextosplit{#1}}}
+ \else
+ \renewcommand{\printindexearly}[1][\jobname]{%
+ \@ifundefined{#1@idxfile}{\imki@error{#1}}{\bbx@putimindex{#1}}}
+ \fi}
+ {\@ifpackageloaded{index}
+ {\renewcommand{\printindexearly}{\@printindex}}
+ {\renewcommand{\printindexearly}[1]{\PackageError{biblatex-oscola}{You need to load either the imakeidx or index package:}}}}}
+
+% Based on imki@putindexsplit
+\newcommand{\bbx@putimindex}[1]{%
+ \let\imki@indexname\indexname
+ \@nameuse{imki@set@#1}%
+ \ifimki@nonewpage\else
+ \imki@clearpage
+ \fi
+ \ifKV@imki@intoc
+ \def\imki@maybeaddtotoc{\@nameuse{phantomsection}%
+ \addcontentsline{toc}{\imki@toclevel}{\imki@title}}%
+ \else
+ \def\imki@maybeaddtotoc{}%
+ \fi
+ \ifx\imki@title\imki@check@indexname\else
+ \def\indexname{\imki@title}%
+ \fi
+ \@input@{#1.ind}
+ \let\indexname\imki@indexname
+}
+\newcommand{\bbx@putimindextosplit}[1]{%
+ \let\imki@indexname\indexname
+ \@nameuse{imki@set@#1}%
+ \ifimki@nonewpage\else
+ \imki@clearpage
+ \fi
+ \ifKV@imki@intoc
+ \def\imki@maybeaddtotoc{\@nameuse{phantomsection}%
+ \addcontentsline{toc}{\imki@toclevel}{\imki@title}}%
+ \else
+ \def\imki@maybeaddtotoc{}%
+ \fi
+ \ifx\imki@title\imki@check@indexname\else
+ \def\indexname{\imki@title}%
+ \fi
+ \@input@{\jobname-#1.ind}
+ \let\indexname\imki@indexname
+}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SOURCE MAPPING
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\DeclareLabeltitle[misc]{%
+ \field{shorttitle}
+ \field{titleaddon}
+ \field{title}}
+
+\DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map[overwrite=false]{
+ \pertype{jurisdiction}
+ \step[fieldsource=reporter,
+ fieldtarget=journaltitle]
+ \step[fieldsource=parvolume,
+ fieldtarget=userb]
+ \step[fieldsource=parreporter,
+ fieldtarget=userc]
+ \step[fieldsource=parseries,
+ fieldtarget=userd]
+ \step[fieldsource=parpages,
+ fieldtarget=usere]
+ \step[fieldsource=court,
+ fieldtarget=institution]
+ \step[fieldsource=additionalreports,
+ fieldtarget=listb]
+ \step[fieldsource=ecli,
+ fieldtarget=verba]
+ }
+ \map[overwrite=false]{
+ \pertype{legal}
+ \step[fieldsource=reporter,
+ fieldtarget=journaltitle]
+ }
+ \map[overwrite=true]{
+ \pertype{legal}
+ \step[fieldsource=parties,
+ fieldtarget=institution]
+ \step[fieldsource=execution,
+ fieldtarget=lista]
+ }
+ \map[overwrite=false]{
+ \pertype{inreference}
+ \step[fieldsource=booktitle,
+ fieldtarget=userb]
+ }
+ \map[overwrite=false]{
+ \step[fieldsource=type,
+ final=true]
+ \step[fieldset=entrysubtype,
+ origfieldval=true]
+ }
+ \map[overwrite=true]{
+ \pertype{legislation}
+ \step[fieldsource=keywords,
+ match={eu},
+ final=true]
+ \step[fieldsource=entrysubtype,
+ match=\regexp{directive|decision},
+ final=true]
+ \step[fieldsource=number]
+ \step[fieldset=indextitle,
+ origfieldval=true]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\S+)/(\d\d\d\d)\D}
+ replace=\regexp{$1/0$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\S+)/(\d\d\d)\D},
+ replace=\regexp{$1/00$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\S+)/(\d\d)\D},
+ replace=\regexp{$1/000$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\S+)/(\d)\D},
+ replace=\regexp{$1/0000$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d+)/(\d+)(\D*)},
+ replace=\regexp{$1$2}]
+ }
+ \map[overwrite=true]{
+ \pertype{legislation}
+ \step[fieldsource=keywords,
+ match={eu},
+ final=true]
+ \step[fieldsource=entrysubtype,
+ match={regulation},
+ final=true]
+ \step[fieldsource=number]
+ \step[fieldset=indextitle,
+ origfieldval=true]
+ \step[fieldsource=indextitle,
+ match=\regexp{\D*(\d+)/(\d\d)\D}
+ replace=\regexp{$1/19$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d\d\d\d)/(\d+)},
+ replace=\regexp{0$1/$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d\d\d)/(\d+)},
+ replace={00$1/$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d\d)/(\d+)},
+ replace=\regexp{000$1/$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d)/(\d+)},
+ replace=\regexp{0000$1/$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d+)/(\d+)},
+ replace=\regexp{$2$1}]
+ }
+ \map[overwrite=false]{
+ \pertype{jurisdiction}
+ \step[fieldsource=keywords,
+ match=eu,
+ final=true]
+ \step[fieldsource=number]
+ \step[fieldset=userf,
+ origfieldval=true]
+ }
+ \map[overwrite=true]{
+ \pertype{jurisdiction}
+ \step[fieldsource=keywords,
+ match={eu},
+ final=true]
+ \step[fieldsource=userf,
+ match=\regexp{^(\d+)/(\d+)},
+ replace=\regexp{C-$1/$2}]
+ \step[fieldsource=userf,
+ match=\regexp{([^/]+)/(\d+)[-,].*$},
+ replace=\regexp{$1/$2}]
+ \step[fieldsource=userf,
+ match=\regexp{(\D)\D*(\d+)/(\d+)},
+ replace=\regexp{$1A$2A$3}]
+ \step[fieldsource=userf,
+ match=\regexp{([^A]*)A([^A]*)A([01234]\d)$},
+ replace=\regexp{$1A$2A20$3}]
+ \step[fieldsource=userf,
+ match=\regexp{([^A]*)A([^A]*)A([56789]\d)$},
+ replace=\regexp{$1A$2A19$3}]
+ \step[fieldsource=userf,
+ match=\regexp{(\d\d\d)A},
+ replace=\regexp{0$1A}]
+ \step[fieldsource=userf,
+ match=\regexp{A(\d\d)A},
+ replace=\regexp{A00$1A}]
+ \step[fieldsource=userf,
+ match=\regexp{A(\d)A},
+ replace=\regexp{A000$1A}]
+ \step[fieldsource=userf,
+ match=\regexp{CA(.*)},
+ replace=\regexp{0A$1}]
+ \step[fieldsource=userf,
+ match=\regexp{(T)},
+ replace={1}]
+ \step[fieldsource=userf,
+ match=\regexp{(\d)A(\d\d\d\d)A(\d\d\d\d)},
+ replace=\regexp{$3$2$1}]
+ }
+ \map[overwrite=true]{
+ \pertype{jurisdiction}
+ \pertype{legislation}
+ \pertype{legal}
+ \step[fieldsource=title,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=title,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=title,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=title,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=shorttitle,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=shorttitle,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=shorttitle,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=shorttitle,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ }
+ \map[overwrite=true]{
+ \step[fieldsource=userc,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=userc,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=userc,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=userc,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=journaltitle,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=journaltitle,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=journaltitle,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=journaltitle,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=institution,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=institution,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=institution,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step[fieldsource=institution,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=publisher,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=publisher,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=publisher,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=publisher,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=location,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=location,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=location,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=location,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=series,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=series,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=series,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=series,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\d)\.(\d)},
+ replace=\regexp{$1.$2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{(\D)\.(\d)},
+ replace=\regexp{$1 $2}]
+ \step[fieldsource=indextitle,
+ match=\regexp{\.(\D)},
+ replace=\regexp{$1}]
+ \step [fieldsource=indextitle,
+ match=\regexp{(\D)\.},
+ replace=\regexp{$1}]
+}
+ \map[overwrite=true]{
+ \step[fieldsource=author,
+ match=\regexp{(\w)\.},
+ replace=\regexp{$1\\bbxinitsep\x20}]
+ }
+ \map[overwrite=true]{
+ \step[fieldsource=editor,
+ match=\regexp{(\w)\.},
+ replace=\regexp{$1\\bbxinitsep\x20}]
+ }
+ \map[overwrite=true]{
+ \step[fieldsource=translator,
+ match=\regexp{(\w)\.},
+ replace=\regexp{$1\\bbxinitsep\x20}]
+ }
+ \map[overwrite=true]{
+ \step[fieldsource=tabulate,
+ fieldtarget=usera]
+ }
+ \map[overwrite=false]{
+ \pertype{misc}
+ \step[fieldsource=entrysubtype,
+ match={undoc},
+ final=true]
+ \step[fieldsource=instrument_no,
+ fieldtarget=titleaddon,
+ origfieldval=true]
+ \step[fieldsource=doc_no,
+ fieldtarget=number,
+ origfieldval=true]
+ }
+ \map[overwrite]{
+ \pertype{misc}
+ \step[fieldsource=institution,
+ fieldset=scratch,
+ origfieldval=true,
+ append=true]
+ \step[fieldsource=titleaddon,
+ fieldset=scratch,
+ origfieldval=true,
+ append=true]
+ }
+ \map[overwrite=false]{
+ \pertype{misc}
+ \step[fieldsource=scratch]
+ \step[fieldsource=title]
+ \step[fieldset=indextitle,
+ origfieldval=true]
+ }
+ }
+}
+
+\endinput \ No newline at end of file