<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" demote-non-dropping-particle="display-and-sort" page-range-format="chicago-16" version="1.0">
  <!-- This file was generated by the Style Variant Builder <https://github.com/citation-style-language/style-variant-builder>. To contribute changes, modify the template and regenerate variants. -->
  <info>
    <title>Chicago Manual of Style 18th edition (shortened notes and bibliography)</title>
    <title-short>CMOS with Bluebook (shortened author-title notes [13.32])</title-short>
    <id>http://www.zotero.org/styles/chicago-shortened-notes-bibliography</id>
    <link href="http://www.zotero.org/styles/chicago-shortened-notes-bibliography" rel="self"/>
    <link href="http://www.zotero.org/styles/chicago-notes-bibliography" rel="template"/>
    <link href="https://www.chicagomanualofstyle.org/" rel="documentation"/>
    <author>
      <name>Andrew Dunning</name>
      <uri>https://orcid.org/0000-0003-0464-5036</uri>
    </author>
    <category citation-format="note"/>
    <category field="anthropology"/>
    <category field="communications"/>
    <category field="generic-base"/>
    <category field="geography"/>
    <category field="history"/>
    <category field="humanities"/>
    <category field="law"/>
    <category field="linguistics"/>
    <category field="literature"/>
    <category field="philosophy"/>
    <category field="political_science"/>
    <category field="science"/>
    <category field="social_science"/>
    <category field="sociology"/>
    <category field="theology"/>
    <summary>Chicago-style source citations (with Bluebook for legal citations), shortened author-title notes and bibliography system</summary>
    <updated>2026-01-11T22:54:31+00:00</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <locale xml:lang="en">
    <terms>
      <!-- Chicago omits 'by' from `verb-short` forms; it abbreviates only the most common roles -->
      <term name="advance-online-publication">ahead of print</term>
      <term name="anonymous">unsigned</term>
      <term form="verb-short" name="collection-editor">ed.</term>
      <term form="short" name="collection-number">
        <single>vol.</single>
        <multiple>vols.</multiple>
      </term>
      <term form="verb-short" name="compiler">comp.</term>
      <term form="verb-short" name="editor">ed.</term>
      <term form="short" name="editor-translator">
        <single>ed. and trans.</single>
        <multiple>eds. and trans.</multiple>
      </term>
      <term form="short" name="editortranslator">
        <single>ed. and trans.</single>
        <multiple>eds. and trans.</multiple>
      </term>
      <term form="verb" name="editor-translator">edited and translated by</term>
      <term form="verb" name="editortranslator">edited and translated by</term>
      <term form="verb-short" name="editor-translator">ed. and trans.</term>
      <term form="verb-short" name="editortranslator">ed. and trans.</term>
      <term form="verb-short" name="illustrator">ill.</term>
      <term form="short" name="legislation">Pub. L.</term>
      <term name="manuscript">unpublished manuscript</term>
      <term name="original-work-published">originally published as</term>
      <term form="short" name="paper-conference">paper</term>
      <!-- 'under' replaces 's.v.' from CMOS17 and earlier (CMOS18 14.130) -->
      <term name="sub-verbo">under</term>
      <term form="short" name="sub-verbo">under</term>
      <term name="timestamp">at</term>
      <term form="verb-short" name="translator">trans.</term>
    </terms>
  </locale>
  <locale xml:lang="en-GB">
    <terms>
      <!-- the Bibliography of Additional Resources recommends the New Oxford Style Manual as a British English guide, which the `en-GB` locale follows -->
      <term form="short" name="collection-number">
        <single>vol.</single>
        <multiple>vols</multiple>
      </term>
      <term form="short" name="editor-translator">
        <single>ed. and trans.</single>
        <multiple>eds and trans.</multiple>
      </term>
      <term form="short" name="editortranslator">
        <single>ed. and trans.</single>
        <multiple>eds and trans.</multiple>
      </term>
      <term form="verb-short" name="illustrator">illus.</term>
    </terms>
  </locale>
  <!-- Contents:
    
       This file interprets Chicago using APA's four basic reference elements
       (cf. CMOS18 14.2, 14.64, 14.161):

        1. Author (CMOS18 13.74-86)
        2. Date (author-date system only, CMOS18 13.102)
        3. Title and descriptions (CMOS18 13.87-101)
            3.1. Title
            3.2. Description
            3.3. Identifiers (edition, contributors, volume)
        4. Source
            4.1. Serial sources
            4.2. Monographic sources
            4.3. Series
            4.4. Event
            4.5. Publisher
            4.6. Date
            4.7. Locator (including page references)
            4.8. Medium
            4.9. Archival location
            4.10. URL or persistent identifier
      
       Freeform annotations to bibliography entries: 
        
        5. Notes
       
       Chicago also provides parallel rules for legal references following
       The Bluebook: A Uniform System of Citation (code shared with APA):

        6. Legal references
  -->
  <!-- In this file, macros suffixed `-bib` and `-note` are parallel versions
       of the same features for the bibliography and notes, and all changes
       must be applied to both. They should only contain differences of
       punctuation (periods in bibliography, commas in notes) and capitalization,
       except where the comments indicate structural changes. -->
  <!-- Categories of CSL item types:

       Serial
       : article-journal article-magazine article-newspaper periodical post-weblog review review-book

       Serial or Monographic
       : interview paper-conference

         Monographic with any of `collection-editor compiler editor editorial-director`.
         A serial `paper-conference` is unpublished if it lacks any of `issue page supplement-number volume`.

       Monographic
       : article book broadcast chapter classic collection dataset document
         entry entry-dictionary entry-encyclopedia event figure
         graphic manuscript map motion_picture musical_score
         pamphlet patent performance personal_communication post report
         software song speech standard thesis webpage

       Legal
       : bill hearing legal_case legislation regulation treaty
  -->
  <!-- Variable labels -->
  <macro name="label-chapter-number">
    <group delimiter=" ">
      <choose>
        <if is-numeric="chapter-number" type="song">
          <text value="track"/>
        </if>
        <else-if is-numeric="chapter-number">
          <label form="short" variable="chapter-number"/>
        </else-if>
      </choose>
      <text variable="chapter-number"/>
    </group>
  </macro>
  <macro name="label-chapter-number-capitalized">
    <group delimiter=" ">
      <choose>
        <if is-numeric="chapter-number" type="song">
          <text text-case="capitalize-first" value="track"/>
        </if>
        <else-if is-numeric="chapter-number">
          <label form="short" text-case="capitalize-first" variable="chapter-number"/>
        </else-if>
      </choose>
      <text text-case="capitalize-first" variable="chapter-number"/>
    </group>
  </macro>
  <macro name="label-collection-number">
    <group delimiter=" ">
      <choose>
        <if is-numeric="collection-number">
          <label form="short" variable="collection-number"/>
        </if>
      </choose>
      <text variable="collection-number"/>
    </group>
  </macro>
  <macro name="label-edition">
    <group delimiter=" ">
      <choose>
        <if is-numeric="edition">
          <number form="ordinal" variable="edition"/>
          <label form="short" variable="edition"/>
        </if>
        <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
          <!-- serial types: full label (CMOS18 14.89) -->
          <text variable="edition"/>
          <label variable="edition"/>
        </else-if>
        <else-if match="any" variable="collection-editor compiler editor editorial-director">
          <!-- monographic types -->
          <text variable="edition"/>
        </else-if>
        <else-if match="any" type="interview paper-conference">
          <!-- serial types -->
          <text variable="edition"/>
          <label variable="edition"/>
        </else-if>
        <else>
          <!-- monographic types -->
          <text variable="edition"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="label-edition-capitalized">
    <group delimiter=" ">
      <choose>
        <if is-numeric="edition">
          <number form="ordinal" variable="edition"/>
          <label form="short" variable="edition"/>
        </if>
        <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
          <!-- serial types: full label (CMOS18 14.89) -->
          <text text-case="title" variable="edition"/>
          <label text-case="capitalize-first" variable="edition"/>
        </else-if>
        <else-if match="any" variable="collection-editor compiler editor editorial-director">
          <!-- monographic types -->
          <text text-case="capitalize-first" variable="edition"/>
        </else-if>
        <else-if match="any" type="interview paper-conference">
          <!-- serial types -->
          <text text-case="title" variable="edition"/>
          <label text-case="capitalize-first" variable="edition"/>
        </else-if>
        <else>
          <!-- monographic types -->
          <text text-case="capitalize-first" variable="edition"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="label-issue">
    <group delimiter=" ">
      <label form="short" variable="issue"/>
      <text variable="issue"/>
    </group>
  </macro>
  <macro name="label-locator">
    <group delimiter=" ">
      <choose>
        <if locator="page"/>
        <else-if match="any" type="bill hearing legal_case legislation regulation treaty">
          <!-- Bluebook-style labels for legal types (CMOS18 14.174) -->
          <choose>
            <if locator="chapter paragraph section" match="any">
              <label form="symbol" variable="locator"/>
            </if>
            <else>
              <label form="short" variable="locator"/>
            </else>
          </choose>
        </else-if>
        <else-if is-numeric="locator" locator="line">
          <label variable="locator"/>
        </else-if>
        <else-if is-numeric="locator">
          <label form="short" variable="locator"/>
        </else-if>
        <else-if locator="chapter line verse" match="any"/>
        <!-- a non-numeric canonical reference is identified by its formatting and does not need a label (CMOS18 14.143-54) -->
        <else>
          <label form="short" variable="locator"/>
        </else>
      </choose>
      <text variable="locator"/>
    </group>
  </macro>
  <macro name="label-locator-all">
    <group delimiter=" ">
      <label form="short" variable="locator"/>
      <text variable="locator"/>
    </group>
  </macro>
  <macro name="label-number-capitalized">
    <group delimiter=" ">
      <choose>
        <if type="standard"/>
        <else-if is-numeric="number" match="any" type="legislation regulation">
          <label form="short" text-case="capitalize-first" variable="number"/>
        </else-if>
      </choose>
      <text text-case="capitalize-first" variable="number"/>
    </group>
  </macro>
  <macro name="label-number-of-volumes">
    <group delimiter=" ">
      <text variable="number-of-volumes"/>
      <choose>
        <if is-numeric="number-of-volumes">
          <label form="short" variable="number-of-volumes"/>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="label-page">
    <group delimiter=" ">
      <label form="short" variable="page"/>
      <text variable="page"/>
    </group>
  </macro>
  <macro name="label-part-number">
    <group delimiter=" ">
      <choose>
        <if is-numeric="part-number">
          <!-- TODO: Replace with `part-number` label when CSL provides one -->
          <text form="short" term="part"/>
        </if>
      </choose>
      <text variable="part-number"/>
    </group>
  </macro>
  <macro name="label-part-number-capitalized">
    <group delimiter=" ">
      <choose>
        <if is-numeric="part-number">
          <!-- TODO: Replace with `part-number` label when CSL provides one -->
          <text form="short" term="part" text-case="capitalize-first"/>
        </if>
      </choose>
      <text text-case="capitalize-first" variable="part-number"/>
    </group>
  </macro>
  <macro name="label-section-capitalized">
    <group delimiter=" ">
      <choose>
        <if is-numeric="section">
          <label form="short" text-case="capitalize-first" variable="section"/>
        </if>
      </choose>
      <text text-case="title" variable="section"/>
    </group>
  </macro>
  <macro name="label-section-symbol">
    <group delimiter=" ">
      <label form="symbol" variable="section"/>
      <text variable="section"/>
    </group>
  </macro>
  <macro name="label-supplement-number">
    <group delimiter=" ">
      <choose>
        <!-- TODO: Replace with `supplement-number` label when CSL provides one -->
        <if variable="issue supplement-number">
          <!-- if there is both an issue and supplement number, do not label both as 'no.' -->
          <text form="short" term="supplement"/>
        </if>
        <else-if is-numeric="supplement-number" variable="volume-title">
          <!-- if there is a volume title, it is already described as a supplement -->
          <text form="short" term="issue"/>
        </else-if>
        <else-if is-numeric="supplement-number" type="periodical" variable="title">
          <text form="short" term="issue"/>
        </else-if>
        <else-if is-numeric="supplement-number">
          <text form="short" term="supplement"/>
        </else-if>
      </choose>
      <text variable="supplement-number"/>
    </group>
  </macro>
  <macro name="label-version">
    <group delimiter=" ">
      <choose>
        <if type="software">
          <!-- short version label for software (CMOS18 14.169) -->
          <label form="short" variable="version"/>
        </if>
        <else>
          <label variable="version"/>
        </else>
      </choose>
      <text variable="version"/>
    </group>
  </macro>
  <macro name="label-version-capitalized">
    <group delimiter=" ">
      <choose>
        <if type="software">
          <!-- short version label for software (CMOS18 14.169) -->
          <label form="short" text-case="capitalize-first" variable="version"/>
        </if>
        <else>
          <label text-case="capitalize-first" variable="version"/>
        </else>
      </choose>
      <text variable="version"/>
    </group>
  </macro>
  <macro name="label-volume">
    <group delimiter=" ">
      <choose>
        <if is-numeric="volume">
          <label form="short" variable="volume"/>
        </if>
      </choose>
      <text variable="volume"/>
      <!-- always display number of volumes in notes without bibliography (CMOS18 14.20): -->
      <!-- <choose><if is-numeric="number-of-volumes" variable="volume"><text value="of"/><text variable="number-of-volumes"/></if></choose>-->
    </group>
  </macro>
  <macro name="label-volume-capitalized">
    <group delimiter=" ">
      <choose>
        <if is-numeric="volume">
          <label form="short" text-case="capitalize-first" variable="volume"/>
        </if>
      </choose>
      <text text-case="capitalize-first" variable="volume"/>
    </group>
  </macro>
  <!-- 1. Author (CMOS18 13.74-86) -->
  <macro name="author-bib">
    <names variable="composer">
      <name and="text" delimiter-precedes-last="always" name-as-sort-order="first"/>
      <label form="short" prefix=", "/>
      <substitute>
        <names variable="author"/>
        <!-- cf. `interview` model (CMOS18 14.110); if it is desired to prioritize `host` over `guest`, the latter could be encoded as a `contributor` -->
        <names variable="guest"/>
        <names variable="host"/>
        <choose>
          <if type="song">
            <names variable="performer"/>
          </if>
        </choose>
        <choose>
          <if type="classic">
            <!-- contributors fall after the title of `classic` (CMOS18 14.147) -->
            <text macro="author-title-substitute-bib"/>
          </if>
          <else-if type="entry-dictionary" variable="container-title">
            <!-- contributors fall after the title of unsigned reference entries (CMOS18 14.130) -->
            <text macro="author-title-substitute-container"/>
          </else-if>
          <else-if type="entry-encyclopedia" variable="container-title">
            <text macro="author-title-substitute-container"/>
          </else-if>
        </choose>
        <names variable="illustrator"/>
        <choose>
          <!-- list an edited multivolume work under the name of the series editor; remove this condition for author-date or notes and bibliography leading with volume title (CMOS18 14.21) -->
          <if variable="container-title"/>
          <else-if match="any" variable="number-of-volumes part-number part-title volume volume-title">
            <names variable="collection-editor"/>
          </else-if>
        </choose>
        <choose>
          <if match="none" type="standard">
            <names variable="editor-translator"/>
            <names variable="editor"/>
            <names variable="translator"/>
            <names variable="collection-editor"/>
          </if>
        </choose>
        <names variable="director"/>
        <choose>
          <!-- serial `broadcast` prioritizes title (CMOS18 14.165, 14.168) -->
          <if type="broadcast" variable="container-title number title"/>
          <else>
            <names variable="producer"/>
            <names variable="executive-producer"/>
            <names variable="series-creator"/>
            <choose>
              <if type="broadcast">
                <names variable="contributor"/>
              </if>
            </choose>
          </else>
        </choose>
        <names variable="editorial-director"/>
        <names variable="compiler"/>
        <choose>
          <if match="any" type="event performance speech">
            <names variable="chair"/>
            <names variable="organizer"/>
          </if>
        </choose>
        <names variable="curator"/>
        <choose>
          <if type="software">
            <!-- `software` listed under the name of the publisher or developer (CMOS18 14.169) -->
            <text variable="publisher"/>
          </if>
          <else-if type="standard">
            <!-- `standard` listed in bibliography under organization, but note omits this (CMOS18 14.159) -->
            <text variable="authority"/>
          </else-if>
        </choose>
        <text macro="author-title-substitute-container"/>
        <text macro="author-title-substitute-bib"/>
        <choose>
          <if match="any" variable="container-title event-date event-place event-title genre title publisher publisher-place"/>
          <else-if type="manuscript">
            <text macro="source-archive-bib"/>
          </else-if>
        </choose>
      </substitute>
    </names>
  </macro>
  <macro name="author-short">
    <choose>
      <if match="any" type="bill hearing legal_case legislation regulation treaty">
        <text macro="title-and-descriptions-short"/>
      </if>
      <else-if match="any" type="interview personal_communication">
        <text macro="author-short-and-recipient"/>
      </else-if>
      <else>
        <names variable="composer">
          <name and="text" form="short"/>
          <substitute>
            <names variable="author"/>
            <names variable="guest"/>
            <names variable="host"/>
            <choose>
              <if type="song">
                <names variable="performer"/>
              </if>
            </choose>
            <choose>
              <if match="any" type="classic performance">
                <!-- note contributors fall after the title of `classic` (CMOS18 14.147), `performance` (CMOS18 14.166) -->
                <text macro="author-title-substitute-short"/>
              </if>
              <else-if type="broadcast" variable="container-title number title">
                <!-- note contributors fall after the title of `broadcast` (CMOS18 14.165) -->
                <text macro="author-title-substitute-container"/>
              </else-if>
              <else-if match="any" type="broadcast motion_picture song">
                <!-- note contributors fall after the title of `broadcast`, `motion_picture` (CMOS18 14.165), `song` (CMOS18 14.163)  -->
                <text macro="author-title-substitute-short"/>
              </else-if>
              <!-- unsigned reference articles consulted in physical formats list `title` in the manner of a `sub-verbo` locator (CMOS18 14.130) -->
              <else-if match="any" variable="DOI URL"/>
              <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
                <text macro="author-title-substitute-container"/>
              </else-if>
            </choose>
            <names variable="illustrator"/>
            <choose>
              <!-- list an edited multivolume work under the name of the series editor; remove this condition for notes and bibliography leading with volume title (CMOS18 14.21) -->
              <if variable="container-title"/>
              <else-if match="any" variable="number-of-volumes part-number part-title volume volume-title">
                <names variable="collection-editor"/>
              </else-if>
            </choose>
            <choose>
              <if match="none" type="standard">
                <names variable="editor-translator"/>
                <names variable="editor"/>
                <names variable="translator"/>
                <names variable="collection-editor"/>
              </if>
            </choose>
            <choose>
              <if type="broadcast" variable="container-title number title"/>
              <else>
                <names variable="director"/>
                <names variable="producer"/>
                <names variable="executive-producer"/>
                <names variable="series-creator"/>
                <choose>
                  <if type="broadcast">
                    <names variable="contributor"/>
                  </if>
                </choose>
              </else>
            </choose>
            <names variable="editorial-director"/>
            <names variable="compiler"/>
            <choose>
              <if match="any" type="event performance speech">
                <names variable="chair"/>
                <names variable="organizer"/>
              </if>
            </choose>
            <names variable="curator"/>
            <choose>
              <!-- no Chicago definition for these shortened references; this follows the bibliography -->
              <if type="software">
                <!-- `software` listed under the name of the publisher or developer (CMOS18 14.169) -->
                <text variable="publisher"/>
              </if>
              <else-if type="standard">
                <!-- `standard` listed in bibliography under organization (CMOS18 14.159) -->
                <text variable="authority"/>
              </else-if>
            </choose>
            <text macro="author-title-substitute-container-short"/>
            <text macro="author-title-substitute-short"/>
            <choose>
              <if match="any" variable="container-title event-date event-place event-title genre title publisher publisher-place"/>
              <else-if type="manuscript">
                <text macro="source-archive-note"/>
              </else-if>
            </choose>
          </substitute>
        </names>
      </else>
    </choose>
  </macro>
  <macro name="author-sort">
    <choose>
      <if match="any" type="bill hearing legal_case legislation regulation treaty">
        <text macro="legal-title"/>
      </if>
      <else>
        <text macro="author-bib"/>
      </else>
    </choose>
  </macro>
  <!-- Author elements -->
  <macro name="author-short-and-recipient">
    <group delimiter=" ">
      <choose>
        <!-- inaccessible `interview` or `personal_commmunication`: in-text citation (CMOS18 14.111) -->
        <if match="none" variable="archive archive-place container-title DOI number publisher references URL">
          <choose>
            <if position="first">
              <!-- at the first citation in shortened forms, give the full name -->
              <names variable="author">
                <name and="text"/>
                <substitute>
                  <text macro="title-and-descriptions-short"/>
                </substitute>
              </names>
            </if>
            <else>
              <names variable="author">
                <name and="text" form="short"/>
                <substitute>
                  <text macro="title-and-descriptions-short"/>
                </substitute>
              </names>
            </else>
          </choose>
          <choose>
            <if variable="genre"/>
            <!-- recipient appears in the description if there is a `genre`; otherwise after `author` -->
            <else-if position="first">
              <names variable="recipient">
                <label form="verb" suffix=" "/>
                <name and="text"/>
              </names>
            </else-if>
            <else>
              <names variable="recipient">
                <label form="verb" suffix=" "/>
                <name and="text" form="short"/>
              </names>
            </else>
          </choose>
        </if>
        <!-- accessible `interview` or `personal_communication`: standard citation -->
        <else-if variable="author recipient">
          <names variable="author">
            <label/>
            <name and="text" form="short"/>
          </names>
          <choose>
            <if match="none" variable="genre">
              <names variable="recipient">
                <label form="verb" suffix=" "/>
                <name and="text" form="short"/>
              </names>
            </if>
          </choose>
        </else-if>
        <else>
          <names variable="author">
            <name and="text" form="short"/>
            <substitute>
              <text macro="title-and-descriptions-short"/>
            </substitute>
          </names>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="author-title-substitute-bib">
    <choose>
      <if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- If a review has no `reviewed-genre` or `reviewed-title`, assume that `title` contains the title of the reviewed work; the description provides it. -->
        <choose>
          <if variable="reviewed-genre title">
            <text macro="title-bib"/>
          </if>
          <else-if variable="reviewed-genre reviewed-title title">
            <text macro="title-bib"/>
          </else-if>
          <else>
            <text macro="title-and-descriptions-bib"/>
          </else>
        </choose>
      </if>
      <else-if variable="title">
        <text macro="title-bib"/>
      </else-if>
      <else>
        <!-- If an item has no `title`, substitute with descriptions. -->
        <text macro="title-and-descriptions-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="author-title-substitute-short">
    <choose>
      <if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- If a review has no `reviewed-genre` or `reviewed-title`, assume that `title` contains the title of the reviewed work; the description provides it. -->
        <choose>
          <if variable="reviewed-genre title">
            <text macro="title-short"/>
          </if>
          <else-if variable="reviewed-genre reviewed-title title">
            <text macro="title-short"/>
          </else-if>
          <else>
            <text macro="title-and-descriptions-short"/>
          </else>
        </choose>
      </if>
      <else-if variable="title">
        <text macro="title-short"/>
      </else-if>
      <else>
        <!-- If an item has no `title`, substitute with descriptions and capitalize -->
        <text macro="title-and-descriptions-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="author-title-substitute-container">
    <choose>
      <!-- no Chicago model for citing an anonymous article with an issue title in `volume-title` -->
      <if variable="volume-title"/>
      <else-if match="any" type="article-magazine article-newspaper">
        <!-- Anonymous magazine and newspaper articles substitute name of publication (CMOS18 14.87, 14.97) -->
        <text macro="source-serial-name"/>
      </else-if>
      <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- Publication name also substituted for unsigned reviews (CMOS18 14.102) -->
        <text macro="source-serial-name"/>
      </else-if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <!-- Anonymous entries in reference works (CMOS18 14.130) -->
        <text font-style="italic" text-case="title" variable="container-title"/>
      </else-if>
      <else-if type="broadcast">
        <!-- TV broadcasts and podcasts (CMOS18 14.165, 14.168) -->
        <text font-style="italic" text-case="title" variable="container-title"/>
      </else-if>
      <else-if type="webpage">
        <!-- Website title substituted in bibliography only (CMOS18 14.104) -->
        <text text-case="title" variable="container-title"/>
      </else-if>
    </choose>
  </macro>
  <macro name="author-title-substitute-container-short">
    <choose>
      <if match="any" type="article-magazine article-newspaper">
        <!-- Anonymous magazine/newspaper articles substitute name of publication (CMOS18 14.87, 14.97) -->
        <text font-style="italic" text-case="title" variable="container-title"/>
      </if>
      <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- Publication name also substituted for unsigned reviews (CMOS18 14.102) -->
        <text font-style="italic" text-case="title" variable="container-title"/>
      </else-if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <!-- Anonymous entries in reference works (CMOS18 14.130) -->
        <text font-style="italic" form="short" text-case="title" variable="container-title"/>
      </else-if>
      <else-if type="broadcast">
        <!-- TV broadcasts and podcasts (CMOS18 14.165, 14.168) -->
        <text font-style="italic" form="short" text-case="title" variable="container-title"/>
      </else-if>
      <else-if type="webpage">
        <!-- Website title substituted in bibliography only (CMOS18 14.104) -->
        <text form="short" text-case="title" variable="container-title"/>
      </else-if>
    </choose>
  </macro>
  <!-- 2. Date (CMOS18 13.102) -->
  <macro name="date-short">
    <group delimiter="-">
      <choose>
        <if variable="issued">
          <group delimiter=" ">
            <choose>
              <if is-uncertain-date="original-date">
                <!-- Uncertain date already has square brackets -->
                <text macro="date-original-year"/>
              </if>
              <else>
                <text macro="date-original-year" prefix="[" suffix="]"/>
              </else>
            </choose>
            <group>
              <choose>
                <if match="none" type="interview personal_communication">
                  <text macro="date-issued-year"/>
                </if>
                <!-- accessible `interview` or `personal_communication` items appear in the bibliography; inaccessible items are in-text only -->
                <else-if match="any" variable="archive archive-place container-title DOI number publisher references URL">
                  <text macro="date-issued-year"/>
                </else-if>
                <else>
                  <text macro="date-issued-full"/>
                </else>
              </choose>
              <text variable="year-suffix"/>
            </group>
          </group>
        </if>
        <else-if variable="event-date">
          <text macro="date-event-year"/>
        </else-if>
        <else-if variable="available-date">
          <date date-parts="year" form="numeric" variable="available-date"/>
        </else-if>
        <else-if variable="status">
          <!-- Print the status variable rather than use generic CSL terms (`in press`, etc.) -->
          <text text-case="lowercase" variable="status"/>
          <text variable="year-suffix"/>
        </else-if>
        <else-if match="any" type="interview personal_communication">
          <choose>
            <if match="any" variable="archive archive-place container-title DOI number publisher references URL">
              <!-- only give n.d. for accessible personal communication (CMOS18 14.111)-->
              <text form="short" term="no date"/>
              <text variable="year-suffix"/>
            </if>
          </choose>
        </else-if>
        <else-if match="any" type="classic collection entry entry-dictionary entry-encyclopedia">
          <!-- do not give n.d. for archival collections (CMOS18 14.128), `classic` (CMOS18 14.143), or reference entries (CMOS18 14.131) -->
          <text variable="year-suffix"/>
        </else-if>
        <else-if type="manuscript">
          <!-- do not give n.d. with a bare shelfmark -->
          <choose>
            <if match="any" variable="container-title event-date event-place event-title genre title publisher publisher-place">
              <text form="short" term="no date"/>
              <text variable="year-suffix"/>
            </if>
          </choose>
        </else-if>
        <else>
          <text form="short" term="no date"/>
          <text variable="year-suffix"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- Date elements -->
  <macro name="date-event-full">
    <choose>
      <if is-uncertain-date="issued">
        <!-- guessed-at date (CMOS18 14.44) -->
        <date form="text" prefix="[" suffix="?]" variable="event-date"/>
      </if>
      <else>
        <date form="text" variable="event-date"/>
      </else>
    </choose>
  </macro>
  <macro name="date-event-year">
    <choose>
      <if is-uncertain-date="issued">
        <!-- guessed-at date (CMOS18 14.44) -->
        <date date-parts="year" form="numeric" prefix="[" suffix="?]" variable="event-date"/>
      </if>
      <else>
        <date date-parts="year" form="numeric" variable="event-date"/>
      </else>
    </choose>
  </macro>
  <macro name="date-issued-full">
    <choose>
      <if is-uncertain-date="issued">
        <!-- guessed-at date (CMOS18 14.44) -->
        <date form="text" prefix="[" suffix="?]" variable="issued"/>
      </if>
      <else>
        <date form="text" variable="issued"/>
      </else>
    </choose>
  </macro>
  <macro name="date-issued-year">
    <choose>
      <if is-uncertain-date="issued">
        <!-- guessed-at date (CMOS18 14.44) -->
        <date date-parts="year" form="numeric" prefix="[" suffix="?]" variable="issued"/>
      </if>
      <else>
        <date date-parts="year" form="numeric" variable="issued"/>
      </else>
    </choose>
  </macro>
  <macro name="date-issued-year-month">
    <choose>
      <if is-uncertain-date="issued">
        <!-- guessed-at date (CMOS18 14.44) -->
        <date date-parts="year-month" form="text" prefix="[" suffix="?]" variable="issued"/>
      </if>
      <else>
        <date date-parts="year-month" form="text" variable="issued"/>
      </else>
    </choose>
  </macro>
  <macro name="date-original-full">
    <choose>
      <if is-uncertain-date="original-date">
        <date form="text" prefix="[" suffix="?]" variable="original-date"/>
      </if>
      <else>
        <date form="text" variable="original-date"/>
      </else>
    </choose>
  </macro>
  <macro name="date-original-year">
    <choose>
      <if is-uncertain-date="original-date">
        <date date-parts="year" form="numeric" prefix="[" suffix="?]" variable="original-date"/>
      </if>
      <else>
        <date date-parts="year" form="numeric" variable="original-date"/>
      </else>
    </choose>
  </macro>
  <macro name="date-original-year-month">
    <choose>
      <if is-uncertain-date="original-date">
        <date date-parts="year-month" form="text" prefix="[" suffix="?]" variable="original-date"/>
      </if>
      <else>
        <date date-parts="year-month" form="text" variable="original-date"/>
      </else>
    </choose>
  </macro>
  <!-- 3. Title and descriptions (CMOS18 13.87-101) -->
  <macro name="title-and-descriptions-bib">
    <group delimiter=". ">
      <choose>
        <if variable="title">
          <text macro="title-bib"/>
          <text macro="description-bib"/>
          <text macro="identifier-bib"/>
        </if>
        <else-if match="any" type="bill report">
          <!-- Bills, resolutions, and congressional reports substitute bill number if no title -->
          <!-- Congressional reports are indistinguishable from other reports -->
          <text macro="identifier-number-bib"/>
          <text macro="identifier-bib"/>
          <text macro="description-bib"/>
        </else-if>
        <else>
          <text macro="description-bib"/>
          <text macro="identifier-bib"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="title-and-descriptions-short">
    <choose>
      <if variable="title">
        <text macro="title-short"/>
      </if>
      <else-if match="any" type="bill report">
        <!-- Bills, resolutions, and congressional reports substitute bill number if no title -->
        <text macro="legal-identifier-bill-report"/>
      </else-if>
      <else>
        <text macro="description-short"/>
      </else>
    </choose>
  </macro>
  <macro name="title-and-source-bib">
    <group delimiter=". ">
      <choose>
        <if type="broadcast" variable="container-title number title">
          <!-- Bespoke `broadcast` format (CMOS18 14.165, 14.168) -->
          <text font-style="italic" text-case="title" variable="container-title"/>
          <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
          <!-- <text macro="source-monographic-title-specific-title-first"/> -->
          <group delimiter=", ">
            <text macro="identifier-number-bib"/>
            <text macro="title-bib"/>
            <text macro="description-bib"/>
            <text macro="source-monographic-identifier-contributors-bib"/>
          </group>
          <text macro="source-series-bib"/>
          <choose>
            <!-- show event information here only if not collapsed with `issued` (CMOS18 14.167) -->
            <if match="any" variable="event-date original-date original-publisher original-publisher-place publisher status">
              <text macro="source-event-bib"/>
            </if>
          </choose>
        </if>
        <else-if type="chapter" variable="container-title genre">
          <!-- 'introduction to', 'online appendix to' (CMOS18 14.12, 14.14) -->
          <group delimiter=" ">
            <text macro="title-and-descriptions-bib"/>
            <text macro="source-bib"/>
          </group>
        </else-if>
        <else-if type="article-journal" variable="container-title genre volume-title">
          <!-- introduction to a special issue or supplement -->
          <group delimiter=" ">
            <text macro="title-and-descriptions-bib"/>
            <text macro="source-bib"/>
          </group>
        </else-if>
        <else>
          <text macro="title-and-descriptions-bib"/>
          <text macro="source-bib"/>
        </else>
      </choose>
      <group delimiter=", ">
        <choose>
          <!-- show event information here only if collapsed with `issued` (CMOS18 14.167) -->
          <if match="any" variable="event-date original-date original-publisher original-publisher-place publisher status"/>
          <!-- omit serial types -->
          <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book"/>
          <else-if match="any" variable="collection-editor compiler editor editorial-director">
            <!-- monographic types -->
            <text macro="source-event-bib"/>
          </else-if>
          <!-- omit serial types -->
          <else-if match="any" type="interview paper-conference"/>
          <else>
            <!-- monographic types -->
            <text macro="source-event-bib"/>
          </else>
        </choose>
        <text macro="source-monographic-publication-bib"/>
      </group>
      <text macro="source-medium-bib"/>
      <text macro="source-archive-bib"/>
      <text macro="source-date-accessed-DOI-URL-bib"/>
    </group>
  </macro>
  <!-- 3.1. Title -->
  <macro name="title-bib">
    <choose>
      <if match="any" type="post webpage">
        <!-- Handle `container-title` on `post` or `webpage` in manner of `publisher` -->
        <text macro="title-and-part-filter-review-bib"/>
      </if>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="title-and-part-filter-review-bib"/>
      </else-if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="title-primary"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="title-monographic-bib-specific-title-first"/> -->
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <!-- serial types -->
        <text macro="title-and-part-filter-review-bib"/>
      </else-if>
      <else>
        <text macro="title-primary"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="title-monographic-bib-specific-title-first"/> -->
      </else>
    </choose>
  </macro>
  <macro name="title-short">
    <choose>
      <if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- If a review has no `reviewed-title`, assume that `title` contains the title of the reviewed work; the description provides it. -->
        <choose>
          <if variable="reviewed-genre title">
            <!-- Quotes, title case -->
            <text form="short" quotes="true" text-case="title" variable="title"/>
          </if>
          <else-if variable="reviewed-genre reviewed-title title">
            <!-- Quotes, title case -->
            <text form="short" quotes="true" text-case="title" variable="title"/>
          </else-if>
          <else>
            <text macro="description-short"/>
          </else>
        </choose>
      </if>
      <else>
        <text macro="title-primary-short"/>
      </else>
    </choose>
  </macro>
  <!-- Title elements -->
  <macro name="title-and-part-filter-review-bib">
    <choose>
      <if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <!-- `title` is only the review title if there is a separate `reviewed-genre` or `reviewed-title`; otherwise, it is the title of the reviewed work, printed in the description -->
        <choose>
          <if match="any" variable="reviewed-genre reviewed-title">
            <text macro="title-and-part-title-bib"/>
          </if>
        </choose>
      </if>
      <else>
        <text macro="title-and-part-title-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="title-and-part-title-bib">
    <group delimiter=". ">
      <text macro="title-primary"/>
      <group delimiter=", ">
        <text macro="label-part-number-capitalized"/>
        <text macro="title-part"/>
      </group>
    </group>
  </macro>
  <macro name="title-part">
    <choose>
      <if type="patent">
        <!-- No italics or quotes, sentence case -->
        <text form="short" text-case="capitalize-first" variable="part-title"/>
      </if>
      <else-if match="any" type="bill collection legislation regulation treaty">
        <!-- No italics or quotes, title case -->
        <text text-case="title" variable="part-title"/>
      </else-if>
      <else-if type="legal_case">
        <!-- Italicized, sentence case -->
        <text font-style="italic" variable="part-title"/>
      </else-if>
      <else-if match="any" type="book classic graphic hearing map">
        <!-- Italicized, title case (regardless of `container-title`) -->
        <text font-style="italic" text-case="title" variable="part-title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="author container-title">
        <!-- Signed encyclopedia entry in quotes, title case (CMOS18 14.132) -->
        <text quotes="true" text-case="title" variable="part-title"/>
      </else-if>
      <else-if type="entry-dictionary" variable="container-title">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="part-title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="container-title">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="part-title"/>
      </else-if>
      <else-if type="post">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="part-title"/>
      </else-if>
      <!-- Other types are formatted based on presence of `container-title` -->
      <else-if variable="container-title">
        <choose>
          <if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
            <!-- serial types -->
            <!-- Quotes, title case -->
            <text quotes="true" text-case="title" variable="part-title"/>
          </if>
          <else-if match="any" variable="collection-editor compiler editor editorial-director">
            <!-- monographic types -->
            <!-- Italics, title case -->
            <text font-style="italic" text-case="title" variable="part-title"/>
          </else-if>
          <else-if match="any" type="interview paper-conference">
            <!-- serial types -->
            <!-- Quotes, title case -->
            <text quotes="true" text-case="title" variable="part-title"/>
          </else-if>
          <else>
            <!-- monographic types -->
            <!-- Italics, title case -->
            <text font-style="italic" text-case="title" variable="part-title"/>
          </else>
        </choose>
      </else-if>
      <else-if match="any" type="article dataset document interview manuscript paper-conference personal_communication speech thesis webpage">
        <!-- Container-like but not necessarily with `container-title` -->
        <!-- Quotes, title case -->
        <text quotes="true" text-case="title" variable="part-title"/>
      </else-if>
      <else>
        <!-- Italicized, title case (default) -->
        <text font-style="italic" text-case="title" variable="part-title"/>
      </else>
    </choose>
  </macro>
  <macro name="title-primary">
    <choose>
      <if type="patent">
        <!-- No italics or quotes, sentence case -->
        <text form="short" text-case="capitalize-first" variable="title"/>
      </if>
      <else-if match="any" type="bill collection legislation regulation treaty">
        <!-- No italics or quotes, title case -->
        <text text-case="title" variable="title"/>
      </else-if>
      <else-if type="legal_case">
        <!-- Italicized, sentence case -->
        <text font-style="italic" variable="title"/>
      </else-if>
      <else-if match="any" type="book classic graphic hearing map">
        <!-- Italicized, title case (regardless of `container-title`) -->
        <text font-style="italic" text-case="title" variable="title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="author container-title">
        <!-- Signed encyclopedia entry in quotes, title case (CMOS18 14.132) -->
        <text quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else-if type="entry-dictionary" variable="container-title">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="container-title">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="title"/>
      </else-if>
      <else-if type="post">
        <!-- Quotes, sentence case -->
        <text quotes="true" variable="title"/>
      </else-if>
      <!-- Other types are formatted based on presence of `container-title` -->
      <else-if variable="container-title">
        <!-- Quotes, title case -->
        <text quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else-if match="any" type="article dataset document interview manuscript paper-conference personal_communication speech thesis webpage">
        <!-- Container-like but not necessarily with `container-title` -->
        <!-- Quotes, title case -->
        <text quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else>
        <!-- Italicized, title case (default) -->
        <text font-style="italic" text-case="title" variable="title"/>
      </else>
    </choose>
  </macro>
  <macro name="title-primary-short">
    <choose>
      <if type="patent">
        <!-- No italics or quotes, sentence case -->
        <text form="short" text-case="capitalize-first" variable="title"/>
      </if>
      <else-if match="any" type="bill collection legislation regulation treaty">
        <!-- No italics or quotes, title case -->
        <text form="short" text-case="title" variable="title"/>
      </else-if>
      <else-if type="legal_case">
        <!-- Italicized, sentence case -->
        <text font-style="italic" form="short" variable="title"/>
      </else-if>
      <else-if match="any" type="book classic graphic hearing map">
        <!-- Italicized, title case (regardless of `container-title`) -->
        <text font-style="italic" form="short" text-case="title" variable="title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="author container-title">
        <!-- Signed encyclopedia entry in quotes, title case (CMOS18 14.132) -->
        <text form="short" quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else-if type="entry-dictionary" variable="container-title">
        <!-- Quotes, sentence case -->
        <text form="short" quotes="true" variable="title"/>
      </else-if>
      <else-if type="entry-encyclopedia" variable="container-title">
        <!-- Quotes, sentence case -->
        <text form="short" quotes="true" variable="title"/>
      </else-if>
      <else-if type="post">
        <!-- Quotes, sentence case -->
        <text form="short" quotes="true" variable="title"/>
      </else-if>
      <!-- Other types are formatted based on presence of `container-title` -->
      <else-if variable="container-title">
        <!-- Quotes, title case -->
        <text form="short" quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else-if match="any" type="article dataset document interview manuscript paper-conference personal_communication speech thesis webpage">
        <!-- Container-like but not necessarily with `container-title` -->
        <!-- Quotes, title case -->
        <text form="short" quotes="true" text-case="title" variable="title"/>
      </else-if>
      <else>
        <!-- Italicized, title case (default) -->
        <text font-style="italic" form="short" text-case="title" variable="title"/>
      </else>
    </choose>
  </macro>
  <!-- 3.2. Description -->
  <macro name="description-bib">
    <choose>
      <if match="any" type="interview" variable="interviewer">
        <text macro="description-interview-bib"/>
      </if>
      <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <text macro="description-review-bib"/>
      </else-if>
      <else-if type="personal_communication">
        <text macro="description-letter-bib"/>
      </else-if>
      <else-if type="song" variable="composer">
        <text macro="description-song-bib"/>
      </else-if>
      <!-- thesis type appears with university name (CMOS18 14.113) -->
      <else-if type="thesis"/>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="description-serial-bib"/>
      </else-if>
      <else-if type="paper-conference">
        <text macro="description-paper-conference-bib"/>
      </else-if>
      <else-if match="none" variable="container-title">
        <text macro="description-format-bib"/>
      </else-if>
      <!-- For conference presentations/performances/events, chapters in reports/standards/generic documents, software, place description within the source element -->
      <else-if match="any" type="document report software standard"/>
      <else-if match="any" type="event paper-conference performance speech">
        <choose>
          <if match="any" variable="collection-editor compiler editor editorial-director issue page supplement-number volume">
            <text macro="description-format-bib"/>
          </if>
        </choose>
      </else-if>
      <else>
        <text macro="description-format-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="description-short">
    <choose>
      <if match="any" type="interview" variable="interviewer">
        <choose>
          <if match="any" variable="archive archive-place container-title DOI number publisher references URL">
            <text macro="description-interview-short"/>
          </if>
          <else>
            <!-- for an inaccessible `interview`, give a full in-text description at the first citation -->
            <choose>
              <if position="first">
                <text macro="description-interview-note"/>
              </if>
              <else>
                <text macro="description-interview-short"/>
              </else>
            </choose>
          </else>
        </choose>
      </if>
      <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
        <text macro="description-review-short"/>
      </else-if>
      <else-if type="personal_communication">
        <text macro="description-letter-short"/>
      </else-if>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="description-serial-short"/>
      </else-if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="description-format-short"/>
      </else-if>
      <else-if type="paper-conference">
        <!-- serial `paper-conference` -->
        <text macro="description-serial-short"/>
      </else-if>
      <else>
        <!-- monographic types -->
        <text macro="description-format-short"/>
      </else>
    </choose>
  </macro>
  <!-- Description elements -->
  <macro name="description-format-bib">
    <choose>
      <if variable="genre number"/>
      <else-if variable="genre">
        <text text-case="capitalize-first" variable="genre"/>
      </else-if>
      <!-- generic labels if unpublished -->
      <else-if match="any" variable="archive archive-place container-title DOI number publisher references URL"/>
      <else-if type="manuscript">
        <!-- 'unpublished manuscript' if no `genre` (CMOS18 14.114) -->
        <text term="manuscript" text-case="capitalize-first"/>
      </else-if>
      <else-if type="personal_communication">
        <!-- 'personal communication' if no `genre` (CMOS18 14.111) -->
        <text term="personal-communication" text-case="capitalize-first"/>
      </else-if>
    </choose>
  </macro>
  <macro name="description-format-note">
    <choose>
      <if variable="genre number"/>
      <else-if variable="genre">
        <text variable="genre"/>
      </else-if>
      <!-- generic labels if unpublished -->
      <else-if match="any" variable="archive archive-place container-title DOI number publisher references URL"/>
      <else-if type="manuscript">
        <!-- 'unpublished manuscript' if no `genre` (CMOS18 14.114) -->
        <text term="manuscript"/>
      </else-if>
      <else-if type="personal_communication">
        <!-- 'personal communication' if no `genre` (CMOS18 14.111) -->
        <text term="personal-communication"/>
      </else-if>
    </choose>
  </macro>
  <macro name="description-format-short">
    <group delimiter=" ">
      <choose>
        <if type="chapter" variable="container-title genre">
          <text form="short" variable="genre"/>
          <!-- untitled introductions: cf. review model, which includes a title (CMOS18 14.101) -->
          <text macro="source-monographic-preposition-note"/>
          <text font-style="italic" form="short" text-case="title" variable="container-title"/>
        </if>
        <else-if type="article-journal" variable="container-title genre volume-title">
          <text form="short" variable="genre"/>
          <!-- untitled introduction to a special issue or supplement -->
          <text macro="source-monographic-preposition-note"/>
          <text form="short" quotes="true" text-case="title" variable="volume-title"/>
        </else-if>
        <else-if variable="genre">
          <text form="short" variable="genre"/>
        </else-if>
        <else-if variable="medium">
          <text form="short" variable="medium"/>
        </else-if>
        <else-if variable="chapter-number container-title">
          <text macro="source-monographic-preposition-note"/>
          <text font-style="italic" form="short" text-case="title" variable="container-title"/>
        </else-if>
        <else-if variable="chapter-number">
          <text macro="label-chapter-number"/>
        </else-if>
        <!-- generic labels if unpublished -->
        <else-if match="any" variable="archive archive-place container-title DOI number publisher references URL"/>
        <else-if type="manuscript">
          <!-- 'unpublished manuscript' if no `genre` (CMOS18 14.114) -->
          <text term="manuscript"/>
        </else-if>
        <else-if type="personal_communication">
          <!-- 'pers. comm.' if no `genre` (CMOS18 14.111) -->
          <text form="short" term="personal-communication"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="description-interview-bib">
    <group delimiter=", ">
      <choose>
        <if variable="genre number">
          <!-- `genre` printed with `number` -->
          <names variable="interviewer">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
        </if>
        <else-if variable="genre">
          <group delimiter=" ">
            <text text-case="capitalize-first" variable="genre"/>
            <group delimiter=" ">
              <text form="verb" term="container-author"/>
              <names variable="interviewer">
                <name and="text"/>
              </names>
            </group>
          </group>
        </else-if>
        <else-if variable="interviewer">
          <names variable="interviewer">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
        </else-if>
        <else>
          <text macro="description-format-bib"/>
        </else>
      </choose>
      <text macro="source-event-place-first"/>
    </group>
  </macro>
  <macro name="description-interview-note">
    <group delimiter=", ">
      <choose>
        <if variable="genre number">
          <!-- `genre` printed with `number` -->
          <names variable="interviewer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
        <else-if variable="genre">
          <group delimiter=" ">
            <text variable="genre"/>
            <group delimiter=" ">
              <text form="verb" term="container-author"/>
              <names variable="interviewer">
                <name and="text"/>
              </names>
            </group>
          </group>
        </else-if>
        <else-if variable="interviewer">
          <names variable="interviewer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </else-if>
        <else>
          <text macro="description-format-note"/>
        </else>
      </choose>
      <text macro="source-event-place-first"/>
    </group>
  </macro>
  <macro name="description-interview-short">
    <choose>
      <if disambiguate="true">
        <names variable="interviewer">
          <label form="verb" suffix=" "/>
          <name and="text" form="short"/>
          <substitute>
            <text macro="description-format-short"/>
          </substitute>
        </names>
      </if>
      <else-if match="any" variable="genre medium">
        <choose>
          <if match="any" variable="author chair collection-editor compiler composer curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator">
            <text macro="description-format-short"/>
          </if>
          <else>
            <!-- capitalize if no author or title -->
            <text macro="description-format-bib"/>
          </else>
        </choose>
      </else-if>
      <else>
        <!-- generic description for an unpublished interview (CMOS18 14.108) -->
        <text term="interview"/>
      </else>
    </choose>
  </macro>
  <macro name="description-letter-bib">
    <choose>
      <if variable="recipient">
        <group delimiter=", ">
          <choose>
            <if variable="genre number">
              <!-- `genre` appears with `number` -->
              <names variable="recipient">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </if>
            <else-if variable="genre">
              <group delimiter=" ">
                <text macro="description-format-bib"/>
                <names variable="recipient">
                  <label form="verb" suffix=" "/>
                  <name and="text"/>
                </names>
              </group>
            </else-if>
            <else>
              <names variable="recipient">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </else>
          </choose>
          <text variable="event-place"/>
          <text macro="date-event-full"/>
        </group>
      </if>
      <else>
        <text macro="description-format-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="description-letter-short">
    <!-- shortened notes ideally give author, recipient, place, and date (CMOS18 14.13) -->
    <group delimiter=", ">
      <choose>
        <if variable="genre recipient">
          <group delimiter=" ">
            <text macro="description-format-short"/>
            <names variable="recipient">
              <label form="verb" suffix=" "/>
              <name and="text" form="short"/>
            </names>
          </group>
        </if>
        <else>
          <text macro="description-format-short"/>
        </else>
      </choose>
      <text variable="event-place"/>
      <choose>
        <if variable="event-date">
          <text macro="date-event-full"/>
        </if>
        <else>
          <text macro="date-issued-full"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="description-paper-conference-bib">
    <choose>
      <if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="description-format-bib"/>
      </if>
      <else>
        <!-- serial types -->
        <group delimiter=". ">
          <text macro="description-serial-bib"/>
          <text macro="source-event-bib"/>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="description-review-bib">
    <!-- Reviewed item -->
    <group delimiter=". ">
      <group delimiter=", ">
        <group delimiter=" ">
          <text macro="description-review-genre-bib"/>
          <text macro="description-review-title"/>
        </group>
        <choose>
          <if variable="reviewed-genre reviewed-title title">
            <names variable="reviewed-author">
              <label form="verb" suffix=" "/>
              <name and="text"/>
            </names>
          </if>
          <else-if variable="reviewed-genre"/>
          <else>
            <names variable="reviewed-author">
              <label form="verb" suffix=" "/>
              <name and="text"/>
            </names>
          </else>
        </choose>
        <text macro="source-event-place-first"/>
      </group>
      <text macro="label-section-capitalized"/>
    </group>
  </macro>
  <macro name="description-review-genre-bib">
    <choose>
      <if variable="reviewed-genre">
        <group delimiter=" ">
          <text macro="description-review-term-unsigned-bib"/>
          <text variable="reviewed-genre"/>
          <choose>
            <if match="none" variable="reviewed-title">
              <names variable="reviewed-author">
                <label form="verb" suffix=" "/>
                <name and="text"/>
              </names>
            </if>
          </choose>
        </group>
      </if>
      <else-if variable="number">
        <text macro="description-review-term-unsigned-bib"/>
      </else-if>
      <!-- If no `reviewed-genre`, assume that `genre` is entered as 'Review of the book' or similar -->
      <else-if variable="genre">
        <text text-case="capitalize-first" variable="genre"/>
      </else-if>
      <else>
        <text macro="description-review-term-unsigned-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="description-review-short">
    <group delimiter=" ">
      <text term="review-of"/>
      <text macro="description-review-title-short"/>
    </group>
  </macro>
  <macro name="description-review-term-unsigned-bib">
    <!-- Anonymous reviews appear as 'unsigned' (CMOS18 14.102) -->
    <choose>
      <if match="any" variable="author chair collection-editor compiler composer curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator">
        <text term="review-of" text-case="capitalize-first"/>
      </if>
      <else>
        <group delimiter=" ">
          <text term="anonymous" text-case="capitalize-first"/>
          <text term="review-of"/>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="description-review-title">
    <choose>
      <if match="any" variable="reviewed-genre reviewed-title">
        <!-- Not possible to distinguish TV series episode from other reviewed works without a reviewed source title -->
        <!-- Adapt for `reviewed-container-title` or similar if it becomes available -->
        <text font-style="italic" text-case="title" variable="reviewed-title"/>
      </if>
      <else>
        <!-- Assume title is title of reviewed work -->
        <text font-style="italic" text-case="title" variable="title"/>
      </else>
    </choose>
  </macro>
  <macro name="description-review-title-short">
    <choose>
      <if match="any" variable="reviewed-genre reviewed-title">
        <!-- Not possible to distinguish TV series episode from other reviewed works without a reviewed source title -->
        <!-- Adapt for `reviewed-container-title` or similar if it becomes available -->
        <text font-style="italic" form="short" text-case="title" variable="reviewed-title"/>
      </if>
      <else>
        <!-- Assume title is title of reviewed work -->
        <text font-style="italic" form="short" text-case="title" variable="title"/>
      </else>
    </choose>
  </macro>
  <macro name="description-serial-bib">
    <group delimiter=". ">
      <text macro="description-format-bib"/>
      <!-- `section` provides magazine departments (CMOS18 14.88) and newspaper column names (CMOS18 14.93) -->
      <text macro="label-section-capitalized"/>
    </group>
  </macro>
  <macro name="description-serial-short">
    <choose>
      <if variable="title"/>
      <else-if variable="genre">
        <text macro="description-format-short"/>
      </else-if>
      <else>
        <text form="short" text-case="title" variable="section"/>
      </else>
    </choose>
  </macro>
  <macro name="description-song-bib">
    <!-- Performer of classical music works -->
    <!-- TODO: remove when Zotero fixes mapping of performer to `author` -->
    <group delimiter=" ">
      <!-- Based on `description-format` macro -->
      <choose>
        <if variable="genre">
          <text text-case="capitalize-first" variable="genre"/>
          <text form="verb" term="performer"/>
        </if>
        <!-- providing 'performed by' label for recorded readings (CMOS18 14.164), but it should be omitted for classical music (CMOS18 14.163) -->
        <else>
          <text form="verb" term="performer" text-case="capitalize-first"/>
        </else>
      </choose>
      <names variable="author">
        <name and="text"/>
        <substitute>
          <names variable="performer"/>
        </substitute>
      </names>
    </group>
  </macro>
  <!-- 3.3. Identifier (edition, contributors, volume) -->
  <macro name="identifier-bib">
    <group delimiter=". ">
      <choose>
        <if type="patent">
          <text macro="identifier-patent"/>
        </if>
        <else-if type="report">
          <text macro="identifier-report-bib"/>
        </else-if>
        <else-if match="any" type="post webpage">
          <!-- Handle `container-title` on `post` or `webpage` akin to `publisher` -->
          <text macro="identifier-number-bib"/>
          <text macro="label-version-capitalized"/>
          <text macro="identifier-edition-bib"/>
          <text macro="identifier-contributors-bib"/>
        </else-if>
        <else-if variable="container-title">
          <choose>
            <if match="any" type="broadcast graphic map motion_picture">
              <!-- For audiovisual media, number information comes after `title`, not `container-title`; `song` places album catalogue `number` with `publisher` (CMOS18 14.163-164) -->
              <text macro="identifier-number-bib"/>
            </if>
          </choose>
          <text macro="identifier-contributors-bib"/>
        </else-if>
        <else>
          <choose>
            <if match="none" type="song">
              <text macro="identifier-number-bib"/>
            </if>
          </choose>
          <text macro="label-version-capitalized"/>
          <text macro="identifier-edition-bib"/>
          <text macro="identifier-contributors-and-volume-bib"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- Identifier elements -->
  <macro name="identifier-contributors-bib">
    <choose>
      <if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <text macro="identifier-contributors-serial-bib"/>
      </if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <text macro="identifier-contributors-monographic-bib"/>
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <text macro="identifier-contributors-serial-bib"/>
      </else-if>
      <else>
        <text macro="identifier-contributors-monographic-bib"/>
      </else>
    </choose>
  </macro>
  <macro name="identifier-contributors-monographic-bib">
    <group delimiter=". ">
      <choose>
        <if match="any" type="post webpage">
          <names variable="container-author">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="editor-translator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names delimiter=". " variable="editor translator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="editorial-director">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="guest">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="host">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="illustrator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="narrator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names delimiter=". " variable="compiler chair organizer curator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names delimiter=". " variable="series-creator executive-producer">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="producer">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="director">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <choose>
            <if match="any" type="broadcast performance">
              <names variable="script-writer">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </if>
          </choose>
          <names variable="performer">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <choose>
            <if match="none" type="thesis">
              <names variable="contributor">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </if>
          </choose>
        </if>
        <else>
          <!-- Handle `container-title` on `post` or `webpage` akin to `publisher` -->
          <choose>
            <if match="none" variable="container-title">
              <names variable="container-author">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="editor-translator">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names delimiter=". " variable="editor translator">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="editorial-director">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="guest">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="host">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </if>
          </choose>
          <names variable="illustrator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <names variable="narrator">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
          <choose>
            <if match="none" variable="container-title">
              <names delimiter=". " variable="compiler chair organizer curator">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names delimiter=". " variable="series-creator executive-producer">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="producer">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <names variable="director">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <choose>
                <if match="any" type="broadcast performance">
                  <names variable="script-writer">
                    <label form="verb" suffix=" " text-case="capitalize-first"/>
                    <name and="text"/>
                  </names>
                </if>
              </choose>
              <names variable="performer">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
              <choose>
                <if match="none" type="song thesis">
                  <names variable="contributor">
                    <label form="verb" suffix=" " text-case="capitalize-first"/>
                    <name and="text"/>
                  </names>
                </if>
              </choose>
            </if>
          </choose>
          <choose>
            <if type="song">
              <!-- Song contributors attached to album (CMOS18 14.163) -->
              <names variable="contributor">
                <label form="verb" suffix=" " text-case="capitalize-first"/>
                <name and="text"/>
              </names>
            </if>
          </choose>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="identifier-contributors-monographic-bib-multivolume">
    <!-- lowercase for attachment to volume; otherwise identical to `identifier-contributors-monographic-bib` -->
    <group delimiter=", ">
      <!-- Handle `container-title` on `post` or `webpage` akin to `publisher` -->
      <choose>
        <if match="none" variable="container-title">
          <names variable="container-author">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="editor-translator">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names delimiter=", " variable="editor translator">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="editorial-director">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="guest">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="host">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
      </choose>
      <names variable="illustrator">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="narrator">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <choose>
        <if match="none" variable="container-title">
          <names delimiter=", " variable="compiler chair organizer curator">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names delimiter=", " variable="series-creator executive-producer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="producer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <names variable="director">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <choose>
            <if match="any" type="broadcast performance">
              <names variable="script-writer">
                <label form="verb" suffix=" "/>
                <name and="text"/>
              </names>
            </if>
          </choose>
          <names variable="performer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <choose>
            <if match="none" type="song thesis">
              <names variable="contributor">
                <label form="verb" suffix=" "/>
                <name and="text"/>
              </names>
            </if>
          </choose>
        </if>
      </choose>
      <choose>
        <if type="song">
          <!-- Song contributors attached to album (CMOS18 14.163) -->
          <names variable="contributor">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="identifier-contributors-serial-bib">
    <group delimiter=". ">
      <names delimiter=". " variable="translator narrator">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names delimiter=". " variable="compiler chair organizer curator">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names delimiter=". " variable="series-creator executive-producer">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names variable="producer">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names variable="director">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names variable="script-writer">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
      <names variable="performer">
        <label form="verb" suffix=" " text-case="capitalize-first"/>
        <name and="text"/>
      </names>
    </group>
  </macro>
  <macro name="identifier-contributors-and-volume-bib">
    <choose>
      <if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="identifier-contributors-serial-bib"/>
      </if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="identifier-contributors-and-volume-monographic-bib"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="identifier-contributors-and-volume-monographic-bib-specific-title-first"/> -->
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <!-- serial types -->
        <text macro="identifier-contributors-serial-bib"/>
      </else-if>
      <else>
        <!-- monographic types -->
        <text macro="identifier-contributors-and-volume-monographic-bib"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="identifier-contributors-and-volume-monographic-bib-specific-title-first"/> -->
      </else>
    </choose>
  </macro>
  <macro name="identifier-contributors-and-volume-monographic-bib">
    <group delimiter=". ">
      <choose>
        <if match="any" variable="number-of-volumes part-number part-title volume volume-title">
          <!-- cite multivolume `collection-editor`; otherwise it belongs with `collection-title` -->
          <names variable="collection-editor">
            <label form="verb" suffix=" " text-case="capitalize-first"/>
            <name and="text"/>
          </names>
        </if>
      </choose>
      <group delimiter=", ">
        <text macro="identifier-volume-bib"/>
        <choose>
          <if match="any" variable="part-number part-title volume volume-title">
            <text macro="identifier-contributors-monographic-bib-multivolume"/>
          </if>
        </choose>
      </group>
      <choose>
        <if match="none" variable="part-number part-title volume volume-title">
          <text macro="identifier-contributors-monographic-bib"/>
          <text macro="label-number-of-volumes"/>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="identifier-edition-bib">
    <choose>
      <!-- ensure `source-publication-history-bib` does not duplicate edition -->
      <if variable="original-title">
        <text macro="label-edition-capitalized"/>
      </if>
      <else-if variable="issued original-date"/>
      <else>
        <text macro="label-edition-capitalized"/>
      </else>
    </choose>
  </macro>
  <macro name="identifier-edition-note">
    <choose>
      <!-- ensure `source-publication-history-note` does not duplicate edition -->
      <if variable="original-title">
        <text macro="label-edition"/>
      </if>
      <else-if variable="issued original-date"/>
      <else>
        <text macro="label-edition"/>
      </else>
    </choose>
  </macro>
  <macro name="identifier-number-bib">
    <group delimiter=" ">
      <choose>
        <if type="thesis"/>
        <else-if is-numeric="number" type="broadcast" variable="genre">
          <text text-case="capitalize-first" variable="genre"/>
          <text variable="number"/>
        </else-if>
        <else-if is-numeric="number" type="broadcast">
          <text text-case="capitalize-first" value="episode"/>
          <text variable="number"/>
        </else-if>
        <else-if variable="number">
          <text text-case="title" variable="genre"/>
          <text macro="label-number-capitalized"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="identifier-patent">
    <group delimiter=", ">
      <group delimiter=" ">
        <!-- `authority`: US ; `genre`: patent ; `number`: 123,445 -->
        <text form="short" variable="authority"/>
        <!-- 'US Patent' capitalized in both bibliography and note forms -->
        <choose>
          <if variable="genre">
            <text text-case="capitalize-first" variable="genre"/>
          </if>
          <else>
            <text term="patent" text-case="capitalize-first"/>
          </else>
        </choose>
        <text variable="number"/>
      </group>
      <group delimiter=" ">
        <text value="filed"/>
        <date form="text" variable="submitted"/>
      </group>
      <group delimiter=" ">
        <choose>
          <if variable="issued submitted">
            <text term="and"/>
          </if>
        </choose>
        <text value="issued"/>
        <!-- Always give full issue date, even in author-date (CMOS18 14.158) -->
        <text macro="date-issued-full"/>
      </group>
    </group>
  </macro>
  <macro name="identifier-report-bib">
    <group delimiter=". ">
      <choose>
        <if variable="container-title">
          <!-- If the report is a chapter in a larger report, then most identifying information is printed in the source. -->
          <text macro="identifier-contributors-bib"/>
        </if>
        <else-if variable="title">
          <text macro="identifier-number-bib"/>
          <text macro="label-version-capitalized"/>
          <text macro="identifier-edition-bib"/>
          <text macro="identifier-contributors-and-volume-bib"/>
        </else-if>
        <else>
          <!-- If there is no `title`, then `genre` and `number` are already printed as the title. -->
          <text macro="label-version-capitalized"/>
          <text macro="identifier-edition-bib"/>
          <text macro="identifier-contributors-and-volume-bib"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="identifier-volume-bib">
    <!-- In notes styles, bibliography entries may be listed beginning with either the general title of the multivolume set or that of the individual volume; the former approach is listed first, but the latter is required in author-date (CMOS18 14.21) -->
    <group delimiter=", ">
      <choose>
        <if match="any" variable="volume volume-title">
          <!-- if there is a volume or volume title, the part number is not capitalized -->
          <text macro="label-volume-capitalized"/>
          <text font-style="italic" text-case="title" variable="volume-title"/>
          <text macro="label-part-number"/>
          <text macro="title-part"/>
        </if>
        <else-if match="any" variable="part-number part-title">
          <text macro="label-part-number-capitalized"/>
          <text macro="title-part"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="identifier-volume-note">
    <!-- List the general title first in the notes (CMOS18 14.20) -->
    <group delimiter=", ">
      <choose>
        <if match="any" variable="part-number part-title volume-title">
          <text macro="label-volume"/>
          <text font-style="italic" text-case="title" variable="volume-title"/>
          <text macro="label-part-number"/>
          <text macro="title-part"/>
        </if>
        <else-if is-numeric="volume" locator="page">
          <!-- provide lone `volume` only if it does not appear in `source-monographic-locator-note` (CMOS18 14.20) -->
          <choose>
            <!-- check for variables that might come between the volume and page number -->
            <if match="any" variable="part-number part-title volume-title">
              <text macro="label-volume"/>
            </if>
            <else-if match="any" variable="container-author editor editor-translator translator">
              <text macro="label-volume"/>
            </else-if>
            <!-- always display number of volumes in notes without bibliography (CMOS18 14.20): -->
            <!-- <else><text macro="label-number-of-volumes"/></else>-->
          </choose>
        </else-if>
        <else-if is-numeric="volume" variable="page">
          <choose>
            <if match="any" variable="part-number part-title volume-title">
              <text macro="label-volume"/>
            </if>
            <else-if match="any" variable="container-author editor editor-translator translator">
              <text macro="label-volume"/>
            </else-if>
            <else-if variable="container-title">
              <!-- remove condition in styles that print chapter page numbers (CMOS17/classic) -->
              <text macro="label-volume"/>
            </else-if>
            <!-- always display number of volumes in notes without bibliography (CMOS18 14.20): -->
            <!-- <else><text macro="label-number-of-volumes"/></else>-->
          </choose>
        </else-if>
        <else-if variable="volume">
          <text macro="label-volume"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <!-- 4. Source -->
  <macro name="source-bib">
    <choose>
      <if match="any" type="patent post webpage"/>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <text macro="source-serial-bib"/>
      </else-if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <text macro="source-monographic-bib"/>
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <text macro="source-serial-bib"/>
      </else-if>
      <else>
        <text macro="source-monographic-bib"/>
      </else>
    </choose>
  </macro>
  <!-- 4.1. Serial sources -->
  <macro name="source-serial-bib">
    <group delimiter=". ">
      <text macro="source-serial-title-volume-bib"/>
      <choose>
        <if match="any" type="article-magazine article-newspaper">
          <!-- magazines and newspapers provide the full date in place of volume/issue numbers (CMOS18 14.87, 14.89) -->
          <group delimiter=", ">
            <text macro="source-serial-title-bib"/>
            <text macro="source-serial-identifier-bib"/>
          </group>
        </if>
        <else-if variable="collection-title volume">
          <group delimiter=", ">
            <text macro="source-serial-title-bib"/>
            <text macro="source-serial-identifier-bib"/>
          </group>
        </else-if>
        <else-if variable="volume">
          <group delimiter=" ">
            <text macro="source-serial-title-bib"/>
            <text macro="source-serial-identifier-bib"/>
          </group>
        </else-if>
        <else>
          <group delimiter=", ">
            <text macro="source-serial-title-bib"/>
            <text macro="source-serial-identifier-bib"/>
          </group>
        </else>
      </choose>
    </group>
  </macro>
  <!-- Serial source title -->
  <macro name="source-serial-name">
    <group delimiter=" ">
      <text font-style="italic" text-case="title" variable="container-title"/>
      <choose>
        <!-- TODO: remove conditional when Zotero stops double-mapping `event-place` and `publisher-place` -->
        <if match="none" variable="event-date event-title">
          <text prefix="(" suffix=")" variable="publisher-place"/>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="source-serial-title-bib">
    <group delimiter=", ">
      <choose>
        <!-- Journal special issues (CMOS18 14.77) and supplements (CMOS18 14.78) -->
        <if match="none" variable="container-title"/>
        <else-if match="none" type="periodical" variable="supplement-number volume-title"/>
        <!-- TODO: use `container-genre` here once available to allow a custom description of the journal volume -->
        <else-if variable="supplement-number volume-title">
          <text term="supplement" text-case="capitalize-first"/>
        </else-if>
        <else-if type="periodical" variable="supplement-number title">
          <text term="supplement" text-case="capitalize-first"/>
        </else-if>
        <else-if variable="volume-title">
          <text term="special-issue" text-case="capitalize-first"/>
        </else-if>
        <else-if type="periodical" variable="title">
          <text term="special-issue" text-case="capitalize-first"/>
        </else-if>
      </choose>
      <text macro="source-serial-name"/>
      <choose>
        <!-- 'ahead of print' is placed akin to a series (CMOS18 14.75) -->
        <if match="any" variable="available-date collection-title issue number page status supplement-number volume volume-title"/>
        <else-if type="article-journal" variable="DOI issued">
          <text term="advance-online-publication"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="source-serial-title-volume-bib">
    <choose>
      <if variable="volume-title">
        <!-- Journal special issues (CMOS18 14.77) and supplements (CMOS18 14.78) -->
        <group delimiter=", ">
          <group delimiter=" ">
            <text macro="source-monographic-preposition-bib"/>
            <text quotes="true" text-case="title" variable="volume-title"/>
          </group>
          <text macro="source-monographic-identifier-contributors-bib"/>
        </group>
      </if>
    </choose>
  </macro>
  <!-- Serial source identifier -->
  <macro name="source-serial-identifier-bib">
    <group delimiter=", ">
      <choose>
        <if match="any" type="article-magazine article-newspaper">
          <group delimiter=". ">
            <text macro="source-serial-identifier-volume-bib"/>
            <!-- for author-date: -->
            <!-- <text macro="source-serial-identifier-volume-author-date"/> -->
            <!-- newspaper edition always capitalized (CMOS18 14.89) -->
            <text macro="label-edition-capitalized"/>
          </group>
          <text macro="source-serial-locator"/>
        </if>
        <else-if match="any" variable="issue supplement-number volume">
          <group delimiter=": ">
            <text macro="source-serial-identifier-volume-bib"/>
            <!-- for author-date: -->
            <!-- <text macro="source-serial-identifier-volume-author-date"/> -->
            <text macro="source-serial-locator"/>
          </group>
        </else-if>
        <else>
          <text macro="source-serial-identifier-volume-bib"/>
          <!-- for author-date: -->
          <!-- <text macro="source-serial-identifier-volume-author-date"/> -->
          <text macro="source-serial-locator"/>
        </else>
        <!-- TODO: If CSL adds `date-part` detection, add two further conditions to address CMOS18 14.74: delimiting with ":" if there is a `volume` and no month or `issue` or `supplement number`; delimiting with ", " or there is an `issue` or `supplement number` and no month -->
      </choose>
    </group>
  </macro>
  <macro name="source-serial-identifier-volume-bib">
    <group delimiter=", ">
      <choose>
        <if match="any" type="article-magazine article-newspaper">
          <!-- magazines and newspapers provide the full date in place of volume/issue numbers (CMOS18 14.87, 14.89) -->
          <text variable="collection-title"/>
          <text macro="source-serial-volume-status-bib"/>
        </if>
        <else-if match="any" variable="issue supplement-number volume">
          <choose>
            <if match="any" variable="author chair collection-editor compiler composer curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator"/>
            <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
              <!-- date appears first if the review `container-title` has been substituted for a missing author (CMOS18 14.87, 14.102) -->
              <text macro="source-date-issued-or-status"/>
            </else-if>
          </choose>
          <!-- `collection-title` is for any serial with multiple series (e.g. 'second series') -->
          <text variable="collection-title"/>
          <group delimiter=" ">
            <group delimiter=", ">
              <choose>
                <if variable="collection-title volume">
                  <text macro="label-volume"/>
                </if>
                <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
                  <!-- date appears first if a review `container-title` has been substituted for a missing author (CMOS18 14.87, 14.102) -->
                  <choose>
                    <if match="any" variable="author chair collection-editor compiler composer curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator">
                      <text variable="volume"/>
                    </if>
                    <else>
                      <text macro="label-volume"/>
                    </else>
                  </choose>
                </else-if>
                <else>
                  <text variable="volume"/>
                </else>
              </choose>
              <text macro="label-issue"/>
              <text macro="label-supplement-number"/>
            </group>
            <choose>
              <if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title">
                <!-- date for unsigned reviews only appears here if it did not earlier (CMOS18 14.102) -->
                <choose>
                  <if match="any" variable="author chair collection-editor compiler composer curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator">
                    <text macro="source-date-issued-or-status" prefix="(" suffix=")"/>
                  </if>
                </choose>
              </if>
              <else>
                <text macro="source-date-issued-or-status" prefix="(" suffix=")"/>
              </else>
            </choose>
          </group>
        </else-if>
        <else>
          <text variable="collection-title"/>
          <choose>
            <if type="interview">
              <!-- publisher possible with `interview` (CMOS18 14.110) -->
              <text variable="publisher"/>
            </if>
          </choose>
          <text macro="source-serial-volume-status-bib"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="source-serial-volume-status-bib">
    <group delimiter=", ">
      <choose>
        <if match="none" variable="collection-title issue number page supplement-number volume">
          <group delimiter=" ">
            <!-- article accepted for publication and available on publisher website (CMOS18 14.75) -->
            <!-- TODO: use CSL term for `available-date` when available -->
            <text value="accepted"/>
            <date form="text" variable="available-date"/>
          </group>
        </if>
      </choose>
      <group delimiter=" ">
        <text macro="source-date-status-bib"/>
        <text macro="source-date-issued-or-status"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="source-date-bib-specific-title-first"/> -->
      </group>
    </group>
  </macro>
  <!-- Serial source locator -->
  <macro name="source-serial-locator">
    <choose>
      <if match="any" variable="locator number">
        <group delimiter=", ">
          <text macro="label-locator"/>
          <!-- an article ID appears alongside locators in notes (CMOS18 14.71) -->
          <choose>
            <!-- if there is an `archive` with no other reference, `number` appears in `source-archive-database-number` -->
            <if match="any" variable="archive_collection archive_location archive-place">
              <text variable="number"/>
            </if>
            <else-if variable="archive"/>
            <else>
              <text variable="number"/>
            </else>
          </choose>
        </group>
      </if>
      <!-- do not give pages for magazines or newspapers (CMOS18 14.87, 14.89) -->
      <else-if match="any" type="article-magazine article-newspaper"/>
      <else>
        <text variable="page"/>
      </else>
    </choose>
  </macro>
  <!-- 4.2. Monographic sources -->
  <macro name="source-monographic-bib">
    <group delimiter=". ">
      <!-- Monographic sources repeat main reference elements -->
      <choose>
        <if variable="container-title">
          <group delimiter=", ">
            <group delimiter=" ">
              <choose>
                <if match="none" type="broadcast motion_picture">
                  <text macro="source-monographic-preposition-bib"/>
                </if>
              </choose>
              <text font-style="italic" text-case="title" variable="container-title"/>
              <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
              <!-- <text macro="source-monographic-title-specific-title-first"/> -->
            </group>
            <text macro="source-monographic-description-bib"/>
            <text macro="source-monographic-identifier-bib"/>
            <text macro="source-monographic-locator"/>
          </group>
        </if>
      </choose>
      <text macro="source-series-bib"/>
      <choose>
        <!-- show event information here only if not collapsed with `issued` (CMOS18 14.167) -->
        <if match="any" variable="event-date original-date original-publisher original-publisher-place publisher status">
          <text macro="source-event-bib"/>
        </if>
      </choose>
    </group>
  </macro>
  <!-- Monographic source title -->
  <macro name="source-monographic-preposition-bib">
    <choose>
      <if type="chapter" variable="container-title genre">
        <text value="to"/>
      </if>
      <else-if type="article-journal" variable="container-title genre volume-title">
        <text value="to"/>
      </else-if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <choose>
          <if match="any" variable="author composer">
            <!-- Give preposition only for signed entries; otherwise, title is substituted -->
            <text term="in" text-case="capitalize-first"/>
          </if>
        </choose>
      </else-if>
      <!-- if printing chapter page numbers (CMOS17/classic):
      <else-if variable="chapter-number page title"><text term="in" text-case="capitalize-first"/></else-if>
      -->
      <else-if variable="chapter-number">
        <group delimiter=" ">
          <text macro="label-chapter-number-capitalized"/>
          <choose>
            <if type="song">
              <text term="on"/>
            </if>
            <else>
              <text term="in"/>
            </else>
          </choose>
        </group>
      </else-if>
      <else>
        <text term="in" text-case="capitalize-first"/>
      </else>
    </choose>
  </macro>
  <macro name="source-monographic-preposition-note">
    <choose>
      <if type="chapter" variable="container-title genre">
        <text value="to"/>
      </if>
      <else-if type="article-journal" variable="container-title genre volume-title">
        <text value="to"/>
      </else-if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <choose>
          <if match="any" variable="author composer">
            <!-- Give preposition only for signed entries; otherwise, title is substituted -->
            <text term="in"/>
          </if>
        </choose>
      </else-if>
      <!-- if printing chapter page numbers (CMOS17/classic):
      <else-if variable="chapter-number page title"><text term="in"/></else-if>
      -->
      <else-if variable="chapter-number">
        <group delimiter=" ">
          <text macro="label-chapter-number"/>
          <choose>
            <if type="song">
              <text term="on"/>
            </if>
            <else>
              <text term="in"/>
            </else>
          </choose>
        </group>
      </else-if>
      <else>
        <text term="in"/>
      </else>
    </choose>
  </macro>
  <!-- Monographic source description -->
  <macro name="source-monographic-description-bib">
    <choose>
      <if match="any" type="document report software standard">
        <!-- place description after `container-title` -->
        <text macro="description-format-bib"/>
      </if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director issue page supplement-number volume"/>
      <else-if match="any" type="event paper-conference performance speech">
        <!-- unpublished conference presentations should describe the session -->
        <text macro="description-format-bib"/>
      </else-if>
    </choose>
  </macro>
  <!-- Monographic source identifier -->
  <macro name="source-monographic-identifier-bib">
    <!-- Based on `identifier-bib` -->
    <choose>
      <if variable="container-title">
        <group delimiter=", ">
          <choose>
            <if match="none" type="broadcast graphic map motion_picture song">
              <!-- For audiovisual media, number information comes after `title`, not `container-title`; `song` places album catalogue `number` with `publisher` (CMOS18 14.163-164) -->
              <text macro="identifier-number-bib"/>
            </if>
          </choose>
          <text macro="label-version"/>
          <!-- use note form as `edition` is not capitalized here -->
          <text macro="identifier-edition-note"/>
          <text macro="source-monographic-identifier-contributors-and-volume-bib"/>
          <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
          <!-- <text macro="source-monographic-identifier-contributors-and-volume-bib-specific-title-first"/> -->
        </group>
      </if>
    </choose>
  </macro>
  <macro name="source-monographic-identifier-contributors-bib">
    <group delimiter=", ">
      <names variable="container-author">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="editor-translator">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names delimiter=", " variable="editor translator">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="guest">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="host">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names delimiter=", " variable="chair organizer">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names delimiter=", " variable="illustrator narrator compiler curator">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names delimiter=", " variable="series-creator executive-producer">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="producer">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="editorial-director">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <choose>
        <if match="any" type="broadcast performance">
          <names variable="script-writer">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
      </choose>
      <names variable="director">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <names variable="performer">
        <label form="verb" suffix=" "/>
        <name and="text"/>
      </names>
      <choose>
        <if match="none" type="song thesis">
          <!-- Song contributors attached to album (CMOS18 14.163) -->
          <names variable="contributor">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="source-monographic-identifier-contributors-and-volume-bib">
    <!-- based on `identifier-contributors-and-volume-monographic-bib` -->
    <group delimiter=", ">
      <choose>
        <if match="any" variable="number-of-volumes part-number part-number volume volume-title">
          <!-- cite multivolume `collection-editor`; otherwise it belongs with `collection-title` -->
          <names variable="collection-editor">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
        </if>
      </choose>
      <!-- use the note form for an item with `container-title` -->
      <text macro="identifier-volume-note"/>
      <text macro="source-monographic-identifier-contributors-bib"/>
      <choose>
        <if match="any" variable="part-number part-title volume volume-title"/>
        <else-if variable="page"/>
        <else>
          <text macro="label-number-of-volumes"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- Monographic source locator -->
  <macro name="source-monographic-locator">
    <choose>
      <!-- archival locators appear after the shelfmark (CMOS18 14.127) -->
      <if locator="column" variable="archive archive_location"/>
      <else-if locator="folio" variable="archive archive_location"/>
      <else-if locator="page" variable="archive archive_location"/>
      <else-if is-numeric="volume" locator="page">
        <!-- separate a volume and page number with a colon (CMOS18 14.18) -->
        <group delimiter=":">
          <choose>
            <if match="any" variable="part-number part-title volume-title"/>
            <else-if match="any" variable="container-author editor editor-translator translator"/>
            <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21), check for name variables falling after the general title: -->
            <!-- <else-if variable="collection-editor"/> -->
            <else>
              <text variable="volume"/>
            </else>
          </choose>
          <text variable="locator"/>
        </group>
      </else-if>
      <else-if variable="locator">
        <text macro="label-locator"/>
      </else-if>
      <!-- remove `container-title` condition in styles that print chapter page numbers (CMOS17/classic) -->
      <else-if variable="container-title"/>
      <else-if is-numeric="volume" variable="page">
        <!-- collapse the volume and page number if adjacent (CMOS18 14.18) -->
        <group delimiter=":">
          <choose>
            <!-- check for variables that might come between the volume and page number -->
            <if match="any" variable="part-number part-title volume-title"/>
            <else-if match="any" variable="container-author editor editor-translator translator"/>
            <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21), check for name variables falling after the general title: -->
            <!-- <else-if variable="collection-editor"/> -->
            <else>
              <text variable="volume"/>
            </else>
          </choose>
          <text variable="page"/>
        </group>
      </else-if>
      <!-- archival locators appear after the shelfmark (CMOS18 14.127) -->
      <else-if variable="archive archive_location page"/>
      <else>
        <text variable="page"/>
      </else>
    </choose>
  </macro>
  <!-- 4.3. Series -->
  <macro name="source-series-bib">
    <group delimiter=", ">
      <choose>
        <if match="any" variable="number-of-volumes part-number part-title volume volume-title">
          <text macro="source-series-title"/>
        </if>
        <else-if variable="collection-editor collection-title">
          <!-- `collection-editor` belongs with `collection-title` if the item is not multivolume -->
          <text text-case="title" variable="collection-title"/>
          <names variable="collection-editor">
            <label form="verb" suffix=" "/>
            <name and="text"/>
          </names>
          <text macro="label-collection-number"/>
          <text macro="label-issue"/>
        </else-if>
        <else>
          <text macro="source-series-title"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="source-series-title">
    <group delimiter=", ">
      <choose>
        <if variable="issue">
          <text text-case="title" variable="collection-title"/>
          <text macro="label-collection-number"/>
          <text macro="label-issue"/>
        </if>
        <else-if is-numeric="collection-number" variable="collection-title">
          <group delimiter=" ">
            <text text-case="title" variable="collection-title"/>
            <text variable="collection-number"/>
          </group>
        </else-if>
        <else-if variable="collection-title">
          <text text-case="title" variable="collection-title"/>
          <text variable="collection-number"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <!-- 4.4. Event -->
  <macro name="source-event-bib">
    <group delimiter=" ">
      <choose>
        <!-- omit types that provide event information in description  -->
        <if match="any" type="interview" variable="interviewer"/>
        <else-if type="personal_communication" variable="recipient"/>
        <else-if match="any" type="review review-book" variable="reviewed-author reviewed-genre reviewed-title"/>
        <else-if match="any" variable="event event-date event-title">
          <!-- TODO: To prevent Zotero from printing `event-place`, due to its double-mapping of `publisher-place` and `event-place`. Remove this when that is changed. -->
          <choose>
            <if type="paper-conference">
              <choose>
                <if match="none" variable="collection-editor compiler editor editorial-director issue page supplement-number volume">
                  <!-- Don't print event info for conference papers published in proceedings -->
                  <text macro="source-event-status-bib"/>
                  <text macro="source-event-description-bib"/>
                </if>
              </choose>
            </if>
            <else>
              <!-- For other item types, print event info even if published (e.g. collection catalogs, performance programs). -->
              <text macro="source-event-status-bib"/>
              <text macro="source-event-description-bib"/>
            </else>
          </choose>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="source-event-place-first">
    <!-- for descriptive elements for interviews, reviews, letters -->
    <choose>
      <if match="any" variable="event event-date event-title">
        <group delimiter=", ">
          <text variable="event-title"/>
          <text variable="event-place"/>
          <text macro="date-event-full"/>
        </group>
      </if>
    </choose>
  </macro>
  <macro name="source-event-status-bib">
    <group delimiter=" ">
      <choose>
        <if type="broadcast" variable="status">
          <!-- 'aired', 'performed', etc. (CMOS18 14.165) -->
          <text text-case="capitalize-first" variable="status"/>
        </if>
        <else-if type="paper-conference">
          <choose>
            <if variable="genre">
              <text text-case="capitalize-first" value="presented"/>
            </if>
            <else>
              <text form="short" term="paper-conference" text-case="capitalize-first"/>
              <text value="presented"/>
            </else>
          </choose>
          <choose>
            <if variable="event-title">
              <text term="at"/>
            </if>
          </choose>
        </else-if>
        <else-if type="song">
          <text text-case="capitalize-first" value="recorded"/>
          <choose>
            <if variable="event-title">
              <text term="at"/>
            </if>
          </choose>
        </else-if>
        <else-if variable="event-date issued"/>
        <else-if variable="issued"/>
        <else>
          <text text-case="capitalize-first" variable="status"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="source-event-title">
    <choose>
      <!-- TODO: We expect `event-title` to be used, but processors and applications may not be updated yet. This macro ensures that either `event` or `event-title` can be accepted. Remove if processor logic and application adoption can handle this. -->
      <if variable="event-title">
        <text variable="event-title"/>
      </if>
      <else>
        <text variable="event"/>
      </else>
    </choose>
  </macro>
  <macro name="source-event-title-capitalized">
    <choose>
      <!-- TODO: We expect `event-title` to be used, but processors and applications may not be updated yet. This macro ensures that either `event` or `event-title` can be accepted. Remove if processor logic and application adoption can handle this. -->
      <if variable="event-title">
        <text text-case="capitalize-first" variable="event-title"/>
      </if>
      <else>
        <text text-case="capitalize-first" variable="event"/>
      </else>
    </choose>
  </macro>
  <macro name="source-event-description-bib">
    <group delimiter=", ">
      <choose>
        <if type="song">
          <text macro="source-event-title"/>
        </if>
        <else-if type="paper-conference" variable="genre">
          <text macro="source-event-title-capitalized"/>
        </else-if>
        <else-if type="paper-conference">
          <text macro="source-event-title"/>
        </else-if>
        <else>
          <text macro="source-event-title-capitalized"/>
        </else>
      </choose>
      <text macro="date-event-full"/>
      <text variable="event-place"/>
    </group>
  </macro>
  <!-- 4.5. Facts of publication -->
  <macro name="source-monographic-publication-bib">
    <group delimiter=". ">
      <choose>
        <!-- `patent` date in identification (CMOS18 14.158) -->
        <if type="patent"/>
        <!-- omit serial types -->
        <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book"/>
        <else-if match="any" variable="collection-editor compiler editor editorial-director">
          <!-- monographic types -->
          <text macro="source-publication-and-date-bib"/>
        </else-if>
        <!-- omit serial types -->
        <else-if match="any" type="interview paper-conference"/>
        <else>
          <!-- monographic types -->
          <text macro="source-publication-and-date-bib"/>
        </else>
      </choose>
      <text macro="source-publication-original-title-bib"/>
    </group>
  </macro>
  <macro name="source-monographic-publication-short-bracketed">
    <!-- mirrors `source-monographic-publication-note-bracketed` -->
    <group delimiter=", " prefix="(" suffix=")">
      <choose>
        <if disambiguate="true" match="none"/>
        <!-- Facts of publication with brackets for print monographic formats -->
        <else-if match="any" type="book chapter classic interview musical_score pamphlet paper-conference report thesis">
          <choose>
            <if disambiguate="true">
              <text macro="source-publication-publisher-note"/>
            </if>
          </choose>
          <text macro="source-date-issued-or-status"/>
        </else-if>
        <else-if type="article" variable="genre publisher">
          <!-- without brackets for a preprint in a repository (CMOS18 14.76), with brackets for a working paper (CMOS18 14.116) -->
          <choose>
            <if disambiguate="true">
              <text macro="source-publication-publisher-note"/>
            </if>
          </choose>
          <text macro="source-date-issued-or-status"/>
        </else-if>
        <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
          <choose>
            <if match="any" variable="publisher publisher-place">
              <choose>
                <if disambiguate="true">
                  <text macro="source-publication-publisher-note"/>
                </if>
              </choose>
              <text macro="source-date-issued-or-status"/>
            </if>
            <!-- online reference sources without a additional publisher details are unbracketed (CMOS18 14.131) -->
            <else-if match="any" variable="DOI URL"/>
            <else>
              <choose>
                <if disambiguate="true">
                  <text macro="source-publication-publisher-note"/>
                </if>
              </choose>
              <text macro="source-date-issued-or-status"/>
            </else>
          </choose>
        </else-if>
        <else-if type="motion_picture" variable="publisher">
          <choose>
            <if disambiguate="true">
              <text macro="source-publication-publisher-note"/>
            </if>
          </choose>
          <text macro="source-date-issued-or-status"/>
        </else-if>
        <else-if type="personal_communication">
          <choose>
            <if match="any" variable="collection-editor compiler editor editorial-director issue page supplement-number volume">
              <!-- in an edited collection -->
              <text macro="source-date-issued-or-status"/>
            </if>
          </choose>
        </else-if>
        <else-if is-uncertain-date="issued">
          <!-- space before bracketed uncertain date (CMOS18 14.127)  -->
          <text macro="source-date-issued-or-status"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="source-monographic-publication-short-unbracketed">
    <!-- mirrors `source-monographic-publication-note-unbracketed` -->
    <choose>
      <if disambiguate="true" match="none"/>
      <!-- Facts of publication without brackets -->
      <else-if match="any" type="book chapter classic interview musical_score pamphlet paper-conference report thesis"/>
      <else-if type="article" variable="genre publisher"/>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <choose>
          <if match="any" variable="publisher publisher-place"/>
          <!-- online reference sources without a additional publisher details are unbracketed (CMOS18 14.131) -->
          <else-if match="any" variable="DOI URL">
            <text macro="source-date-issued-or-status"/>
          </else-if>
        </choose>
      </else-if>
      <else-if type="motion_picture" variable="publisher"/>
      <else-if type="personal_communication">
        <choose>
          <if match="none" variable="collection-editor compiler editor editorial-director issue page supplement-number volume">
            <!-- not in an edited collection -->
            <text macro="source-date-issued-or-status"/>
          </if>
        </choose>
      </else-if>
      <else-if is-uncertain-date="issued"/>
      <else>
        <text macro="source-date-issued-or-status"/>
      </else>
    </choose>
  </macro>
  <macro name="source-publication-and-date-bib">
    <group delimiter=", ">
      <choose>
        <if match="any" type="post webpage">
          <!-- `container-title` functions like a publisher with social media and website sources (CMOS18 14.104-106) -->
          <text text-case="title" variable="container-title"/>
        </if>
      </choose>
      <choose>
        <if type="broadcast" variable="DOI">
          <!-- a podcast publisher appears before the date, whereas the network of an aired show appears after (CMOS18 14.165); unfortunately CSL stores both in `publisher` -->
          <!-- TODO: `DOI` or `URL` detection is the only way to distinguish radio/TV from podcasts, but it is obviously imprecise; modify if CSL provides a `podcast` type -->
          <text macro="source-publication-history-bib"/>
        </if>
        <else-if type="broadcast" variable="URL">
          <text macro="source-publication-history-bib"/>
        </else-if>
        <else-if type="broadcast"/>
        <else>
          <text macro="source-publication-history-bib"/>
        </else>
      </choose>
      <group delimiter=" ">
        <text macro="source-date-status-bib"/>
        <text macro="source-date-issued-or-status"/>
        <!-- for author-date or notes and bibliography leading with volume title (CMOS18 14.21): -->
        <!-- <text macro="source-date-bib-specific-title-first"/> -->
      </group>
      <choose>
        <if type="broadcast" variable="URL"/>
        <else-if type="broadcast">
          <group delimiter=" ">
            <text term="on"/>
            <text macro="source-publication-history-bib"/>
          </group>
        </else-if>
      </choose>
    </group>
  </macro>
  <!-- Facts of publication elements -->
  <macro name="source-publication-description-bib">
    <choose>
      <if type="article" variable="genre"/>
      <else-if type="article">
        <!-- `preprint` term attached to repository name, but specific working paper descriptors appear in description (CMOS18 14.76, 14.116) -->
        <text term="preprint" text-case="capitalize-first"/>
      </else-if>
      <else-if type="thesis">
        <!-- thesis type appears with university name (CMOS18 14.113) -->
        <text text-case="capitalize-first" variable="genre"/>
      </else-if>
      <else-if match="any" variable="original-publisher original-publisher-place">
        <choose>
          <!-- `edition` provides an alternative label to `reprint` (CMOS18 14.16) -->
          <if match="any" variable="edition original-title"/>
          <else-if match="none" type="book chapter classic entry entry-dictionary entry-encyclopedia interview musical_score pamphlet paper-conference report thesis"/>
          <else-if variable="issued original-date">
            <text text-case="capitalize-first" value="reprint"/>
          </else-if>
        </choose>
      </else-if>
    </choose>
  </macro>
  <macro name="source-publication-history-bib">
    <choose>
      <if variable="original-title">
        <!-- `original-title` is covered in `source-publication-original-title-bib` -->
        <group delimiter=", ">
          <text macro="source-publication-description-bib"/>
          <text macro="source-publication-publisher-bib"/>
        </group>
      </if>
      <else-if match="any" variable="edition original-publisher original-publisher-place">
        <group delimiter=". ">
          <!-- full stop to separate original date if `original-publisher` (CMOS18 14.16) -->
          <group delimiter=", ">
            <text macro="source-publication-publisher-original-bib"/>
            <text macro="source-date-original"/>
          </group>
          <group delimiter=". ">
            <choose>
              <if variable="issued original-date">
                <text macro="label-edition-capitalized"/>
              </if>
            </choose>
            <group delimiter=", ">
              <text macro="source-publication-description-bib"/>
              <text macro="source-publication-publisher-bib"/>
            </group>
          </group>
        </group>
      </else-if>
      <else>
        <group delimiter="; ">
          <!-- semicolon to separate original date if no publisher (CMOS18 14.165) -->
          <text macro="source-date-original"/>
          <group delimiter=", ">
            <text macro="source-publication-description-bib"/>
            <text macro="source-publication-publisher-bib"/>
          </group>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="source-publication-original-title-bib">
    <!-- Work originally published under a different title (CMOS18 13.101) -->
    <choose>
      <if variable="original-title">
        <group delimiter=" ">
          <text term="original-work-published" text-case="capitalize-first"/>
          <group delimiter=", ">
            <names variable="original-author">
              <name and="text"/>
            </names>
            <text font-style="italic" text-case="title" variable="original-title"/>
          </group>
          <group delimiter=", " prefix="(" suffix=")">
            <text macro="source-publication-publisher-original-bib"/>
            <text macro="source-date-original"/>
          </group>
        </group>
      </if>
    </choose>
  </macro>
  <macro name="source-publication-publisher-bib">
    <group delimiter=" ">
      <choose>
        <if type="thesis" variable="publisher">
          <text text-case="capitalize-first" variable="publisher"/>
        </if>
        <else-if variable="publisher">
          <group delimiter=": ">
            <!-- <text text-case="capitalize-first" variable="publisher-place"/> -->
            <text text-case="capitalize-first" variable="publisher"/>
          </group>
        </else-if>
        <!-- TODO: remove conditional when Zotero fixes double-mapping of `event-place` -->
        <else-if match="any" variable="event-date event-title"/>
        <else>
          <text text-case="capitalize-first" variable="publisher-place"/>
        </else>
      </choose>
      <choose>
        <if type="song">
          <!-- Album catalogue number follows label name (CMOS18 14.163-164) -->
          <text variable="number"/>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="source-publication-publisher-note">
    <group delimiter=" ">
      <choose>
        <if type="thesis" variable="publisher">
          <text variable="publisher"/>
        </if>
        <else-if variable="publisher">
          <group delimiter=": ">
            <!-- <text variable="publisher-place"/> -->
            <text variable="publisher"/>
          </group>
        </else-if>
        <!-- TODO: remove conditional when Zotero fixes double-mapping of `event-place` -->
        <else-if match="any" variable="event-date event-title"/>
        <else>
          <text variable="publisher-place"/>
        </else>
      </choose>
      <choose>
        <if type="song">
          <!-- Album catalogue number follows label name (CMOS18 14.163-164) -->
          <text variable="number"/>
        </if>
      </choose>
    </group>
  </macro>
  <macro name="source-publication-publisher-original-bib">
    <choose>
      <if variable="original-publisher">
        <group delimiter=": ">
          <!-- <text text-case="capitalize-first" variable="original-publisher-place"/> -->
          <text text-case="capitalize-first" variable="original-publisher"/>
        </group>
      </if>
      <else>
        <text text-case="capitalize-first" variable="original-publisher-place"/>
      </else>
    </choose>
  </macro>
  <!-- 4.6. Date -->
  <!-- Date elements -->
  <macro name="source-date-issued-full">
    <!-- Give full date for more ephemeral types -->
    <!-- NB: any changes must also be applied to `source-date-original-full` -->
    <choose>
      <if type="personal_communication" variable="event-date issued">
        <!-- Provide issue date for letters listed under event-date -->
        <text macro="date-issued-year"/>
      </if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <choose>
          <if match="any" variable="DOI URL">
            <!-- Online reference works use full dates (CMOS18 14.131) -->
            <text macro="date-issued-full"/>
          </if>
          <else>
            <text macro="date-issued-year"/>
          </else>
        </choose>
      </else-if>
      <else-if match="any" type="article broadcast collection dataset document event graphic manuscript map patent performance personal_communication post software song speech standard webpage">
        <text macro="date-issued-full"/>
      </else-if>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="source-date-issued-full-serial"/>
      </else-if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="date-issued-year"/>
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <!-- serial types -->
        <text macro="source-date-issued-full-serial"/>
      </else-if>
      <!-- monographic types -->
      <else-if variable="issued">
        <text macro="date-issued-year"/>
      </else-if>
      <else-if variable="event-date">
        <text macro="date-event-year"/>
      </else-if>
      <else-if variable="available-date">
        <date date-parts="year" form="numeric" variable="available-date"/>
      </else-if>
    </choose>
  </macro>
  <macro name="source-date-issued-full-serial">
    <choose>
      <if match="any" type="article-magazine article-newspaper">
        <!-- magazines and newspapers provide the full date in place of volume/issue numbers (CMOS18 14.87, 14.89) -->
        <text macro="date-issued-full"/>
      </if>
      <else-if variable="issue volume">
        <text macro="date-issued-year"/>
        <!-- for CMOS17: -->
        <!-- <text macro="date-issued-year-month"/> -->
      </else-if>
      <else-if variable="supplement-number">
        <text macro="date-issued-year"/>
        <!-- for CMOS17: -->
        <!-- <text macro="date-issued-year-month"/> -->
      </else-if>
      <else-if match="any" variable="issue volume">
        <text macro="date-issued-year-month"/>
      </else-if>
      <else>
        <text macro="date-issued-full"/>
      </else>
    </choose>
  </macro>
  <macro name="source-date-issued-or-status">
    <choose>
      <if match="any" variable="event-date issued">
        <text macro="source-date-issued-full"/>
      </if>
      <else-if variable="status">
        <text text-case="lowercase" variable="status"/>
      </else-if>
      <else-if match="any" type="interview personal_communication">
        <choose>
          <if match="any" variable="archive archive-place container-title DOI number publisher references URL">
            <!-- only give n.d. for accessible personal communication (CMOS18 14.111)-->
            <text form="short" term="no date"/>
          </if>
        </choose>
      </else-if>
      <!-- types with unusual reference (CMOS18 14.44, 14.127) -->
      <else-if match="any" type="classic collection entry entry-dictionary entry-encyclopedia webpage"/>
      <else-if type="manuscript">
        <!-- do not give n.d. with a bare shelfmark -->
        <choose>
          <if match="any" variable="container-title event-date event-place event-title genre title publisher publisher-place">
            <text form="short" term="no date"/>
          </if>
        </choose>
      </else-if>
      <else-if type="article-journal">
        <choose>
          <if variable="available-date">
            <!-- label journal articles available but not yet formally published as 'forthcoming' (CMOS18 14.75) -->
            <text term="forthcoming"/>
          </if>
          <else>
            <text form="short" term="no date"/>
          </else>
        </choose>
      </else-if>
      <else>
        <text form="short" term="no date"/>
      </else>
    </choose>
  </macro>
  <macro name="source-date-original">
    <text macro="source-date-original-full"/>
    <!-- for author-date 18th edition: -->
    <!-- <text macro="source-date-original-month-day"/> -->
  </macro>
  <macro name="source-date-original-full">
    <!-- Give full date for more ephemeral types -->
    <!-- Macro derived from `source-date-issued-full` -->
    <choose>
      <if type="personal_communication" variable="event-date original-date">
        <!-- Provide original date for letters listed under event-date -->
        <text macro="date-original-year"/>
      </if>
      <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
        <choose>
          <if match="any" variable="DOI URL">
            <!-- Online reference works use full dates (CMOS18 14.131) -->
            <text macro="date-original-full"/>
          </if>
          <else>
            <text macro="date-original-year"/>
          </else>
        </choose>
      </else-if>
      <else-if match="any" type="article broadcast collection dataset document event graphic manuscript map patent performance personal_communication post software song speech standard webpage">
        <text macro="date-original-full"/>
      </else-if>
      <else-if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <!-- serial types -->
        <text macro="source-date-original-full-serial"/>
      </else-if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="date-original-year"/>
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <!-- serial types -->
        <text macro="source-date-original-full-serial"/>
      </else-if>
      <else>
        <!-- monographic types -->
        <text macro="date-original-year"/>
      </else>
    </choose>
  </macro>
  <macro name="source-date-original-full-serial">
    <choose>
      <if variable="issue volume">
        <text macro="date-original-year"/>
        <!-- for CMOS17: -->
        <!-- <text macro="date-original-year-month"/> -->
      </if>
      <else-if variable="supplement-number">
        <text macro="date-original-year"/>
        <!-- for CMOS17: -->
        <!-- <text macro="date-original-year-month"/> -->
      </else-if>
      <else-if match="any" variable="issue volume">
        <text macro="date-original-year-month"/>
      </else-if>
      <else>
        <text macro="date-original-full"/>
      </else>
    </choose>
  </macro>
  <macro name="source-date-status-bib">
    <choose>
      <if type="broadcast" variable="event-title issued status"/>
      <!-- on a `broadcast`, if there is an `event-title`, `status` appears with `event-date` as part of `source-event` (CMOS18 14.165) -->
      <else-if variable="issued status">
        <!-- `status` specifies date type, e.g. 'effective', 'last modified', 'approved' (CMOS18 14.104 for `webpage`; CMOS18 14.159 for `standard`) -->
        <choose>
          <if match="any" variable="original-date original-publisher original-publisher-place original-title publisher">
            <text variable="status"/>
          </if>
          <else>
            <text text-case="capitalize-first" variable="status"/>
          </else>
        </choose>
      </else-if>
      <else-if type="broadcast" variable="issued URL"/>
      <else-if type="broadcast" variable="issued">
        <!-- `status` of a radio or TV broadcast is 'aired' if unspecified (CMOS18 14.165) -->
        <text text-case="capitalize-first" value="aired"/>
      </else-if>
      <else-if type="software" variable="issued publisher">
        <!-- `status` of software is 'released' if unspecified (CMOS18 14.169) -->
        <choose>
          <if match="any" variable="author chair collection-editor compiler composer contributor curator director editor editor-translator editorial-director executive-producer guest host illustrator organizer producer series-creator translator">
            <!-- lowercase if `publisher` is adjacent -->
            <text value="released"/>
          </if>
          <else>
            <text text-case="capitalize-first" value="released"/>
          </else>
        </choose>
      </else-if>
      <else-if type="software" variable="original-date">
        <!-- lowercase if `original-date` is adjacent -->
        <text value="released"/>
      </else-if>
      <else-if type="software" variable="issued">
        <!-- capitalize if `publisher` is not present -->
        <text text-case="capitalize-first" value="released"/>
      </else-if>
    </choose>
  </macro>
  <!-- 4.7. Locator (including page references) -->
  <macro name="source-locator-subsequent">
    <choose>
      <if match="any" type="article-journal article-magazine article-newspaper periodical post-weblog review review-book">
        <text macro="source-locator-subsequent-serial"/>
      </if>
      <else-if match="any" variable="collection-editor compiler editor editorial-director">
        <!-- monographic types -->
        <text macro="source-locator-subsequent-monographic"/>
      </else-if>
      <else-if match="any" type="interview paper-conference">
        <!-- serial types -->
        <text macro="source-locator-subsequent-serial"/>
      </else-if>
      <else>
        <text macro="source-locator-subsequent-monographic"/>
      </else>
    </choose>
  </macro>
  <macro name="source-locator-subsequent-monographic">
    <group delimiter=", ">
      <choose>
        <if variable="container-title">
          <!-- Do not provide `volume` or `part-number` for defined section -->
          <text macro="label-locator"/>
        </if>
        <else-if variable="part-number">
          <!-- label page numbers to balance a part number (CMOS18 14.50) -->
          <text macro="label-volume"/>
          <text macro="label-part-number"/>
          <text macro="label-locator-all"/>
        </else-if>
        <else-if is-numeric="volume" locator="page">
          <!-- separate a volume and page number with a colon (CMOS18 14.18) -->
          <group delimiter=":">
            <text variable="volume"/>
            <text variable="locator"/>
          </group>
        </else-if>
        <else>
          <text macro="label-volume"/>
          <text macro="label-locator"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="source-locator-subsequent-serial">
    <group delimiter=", ">
      <choose>
        <if variable="part-number">
          <!-- label page numbers when using multiple locators (CMOS18 14.50) -->
          <text macro="label-part-number"/>
          <text macro="label-locator-all"/>
        </if>
        <else>
          <text macro="label-locator"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- 4.8. Medium -->
  <macro name="source-medium-bib">
    <group delimiter=", ">
      <text text-case="capitalize-first" variable="medium"/>
      <text variable="scale"/>
      <text variable="dimensions"/>
    </group>
  </macro>
  <macro name="source-medium-note">
    <group delimiter=", ">
      <text variable="medium"/>
      <text variable="scale"/>
      <text variable="dimensions"/>
    </group>
  </macro>
  <!-- 4.9. Archival location -->
  <macro name="source-archive-bib">
    <group delimiter=" ">
      <choose>
        <if type="graphic">
          <text macro="source-archive-reference-institution-first"/>
        </if>
        <else>
          <text macro="source-archive-reference-location-first-bib"/>
        </else>
      </choose>
      <text macro="source-archive-database-number" prefix="(" suffix=")"/>
    </group>
  </macro>
  <macro name="source-archive-note">
    <group delimiter=" ">
      <choose>
        <if type="graphic">
          <text macro="source-archive-reference-institution-first"/>
        </if>
        <else>
          <text macro="source-archive-reference-location-first-note"/>
        </else>
      </choose>
      <text macro="source-archive-database-number" prefix="(" suffix=")"/>
    </group>
  </macro>
  <!-- Archival elements -->
  <macro name="source-archive-database-number">
    <!-- database identifier, if not included elsewhere (CMOS18 14.113) -->
    <choose>
      <if match="any" variable="archive_collection archive_location archive-place"/>
      <!-- `number` never shown elsewhere with a thesis -->
      <else-if type="thesis">
        <text variable="number"/>
      </else-if>
      <!-- `number` shown with `genre` -->
      <else-if match="any" type="dataset entry song" variable="genre"/>
      <else-if variable="archive">
        <text variable="number"/>
      </else-if>
    </choose>
  </macro>
  <macro name="source-archive-locator">
    <choose>
      <!-- physical locators with archival references appear after the shelfmark (CMOS18 14.127) -->
      <if locator="column" variable="archive archive_location">
        <!-- archival locators must always be labelled to avoid confusion with `archive_location` (CMOS18 14.123) -->
        <text macro="label-locator-all"/>
      </if>
      <else-if locator="folio" variable="archive archive_location">
        <text macro="label-locator-all"/>
      </else-if>
      <else-if locator="page" variable="archive archive_location">
        <text macro="label-locator-all"/>
      </else-if>
      <else-if variable="archive archive_location page">
        <choose>
          <if is-numeric="page">
            <!-- TODO: remove this conditional when `page` parsing is fixed for different locator types -->
            <text macro="label-page"/>
          </if>
          <else>
            <text variable="page"/>
          </else>
        </choose>
      </else-if>
    </choose>
  </macro>
  <macro name="source-archive-reference-institution-first">
    <!-- Archive (gallery) name first for art (CMOS18 14.133) -->
    <group delimiter=", ">
      <text variable="archive"/>
      <text variable="archive-place"/>
      <text variable="archive_collection"/>
      <text variable="archive_location"/>
      <text macro="source-archive-locator"/>
    </group>
  </macro>
  <macro name="source-archive-reference-location-first-bib">
    <!-- Order of elements begins with the most specific (CMOS18 14.128) -->
    <group delimiter=". ">
      <group delimiter=", ">
        <text text-case="capitalize-first" variable="archive_location"/>
        <text macro="source-archive-locator"/>
      </group>
      <text variable="archive_collection"/>
      <group delimiter=", ">
        <text variable="archive"/>
        <text variable="archive-place"/>
      </group>
    </group>
  </macro>
  <macro name="source-archive-reference-location-first-note">
    <!-- Order of elements begins with the most specific (CMOS18 14.127) -->
    <group delimiter=", ">
      <text variable="archive_location"/>
      <text macro="source-archive-locator"/>
      <text variable="archive_collection"/>
      <text variable="archive"/>
      <text variable="archive-place"/>
    </group>
  </macro>
  <!-- 4.10. URL or persistent identifier -->
  <macro name="source-date-accessed-DOI-URL-bib">
    <group delimiter=". ">
      <choose>
        <if variable="DOI"/>
        <else-if match="any" variable="available-date event-date issued status"/>
        <else-if variable="accessed URL">
          <group delimiter=" ">
            <text term="accessed" text-case="capitalize-first"/>
            <date form="text" variable="accessed"/>
          </group>
        </else-if>
      </choose>
      <text macro="source-DOI-URL"/>
    </group>
  </macro>
  <macro name="source-DOI-URL">
    <choose>
      <if variable="DOI">
        <text prefix="https://doi.org/" variable="DOI"/>
      </if>
      <else-if variable="URL">
        <text variable="URL"/>
      </else-if>
    </choose>
  </macro>
  <!-- 5. Notes -->
  <!-- TODO: add variables for distributor and exhibitions if available in CSL -->
  <!-- 6. Legal references: Bluebook style (shared with APA) -->
  <!-- Where APA or Chicago diverge from Bluebook, the official manual is followed -->
  <macro name="legal-reference">
    <!-- Type usage:

         `bill`
         : bills, resolutions, federal reports

         `legal_case`
         : all legal and court cases

         `hearing`
         : hearings and testimony

         `legislation`
         : statutes, constitutional items, and charters

         `regulation`
         : codified regulations, uncodified regulations, executive orders

         `treaty`
         : treaties
    -->
    <group delimiter=", ">
      <choose>
        <if type="treaty">
          <text macro="legal-title"/>
          <names variable="author">
            <!-- Treaty parties should be included at least for bilateral treaties (Bluebook 21.4.2) -->
            <name delimiter="-" et-al-min="100" et-al-use-first="99" form="short"/>
          </names>
          <text macro="legal-date"/>
          <!-- treaty source/report in addition to URL (Bluebook 21.4.5) -->
          <text macro="legal-source"/>
        </if>
        <else>
          <group delimiter=" ">
            <group delimiter=", ">
              <text macro="legal-title"/>
              <text macro="legal-source"/>
            </group>
            <text macro="legal-date"/>
            <text macro="legal-identifier"/>
          </group>
        </else>
      </choose>
      <group delimiter=" ">
        <!-- locator for use in notes -->
        <choose>
          <if locator="page" variable="page">
            <text term="at"/>
          </if>
        </choose>
        <text macro="label-locator"/>
      </group>
    </group>
  </macro>
  <!-- 6.1. Legal date -->
  <macro name="legal-date">
    <choose>
      <if type="treaty">
        <text macro="date-issued-full"/>
      </if>
      <else-if type="legal_case">
        <text macro="legal-date-case"/>
      </else-if>
      <else-if match="any" type="bill hearing legislation regulation">
        <group delimiter=" " prefix="(" suffix=")">
          <group delimiter=" ">
            <text macro="date-original-year"/>
            <text form="symbol" term="and"/>
          </group>
          <choose>
            <if variable="issued">
              <text macro="date-issued-year"/>
            </if>
            <else>
              <!-- Show proposal date for uncodified regulations. Assume date is entered literally ala "proposed May 23, 2016". -->
              <!-- TODO: Add `proposed` date here if that becomes available -->
              <date form="text" variable="submitted"/>
            </else>
          </choose>
        </group>
      </else-if>
    </choose>
  </macro>
  <macro name="legal-date-case">
    <group delimiter=" " prefix="(" suffix=")">
      <text variable="authority"/>
      <choose>
        <if variable="container-title">
          <!-- Print only year for cases published in reporters-->
          <text macro="date-issued-year"/>
        </if>
        <else>
          <text macro="date-issued-full"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- 6.2.1. Legal title -->
  <macro name="legal-title">
    <choose>
      <if match="any" type="bill legal_case legislation regulation treaty">
        <text text-case="title" variable="title"/>
      </if>
      <else-if type="hearing">
        <!-- use standard format (Bluebook 13.3) -->
        <group delimiter=": " font-style="italic">
          <text text-case="capitalize-first" variable="title"/>
          <group delimiter=" ">
            <text term="hearing" text-case="capitalize-first"/>
            <group delimiter=" ">
              <text term="on"/>
              <text variable="number"/>
            </group>
            <group delimiter=" ">
              <text value="before the"/>
              <text variable="section"/>
            </group>
          </group>
        </group>
      </else-if>
    </choose>
  </macro>
  <!-- 6.2.2. Legal identifier -->
  <macro name="legal-identifier">
    <group delimiter=" " prefix="(" suffix=")">
      <choose>
        <if type="hearing">
          <!-- Use the 'verb' form of the hearing term to hold 'testimony of' -->
          <text form="verb" term="hearing"/>
          <names variable="author">
            <name and="symbol" initialize="false"/>
          </names>
        </if>
        <else-if match="any" type="bill legislation regulation">
          <!-- For uncodified regulations, assume future code section is in `status`. -->
          <text variable="status"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="legal-identifier-bill-report">
    <group delimiter=" ">
      <text variable="genre"/>
      <choose>
        <if match="any" variable="authority chapter-number container-title">
          <text variable="number"/>
        </if>
        <else>
          <!-- If there is no legislative body, session number, or code/record title, assume the item is a congressional report and include 'No.' label. -->
          <text macro="label-number-capitalized"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- 6.3. Legal source -->
  <macro name="legal-source">
    <!-- Expect legal item `container-title` to be stored in short form -->
    <choose>
      <if type="bill">
        <text macro="legal-source-bill"/>
      </if>
      <else-if type="hearing">
        <text macro="legal-source-hearing"/>
      </else-if>
      <else-if type="legal_case">
        <text macro="legal-source-case"/>
      </else-if>
      <else-if type="legislation">
        <text macro="legal-source-legislation"/>
      </else-if>
      <else-if type="regulation">
        <text macro="legal-source-regulation"/>
      </else-if>
      <else-if type="treaty">
        <text macro="legal-source-treaty"/>
      </else-if>
    </choose>
  </macro>
  <!-- Legal source types -->
  <macro name="legal-source-bill">
    <group delimiter=", ">
      <text macro="legal-identifier-bill-report"/>
      <group delimiter=" ">
        <text variable="authority"/>
        <!-- `chapter-number` is a session number -->
        <text variable="chapter-number"/>
      </group>
      <group delimiter=" ">
        <text variable="volume"/>
        <text variable="container-title"/>
        <text variable="page-first"/>
      </group>
    </group>
  </macro>
  <macro name="legal-source-case">
    <group delimiter=" ">
      <choose>
        <if variable="container-title">
          <text variable="volume"/>
          <text variable="container-title"/>
          <text macro="label-section-symbol"/>
          <choose>
            <if match="any" variable="page page-first">
              <text variable="page-first"/>
            </if>
            <else>
              <text value="___"/>
            </else>
          </choose>
        </if>
        <else>
          <text macro="label-number-capitalized"/>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="legal-source-hearing">
    <group delimiter=" ">
      <text variable="authority"/>
      <!-- `chapter-number` is a session number -->
      <text variable="chapter-number"/>
    </group>
  </macro>
  <macro name="legal-source-legislation">
    <choose>
      <if variable="number">
        <!-- `number` is a public law number -->
        <group delimiter=", ">
          <group delimiter=" ">
            <choose>
              <if variable="genre">
                <text text-case="capitalize-first" variable="genre"/>
              </if>
              <else>
                <text form="short" term="legislation" text-case="capitalize-first"/>
              </else>
            </choose>
            <text macro="label-number-capitalized"/>
          </group>
          <group delimiter=" ">
            <text variable="volume"/>
            <text variable="container-title"/>
            <text variable="page-first"/>
          </group>
        </group>
      </if>
      <else>
        <group delimiter=" ">
          <text variable="volume"/>
          <text variable="container-title"/>
          <choose>
            <if variable="section">
              <text macro="label-section-symbol"/>
            </if>
            <else>
              <text variable="page-first"/>
            </else>
          </choose>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="legal-source-regulation">
    <group delimiter=", ">
      <group delimiter=" ">
        <text variable="genre"/>
        <text macro="label-number-capitalized"/>
      </group>
      <group delimiter=" ">
        <text variable="volume"/>
        <text variable="container-title"/>
        <choose>
          <if variable="section">
            <text macro="label-section-symbol"/>
          </if>
          <else>
            <text variable="page-first"/>
          </else>
        </choose>
      </group>
    </group>
  </macro>
  <macro name="legal-source-treaty">
    <group delimiter=" ">
      <number variable="volume"/>
      <text variable="container-title"/>
      <choose>
        <if match="any" variable="page page-first">
          <text variable="page-first"/>
        </if>
        <else>
          <text macro="label-number-capitalized"/>
        </else>
      </choose>
    </group>
  </macro>
  <!-- Citation -->
  <macro name="citation-notes-shortened-author-title-item">
    <group delimiter=" ">
      <group delimiter=", ">
        <text macro="author-short"/>
        <choose>
          <if match="none" type="bill hearing legal_case legislation regulation treaty">
            <text macro="title-and-descriptions-short"/>
          </if>
        </choose>
        <text macro="citation-notes-shortened-author-title-disambiguate"/>
        <choose>
          <!-- inaccessible `interview` or `personal_communication` uses in-text format (CMOS18 14.111): give the date at the first citation in shortened notes -->
          <if match="any" variable="archive archive-place container-title DOI number publisher references URL"/>
          <else-if position="first" type="interview">
            <text macro="date-short"/>
            <text macro="source-medium-note"/>
          </else-if>
          <else-if position="first" type="personal_communication">
            <text macro="source-medium-note"/>
          </else-if>
        </choose>
        <text macro="source-monographic-publication-short-unbracketed"/>
      </group>
      <text macro="source-monographic-publication-short-bracketed"/>
    </group>
  </macro>
  <macro name="citation-notes-shortened-author-title-disambiguate">
    <!-- CMOS18 gives examples of added dates (CMOS18 14.13) and editors/translators, publisher, date (CMOS18 14.146) -->
    <group delimiter=", ">
      <choose>
        <if disambiguate="true">
          <choose>
            <if disambiguate="true">
              <text macro="label-version"/>
              <text macro="label-edition"/>
            </if>
          </choose>
          <names variable="editor-translator">
            <label form="verb-short" suffix=" "/>
            <name and="text" form="short"/>
            <substitute>
              <names variable="editor"/>
              <names variable="translator"/>
            </substitute>
          </names>
        </if>
      </choose>
    </group>
  </macro>
  <citation disambiguate-add-givenname="true" disambiguate-add-names="true" et-al-min="3" et-al-use-first="1">
    <layout delimiter="; " suffix=".">
      <!-- Shortened note styles mirror the filtering approach of author-date -->
      <group delimiter=", ">
        <choose>
          <if match="any" variable="part-number volume">
            <!-- comma always needed with volume/part -->
            <text macro="citation-notes-shortened-author-title-item"/>
            <text macro="source-locator-subsequent"/>
          </if>
          <else-if match="none" type="classic">
            <text macro="citation-notes-shortened-author-title-item"/>
            <text macro="source-locator-subsequent"/>
          </else-if>
          <!-- with `classic`, a non-numeric canonical reference or identifying number is separated by a space rather than a comma (CMOS18 14.145) -->
          <else-if is-numeric="locator">
            <text macro="citation-notes-shortened-author-title-item"/>
            <text macro="source-locator-subsequent"/>
          </else-if>
          <else-if locator="chapter line verse" match="any">
            <group delimiter=" ">
              <text macro="citation-notes-shortened-author-title-item"/>
              <text macro="source-locator-subsequent"/>
            </group>
          </else-if>
          <else>
            <text macro="citation-notes-shortened-author-title-item"/>
            <text macro="source-locator-subsequent"/>
          </else>
        </choose>
      </group>
    </layout>
  </citation>
  <!-- Bibliography -->
  <macro name="bibliography-notes">
    <group delimiter=". ">
      <choose>
        <if match="any" type="bill hearing legal_case legislation regulation treaty">
          <!-- Legal items have different orders and delimiters -->
          <text macro="legal-reference"/>
          <text macro="source-date-accessed-DOI-URL-bib"/>
          <text variable="references"/>
        </if>
        <else>
          <text macro="author-bib"/>
          <text macro="title-and-source-bib"/>
          <text variable="references"/>
        </else>
      </choose>
    </group>
  </macro>
  <bibliography et-al-min="7" et-al-use-first="3" hanging-indent="true">
    <sort>
      <key macro="author-sort"/>
      <key macro="title-and-descriptions-bib"/>
      <key macro="source-bib"/>
      <key variable="volume"/>
      <key variable="part-number"/>
      <key variable="event-date"/>
      <key macro="source-date-issued-or-status"/>
      <key macro="source-archive-bib"/>
    </sort>
    <layout suffix=".">
      <!-- logic identical to `bibliography-filtered-author-date` -->
      <choose>
        <if type="classic">
          <choose>
            <if match="any" variable="archive editor translator publisher">
              <text macro="bibliography-notes"/>
            </if>
          </choose>
        </if>
        <else-if match="any" type="entry entry-dictionary entry-encyclopedia">
          <choose>
            <if variable="author">
              <!-- Signed reference entries appear in the bibliography (CMOS18 14.132) -->
              <text macro="bibliography-notes"/>
            </if>
            <else-if match="any" variable="DOI URL">
              <!-- Provide a bibliography if necessary identifying information is not in text -->
              <text macro="bibliography-notes"/>
            </else-if>
          </choose>
        </else-if>
        <!-- Personal communications only appear in the bibliography if the reader can retrieve them (CMOS18 14.13, 14.111) -->
        <else-if match="any" variable="archive archive-place container-title DOI number publisher references URL">
          <text macro="bibliography-notes"/>
        </else-if>
        <else-if match="any" type="interview personal_communication"/>
        <else>
          <text macro="bibliography-notes"/>
        </else>
      </choose>
    </layout>
  </bibliography>
</style>
