Compare commits

...
6 Commits
6 changed files with 34 additions and 25 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "distill-template", "name": "distill-template",
"version": "2.2.18", "version": "2.2.19",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "distill-template", "name": "distill-template",
"version": "2.2.18", "version": "2.2.19",
"description": "Template for creating Distill articles.", "description": "Template for creating Distill articles.",
"main": "dist/template.v2.js", "main": "dist/template.v2.js",
"bin": { "bin": {
+1
View File
@@ -30,6 +30,7 @@ const T = Template('d-hover-box', `
box-shadow: 0 0 7px rgba(0, 0, 0, 0.1); box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
padding: 10px;
} }
</style> </style>
+15 -9
View File
@@ -73,6 +73,8 @@ export function mergeFromYMLFrontmatter(target, source) {
target.publishedDate = source.publishedDate; target.publishedDate = source.publishedDate;
} else if (source.publishedDate.constructor === String) { } else if (source.publishedDate.constructor === String) {
target.publishedDate = new Date(source.publishedDate); target.publishedDate = new Date(source.publishedDate);
} else {
console.error('Don\'t know what to do with published date: ' + source.publishedDate);
} }
} }
target.description = source.description; target.description = source.description;
@@ -303,15 +305,19 @@ export class FrontMatter {
target.url = this.url; target.url = this.url;
target.githubUrl = this.githubUrl; target.githubUrl = this.githubUrl;
target.previewURL = this.previewURL; target.previewURL = this.previewURL;
target.volume = this.volume; if (this.publishedDate) {
target.issue = this.issue; target.volume = this.volume;
target.publishedDateRFC = this.publishedDateRFC; target.issue = this.issue;
target.publishedYear = this.publishedYear; target.publishedDateRFC = this.publishedDateRFC;
target.publishedMonth = this.publishedMonth; target.publishedYear = this.publishedYear;
target.publishedDay = this.publishedDay; target.publishedMonth = this.publishedMonth;
target.publishedMonthPadded = this.publishedMonthPadded; target.publishedDay = this.publishedDay;
target.publishedDayPadded = this.publishedDayPadded; target.publishedMonthPadded = this.publishedMonthPadded;
target.updatedDateRFC = this.updatedDateRFC; target.publishedDayPadded = this.publishedDayPadded;
}
if (this.updatedDate) {
target.updatedDateRFC = this.updatedDateRFC;
}
target.concatenatedAuthors = this.concatenatedAuthors; target.concatenatedAuthors = this.concatenatedAuthors;
target.bibtexAuthors = this.bibtexAuthors; target.bibtexAuthors = this.bibtexAuthors;
target.slug = this.slug; target.slug = this.slug;
+1 -1
View File
@@ -79,7 +79,7 @@ distill-footer {
} }
} }
@media(min-width: 1280px) { @media(min-width: 1180px) {
.base-grid, .base-grid,
distill-header, distill-header,
d-title, d-title,
+15 -13
View File
@@ -124,26 +124,28 @@ function appendHtml(el, html) {
} }
function citation_meta_content(ref){ function citation_meta_content(ref){
// Special test for arxiv
var content = `citation_title=${ref.title};`; var content = `citation_title=${ref.title};`;
ref.author.split(' and ').forEach(name => { if (ref.author && ref.author !== '') {
name = name.trim(); ref.author.split(' and ').forEach(name => {
let last, firsts; name = name.trim();
if (name.indexOf(',') != -1){ let last, firsts;
last = name.split(',')[0].trim(); if (name.indexOf(',') != -1){
firsts = name.split(',')[1].trim(); last = name.split(',')[0].trim();
} else { firsts = name.split(',')[1].trim();
last = name.split(' ').slice(-1)[0].trim(); } else {
firsts = name.split(' ').slice(0,-1).join(' '); last = name.split(' ').slice(-1)[0].trim();
} firsts = name.split(' ').slice(0,-1).join(' ');
content += `citation_author=${firsts} ${last};`; }
}); content += `citation_author=${firsts} ${last};`;
});
}
if ('year' in ref) { if ('year' in ref) {
content += `citation_publication_date=${ref.year};`; 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); 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 || /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); arxiv_id_search = arxiv_id_search || /arXiv preprint arXiv:([0-9]*\.[0-9]*)/.exec(ref.journal);