From 000fa088db6f3d05d16403af6748c410f4c5ddb6 Mon Sep 17 00:00:00 2001 From: Ludwig Schubert Date: Fri, 1 Dec 2017 15:09:23 -0800 Subject: [PATCH] Special case citations without authors --- src/helpers/citation.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/helpers/citation.js b/src/helpers/citation.js index 1f98bf7..a419441 100644 --- a/src/helpers/citation.js +++ b/src/helpers/citation.js @@ -114,13 +114,22 @@ function doi_string(ent, new_line){ } } +function title_string(ent) { + return '' + ent.title + ' '; +} + export function bibliography_cite(ent, fancy){ if (ent){ - var cite = '' + ent.title + ' '; + var cite = title_string(ent); cite += link_string(ent) + '
'; - cite += author_string(ent, '${L}, ${I}', ', ', ' and '); - if (ent.year || ent.date){ - cite += ', ' + (ent.year || ent.date) + '. '; + if (ent.author) { + cite += author_string(ent, '${L}, ${I}', ', ', ' and '); + if (ent.year || ent.date) { + cite += ', '; + } + } + if (ent.year || ent.date) { + cite += (ent.year || ent.date) + '. '; } else { cite += '. '; }