1 | const html = `
|
2 | <style>
|
3 | dt-appendix {
|
4 | display: block;
|
5 | font-size: 14px;
|
6 | line-height: 24px;
|
7 | margin-bottom: 0;
|
8 | border-top: 1px solid rgba(0,0,0,0.1);
|
9 | color: rgba(0,0,0,0.5);
|
10 | background: rgb(250, 250, 250);
|
11 | padding-top: 36px;
|
12 | padding-bottom: 60px;
|
13 | }
|
14 | dt-appendix h3 {
|
15 | font-size: 16px;
|
16 | font-weight: 500;
|
17 | margin-top: 18px;
|
18 | margin-bottom: 18px;
|
19 | color: rgba(0,0,0,0.65);
|
20 | }
|
21 | dt-appendix .citation {
|
22 | font-size: 11px;
|
23 | line-height: 15px;
|
24 | border-left: 1px solid rgba(0, 0, 0, 0.1);
|
25 | padding-left: 18px;
|
26 | border: 1px solid rgba(0,0,0,0.1);
|
27 | background: rgba(0, 0, 0, 0.02);
|
28 | padding: 10px 18px;
|
29 | border-radius: 3px;
|
30 | color: rgba(150, 150, 150, 1);
|
31 | overflow: hidden;
|
32 | margin-top: -12px;
|
33 | }
|
34 | dt-appendix .references {
|
35 | font-size: 12px;
|
36 | line-height: 20px;
|
37 | }
|
38 | dt-appendix a {
|
39 | color: rgba(0, 0, 0, 0.6);
|
40 | }
|
41 | dt-appendix ol,
|
42 | dt-appendix ul {
|
43 | padding-left: 24px;
|
44 | }
|
45 | </style>
|
46 |
|
47 | <div class="l-body">
|
48 | <h3>References</h3>
|
49 | <dt-bibliography></dt-bibliography>
|
50 | <h3 id="citation">Errors, Reuse, and Citation</h3>
|
51 | <p>If you see mistakes or want to suggest changes, please <a class="github-issue">create an issue on GitHub</a>.</p>
|
52 | <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>
|
53 | <p>For attribution in academic contexts, please cite this work as</p>
|
54 | <pre class="citation short"></pre>
|
55 | <p>BibTeX citation</p>
|
56 | <pre class="citation long"></pre>
|
57 | </div>
|
58 | `;
|
59 |
|
60 | export default function(dom, data) {
|
61 | let el = dom.querySelector('dt-appendix')
|
62 | if (el) {
|
63 | let oldHtml = el.innerHTML;
|
64 | el.innerHTML = html;
|
65 | let div = el.querySelector("div.l-body")
|
66 |
|
67 | if (dom.querySelector("dt-fn")) {
|
68 | div.innerHTML = `<h3>Footnotes</h3><dt-fn-list></dt-fn-list>` + div.innerHTML;
|
69 | }
|
70 |
|
71 | div.innerHTML = oldHtml + div.innerHTML;
|
72 | if (data.githubCompareUpdatesUrl) {
|
73 | div.innerHTML = `<h3>Updates</h3><p><a href="${data.githubCompareUpdatesUrl}">View all changes</a> to this article since it was first published.</p>` + div.innerHTML;
|
74 | }
|
75 |
|
76 | el.querySelector("a.github").setAttribute("href", data.githubUrl);
|
77 | el.querySelector("a.github-issue").setAttribute("href", data.githubUrl + "/issues/new");
|
78 | el.querySelector(".citation.short").textContent = data.concatenatedAuthors + ", " + '"' + data.title + '", Distill, ' + data.publishedYear + ".";
|
79 | var bibtex = "@article{" + data.slug + ",\n";
|
80 | bibtex += " author = {" + data.bibtexAuthors + "},\n";
|
81 | bibtex += " title = {" + data.title + "},\n";
|
82 | bibtex += " journal = {Distill},\n";
|
83 | bibtex += " year = {" + data.publishedYear + "},\n";
|
84 | bibtex += " note = {" + data.url + "}\n";
|
85 | bibtex += "}";
|
86 | el.querySelector(".citation.long").textContent = bibtex;
|
87 | }
|
88 |
|
89 | }
|