Skip to content

Commit

Permalink
Fix broken getCiteKey() resulting from recent BBT update
Browse files Browse the repository at this point in the history
  • Loading branch information
RoBaaaT committed Oct 25, 2023
1 parent 53fa5de commit 14979e4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions content/mdnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ function getDateAdded(item) {
function getCiteKey(item) {
if (typeof Zotero.BetterBibTeX === "object" && Zotero.BetterBibTeX !== null) {
var bbtItem = Zotero.BetterBibTeX.KeyManager.get(item.getField("id"));
return bbtItem.citekey;
// note: 'citekey' has been renamed to 'citationKey' in BBT - https://github.com/retorquere/zotero-better-bibtex/commit/63028dcd03ada843d6f55dfd6745bc92d6587ab2
return bbtItem.citekey ? bbtItem.citekey : bbtItem.citationKey;
}

return "undefined";
Expand Down Expand Up @@ -523,7 +524,7 @@ function replace_wildcards(str, args) {


/**
*
*
* @param {string} str The string to be replaced
* @param {Object} args An array with the placeholder name as key and the (formatted) contents as values
* @returns {string} A string with the placeholders replaced
Expand Down Expand Up @@ -728,7 +729,7 @@ async function getZoteroNoteFileContents(item) {
let fileContents = remove_invalid_placeholders(
replace_placeholders(template, formattedPlaceholders)
);

fileContents = replace_wildcards(fileContents, note);
return { content: fileContents, name: fileName };
}
Expand Down Expand Up @@ -953,10 +954,10 @@ Zotero.Mdnotes =
async getRegularItemContents(item) {
let metadata = getItemMetadata(item);
let template = await readTemplate("Zotero Metadata Template");

// Add custom placeholders
get_placeholder_contents(template, metadata);

// Add formatting
let formattedPlaceholders = format_placeholders(metadata);
let newContents = remove_invalid_placeholders(
Expand Down

0 comments on commit 14979e4

Please sign in to comment.