From 7547307b5a762b2e0a341894ce5d885cd86e2b99 Mon Sep 17 00:00:00 2001 From: Stefanie Lemcke <slemcke@uni-potsdam.de> Date: Mon, 8 Nov 2021 10:50:16 +0100 Subject: [PATCH 1/2] filter functionality fixed. eval_list did not work -> Object.entries is now used to access the subentries comparing numbers in eval_spec did not work -> added string conversion if entry is a number --- citeproc.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/citeproc.js b/citeproc.js index 34020a9ef..2615affaa 100644 --- a/citeproc.js +++ b/citeproc.js @@ -8679,9 +8679,8 @@ CSL.getBibliographyEntries = function (bibsection) { return false; } function eval_list(a, lst) { - lllen = lst.length; - for (pppos = 0; pppos < lllen; pppos += 1) { - if (eval_string(a, lst[pppos])) { + for (const [key, value] of Object.entries(lst)) { + if (eval_spec(a, value)) { return true; } } @@ -8695,9 +8694,11 @@ CSL.getBibliographyEntries = function (bibsection) { return !b; } } else { - if ("string" === typeof b) { + if ("string" === typeof b ) { return eval_string(a, b); - } else if (!b) { + } else if ("number" === typeof b) { + return eval_string(a, b.toString()); + }else if (!b) { return false; } else { return eval_list(a, b); From 77541fb95f2fdeeece6723274812a9fefbec6b53 Mon Sep 17 00:00:00 2001 From: Stefanie Lemcke <slemcke@uni-potsdam.de> Date: Mon, 8 Nov 2021 11:41:51 +0100 Subject: [PATCH 2/2] moved changes to filter in src/api_bibliography.js --- citeproc.js | 11 +++++------ src/api_bibliography.js | 13 +++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/citeproc.js b/citeproc.js index 2615affaa..34020a9ef 100644 --- a/citeproc.js +++ b/citeproc.js @@ -8679,8 +8679,9 @@ CSL.getBibliographyEntries = function (bibsection) { return false; } function eval_list(a, lst) { - for (const [key, value] of Object.entries(lst)) { - if (eval_spec(a, value)) { + lllen = lst.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + if (eval_string(a, lst[pppos])) { return true; } } @@ -8694,11 +8695,9 @@ CSL.getBibliographyEntries = function (bibsection) { return !b; } } else { - if ("string" === typeof b ) { + if ("string" === typeof b) { return eval_string(a, b); - } else if ("number" === typeof b) { - return eval_string(a, b.toString()); - }else if (!b) { + } else if (!b) { return false; } else { return eval_list(a, b); diff --git a/src/api_bibliography.js b/src/api_bibliography.js index f6bfbf68c..a36812b4e 100644 --- a/src/api_bibliography.js +++ b/src/api_bibliography.js @@ -122,10 +122,9 @@ CSL.getBibliographyEntries = function (bibsection) { } return false; } - function eval_list(a, lst) { - lllen = lst.length; - for (pppos = 0; pppos < lllen; pppos += 1) { - if (eval_string(a, lst[pppos])) { + function eval_list(a, lst) { + for (const [key, value] of Object.entries(lst)) { + if (eval_spec(a, value)) { return true; } } @@ -139,9 +138,11 @@ CSL.getBibliographyEntries = function (bibsection) { return !b; } } else { - if ("string" === typeof b) { + if ("string" === typeof b ) { return eval_string(a, b); - } else if (!b) { + } else if ("number" === typeof b) { + return eval_string(a, b.toString()); + }else if (!b) { return false; } else { return eval_list(a, b);