% \iffalse
%<*driver>
\ProvidesFile{biblatex-asa.dtx}
\documentclass{ltxdoc}
\usepackage{biblatex}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{biblatex-asa.dtx}
\end{document}
%</driver>
% \fi

% \title{\textsf{biblatex-asa} package}
% \author{Yuqi Liang}
% \date{6 August 2026}
% \maketitle

% \section{Introduction}
% ASA citation and bibliography style for biblatex, aligned with the
% ASA Style Guide, 7th edition (2022), for common scholarly and
% online source types used in sociology.

% \section{Implementation}

%<*sty>
% \subsection{biblatex-asa.sty}
% \begin{macrocode}
%% biblatex-asa.sty
%% Copyright (C) 2025--2026 Yuqi Liang
%%
%% 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 this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{biblatex-asa}[2026/08/06 v1.0.0 ASA citation style for biblatex]

\makeatletter

\def\asa@giveninits{false}

\DeclareOption{giveninits}{\def\asa@giveninits{true}}
\DeclareOption{nogiveninits}{\def\asa@giveninits{false}}
\DeclareOption{backend=biber}{\PassOptionsToPackage{backend=biber}{biblatex}}
\DeclareOption{backend=bibtex}{\PassOptionsToPackage{backend=bibtex}{biblatex}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{biblatex}}

\ProcessOptions\relax

\RequirePackage[style=biblatex-asa]{biblatex}

\urlstyle{same}
\setlength{\Urlmuskip}{0mu plus 1mu}

% In text: up to three names; four or more use et al.
\ExecuteBibliographyOptions{
  giveninits=\asa@giveninits,
  autocite=inline,
  autopunct=true,
  labeldateparts=true,
  uniquename=full,
  uniquelist=false,
  maxnames=3,
  minnames=1,
  maxcitenames=3,
  mincitenames=1
}

\makeatother

% \end{macrocode}
%</sty>

%<*bbx>
% \subsection{biblatex-asa.bbx}
% \begin{macrocode}
\ProvidesFile{biblatex-asa.bbx}[2026/08/06 v1.0.0 ASA bibliography style]

% ASA bibliography style -- ASA Style Guide, 7th ed. (2022)
% Author: Yuqi Liang
% License: LPPL 1.3c or later

\RequireBibliographyStyle{standard}

\ExecuteBibliographyOptions{
  giveninits=false,
  uniquename=full,
  uniquelist=false,
  sorting=nyt,
  maxbibnames=999,
  minbibnames=1,
  maxcitenames=3,
  mincitenames=1,
  isbn=false,
  url=true,
  doi=true,
  eprint=false
}

% Year / Forthcoming / n.d. / reprint [origyear] year
\newbibmacro*{date+extradate}{%
  \iffieldundef{labelyear}%
    {\printtext{n.d.}}%
    {\iffieldequalstr{labelyear}{Forthcoming}%
      {\printtext{Forthcoming}}%
      {\iffieldequalstr{labelyear}{n.d.}%
        {\printtext{n.d.}}%
        {\iffieldundef{origyear}%
          {\printfield{labelyear}%
           \printfield{extradate}}%
          {\mkbibbrackets{\printfield{origyear}}%
           \addspace
           \printfield{labelyear}%
           \printfield{extradate}}%
         }%
       }%
     }%
}

% Month Day, Year after titles (year only when day is present;
% month-only forms like "May." match common ASA web/AV examples)
\newbibmacro*{asa:monthdayyear}{%
  \iffieldundef{month}
    {}
    {%
      \printfield{month}%
      \iffieldundef{day}
        {}
        {%
          \setunit{\addspace}\printfield{day}%
          \iffieldundef{year}
            {}
            {\setunit{\addcomma\space}\printfield{year}}%
        }%
    }%
}

% Accessed Month Day, Year (when publication date is missing)
\newbibmacro*{asa:urldate}{%
  \iffieldundef{urlyear}
    {}
    {%
      \setunit{\addperiod\space}%
      \printtext{Accessed}%
      \setunit{\addspace}%
      \iffieldundef{urlmonth}
        {}
        {\printfield{urlmonth}\setunit{\addspace}}%
      \iffieldundef{urlday}
        {}
        {\printfield{urlday}\setunit{\addcomma\space}}%
      \printfield{urlyear}%
    }%
}

\newbibmacro*{asa:doi+url}{%
  \iffieldundef{doi}
    {%
      \iffieldundef{url}
        {\usebibmacro{asa:urldate}}
        {\setunit{\addperiod\space}\printfield{url}\setunit{}%
         \usebibmacro{asa:urldate}}%
    }
    {\setunit{\addperiod\space}\printfield{doi}\setunit{}}%
}

% howpublished / type / note as a short medium label (e.g. YouTube Video)
\newbibmacro*{asa:medium}{%
  \iffieldundef{howpublished}
    {%
      \iffieldundef{type}
        {}
        {\setunit{\addperiod\space}\printfield{type}}%
    }
    {\setunit{\addperiod\space}\printfield{howpublished}}%
}

\newbibmacro*{asa:organization}{%
  \iffieldundef{organization}
    {}
    {\setunit{\addperiod\space}\printfield{organization}}%
}

\DeclareNameFormat{author}{%
  \ifboolexpr{
    test {\ifdefvoid\namepartgiven}
  }
  {%
   \namepartfamily%
   \ifdefvoid\namepartprefix{}{\namepartprefix\space}%
   \ifdefvoid\namepartsuffix{}{\space\namepartsuffix}%
  }
  {%
   \ifnumequal{\value{listcount}}{1}
     {%
      \usebibmacro{name:family-given}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}
     {%
      \usebibmacro{name:given-family}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}%
  }%
}

\DeclareNameFormat{editor}{%
  \usebibmacro{name:given-family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
}

\renewcommand*{\multinamedelim}{\addcomma\space}
\renewcommand*{\finalnamedelim}{\addcomma\space\bibstring{and}\space}

\newbibmacro*{asa:author}{%
  \ifnameundef{author}
    {%
      \ifnameundef{editor}
        {}
        {%
          \printnames[author]{editor}%
          \setunit{\addcomma\space}%
          \ifnumgreater{\value{editor}}{1}
            {\bibstring{editors}}
            {\bibstring{editor}}%
        }%
    }
    {\printnames{author}}%
}

\newbibmacro*{asa:title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
  {}
  {%
    \printfield[titlecase]{title}%
    \setunit{\subtitlepunct}%
    \printfield[titlecase]{subtitle}%
  }%
}

\newbibmacro*{asa:title:quoted}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
  {}
  {%
    \textquotedblleft%
    \printfield[titlecase]{title}%
    \setunit{\subtitlepunct}%
    \printfield[titlecase]{subtitle}%
    \textquotedblright%
  }%
}

\newbibmacro*{asa:journal+volume+pages}{%
  \usebibmacro{journal}%
  \setunit{\space}%
  \printfield{volume}%
  \iffieldundef{number}
    {}
    {\mkbibparens{\printfield{number}}}%
  \setunit{\addcolon}%
  \printfield{pages}%
  \newunit%
}

% Newspaper / magazine: Journal, Month Day, pages
\newbibmacro*{asa:newspaper+date+pages}{%
  \usebibmacro{journal}%
  \setunit{\addcomma\space}%
  \usebibmacro{asa:monthdayyear}%
  \iffieldundef{pages}
    {}
    {\setunit{\addcomma\space}\printfield{pages}}%
  \newunit%
}

\newbibmacro*{asa:publisher+location}{%
  \printlist{location}%
  \iflistundef{publisher}
    {}
    {\setunit{\addcolon\space}%
     \printlist{publisher}}%
  \newunit%
}

\DeclareFieldFormat[incollection,inproceedings,inbook]{pages}{Pp.~\mknormrange{#1}}
\DeclareFieldFormat{pages}{\mknormrange{#1}}
\DeclareFieldFormat{doi}{\url{https://doi.org/#1}}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{edition}{\mkbibparens{#1}}
\DeclareFieldFormat{version}{Version~#1}
\DeclareFieldFormat{type}{#1}
\DeclareFieldFormat{howpublished}{#1}

\newbibmacro*{asa:edition+volume}{%
  \iffieldundef{edition}
    {}
    {\setunit{\addspace}\printfield{edition}}%
  \iffieldundef{volume}
    {}
    {\setunit{\addspace}%
     \printtext{\bibstring{volume}\addspace\printfield{volume}}%
     \iffieldundef{part}{}{\setunit{\addcomma\space}\printfield{part}}}%
}

% ---------- Drivers ----------

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title}%
  \usebibmacro{asa:edition+volume}%
  \addperiod\space%
  \iffieldundef{translator}
    {}
    {\printtext{Translated by \printnames[editor]{translator}}%
     \addperiod\space}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}

% Edited volume (no chapter)
\DeclareBibliographyDriver{collection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title}%
  \usebibmacro{asa:edition+volume}%
  \addperiod\space%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{proceedings}{collection}
\DeclareBibliographyAlias{reference}{collection}
\DeclareBibliographyAlias{mvbook}{book}
\DeclareBibliographyAlias{mvcollection}{collection}
\DeclareBibliographyAlias{booklet}{book}
\DeclareBibliographyAlias{manual}{book}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \addperiod\space%
  \ifboolexpr{
    test {\iffieldequalstr{entrysubtype}{newspaper}}
    or
    test {\iffieldequalstr{entrysubtype}{magazine}}
  }
    {\usebibmacro{asa:newspaper+date+pages}}
    {\usebibmacro{asa:journal+volume+pages}}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{periodical}{article}
\DeclareBibliographyAlias{suppperiodical}{article}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \addperiod\space%
  \printtext{\printfield{pages} in\space}%
  \printfield[title]{booktitle}%
  \ifnameundef{editor}
    {}
    {\setunit{\addcomma\space}%
     \printtext{edited by \printnames[editor]{editor}}}%
  \addperiod\space%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{inbook}{incollection}
\DeclareBibliographyAlias{inproceedings}{incollection}
\DeclareBibliographyAlias{conference}{incollection}

\DeclareBibliographyAlias{thesis}{phdthesis}
\DeclareBibliographyAlias{mathesis}{phdthesis}
\DeclareBibliographyDriver{phdthesis}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \addperiod\space%
  \printfield{type}%
  \iffieldundef{note}
    {}
    {\setunit{\addcomma\space}\printfield{note}}%
  \iffieldundef{department}
    {}
    {\setunit{\addcomma\space}\printfield{department}}%
  \setunit{\addcomma\space}%
  \printlist{institution}%
  \iflistundef{location}
    {}
    {\setunit{\addcomma\space}\printlist{location}}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}

% Web pages, blogs, news pages
\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \addperiod\space%
  \usebibmacro{asa:organization}%
  \iffieldundef{month}
    {}
    {\setunit{\addperiod\space}\usebibmacro{asa:monthdayyear}}%
  \usebibmacro{asa:medium}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{www}{online}
\DeclareBibliographyAlias{electronic}{online}

% Government / organisational reports
\DeclareBibliographyDriver{report}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{number}
    {\addperiod\space}
    {\addperiod\space\mkbibparens{\printfield{number}}\addperiod\space}%
  \usebibmacro{asa:organization}%
  \iffieldundef{month}
    {}
    {\setunit{\addcomma\space}\usebibmacro{asa:monthdayyear}}%
  \iflistundef{publisher}
    {}
    {\setunit{\addperiod\space}\printlist{publisher}}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{techreport}{report}

% Films, streaming video, webinars (use howpublished/type for medium)
\DeclareBibliographyDriver{video}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{month}
    {}
    {\setunit{\addperiod\space}\usebibmacro{asa:monthdayyear}}%
  \usebibmacro{asa:medium}%
  \usebibmacro{asa:organization}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{movie}{video}
\DeclareBibliographyAlias{footage}{video}

% Music / audio / podcasts
\DeclareBibliographyDriver{audio}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{booktitle}
    {}
    {\setunit{\addperiod\space}%
     \printtext{on \printfield{booktitle}}}%
  \iffieldundef{month}
    {}
    {\setunit{\addperiod\space}\usebibmacro{asa:monthdayyear}}%
  \usebibmacro{asa:medium}%
  \usebibmacro{asa:organization}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{music}{audio}
\DeclareBibliographyAlias{podcast}{audio}

% Software / code
\DeclareBibliographyDriver{software}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title}%
  \iffieldundef{version}
    {\addperiod\space}
    {\addperiod\space\printfield{version}\addperiod\space}%
  \usebibmacro{asa:medium}%
  \usebibmacro{asa:organization}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{code}{software}
\DeclareBibliographyAlias{codefragment}{software}

% Datasets
\DeclareBibliographyDriver{data}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{version}
    {\addperiod\space}
    {\addperiod\space\printfield{version}\addperiod\space}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{dataset}{data}

% Legislation / legal-ish grey literature (keep flexible via note/type)
\DeclareBibliographyDriver{legislation}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{note}
    {\addperiod\space}
    {\addperiod\space(\thefield{note})\addperiod\space}%
  \usebibmacro{asa:organization}%
  \usebibmacro{asa:publisher+location}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{legal}{legislation}
\DeclareBibliographyAlias{jurisdiction}{legislation}

% Personal communications / AI text (usually not in reference list;
% if listed, format as misc with a clear note)
\DeclareBibliographyDriver{unpublished}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{note}
    {\addperiod\space}
    {\addperiod\space(\thefield{note})\addperiod\space}%
  \usebibmacro{asa:organization}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}
\DeclareBibliographyAlias{letter}{unpublished}

% Catch-all (social posts, grey literature, unusual formats)
\DeclareBibliographyDriver{misc}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{asa:author}%
  \addperiod\space%
  \usebibmacro{date+extradate}%
  \addperiod\space%
  \usebibmacro{asa:title:quoted}%
  \iffieldundef{note}
    {}
    {\addperiod\space(\thefield{note})}%
  \iffieldundef{month}
    {}
    {\setunit{\addperiod\space}\usebibmacro{asa:monthdayyear}}%
  \usebibmacro{asa:medium}%
  \usebibmacro{asa:organization}%
  \iflistundef{location}
    {}
    {\setunit{\addperiod\space}\printlist{location}%
     \iflistundef{publisher}{}{\setunit{\addcolon\space}}}%
  \printlist{publisher}%
  \usebibmacro{asa:doi+url}%
  \setunit{\bibpagerefpunct}\newblock%
  \usebibmacro{pageref}%
  \usebibmacro{finentry}%
}

\defbibheading{bibliography}[\refname]{%
  \section*{REFERENCES}%
}

% \end{macrocode}
%</bbx>

%<*cbx>
% \subsection{biblatex-asa.cbx}
% \begin{macrocode}
\ProvidesFile{biblatex-asa.cbx}[2026/08/06 v1.0.0 ASA citation style]

% ASA citation style -- ASA Style Guide, 7th ed. (2022)
% Author: Yuqi Liang
% License: LPPL 1.3c or later

\RequireCitationStyle{authoryear}

\ExecuteBibliographyOptions{
  autocite=inline,
  autopunct=true,
  labeldateparts=true,
  uniquename=full,
  uniquelist=false,
  maxnames=3,
  minnames=1,
  maxcitenames=3,
  mincitenames=1,
  giveninits=false
}

\AtBeginBibliography{%
  \defcounter{maxnames}{999}%
  \defcounter{minnames}{1}%
}

\DeclareNameFormat{labelname}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}%
}

\DeclareDelimFormat[cite,parencite,textcite]{multinamedelim}{\addspace}
\DeclareDelimFormat[cite,parencite,textcite]{finalnamedelim}{\addspace and\space}
\DeclareDelimFormat[cite,parencite,textcite]{revsdnamedelim}{\addspace and\space}

\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

\newbibmacro*{asa:citeyear}{%
  \iffieldundef{labelyear}
    {\printtext{n.d.}}
    {\iffieldequalstr{labelyear}{Forthcoming}
      {\printtext{Forthcoming}}
      {\iffieldequalstr{labelyear}{n.d.}
        {\printtext{n.d.}}
        {\iffieldundef{origyear}
          {\printfield{labelyear}\printfield{extradate}}
          {\mkbibbrackets{\printfield{origyear}}\addspace
           \printfield{labelyear}\printfield{extradate}}}}}%
}

\renewbibmacro*{cite:labeldate+extradate}{%
  \usebibmacro{asa:citeyear}%
}

\renewbibmacro*{cite:label}{%
  \iffieldundef{label}
    {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
    {\printtext[bibhyperref]{\printfield{label}}}%
}

\newbibmacro*{cite:labelname}{%
  \ifnameundef{labelname}
    {\usebibmacro{cite:label}}
    {\printtext[bibhyperref]{\printnames{labelname}}}%
}

\newbibmacro*{cite:labelname+labeldate:parens}{%
  \usebibmacro{cite:labelname}%
  \setunit{\addspace}%
  \usebibmacro{asa:citeyear}%
}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:labelname+labeldate:parens}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\textcite}
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:labelname}%
   \addspace%
   \mkbibparens{%
     \usebibmacro{asa:citeyear}}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
   \multicitedelim}
  {\usebibmacro{textcite:postnote}}

\DeclareCiteCommand{\cite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:labelname+labeldate:parens}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\autocite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:labelname+labeldate:parens}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\renewbibmacro*{textcite:postnote}{%
  \iffieldundef{postnote}
    {\ifbool{cbx:parens}
       {\bibcloseparen\global\boolfalse{cbx:parens}}
       {}}
    {\ifbool{cbx:parens}
       {\setunit{\postnotedelim}}
       {\setunit{\addspace\bibopenparen}%
        \global\booltrue{cbx:parens}}%
     \printfield{postnote}%
     \ifbool{cbx:parens}
       {\bibcloseparen\global\boolfalse{cbx:parens}}
       {}}}

\renewcommand*{\multicitedelim}{\addsemicolon\space}
\renewcommand*{\compcitedelim}{\addsemicolon\space}
\renewcommand*{\textcitedelim}{\addcomma\space}

\renewbibmacro*{prenote}{%
  \iffieldundef{prenote}
    {}
    {\printfield{prenote}\addspace}}

\renewbibmacro*{postnote}{%
  \iffieldundef{postnote}
    {}
    {\setunit{\postnotedelim}%
     \printfield{postnote}}}

% \end{macrocode}
%</cbx>
\endinput
