mirror of
https://github.com/wassname/template.git
synced 2026-08-13 12:40:25 +08:00
Adding scaffolds and moving data around
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('dt-appendix > div');
|
||||
if (el) {
|
||||
let existingHTML = el.innerHTML;
|
||||
let newHTML = "";
|
||||
|
||||
newHTML += `<h3>Updates and Corrections</h3>
|
||||
<p><a href="${data.githubCompareUpdatesUrl}">View all changes</a> to this article since it was first published. If you see a mistake or want to suggest a change, please <a class="github-issue" href="${data.githubUrl}/issues/new">create an issue on GitHub</a>.</p>`;
|
||||
newHTML += `<h3>Updates and Corrections</h3>
|
||||
<p><a href="${data.githubCompareUpdatesUrl}">View all changes</a> to this article since it was first published. If you see a mistake or want to suggest a change, please <a class="github-issue" href="${data.githubUrl}/issues/new">create an issue on GitHub</a>.</p>`;
|
||||
|
||||
newHTML += `<h3>Citations and Reuse</h3>
|
||||
<p>Diagrams and text are licensed under Creative Commons Attribution <a href="https://creativecommons.org/licenses/by/2.0/">CC-BY 2.0</a>, unless noted otherwise, with the <a class="github" href="${data.githubUrl}">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>`;
|
||||
newHTML += `<h3>Citations and Reuse</h3>
|
||||
<p>Diagrams and text are licensed under Creative Commons Attribution <a href="https://creativecommons.org/licenses/by/2.0/">CC-BY 2.0</a>, unless noted otherwise, with the <a class="github" href="${data.githubUrl}">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>
|
||||
|
||||
newHTML += `<p>For attribution in academic contexts, please cite this work as</p>
|
||||
<pre class="citation short">${data.concatenatedAuthors}, "${data.title}", ${data.journal.title}, ${data.publishedYear}. http://doi.org/${data.doi}</pre>`;
|
||||
<p>For attribution in academic contexts, please cite this work as</p>
|
||||
<pre class="citation short">${data.concatenatedAuthors}, "${data.title}", ${data.journal.title}, ${data.publishedYear}. http://doi.org/${data.doi}</pre>
|
||||
|
||||
newHTML += `<p>BibTeX citation</p>
|
||||
<p>BibTeX citation</p>
|
||||
<pre class="citation long">@article{${data.slug},
|
||||
author = {${data.bibtexAuthors}},
|
||||
title = {${data.title}},
|
||||
@@ -23,6 +22,7 @@ newHTML += `<p>BibTeX citation</p>
|
||||
doi = {${data.doi}}
|
||||
}</pre>`;
|
||||
|
||||
let existingHTML = el.innerHTML;
|
||||
el.innerHTML = existingHTML + newHTML;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import bibtexParse from "bibtex-parse-js";
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('script[type="text/bibliography"]');
|
||||
let citations = [];
|
||||
let bibliography = {};
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
if (el) {
|
||||
@@ -23,24 +22,6 @@ export default function(dom, data) {
|
||||
bibliography[e.citationKey].type = e.entryType;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
citeTags.forEach(el => {
|
||||
let key = el.getAttribute("key");
|
||||
if (key) {
|
||||
let citationKeys = key.split(",");
|
||||
citationKeys.forEach(key => {
|
||||
if (citations.indexOf(key) == -1){
|
||||
citations.push(key);
|
||||
if (!(key in bibliography)){
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
data.bibliography = bibliography;
|
||||
data.citations = citations;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
import {timeFormat} from "d3-time-format";
|
||||
|
||||
export default function(dom, data) {
|
||||
|
||||
//
|
||||
// Properties from source
|
||||
//
|
||||
|
||||
// title: 'Attention and Augmented Recurrent Neural Networks',
|
||||
// description: 'A visual overview of neural attention, and the powerful extensions of neural networks being built on top of it.',
|
||||
// url: 'http://distill.pub/2016/augmented-rnns',
|
||||
// tags: [ 'rnn' ],
|
||||
// doiSuffix: 1,
|
||||
// doi: '10.23915/distill.00001',
|
||||
// volume: 1,
|
||||
// issue: 9,
|
||||
// distillPath: '2016/augmented-rnns',
|
||||
// githubPath: 'distillpub/post--augmented-rnns',
|
||||
// githubCompareUpdatesUrl: 'https://github.com/distillpub/post--augmented-rnns/compare/1596e094d8943d2dc0ea445d92071129c6419c59...3bd9209e0c24d020f87cf6152dcecc6017cbc193',
|
||||
// updatedDate: 2017-03-21T07:13:16.000Z,
|
||||
// publishedDate: 2016-09-08T07:00:00.000Z,
|
||||
// journal: {
|
||||
// "title": "Distill",
|
||||
// "full_title": "Distill",
|
||||
// "abbrev_title": "Distill",
|
||||
// "url": "http://distill.pub",
|
||||
// "doi": "10.23915/distill",
|
||||
// "publisherName": "Distill Working Group",
|
||||
// "publisherEmail": "admin@distill.pub",
|
||||
// "issn": "2476-0757",
|
||||
// "editors": [...],
|
||||
// "committee": [...]
|
||||
// }
|
||||
|
||||
//
|
||||
// Computed Properties
|
||||
//
|
||||
|
||||
// githubUrl: 'https://github.com/distillpub/post--augmented-rnns',
|
||||
// previewURL: 'http://distill.pub/2016/augmented-rnns/thumbnail.jpg',
|
||||
// publishedDateRFC: 'Thu, 08 Sep 2016 00:00:00 -0700',
|
||||
// publishedYear: 2016,
|
||||
// publishedMonth: 'Sept',
|
||||
// publishedDay: 8,
|
||||
// publishedMonthPadded: '09',
|
||||
// publishedDayPadded: '08',
|
||||
// updatedDateRFC: 'Tue, 21 Mar 2017 00:13:16 -0700',
|
||||
// concatenatedAuthors: 'Olah & Carter',
|
||||
// bibtexAuthors: 'Olah, Chris and Carter, Shan',
|
||||
// slug: 'olah2016attention'
|
||||
// authors: [
|
||||
// {
|
||||
// "personalURL": null,
|
||||
// "name": "Chris Olah",
|
||||
// "firstName": "Chris",
|
||||
// "lastName": "Olah",
|
||||
// "affiliationURL": null,
|
||||
// "affiliation": "Google Brain"
|
||||
// }
|
||||
// ],
|
||||
// bibliography: {
|
||||
// "gregor2015draw": {
|
||||
// "title": "DRAW: A recurrent neural network for image generation",
|
||||
// "author": "Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan",
|
||||
// "journal": "arXiv preprint arXiv:1502.04623",
|
||||
// "year": "2015",
|
||||
// "url": "https://arxiv.org/pdf/1502.04623.pdf",
|
||||
// "type": "article"
|
||||
// },
|
||||
// ...
|
||||
// },
|
||||
// citations: [
|
||||
// "gregor2015draw",
|
||||
// "mercier2011humans",
|
||||
// "dong2014image",
|
||||
// "dumoulin2016guide",
|
||||
// "mordvintsev2015inceptionism"
|
||||
// ],
|
||||
|
||||
|
||||
// citations:
|
||||
let citations = [];
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
citeTags.forEach(el => {
|
||||
let key = el.getAttribute("key");
|
||||
if (key) {
|
||||
let citationKeys = key.split(",");
|
||||
citationKeys.forEach(key => {
|
||||
if (citations.indexOf(key) == -1){
|
||||
citations.push(key);
|
||||
if (!(key in data.bibliography)){
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
data.citations = citations;
|
||||
|
||||
|
||||
data.authors = data.authors || [];
|
||||
|
||||
// paths
|
||||
if (!data.distillPath && !data.url) {
|
||||
data.url = "http://distill.pub/";
|
||||
} else if (!data.url) {
|
||||
data.url = "http://distill.pub/" + data.distillPath;
|
||||
}
|
||||
data.githubUrl = "https://github.com/" + data.githubPath;
|
||||
|
||||
data.previewURL = data.previewURL ? data.previewURL : data.url + "/thumbnail.jpg"
|
||||
|
||||
// Homepage
|
||||
//data.homepage = !post.noHomepage;
|
||||
data.journal = data.journal || {};
|
||||
|
||||
// Dates
|
||||
if (data.publishedDate){//} && data.journal) {
|
||||
data.volume = data.publishedDate.getFullYear() - 2015;
|
||||
data.issue = data.publishedDate.getMonth() + 1;
|
||||
}
|
||||
|
||||
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
|
||||
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
|
||||
|
||||
data.publishedDateRFC
|
||||
let RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
|
||||
let months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
data.publishedDateRFC = RFC(data.publishedDate);
|
||||
data.publishedYear = data.publishedDate.getFullYear();
|
||||
data.publishedMonth = months[data.publishedDate.getMonth()];
|
||||
data.publishedDay = data.publishedDate.getDate();
|
||||
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
|
||||
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
|
||||
data.updatedDateRFC = RFC(data.updatedDate);
|
||||
|
||||
if (data.authors.length > 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
|
||||
} else if (data.authors.length === 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
|
||||
} else if (data.authors.length === 1) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName
|
||||
}
|
||||
|
||||
data.bibtexAuthors = data.authors.map(function(author){
|
||||
return author.lastName + ", " + author.firstName;
|
||||
}).join(" and ");
|
||||
|
||||
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
import {timeFormat} from "d3-time-format";
|
||||
|
||||
export default function(dom, data) {
|
||||
|
||||
data.authors = data.authors || [];
|
||||
|
||||
// paths
|
||||
if (!data.distillPath && !data.url) {
|
||||
data.url = "http://distill.pub/";
|
||||
} else if (!data.url) {
|
||||
data.url = "http://distill.pub/" + data.distillPath;
|
||||
}
|
||||
data.githubUrl = "https://github.com/" + data.githubPath;
|
||||
|
||||
data.previewURL = data.previewURL ? data.previewURL : data.url + "/thumbnail.jpg"
|
||||
|
||||
// Homepage
|
||||
//data.homepage = !post.noHomepage;
|
||||
data.journal = data.journal || {};
|
||||
|
||||
// Dates
|
||||
if (data.publishedDate){//} && data.journal) {
|
||||
data.volume = data.publishedDate.getFullYear() - 2015;
|
||||
data.issue = data.publishedDate.getMonth() + 1;
|
||||
}
|
||||
|
||||
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
|
||||
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
|
||||
|
||||
data.publishedDateRFC
|
||||
let RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
|
||||
let months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
data.publishedDateRFC = RFC(data.publishedDate);
|
||||
data.publishedYear = data.publishedDate.getFullYear();
|
||||
data.publishedMonth = months[data.publishedDate.getMonth()];
|
||||
data.publishedDay = data.publishedDate.getDate();
|
||||
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
|
||||
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
|
||||
data.updatedDateRFC = RFC(data.updatedDate);
|
||||
|
||||
if (data.authors.length > 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
|
||||
} else if (data.authors.length === 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
|
||||
} else if (data.authors.length === 1) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName
|
||||
}
|
||||
|
||||
data.bibtexAuthors = data.authors.map(function(author){
|
||||
return author.lastName + ", " + author.firstName;
|
||||
}).join(" and ");
|
||||
|
||||
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
|
||||
|
||||
}
|
||||
Vendored
+139
-66
@@ -4205,7 +4205,6 @@ var bibtexParse = createCommonjsModule(function (module, exports) {
|
||||
|
||||
var bibliography = function(dom, data) {
|
||||
var el = dom.querySelector('script[type="text/bibliography"]');
|
||||
var citations = [];
|
||||
var bibliography = {};
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
if (el) {
|
||||
@@ -4226,26 +4225,8 @@ var bibliography = function(dom, data) {
|
||||
bibliography[e.citationKey].type = e.entryType;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
citeTags.forEach(function (el) {
|
||||
var key = el.getAttribute("key");
|
||||
if (key) {
|
||||
var citationKeys = key.split(",");
|
||||
citationKeys.forEach(function (key) {
|
||||
if (citations.indexOf(key) == -1){
|
||||
citations.push(key);
|
||||
if (!(key in bibliography)){
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
data.bibliography = bibliography;
|
||||
data.citations = citations;
|
||||
};
|
||||
|
||||
var t0 = new Date;
|
||||
@@ -5089,56 +5070,152 @@ var parseIso = +new Date("2000-01-01T00:00:00.000Z")
|
||||
|
||||
var expandData = function(dom, data) {
|
||||
|
||||
data.authors = data.authors || [];
|
||||
//
|
||||
// Properties from source
|
||||
//
|
||||
|
||||
// paths
|
||||
if (!data.distillPath && !data.url) {
|
||||
data.url = "http://distill.pub/";
|
||||
} else if (!data.url) {
|
||||
data.url = "http://distill.pub/" + data.distillPath;
|
||||
// title: 'Attention and Augmented Recurrent Neural Networks',
|
||||
// description: 'A visual overview of neural attention, and the powerful extensions of neural networks being built on top of it.',
|
||||
// url: 'http://distill.pub/2016/augmented-rnns',
|
||||
// tags: [ 'rnn' ],
|
||||
// doiSuffix: 1,
|
||||
// doi: '10.23915/distill.00001',
|
||||
// volume: 1,
|
||||
// issue: 9,
|
||||
// distillPath: '2016/augmented-rnns',
|
||||
// githubPath: 'distillpub/post--augmented-rnns',
|
||||
// githubCompareUpdatesUrl: 'https://github.com/distillpub/post--augmented-rnns/compare/1596e094d8943d2dc0ea445d92071129c6419c59...3bd9209e0c24d020f87cf6152dcecc6017cbc193',
|
||||
// updatedDate: 2017-03-21T07:13:16.000Z,
|
||||
// publishedDate: 2016-09-08T07:00:00.000Z,
|
||||
// journal: {
|
||||
// "title": "Distill",
|
||||
// "full_title": "Distill",
|
||||
// "abbrev_title": "Distill",
|
||||
// "url": "http://distill.pub",
|
||||
// "doi": "10.23915/distill",
|
||||
// "publisherName": "Distill Working Group",
|
||||
// "publisherEmail": "admin@distill.pub",
|
||||
// "issn": "2476-0757",
|
||||
// "editors": [...],
|
||||
// "committee": [...]
|
||||
// }
|
||||
|
||||
//
|
||||
// Computed Properties
|
||||
//
|
||||
|
||||
// githubUrl: 'https://github.com/distillpub/post--augmented-rnns',
|
||||
// previewURL: 'http://distill.pub/2016/augmented-rnns/thumbnail.jpg',
|
||||
// publishedDateRFC: 'Thu, 08 Sep 2016 00:00:00 -0700',
|
||||
// publishedYear: 2016,
|
||||
// publishedMonth: 'Sept',
|
||||
// publishedDay: 8,
|
||||
// publishedMonthPadded: '09',
|
||||
// publishedDayPadded: '08',
|
||||
// updatedDateRFC: 'Tue, 21 Mar 2017 00:13:16 -0700',
|
||||
// concatenatedAuthors: 'Olah & Carter',
|
||||
// bibtexAuthors: 'Olah, Chris and Carter, Shan',
|
||||
// slug: 'olah2016attention'
|
||||
// authors: [
|
||||
// {
|
||||
// "personalURL": null,
|
||||
// "name": "Chris Olah",
|
||||
// "firstName": "Chris",
|
||||
// "lastName": "Olah",
|
||||
// "affiliationURL": null,
|
||||
// "affiliation": "Google Brain"
|
||||
// }
|
||||
// ],
|
||||
// bibliography: {
|
||||
// "gregor2015draw": {
|
||||
// "title": "DRAW: A recurrent neural network for image generation",
|
||||
// "author": "Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan",
|
||||
// "journal": "arXiv preprint arXiv:1502.04623",
|
||||
// "year": "2015",
|
||||
// "url": "https://arxiv.org/pdf/1502.04623.pdf",
|
||||
// "type": "article"
|
||||
// },
|
||||
// ...
|
||||
// },
|
||||
// citations: [
|
||||
// "gregor2015draw",
|
||||
// "mercier2011humans",
|
||||
// "dong2014image",
|
||||
// "dumoulin2016guide",
|
||||
// "mordvintsev2015inceptionism"
|
||||
// ],
|
||||
|
||||
|
||||
// citations:
|
||||
var citations = [];
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
citeTags.forEach(function (el) {
|
||||
var key = el.getAttribute("key");
|
||||
if (key) {
|
||||
var citationKeys = key.split(",");
|
||||
citationKeys.forEach(function (key) {
|
||||
if (citations.indexOf(key) == -1){
|
||||
citations.push(key);
|
||||
if (!(key in data.bibliography)){
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
data.githubUrl = "https://github.com/" + data.githubPath;
|
||||
});
|
||||
data.citations = citations;
|
||||
|
||||
data.previewURL = data.previewURL ? data.previewURL : data.url + "/thumbnail.jpg";
|
||||
|
||||
// Homepage
|
||||
//data.homepage = !post.noHomepage;
|
||||
data.journal = data.journal || {};
|
||||
data.authors = data.authors || [];
|
||||
|
||||
// Dates
|
||||
if (data.publishedDate){//} && data.journal) {
|
||||
data.volume = data.publishedDate.getFullYear() - 2015;
|
||||
data.issue = data.publishedDate.getMonth() + 1;
|
||||
}
|
||||
// paths
|
||||
if (!data.distillPath && !data.url) {
|
||||
data.url = "http://distill.pub/";
|
||||
} else if (!data.url) {
|
||||
data.url = "http://distill.pub/" + data.distillPath;
|
||||
}
|
||||
data.githubUrl = "https://github.com/" + data.githubPath;
|
||||
|
||||
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
|
||||
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
|
||||
data.previewURL = data.previewURL ? data.previewURL : data.url + "/thumbnail.jpg";
|
||||
|
||||
data.publishedDateRFC;
|
||||
var RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
|
||||
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
|
||||
var zeroPad = function (n) { return n < 10 ? "0" + n : n; };
|
||||
data.publishedDateRFC = RFC(data.publishedDate);
|
||||
data.publishedYear = data.publishedDate.getFullYear();
|
||||
data.publishedMonth = months[data.publishedDate.getMonth()];
|
||||
data.publishedDay = data.publishedDate.getDate();
|
||||
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
|
||||
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
|
||||
data.updatedDateRFC = RFC(data.updatedDate);
|
||||
// Homepage
|
||||
//data.homepage = !post.noHomepage;
|
||||
data.journal = data.journal || {};
|
||||
|
||||
if (data.authors.length > 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
|
||||
} else if (data.authors.length === 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
|
||||
} else if (data.authors.length === 1) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName;
|
||||
}
|
||||
// Dates
|
||||
if (data.publishedDate){//} && data.journal) {
|
||||
data.volume = data.publishedDate.getFullYear() - 2015;
|
||||
data.issue = data.publishedDate.getMonth() + 1;
|
||||
}
|
||||
|
||||
data.bibtexAuthors = data.authors.map(function(author){
|
||||
return author.lastName + ", " + author.firstName;
|
||||
}).join(" and ");
|
||||
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
|
||||
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
|
||||
|
||||
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
|
||||
data.publishedDateRFC;
|
||||
var RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
|
||||
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
|
||||
var zeroPad = function (n) { return n < 10 ? "0" + n : n; };
|
||||
data.publishedDateRFC = RFC(data.publishedDate);
|
||||
data.publishedYear = data.publishedDate.getFullYear();
|
||||
data.publishedMonth = months[data.publishedDate.getMonth()];
|
||||
data.publishedDay = data.publishedDate.getDate();
|
||||
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
|
||||
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
|
||||
data.updatedDateRFC = RFC(data.updatedDate);
|
||||
|
||||
if (data.authors.length > 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
|
||||
} else if (data.authors.length === 2) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
|
||||
} else if (data.authors.length === 1) {
|
||||
data.concatenatedAuthors = data.authors[0].lastName;
|
||||
}
|
||||
|
||||
data.bibtexAuthors = data.authors.map(function(author){
|
||||
return author.lastName + ", " + author.firstName;
|
||||
}).join(" and ");
|
||||
|
||||
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
|
||||
|
||||
};
|
||||
|
||||
@@ -6017,17 +6094,13 @@ var appendix = function(dom, data) {
|
||||
var appendixDistill = function(dom, data) {
|
||||
var el = dom.querySelector('dt-appendix > div');
|
||||
if (el) {
|
||||
var existingHTML = el.innerHTML;
|
||||
var newHTML = "";
|
||||
|
||||
newHTML += "<h3>Updates and Corrections</h3>\n<p><a href=\"" + (data.githubCompareUpdatesUrl) + "\">View all changes</a> to this article since it was first published. If you see a mistake or want to suggest a change, please <a class=\"github-issue\" href=\"" + (data.githubUrl) + "/issues/new\">create an issue on GitHub</a>.</p>";
|
||||
newHTML += "<h3>Updates and Corrections</h3>\n <p><a href=\"" + (data.githubCompareUpdatesUrl) + "\">View all changes</a> to this article since it was first published. If you see a mistake or want to suggest a change, please <a class=\"github-issue\" href=\"" + (data.githubUrl) + "/issues/new\">create an issue on GitHub</a>.</p>";
|
||||
|
||||
newHTML += "<h3>Citations and Reuse</h3>\n<p>Diagrams and text are licensed under Creative Commons Attribution <a href=\"https://creativecommons.org/licenses/by/2.0/\">CC-BY 2.0</a>, unless noted otherwise, with the <a class=\"github\" href=\"" + (data.githubUrl) + "\">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>";
|
||||
|
||||
newHTML += "<p>For attribution in academic contexts, please cite this work as</p>\n<pre class=\"citation short\">" + (data.concatenatedAuthors) + ", \"" + (data.title) + "\", " + (data.journal.title) + ", " + (data.publishedYear) + ". http://doi.org/" + (data.doi) + "</pre>";
|
||||
|
||||
newHTML += "<p>BibTeX citation</p>\n<pre class=\"citation long\">@article{" + (data.slug) + ",\n author = {" + (data.bibtexAuthors) + "},\n title = {" + (data.title) + "},\n journal = {" + (data.journal.title) + "},\n year = {" + (data.publishedYear) + "},\n url = {" + (data.url) + "},\n doi = {" + (data.doi) + "}\n}</pre>";
|
||||
newHTML += "<h3>Citations and Reuse</h3>\n <p>Diagrams and text are licensed under Creative Commons Attribution <a href=\"https://creativecommons.org/licenses/by/2.0/\">CC-BY 2.0</a>, unless noted otherwise, with the <a class=\"github\" href=\"" + (data.githubUrl) + "\">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>\n\n <p>For attribution in academic contexts, please cite this work as</p>\n <pre class=\"citation short\">" + (data.concatenatedAuthors) + ", \"" + (data.title) + "\", " + (data.journal.title) + ", " + (data.publishedYear) + ". http://doi.org/" + (data.doi) + "</pre>\n\n <p>BibTeX citation</p>\n<pre class=\"citation long\">@article{" + (data.slug) + ",\n author = {" + (data.bibtexAuthors) + "},\n title = {" + (data.title) + "},\n journal = {" + (data.journal.title) + "},\n year = {" + (data.publishedYear) + "},\n url = {" + (data.url) + "},\n doi = {" + (data.doi) + "}\n}</pre>";
|
||||
|
||||
var existingHTML = el.innerHTML;
|
||||
el.innerHTML = existingHTML + newHTML;
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@ import html from "./components/html";
|
||||
import styles from "./components/styles";
|
||||
import frontMatter from "./components/front-matter";
|
||||
import bibliography from "./components/bibliography";
|
||||
import expandData from "./components/expand-data";
|
||||
import expandData from "./components/data";
|
||||
import meta from "./components/meta";
|
||||
import banner from "./components/banner";
|
||||
import byline from "./components/byline";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Gulp with Mustache Templates
|
||||
|
||||
To get started, make sure to run `yarn install` or `npm install` to install dependencies.
|
||||
|
||||
Run `gulp` to build the project. Running `gulp serve` will run a watching server.
|
||||
|
||||
There is very little processing going on, the only thing we've added is support for mustache partials.
|
||||
Reference in New Issue
Block a user