Reinstating Short Titles
I deleted all the short titles from my entries as I thought they were interfering with the formatting that I needed. I now need those short titles for the referencing system that I am using. Is there a way to automatically reinstate short titles after they have been removed?
for (let item of ZoteroPane.getSelectedItems()) {
if (!item.isRegularItem()) continue;
let title = item.getField("title", false, true);
let setShortTitle = false;
// shorten to before first colon
let index = title.indexOf(":");
if (index !== -1) {
title = title.substr(0, index);
setShortTitle = true;
}
// shorten to after first question mark
index = title.indexOf("?");
if (index !== -1) {
index++;
if (index != title.length) {
title = title.substr(0, index);
setShortTitle = true;
}
}
if (setShortTitle) {
item.setField("shortTitle", title);
await item.saveTx();
}
}
When you click Run, it will set automatic short titles on all selected items.
Am I doing something wrong?
(copy/pasting the same reply in different threads doesn't help your case. Please be respectful of our forum etiquette)
Assuming that for the full notes of cases you want to print the short title instead of the long title.
You'd change the "title" macro from:
<macro name="title">
<choose>
<if type="book legislation motion_picture manuscript report" match="any">
<text variable="title" font-style="italic" text-case="title"/>
</if>
<else-if type="bill">
<text variable="title" text-case="title"/>
</else-if>
<else-if type="legal_case">
<text variable="title" font-style="italic" strip-periods="true"/>
</else-if>
<else-if type="entry-dictionary">
<text variable="container-title" font-style="italic"/>
</else-if>
<else-if type="entry-encyclopedia">
<group delimiter=", ">
<text variable="publisher"/>
<text variable="container-title" font-style="italic"/>
</group>
</else-if>
<else>
<text variable="title" quotes="true" text-case="title"/>
</else>
</choose>
</macro>
to
<macro name="title">
<choose>
<if type="book legislation motion_picture manuscript report" match="any">
<text variable="title" font-style="italic" text-case="title"/>
</if>
<else-if type="bill">
<text variable="title" text-case="title"/>
</else-if>
<else-if type="legal_case">
<text variable="title" font-style="italic" strip-periods="true" form="short"/>
</else-if>
<else-if type="entry-dictionary">
<text variable="container-title" font-style="italic"/>
</else-if>
<else-if type="entry-encyclopedia">
<group delimiter=", ">
<text variable="publisher"/>
<text variable="container-title" font-style="italic"/>
</group>
</else-if>
<else>
<text variable="title" quotes="true" text-case="title"/>
</else>
</choose>
</macro>
Follow this guide to the T!! and change the ID and self link as explained. Otherwise your style will be overwritten.
https://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step