Skip to content

Instantly share code, notes, and snippets.

@fbennett
Created May 13, 2013 11:07
Show Gist options
  • Save fbennett/5567599 to your computer and use it in GitHub Desktop.
Save fbennett/5567599 to your computer and use it in GitHub Desktop.
Title macro from the American Law Style, as a worked example from a production environment
<macro name="amlaw-title">
<choose>
<if>
<conditions match="all">
<condition type="book song motion_picture" match="any"/>
<condition variable="title version" match="all"/>
<condition disambiguate="true" position="first" match="any"/>
<condition is-numeric="version" match="all"/>
</conditions>
<group delimiter=", ">
<text form="short" text-case="title" variable="title"/>
<group delimiter=" ">
<text value="ver."/>
<text variable="version"/>
</group>
<text form="short" variable="medium"/>
</group>
</if>
<else-if>
<conditions match="all">
<condition type="book song motion_picture" match="any"/>
<condition variable="title version" match="all"/>
<condition disambiguate="true" position="first" match="any"/>
<condition is-numeric="version" match="none"/>
</conditions>
<group delimiter=", ">
<text form="short" text-case="title" variable="title"/>
<text quotes="true" variable="version"/>
<text form="short" variable="medium"/>
</group>
</else-if>
<else-if>
<conditions match="all">
<condition type="book song motion_picture" match="any"/>
<condition variable="title version" match="all"/>
</conditions>
<choose>
<if>
<conditions match="any">
<condition position="first" disambiguate="true" match="any"/>
<condition variable="author container-author" match="none"/>
</conditions>
<text form="short" text-case="title" variable="title"/>
</if>
</choose>
</else-if>
<else-if>
<conditions match="all">
<condition type="book song motion_picture" match="any"/>
<condition variable="title version" match="nand"/>
<condition variable="container-title" match="none"/>
<condition type="song" variable="collection-title" match="nand"/>
</conditions>
<choose>
<if position="subsequent" disambiguate="true" variable="title-short" match="all">
<text font-variant="small-caps" form="short" text-case="title" variable="title-short"/>
</if>
<else-if>
<conditions match="all">
<condition position="subsequent" match="any"/>
<condition variable="author composer" match="none"/>
</conditions>
<text font-variant="small-caps" form="short" text-case="title" variable="title-short"/>
</else-if>
<else-if>
<conditions match="any">
<condition position="first" match="any"/>
<condition disambiguate="true" match="any"/>
<condition variable="author composer" match="none"/>
</conditions>
<text font-variant="small-caps" form="short" text-case="title" variable="title"/>
</else-if>
</choose>
</else-if>
<else-if>
<conditions match="any">
<condition type="song" variable="collection-title" match="all"/>
<condition type="song" variable="container-title composer" match="all"/>
<condition type="song" variable="container-title author" match="all"/>
</conditions>
<choose>
<if>
<conditions match="any">
<condition position="first" disambiguate="true" match="any"/>
<condition variable="author" match="none"/>
</conditions>
<group delimiter=" ">
<text font-style="italic" form="short" text-case="title" variable="title"/>
<names prefix="[" suffix="]" variable="composer">
<name form="short" initialize-with="."/>
</names>
</group>
</if>
</choose>
</else-if>
<else-if type="book song motion_picture" match="any">
<choose>
<if>
<conditions match="any">
<condition position="first" disambiguate="true" match="any"/>
</conditions>
<text font-variant="small-caps" form="short" text-case="title" variable="title"/>
</if>
</choose>
</else-if>
<else-if>
<conditions match="any">
<condition type="broadcast" variable="container-title publisher" match="all"/>
<condition type="video" variable="container-title publisher" match="all"/>
</conditions>
<group delimiter=": " font-style="italic">
<text form="short" text-case="title" variable="container-title"/>
<text form="short" text-case="title" variable="title"/>
</group>
</else-if>
<else-if>
<conditions match="any">
<condition type="video" variable="container-title URL" match="all"/>
<condition type="post" variable="container-title URL" match="all"/>
<condition type="post-weblog" variable="container-title URL" match="all"/>
<condition type="webpage" variable="container-title URL" match="all"/>
</conditions>
<choose>
<if position="first" disambiguate="true" match="any">
<text font-style="italic" form="short" variable="title"/>
</if>
</choose>
</else-if>
<else-if>
<conditions match="any">
<condition type="song" variable="collection-title" match="all"/>
<condition type="broadcast" variable="container-title" match="all"/>
<condition type="video" variable="container-title" match="all"/>
<condition type="post" variable="container-title" match="all"/>
<condition type="post-weblog" variable="container-title" match="all"/>
<condition type="webpage" variable="container-title" match="all"/>
<condition type="paper-conference" variable="container-title" match="all"/>
<condition type="article-magazine graphic article-journal article-newspaper chapter" match="any"/>
<condition type="entry-encyclopedia"/>
<condition type="entry-dictionary"/>
</conditions>
<choose>
<if>
<conditions match="any">
<condition position="first" disambiguate="true" match="any"/>
<condition variable="author container-author" match="none"/>
</conditions>
<text font-style="italic" form="short" text-case="title" variable="title"/>
</if>
</choose>
</else-if>
<else-if>
<conditions match="any">
<condition type="video" variable="URL" match="all"/>
<condition type="post" variable="URL" match="all"/>
<condition type="post-weblog" variable="URL" match="all"/>
<condition type="webpage" variable="URL" match="all"/>
</conditions>
<text form="short" variable="title"/>
</else-if>
<else-if type="legal_case">
<choose>
<if position="first">
<text form="short" variable="title"/>
</if>
<else-if variable="title-short">
<text form="short" font-style="italic" variable="title-short"/>
</else-if>
<else>
<text form="short" font-style="italic" variable="title"/>
</else>
</choose>
</else-if>
<else>
<choose>
<if>
<conditions match="any">
<condition position="first" disambiguate="true" match="any"/>
<condition variable="author container-author" match="none"/>
</conditions>
<text form="short" text-case="title" variable="title"/>
</if>
</choose>
</else>
</choose>
</macro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment