Compare commits

...

5 Commits

Author SHA1 Message Date
Ludwig Schubert 6f7df48fc2 2.2.19 2017-12-04 16:50:48 -08:00
Ludwig Schubert 71450e9ba8 Fix crash when a citation has no authors in Meta tags transform 2017-12-04 16:50:39 -08:00
Shan Carter 6679b120ab 2.2.18 2017-12-01 15:38:42 -08:00
Shan Carter 8bff98944a merge 2017-12-01 15:38:31 -08:00
Shan Carter b4c8fdc56a No authors bugfix 2017-12-01 15:38:04 -08:00
5 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "distill-template",
"version": "2.2.17",
"version": "2.2.19",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "distill-template",
"version": "2.2.17",
"version": "2.2.19",
"description": "Template for creating Distill articles.",
"main": "dist/template.v2.js",
"bin": {
+1
View File
@@ -40,6 +40,7 @@ export function inline_cite_long(keys){
}
function author_string(ent, template, sep, finalSep){
if (ent.author == null) { return ''; }
var names = ent.author.split(' and ');
let name_strings = names.map(name => {
name = name.trim();
+1
View File
@@ -95,6 +95,7 @@ export default function(dom, data) {
}
function author_string(ent, template, sep, finalSep){
if (ent.author == null) { return ''; }
var names = ent.author.split(' and ');
let name_strings = names.map(name => {
name = name.trim();
+15 -13
View File
@@ -124,26 +124,28 @@ function appendHtml(el, html) {
}
function citation_meta_content(ref){
// Special test for arxiv
var content = `citation_title=${ref.title};`;
ref.author.split(' and ').forEach(name => {
name = name.trim();
let last, firsts;
if (name.indexOf(',') != -1){
last = name.split(',')[0].trim();
firsts = name.split(',')[1].trim();
} else {
last = name.split(' ').slice(-1)[0].trim();
firsts = name.split(' ').slice(0,-1).join(' ');
}
content += `citation_author=${firsts} ${last};`;
});
if (ref.author && ref.author !== '') {
ref.author.split(' and ').forEach(name => {
name = name.trim();
let last, firsts;
if (name.indexOf(',') != -1){
last = name.split(',')[0].trim();
firsts = name.split(',')[1].trim();
} else {
last = name.split(' ').slice(-1)[0].trim();
firsts = name.split(' ').slice(0,-1).join(' ');
}
content += `citation_author=${firsts} ${last};`;
});
}
if ('year' in ref) {
content += `citation_publication_date=${ref.year};`;
}
// Special test for arxiv
let arxiv_id_search = /https?:\/\/arxiv\.org\/pdf\/([0-9]*\.[0-9]*)\.pdf/.exec(ref.url);
arxiv_id_search = arxiv_id_search || /https?:\/\/arxiv\.org\/abs\/([0-9]*\.[0-9]*)/.exec(ref.url);
arxiv_id_search = arxiv_id_search || /arXiv preprint arXiv:([0-9]*\.[0-9]*)/.exec(ref.journal);