This commit is contained in:
Shan Carter
2017-01-11 10:34:33 -08:00
parent 9ebc8d5ea6
commit 10c436ffb2
7 changed files with 125 additions and 91 deletions
+18 -19
View File
@@ -47,8 +47,8 @@ const html = `
<h3>References</h3>
<dt-bibliography></dt-bibliography>
<h3 id="citation">Errors, Reuse, and Citation</h3>
<p>If you see mistakes or want to suggest changes, please submit a pull request on <a class="github">github</a>.</p>
<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 source available on available on <a class="github">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>
<p>If you see mistakes or want to suggest changes, please <a class="github-issue">create an issue on GitHub</a>.</p>
<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">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>
<p>For attribution in academic contexts, please cite this work as</p>
<pre class="citation short"></pre>
<p>BibTeX citation</p>
@@ -56,23 +56,22 @@ const html = `
</div>
`;
// distill.data().then(function(data) {
// var as = el.querySelectorAll("a.github");
// [].forEach.call(as, function(a) {
// a.setAttribute("href", data.github);
// });
// el.querySelector(".citation.short").textContent = data.concatenatedAuthors + ", " + '"' + data.title + '", Distill, ' + data.firstPublishedYear + ".";
// var bibtex = "@article{" + data.slug + ",\n";
// bibtex += " author = {" + data.bibtexAuthors + "},\n";
// bibtex += " title = {" + data.title + "},\n";
// bibtex += " journal = {Distill},\n";
// bibtex += " year = {" + data.firstPublishedYear + "},\n";
// bibtex += " note = {" + data.url + "}\n";
// bibtex += "}";
// el.querySelector(".citation.long").textContent = bibtex;
// })
export default function(dom, data) {
let el = dom.querySelector('dt-appendix')
if (el) el.innerHTML = html;
if (el) {
el.innerHTML = html;
el.querySelector("a.github").setAttribute("href", data.githubUrl);
el.querySelector("a.github-issue").setAttribute("href", data.githubUrl + "/issues/new");
el.querySelector(".citation.short").textContent = data.concatenatedAuthors + ", " + '"' + data.title + '", Distill, ' + data.publishedYear + ".";
var bibtex = "@article{" + data.slug + ",\n";
bibtex += " author = {" + data.bibtexAuthors + "},\n";
bibtex += " title = {" + data.title + "},\n";
bibtex += " journal = {Distill},\n";
bibtex += " year = {" + data.publishedYear + "},\n";
bibtex += " note = {" + data.url + "}\n";
bibtex += "}";
el.querySelector(".citation.long").textContent = bibtex;
}
}