diff --git a/examples/article.html b/examples/article.html
index e592d83..60264e2 100644
--- a/examples/article.html
+++ b/examples/article.html
@@ -78,7 +78,7 @@
1.1
Citations
- We can also cite external publications. . We should also be testing footnotesThis will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote.. There are multiple footnotes, and they appear in the appendixGiven I have coded them right. Also, here's math in a footnote: c = \sum_0^i{x}. Also, a citation. Box-ception! as well.
+ We can also cite external publications. . We should also be testing footnotesThis will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote.. There are multiple footnotes, and they appear in the appendixGiven I have coded them right. Also, here's math in a footnote: c = \sum_0^i{x}. Also, a citation. Box-ception! as well.
2
Displaying code snippets
Some inline javascript:var x = 25;. And here's a javascript code block.
diff --git a/examples/bibliography.bib b/examples/bibliography.bib
index 1508c51..644e10e 100644
--- a/examples/bibliography.bib
+++ b/examples/bibliography.bib
@@ -97,3 +97,12 @@
year={2016},
url={https://arxiv.org/pdf/1609.07009.pdf}
}
+
+@misc{openai2018charter,
+ author={OpenAI},
+ title={OpenAI Charter},
+ type={Blog},
+ number={April 9},
+ year={2018},
+ url={https://blog.openai.com/charter},
+}
diff --git a/src/front-matter.js b/src/front-matter.js
index 2a22c6b..ccedc31 100644
--- a/src/front-matter.js
+++ b/src/front-matter.js
@@ -96,7 +96,9 @@ export function mergeFromYMLFrontmatter(target, source) {
target.authors = source.authors.map( (authorObject) => new Author(authorObject));
target.katex = source.katex;
target.password = source.password;
- target.doi = source.doi;
+ if (source.doi) {
+ target.doi = source.doi;
+ }
}
export class FrontMatter {
@@ -161,6 +163,7 @@ export class FrontMatter {
// githubCompareUpdatesUrl: 'https://github.com/distillpub/post--augmented-rnns/compare/1596e094d8943d2dc0ea445d92071129c6419c59...3bd9209e0c24d020f87cf6152dcecc6017cbc193',
// updatedDate: 2017-03-21T07:13:16.000Z,
// doi: '10.23915/distill.00001',
+ this.doi = undefined;
this.publishedDate = undefined;
}
@@ -319,6 +322,7 @@ export class FrontMatter {
Object.assign(target, this);
target.bibliography = objectFromMap(this.bibliographyEntries);
target.url = this.url;
+ target.doi = this.doi;
target.githubUrl = this.githubUrl;
target.previewURL = this.previewURL;
if (this.publishedDate) {
diff --git a/src/helpers/citation.js b/src/helpers/citation.js
index 943139e..8971b20 100644
--- a/src/helpers/citation.js
+++ b/src/helpers/citation.js
@@ -61,9 +61,11 @@ function author_string(ent, template, sep, finalSep){
if (name.indexOf(',') != -1){
var last = name.split(',')[0].trim();
var firsts = name.split(',')[1];
- } else {
+ } else if (name.indexOf(' ') != -1) {
var last = name.split(' ').slice(-1)[0].trim();
var firsts = name.split(' ').slice(0,-1).join(' ');
+ } else {
+ var last = name.trim();
}
var initials = '';
if (firsts != undefined) {
@@ -72,7 +74,8 @@ function author_string(ent, template, sep, finalSep){
}
return template.replace('${F}', firsts)
.replace('${L}', last)
- .replace('${I}', initials);
+ .replace('${I}', initials)
+ .trim(); // in case one of first or last was empty
});
if (names.length > 1) {
var str = name_strings.slice(0, names.length-1).join(sep);