This commit is contained in:
Christopher Olah
2017-01-13 12:45:19 -08:00
parent f190b3bef7
commit ecfe234414
2 changed files with 32 additions and 11 deletions
+31 -10
View File
@@ -282,6 +282,8 @@ function Type$2(tag, options) {
var type = Type$2;
/*eslint-disable max-len*/
var common$4 = common$1;
var YAMLException$3 = exception;
var Type$1 = type;
@@ -893,6 +895,8 @@ function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
/*eslint-disable no-bitwise*/
var NodeBuffer;
try {
@@ -1350,6 +1354,8 @@ var default_full = Schema$6.DEFAULT = new Schema$6({
]
});
/*eslint-disable max-len,no-use-before-define*/
var common = common$1;
var YAMLException$1 = exception;
var Mark = mark;
@@ -2941,6 +2947,8 @@ var loader$1 = {
safeLoad: safeLoad_1
};
/*eslint-disable no-use-before-define*/
var common$7 = common$1;
var YAMLException$5 = exception;
var DEFAULT_FULL_SCHEMA$2 = default_full;
@@ -4208,6 +4216,8 @@ var bibliography = function(dom, data) {
val = val.replace(/[\t\n ]+/g, " ");
val = val.replace(/{\\["^`\.'acu~Hvs]( )?([a-zA-Z])}/g,
function (full, x, char) { return char; });
val = val.replace(/{\\([a-zA-Z])}/g,
function (full, char) { return char; });
e.entryTags[k] = val;
}
bibliography[e.citationKey] = e.entryTags;
@@ -5988,16 +5998,22 @@ var citation = function(dom, data) {
function author_string(ent, template, sep, finalSep){
var names = ent.author.split(" and ");
var name_strings = names.map(function (name) {
var last = name.split(",")[0].trim();
var firsts = name.split(",")[1];
name = name.trim();
if (name.indexOf(",") != -1){
var last = name.split(",")[0].trim();
var firsts = name.split(",")[1];
} else {
var last = name.split(" ").slice(-1)[0].trim();
var firsts = name.split(" ").slice(0,-1).join(" ");
}
var initials = "";
if (firsts != undefined) {
initials = firsts.trim().split(" ").map(function (s) { return s.trim()[0]; });
initials = initials.join(".")+".";
}
return template.replace("F", firsts)
.replace("L", last)
.replace("I", initials);
return template.replace("${F}", firsts)
.replace("${L}", last)
.replace("${I}", initials);
});
if (names.length > 1) {
var str = name_strings.slice(0, names.length-1).join(sep);
@@ -6018,9 +6034,10 @@ var citation = function(dom, data) {
if ("pages" in ent){
cite += ", pp. " + ent.pages;
}
cite += ". ";
if (cite != "") { cite += ". "; }
if ("publisher" in ent){
cite += ent.publisher + ".";
cite += ent.publisher;
if (cite[cite.length-1] != ".") { cite += "."; }
}
return cite;
}
@@ -6049,8 +6066,12 @@ var citation = function(dom, data) {
function bibliography_cite(ent, fancy){
if (ent){
var cite = author_string(ent, "L, I", ", ", " and ");
cite += ", " + ent.year + ". ";
var cite = author_string(ent, "${L}, ${I}", ", ", " and ");
if (ent.year || ent.date){
cite += ", " + (ent.year || ent.date) + ". ";
} else {
cite += ". ";
}
cite += "<b>" + ent.title + "</b>. ";
cite += venue_string(ent);
cite += doi_string(ent);
@@ -6067,7 +6088,7 @@ var citation = function(dom, data) {
cite += "<b>" + ent.title + "</b>";
cite += link_string(ent);
cite += "<br>";
cite += author_string(ent, "I L", ", ") + ".<br>";
cite += author_string(ent, "${I} ${L}", ", ") + ".<br>";
cite += venue_string(ent).trim() + " " + ent.year + ". ";
cite += doi_string(ent, true);
return cite
+1 -1
View File
File diff suppressed because one or more lines are too long