mirror of
https://github.com/wassname/template.git
synced 2026-06-28 04:07:59 +08:00
Compare commits
177 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6422c27090 | |||
| adba0f6e9b | |||
| 84503f98ae | |||
| 940b70ce5b | |||
| c884d2f018 | |||
| 5ed8b40f23 | |||
| 6f4a44227f | |||
| 2c9850920b | |||
| 0abf0247e2 | |||
| 5c4b1108b6 | |||
| 11b5186394 | |||
| 04fa4ebb8c | |||
| 5292390ba8 | |||
| 0f9e12b1f1 | |||
| e606c84700 | |||
| f96ba800d8 | |||
| 84c90fbef4 | |||
| 0344bc2704 | |||
| afc798f7a0 | |||
| cecaa95989 | |||
| 87d1276564 | |||
| 397bc72df0 | |||
| b19b918466 | |||
| aef31660cc | |||
| 22b1f06a12 | |||
| 6394270d58 | |||
| 788546b8ca | |||
| b3efa2526d | |||
| c24a1d0485 | |||
| 7a5a9bbe74 | |||
| a8c29e227a | |||
| be4e9453c2 | |||
| 22fd0e2b21 | |||
| f362584a74 | |||
| a85517e61b | |||
| 1b7964f626 | |||
| befa67b4dd | |||
| f3578fbf15 | |||
| 56e8de28c4 | |||
| a770e93ec9 | |||
| dceed2ac71 | |||
| ac37a19124 | |||
| e622bd0caa | |||
| cdb4263487 | |||
| 9e14a84149 | |||
| abea1dad49 | |||
| c4c94867bf | |||
| 4bd4c4dcf9 | |||
| bf0cefac67 | |||
| f2cbc9ead4 | |||
| f6cb5bed7d | |||
| 2fd62c518d | |||
| 6c2a450662 | |||
| af02c0a845 | |||
| eb8bc670c9 | |||
| 6721d1f2db | |||
| b439644064 | |||
| 7698d45885 | |||
| b5d5e2a2f1 | |||
| 47ed46b52f | |||
| a1651d2195 | |||
| 4ba3780f88 | |||
| 23889d702e | |||
| 815758622d | |||
| b78eaf1a49 | |||
| f19e65c68c | |||
| 056c74d2dd | |||
| 174edd5973 | |||
| 8162b8ea2d | |||
| 97acdc60d6 | |||
| de7ec5fc58 | |||
| 0c49900eae | |||
| 5dac7eed8b | |||
| e8e1a353ef | |||
| 19da5e90c4 | |||
| 1995d75cb0 | |||
| 571d437fcf | |||
| 2197327ca6 | |||
| 7426809669 | |||
| 00ccea8950 | |||
| e637010296 | |||
| e95a67b236 | |||
| 354293079a | |||
| 4e3640f5d1 | |||
| 0cfdef58c1 | |||
| 8f0b24e0a1 | |||
| cde1ca1121 | |||
| 47bf2ad986 | |||
| 3c167692ae | |||
| 495804e37d | |||
| 5c20980664 | |||
| 1a30efb26f | |||
| ad87af296d | |||
| fbcedcf9d5 | |||
| 33aa934b8b | |||
| b278859a61 | |||
| f549e6e2bd | |||
| 9e76725bc6 | |||
| cc02e9aa20 | |||
| 50b73d8e35 | |||
| a411a2a3ed | |||
| e4bb6c0ba6 | |||
| 7df82584e7 | |||
| 83c6a8c161 | |||
| e40e69733a | |||
| 353f205ae7 | |||
| 122ca1d50f | |||
| 05d90a2b5b | |||
| 8f55384b9a | |||
| 347f509660 | |||
| 02a6b5f1f1 | |||
| b914701d2b | |||
| 9c31a1ae49 | |||
| 80b752ccdb | |||
| 9b74a4e43c | |||
| 02e81e2a8b | |||
| 93e95030f4 | |||
| 45a8c03dc3 | |||
| 6ef2df375c | |||
| 42fd20f2ac | |||
| 7e03641e08 | |||
| bc04e18aba | |||
| ecfe234414 | |||
| f190b3bef7 | |||
| 8627c53506 | |||
| b6140bec36 | |||
| f6c8a2a870 | |||
| d8bc87061d | |||
| e107e72cd0 | |||
| 44af921b8c | |||
| 3e61d836ea | |||
| 548037bbe2 | |||
| d7d256946d | |||
| 1844906ec4 | |||
| beb7b6e195 | |||
| e54311ee40 | |||
| febbb4fb5f | |||
| d70d9f35f9 | |||
| 3dc4f84514 | |||
| 93d61449f9 | |||
| 10c436ffb2 | |||
| 9ebc8d5ea6 | |||
| 2ab2f0ffd5 | |||
| 30b0fdd880 | |||
| a81b614e02 | |||
| 651b650d7b | |||
| b389feff21 | |||
| f4cd0a580a | |||
| 20efb33c32 | |||
| 5f837d38b4 | |||
| 712d859dad | |||
| 2010c6d6be | |||
| 9c40d08edd | |||
| 501e624d74 | |||
| 5ff2ea745f | |||
| 460a989897 | |||
| d5c70f7c19 | |||
| 66467a9e12 | |||
| 758697ab97 | |||
| 4428ad1a5f | |||
| c77fbbd18f | |||
| adcfba4627 | |||
| 6ef3847bf6 | |||
| 0b68c4ea1f | |||
| 60cf026b88 | |||
| b30d4084ef | |||
| 8aa8ef2206 | |||
| c0824c1827 | |||
| 7fe35c3b88 | |||
| b0b3265f72 | |||
| 971e90069e | |||
| c8fa1f7eaa | |||
| 05179d887e | |||
| c02748434c | |||
| bed9a09325 | |||
| 010daea5f5 | |||
| 65ca734aa3 |
+18
@@ -0,0 +1,18 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node" # latest version
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
script:
|
||||
- yarn build
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GITHUB_OAUTH_TOKEN
|
||||
file_glob: true
|
||||
file: dist/*
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
on:
|
||||
tags: true
|
||||
@@ -1,5 +1,25 @@
|
||||
# Distill Templates
|
||||
|
||||
This is the repository for the distill web framework. If you're interesting in just using the framework to write an article for the [Distill journal](http://distill.pub), visit http://distill.pub/guide/.
|
||||
|
||||
The general process for using this framework is to hotlink the compiled code in your dev environment.
|
||||
|
||||
```html
|
||||
<script src="http://distill.pub/template.v1.js"></script>
|
||||
```
|
||||
|
||||
You can also install it as a local dependency through npm or with [yarn](https://yarnpkg.com).
|
||||
|
||||
```
|
||||
npm install --D distill-template
|
||||
```
|
||||
|
||||
If you're interested in submitting pull requests or developing on the framework itself, read on.
|
||||
|
||||
## Development
|
||||
|
||||
Run `yarn start` to start a watching build rollup server. To view the sample pages in the repo, you can run `yarn serve` as a separate process which starts a static server. `yarn build` will run a one-time build.
|
||||
|
||||
## Testing
|
||||
|
||||
Run `yarn test`. That's it.
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs"),
|
||||
jsdom = require("jsdom").jsdom,
|
||||
serializeDocument = require("jsdom").serializeDocument,
|
||||
distill = require("../dist/template.js"),
|
||||
program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-i, --input <path>', 'path to input file.')
|
||||
.parse(process.argv);
|
||||
|
||||
let htmlString = fs.readFileSync(program.input, "utf8");
|
||||
var dom = jsdom(htmlString, {features: {ProcessExternalResources: false, FetchExternalResources: false}});
|
||||
distill.render(dom, {});
|
||||
let transformedHtml = serializeDocument(dom);
|
||||
process.stdout.write(transformedHtml);
|
||||
@@ -0,0 +1,28 @@
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('dt-appendix > div');
|
||||
if (el) {
|
||||
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 id="citation">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>
|
||||
|
||||
<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>BibTeX citation</p>
|
||||
<pre class="citation long">@article{${data.slug},
|
||||
author = {${data.bibtexAuthors}},
|
||||
title = {${data.title}},
|
||||
journal = {${data.journal.title}},
|
||||
year = {${data.publishedYear}},
|
||||
url = {${data.url}},
|
||||
doi = {${data.doi}}
|
||||
}</pre>`;
|
||||
|
||||
let existingHTML = el.innerHTML;
|
||||
el.innerHTML = existingHTML + newHTML;
|
||||
}
|
||||
}
|
||||
+25
-31
@@ -1,18 +1,15 @@
|
||||
const html = `
|
||||
const templateHTML = `
|
||||
<style>
|
||||
dt-appendix {
|
||||
display: block;
|
||||
font-family: "Open Sans";
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
margin-bottom: 0;
|
||||
border-top: 1px solid rgba(0,0,0,0.1);
|
||||
color: rgba(0,0,0,0.5);
|
||||
background: rgba(0,0,0,0.025);
|
||||
background: rgb(250, 250, 250);
|
||||
padding-top: 36px;
|
||||
padding-right: 24px;
|
||||
padding-bottom: 60px;
|
||||
padding-left: 24px;
|
||||
}
|
||||
dt-appendix h3 {
|
||||
font-size: 16px;
|
||||
@@ -41,38 +38,35 @@ const html = `
|
||||
dt-appendix a {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
dt-appendix ol,
|
||||
dt-appendix ul {
|
||||
padding-left: 24px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="l-body">
|
||||
<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>For attribution in academic contexts, please cite this work as</p>
|
||||
<pre class="citation short"></pre>
|
||||
<p>BibTeX citation</p>
|
||||
<pre class="citation long"></pre>
|
||||
</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) {
|
||||
let userHTML = el.innerHTML;
|
||||
el.innerHTML = templateHTML;
|
||||
let newHTML = "";
|
||||
|
||||
// If we have some footnotes on the page, render a container for the footnote list.
|
||||
if (dom.querySelector("dt-fn")) {
|
||||
newHTML = newHTML + `<h3>Footnotes</h3><dt-fn-list></dt-fn-list>`;
|
||||
}
|
||||
|
||||
// If we have any citations on the page, render a container for the bibliography.
|
||||
if (dom.querySelector("dt-cite")) {
|
||||
newHTML = newHTML + `<h3>References</h3><dt-bibliography></dt-bibliography>`;
|
||||
}
|
||||
|
||||
let div = el.querySelector("div.l-body")
|
||||
div.innerHTML = userHTML + newHTML;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
const html = `
|
||||
<style>
|
||||
dt-banner {
|
||||
background: #FFF59D;
|
||||
display: block;
|
||||
text-align: center;
|
||||
color: black;
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
}
|
||||
</style>
|
||||
<div>This article is a draft, awaiting review for publication in Distill</div>
|
||||
`;
|
||||
|
||||
export default function(dom, data) {
|
||||
let banner = dom.createElement("dt-banner");
|
||||
banner.innerHTML = html;
|
||||
let b = dom.querySelector("body");
|
||||
b.insertBefore(banner, b.firstChild);
|
||||
banner.addEventListener("click", function() {
|
||||
banner.style.display = "none";
|
||||
});
|
||||
}
|
||||
+18
-25
@@ -2,33 +2,26 @@ import bibtexParse from "bibtex-parse-js";
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('script[type="text/bibliography"]');
|
||||
|
||||
let bibliography = {};
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
if (el) {
|
||||
let rawBib = el.textContent;
|
||||
let bibliography = {};
|
||||
bibtexParse.toJSON(rawBib).forEach(e => {
|
||||
bibliography[e.citationKey] = e.entryTags;
|
||||
bibliography[e.citationKey].type = e.entryType;
|
||||
});
|
||||
|
||||
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 bibliography)){
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
data.bibliography = bibliography;
|
||||
data.citations = citations;
|
||||
let parsed = bibtexParse.toJSON(rawBib);
|
||||
if(parsed) {
|
||||
parsed.forEach(e => {
|
||||
for (var k in e.entryTags){
|
||||
var val = e.entryTags[k];
|
||||
val = val.replace(/[\t\n ]+/g, " ");
|
||||
val = val.replace(/{\\["^`\.'acu~Hvs]( )?([a-zA-Z])}/g,
|
||||
(full, x, char) => char);
|
||||
val = val.replace(/{\\([a-zA-Z])}/g,
|
||||
(full, char) => char);
|
||||
e.entryTags[k.toLowerCase()] = val;
|
||||
}
|
||||
bibliography[e.citationKey] = e.entryTags;
|
||||
bibliography[e.citationKey].type = e.entryType;
|
||||
});
|
||||
}
|
||||
}
|
||||
data.bibliography = bibliography;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
import mustache from "mustache";
|
||||
|
||||
const html = `
|
||||
<style>
|
||||
dt-byline {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
display: block;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
dt-article.centered dt-byline {
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
dt-byline a,
|
||||
dt-article dt-byline a {
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
dt-article dt-byline a:hover {
|
||||
text-decoration: underline;
|
||||
border-bottom: none;
|
||||
}
|
||||
dt-byline .authors {
|
||||
text-align: left;
|
||||
}
|
||||
dt-byline .name {
|
||||
display: inline;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
dt-byline .affiliation {
|
||||
display: inline;
|
||||
}
|
||||
dt-byline .date {
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
dt-byline .year, dt-byline .month {
|
||||
display: inline;
|
||||
}
|
||||
dt-byline .citation {
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
dt-byline .citation div {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@media(min-width: 768px) {
|
||||
dt-byline {
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 1080px) {
|
||||
dt-byline {
|
||||
border-bottom: none;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
dt-byline a:hover {
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
}
|
||||
|
||||
dt-byline .authors {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
dt-byline .author {
|
||||
display: inline-block;
|
||||
margin-right: 12px;
|
||||
/*padding-left: 20px;*/
|
||||
/*border-left: 1px solid #ddd;*/
|
||||
}
|
||||
|
||||
dt-byline .affiliation {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt-byline .author:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
dt-byline .name {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt-byline .date {
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
||||
padding-left: 15px;
|
||||
margin-left: 15px;
|
||||
display: inline-block;
|
||||
}
|
||||
dt-byline .year, dt-byline .month {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt-byline .citation {
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.15);
|
||||
padding-left: 15px;
|
||||
margin-left: 15px;
|
||||
display: inline-block;
|
||||
}
|
||||
dt-byline .citation div {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
`;
|
||||
|
||||
const template = `
|
||||
<div class="byline">
|
||||
<div class="authors">
|
||||
{{#authors}}
|
||||
<div class="author">
|
||||
{{#personalURL}}
|
||||
<a class="name" href="{{personalURL}}">{{name}}</a>
|
||||
{{/personalURL}}
|
||||
{{^personalURL}}
|
||||
<div class="name">{{name}}</div>
|
||||
{{/personalURL}}
|
||||
{{#affiliation}}
|
||||
{{#affiliationURL}}
|
||||
<a class="affiliation" href="{{affiliationURL}}">{{affiliation}}</a>
|
||||
{{/affiliationURL}}
|
||||
{{^affiliationURL}}
|
||||
<div class="affiliation">{{affiliation}}</div>
|
||||
{{/affiliationURL}}
|
||||
{{/affiliation}}
|
||||
</div>
|
||||
{{/authors}}
|
||||
</div>
|
||||
{{#publishedYear}}
|
||||
<div class="date">
|
||||
<div class="month">{{publishedMonth}}. {{publishedDay}}</div>
|
||||
<div class="year">{{publishedYear}}</div>
|
||||
</div>
|
||||
{{/publishedYear}}
|
||||
{{#publishedYear}}
|
||||
<a class="citation" href="#citation">
|
||||
<div>Citation:</div>
|
||||
<div>{{concatenatedAuthors}}, {{publishedYear}}</div>
|
||||
</a>
|
||||
{{/publishedYear}}
|
||||
</div>
|
||||
`
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('dt-byline');
|
||||
if (el) {
|
||||
el.innerHTML = html + mustache.render(template, data);
|
||||
}
|
||||
}
|
||||
+174
-31
@@ -1,4 +1,33 @@
|
||||
export default function(dom, data) {
|
||||
let css = `
|
||||
dt-cite {
|
||||
color: hsla(206, 90%, 20%, 0.7);
|
||||
}
|
||||
dt-cite .citation-number {
|
||||
cursor: default;
|
||||
white-space: nowrap;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Roboto", Helvetica, sans-serif;
|
||||
font-size: 75%;
|
||||
color: hsla(206, 90%, 20%, 0.7);
|
||||
display: inline-block;
|
||||
line-height: 1.1em;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
margin: 0 2px;
|
||||
}
|
||||
figcaption dt-cite .citation-number {
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
top: -2px;
|
||||
line-height: 1em;
|
||||
}
|
||||
`;
|
||||
|
||||
let style = dom.createElement("style");
|
||||
style.textContent = css;
|
||||
dom.querySelector("body").appendChild(style);
|
||||
|
||||
let citations = data.citations;
|
||||
/*if (data.citations) {
|
||||
citations = Object.keys(data.citations).map(c => data.citations[c]);
|
||||
@@ -6,16 +35,42 @@ export default function(dom, data) {
|
||||
return a.author.localeCompare(b.author);
|
||||
});
|
||||
}*/
|
||||
|
||||
var appendCiteHoverDiv = (function() {
|
||||
function nodeFromString(str) {
|
||||
var div = dom.createElement("div");
|
||||
div.innerHTML = str;
|
||||
return div.firstChild;
|
||||
}
|
||||
var hover_boxes_container = nodeFromString(`<div id="cite-hover-boxes-container"></div>`)
|
||||
dom.querySelector("body").appendChild(hover_boxes_container);
|
||||
var hover_n = 0;
|
||||
return function appendHoverDiv(content) {
|
||||
var id = `dt-cite-hover-box-${hover_n}`;
|
||||
hover_n += 1;
|
||||
var str = `<div style="display:none;" class="dt-hover-box" id="${id}" >${content}</div>`;
|
||||
var div = nodeFromString(str);
|
||||
hover_boxes_container.appendChild(div);
|
||||
return id;
|
||||
}
|
||||
})();
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
console.log(citeTags);
|
||||
citeTags.forEach(el => {
|
||||
citeTags.forEach((el,n) => {
|
||||
var key = el.getAttribute("key");
|
||||
if (key) {
|
||||
var keys = key.split(",");
|
||||
console.log(keys)
|
||||
var cite_string = inline_cite_short(keys);
|
||||
el.innerHTML = cite_string;
|
||||
var cite_hover_str = "";
|
||||
keys.map((key,n) => {
|
||||
if (n>0) cite_hover_str += "<br><br>";
|
||||
cite_hover_str += hover_cite(data.bibliography[key]);
|
||||
});
|
||||
var ref_id = appendCiteHoverDiv(cite_hover_str);
|
||||
//cite_hover_str = cite_hover_str.replace(/"/g, "'")
|
||||
var orig_string = el.innerHTML;
|
||||
if (orig_string != "") orig_string += " ";
|
||||
el.innerHTML = `<span id="citation-${n}" data-hover-ref="${ref_id}">${orig_string}<span class="citation-number">${cite_string}</span></span>`;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +79,7 @@ export default function(dom, data) {
|
||||
let ol = dom.createElement("ol");
|
||||
citations.forEach(key => {
|
||||
let el = dom.createElement("li");
|
||||
el.textContent = bibliography_cite(data.bibliography[key]);
|
||||
el.innerHTML = bibliography_cite(data.bibliography[key]);
|
||||
ol.appendChild(el);
|
||||
})
|
||||
bibEl.appendChild(ol);
|
||||
@@ -59,38 +114,126 @@ export default function(dom, data) {
|
||||
return keys.map(cite_string).join(", ");
|
||||
}
|
||||
|
||||
function bibliography_cite(ent){
|
||||
if (ent){
|
||||
var names = ent.author.split(" and ");
|
||||
var cite = "";
|
||||
let name_strings = names.map(name => {
|
||||
function author_string(ent, template, sep, finalSep){
|
||||
var names = ent.author.split(" and ");
|
||||
let name_strings = names.map(name => {
|
||||
name = name.trim();
|
||||
if (name.indexOf(",") != -1){
|
||||
var last = name.split(",")[0].trim();
|
||||
var firsts = name.split(",")[1];
|
||||
if (firsts != undefined) {
|
||||
var initials = firsts.trim().split(" ").map(s => s.trim()[0]);
|
||||
return last + ", " + initials.join(".")+".";
|
||||
}
|
||||
return last;
|
||||
});
|
||||
if (names.length > 1) {
|
||||
cite += name_strings.slice(0, names.length-1).join(", ");
|
||||
cite += " and " + name_strings[names.length-1];
|
||||
} else {
|
||||
cite += name_strings[0]
|
||||
var last = name.split(" ").slice(-1)[0].trim();
|
||||
var firsts = name.split(" ").slice(0,-1).join(" ");
|
||||
}
|
||||
cite += ", " + ent.year + ". "
|
||||
cite += ent.title + ". "
|
||||
cite += (ent.journal || ent.booktitle || "")
|
||||
if ("volume" in ent){
|
||||
var issue = ent.issue || ent.number;
|
||||
issue = (issue != undefined)? "("+issue+")" : "";
|
||||
cite += ", Vol " + ent.volume + issue;
|
||||
var initials = "";
|
||||
if (firsts != undefined) {
|
||||
initials = firsts.trim().split(" ").map(s => s.trim()[0]);
|
||||
initials = initials.join(".")+".";
|
||||
}
|
||||
if ("pages" in ent){
|
||||
cite += ", pp. " + ent.pages
|
||||
return template.replace("${F}", firsts)
|
||||
.replace("${L}", last)
|
||||
.replace("${I}", initials);
|
||||
});
|
||||
if (names.length > 1) {
|
||||
var str = name_strings.slice(0, names.length-1).join(sep);
|
||||
str += (finalSep || sep) + name_strings[names.length-1];
|
||||
return str;
|
||||
} else {
|
||||
return name_strings[0];
|
||||
}
|
||||
}
|
||||
|
||||
function venue_string(ent) {
|
||||
var cite = (ent.journal || ent.booktitle || "")
|
||||
if ("volume" in ent){
|
||||
var issue = ent.issue || ent.number;
|
||||
issue = (issue != undefined)? "("+issue+")" : "";
|
||||
cite += ", Vol " + ent.volume + issue;
|
||||
}
|
||||
if ("pages" in ent){
|
||||
cite += ", pp. " + ent.pages
|
||||
}
|
||||
if (cite != "") cite += ". "
|
||||
if ("publisher" in ent){
|
||||
cite += ent.publisher;
|
||||
if (cite[cite.length-1] != ".") cite += ".";
|
||||
}
|
||||
return cite;
|
||||
}
|
||||
|
||||
function link_string(ent){
|
||||
if ("url" in ent){
|
||||
var url = ent.url;
|
||||
var arxiv_match = (/arxiv\.org\/abs\/([0-9\.]*)/).exec(url);
|
||||
if (arxiv_match != null){
|
||||
url = `http://arxiv.org/pdf/${arxiv_match[1]}.pdf`;
|
||||
}
|
||||
cite += ". "
|
||||
|
||||
if (url.slice(-4) == ".pdf"){
|
||||
var label = "PDF";
|
||||
} else if (url.slice(-5) == ".html") {
|
||||
var label = "HTML";
|
||||
}
|
||||
return `  <a href="${url}">[${label||"link"}]</a>`;
|
||||
}/* else if ("doi" in ent){
|
||||
return `  <a href="https://doi.org/${ent.doi}" >[DOI]</a>`;
|
||||
}*/ else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function doi_string(ent, new_line){
|
||||
if ("doi" in ent) {
|
||||
return `${new_line?"<br>":""} <a href="https://doi.org/${ent.doi}" style="text-decoration:inherit;">DOI: ${ent.doi}</a>`;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function bibliography_cite(ent, fancy){
|
||||
if (ent){
|
||||
var cite = "<b>" + ent.title + "</b> "
|
||||
cite += link_string(ent) + "<br>";
|
||||
cite += author_string(ent, "${L}, ${I}", ", ", " and ");
|
||||
if (ent.year || ent.date){
|
||||
cite += ", " + (ent.year || ent.date) + ". "
|
||||
} else {
|
||||
cite += ". "
|
||||
}
|
||||
cite += venue_string(ent);
|
||||
cite += doi_string(ent);
|
||||
return cite
|
||||
/*var cite = author_string(ent, "${L}, ${I}", ", ", " and ");
|
||||
if (ent.year || ent.date){
|
||||
cite += ", " + (ent.year || ent.date) + ". "
|
||||
} else {
|
||||
cite += ". "
|
||||
}
|
||||
cite += "<b>" + ent.title + "</b>. ";
|
||||
cite += venue_string(ent);
|
||||
cite += doi_string(ent);
|
||||
cite += link_string(ent);
|
||||
return cite*/
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
function hover_cite(ent){
|
||||
if (ent){
|
||||
var cite = "";
|
||||
cite += "<b>" + ent.title + "</b>";
|
||||
cite += link_string(ent);
|
||||
cite += "<br>"
|
||||
|
||||
var a_str = author_string(ent, "${I} ${L}", ", ") + ".";
|
||||
var v_str = venue_string(ent).trim() + " " + ent.year + ". " + doi_string(ent, true);
|
||||
|
||||
if ((a_str+v_str).length < Math.min(40, ent.title.length)) {
|
||||
cite += a_str + " " + v_str;
|
||||
} else {
|
||||
cite += a_str + "<br>" + v_str;
|
||||
}
|
||||
return cite;
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
@@ -98,7 +241,7 @@ export default function(dom, data) {
|
||||
|
||||
|
||||
//https://scholar.google.com/scholar?q=allintitle%3ADocument+author%3Aolah
|
||||
function get_URL(ent){
|
||||
function get_GS_URL(ent){
|
||||
if (ent){
|
||||
var names = ent.author.split(" and ");
|
||||
names = names.map(name => name.split(",")[0].trim())
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/components/prism-python";
|
||||
import "prismjs/components/prism-clike";
|
||||
import "prismjs/components/prism-lua";
|
||||
import "prismjs/components/prism-bash";
|
||||
import "prismjs/components/prism-go";
|
||||
import "prismjs/components/prism-markdown";
|
||||
import "prismjs/components/prism-julia";
|
||||
|
||||
|
||||
export default function(dom, data) {
|
||||
let codeElements = [].slice.call(dom.querySelectorAll("dt-code"));
|
||||
|
||||
@@ -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,3 +1,3 @@
|
||||
<svg viewBox="-607 419 64 64">
|
||||
<path style="fill: none; stroke: black;stroke-width: 2px;" d="M-573.4,478.9c-8,0-14.6-6.4-14.6-14.5s14.6-25.9,14.6-40.8c0,14.9,14.6,32.8,14.6,40.8S-565.4,478.9-573.4,478.9z"/>
|
||||
<path d="M-573.4,478.9c-8,0-14.6-6.4-14.6-14.5s14.6-25.9,14.6-40.8c0,14.9,14.6,32.8,14.6,40.8S-565.4,478.9-573.4,478.9z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 163 B |
@@ -0,0 +1,18 @@
|
||||
import katex from "katex";
|
||||
|
||||
const html = `
|
||||
<style>
|
||||
dt-math[block] {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
|
||||
export default function(dom, data) {
|
||||
let equationElements = [].slice.call(dom.querySelectorAll("dt-math"));
|
||||
equationElements.forEach(el => {
|
||||
let content = el.textContent;
|
||||
let displayMode = el.hasAttribute("block") ? true : false;
|
||||
el.innerHTML = html + katex.renderToString(content, {displayMode: displayMode});
|
||||
});
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
export default function(dom, data) {
|
||||
|
||||
data.authors = data.authors || [];
|
||||
|
||||
// paths
|
||||
//data.distillPath = post.distillPath;
|
||||
//data.githubPath = post.githubPath;
|
||||
//data.url = "http://distill.pub/" + post.distillPath;
|
||||
//data.githubUrl = "https://github.com/" + post.githubPath;
|
||||
|
||||
// Homepage
|
||||
//data.homepage = !post.noHomepage;
|
||||
|
||||
// Dates
|
||||
// TODO: fix updated date
|
||||
if (data.published){//} && data.journal) {
|
||||
data.volume = data.published.getFullYear() - 2015;
|
||||
data.issue = data.published.getMonth() + 1;
|
||||
}
|
||||
/*
|
||||
//let RFC = d3.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.volume = data.publishedDate.getFullYear() - 2015;
|
||||
data.issue = data.publishedDate.getMonth() + 1;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
+38
-9
@@ -8,36 +8,65 @@ dt-footer {
|
||||
font-weight: 300;
|
||||
padding: 40px 0;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
background-color: hsl(200, 60%, 15%);
|
||||
text-align: center;
|
||||
}
|
||||
dt-footer .logo svg {
|
||||
width: 24px;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
margin-right: -2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
dt-footer .logo svg path {
|
||||
stroke: rgba(255, 255, 255, 0.8)!important;
|
||||
stroke-width: 3px!important;
|
||||
fill: none;
|
||||
stroke: rgba(255, 255, 255, 0.8);
|
||||
stroke-width: 3px;
|
||||
}
|
||||
dt-footer .logo {
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
font-size: 17px;
|
||||
font-weight: 200;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
text-decoration: none;
|
||||
margin-right: 6px;
|
||||
}
|
||||
dt-footer .nav {
|
||||
margin-top: 12px;
|
||||
}
|
||||
dt-footer .nav a {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-right: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="l-body">
|
||||
<div class="l-page">
|
||||
<div class="description">
|
||||
<a href="/" class="logo">
|
||||
${logo}
|
||||
Distill
|
||||
</a> is dedicated to clear explanations of machine learning
|
||||
</a>
|
||||
is dedicated to clear explanations of machine learning
|
||||
</div>
|
||||
<div class="nav">
|
||||
<a href="http://distill.pub/about/">About</a>
|
||||
<a href="http://distill.pub/journal/">Submit</a>
|
||||
<a href="http://distill.pub/prize/">Prize</a>
|
||||
<a href="http://distill.pub/archive/">Archive</a>
|
||||
<a href="http://distill.pub/rss.xml">RSS</a>
|
||||
<a href="https://github.com/distillpub">GitHub</a>
|
||||
<a href="https://twitter.com/distillpub">Twitter</a>
|
||||
ISSN 2476-0757
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector("dt-footer");
|
||||
if(el) el.innerHTML = html;
|
||||
if(el) {
|
||||
el.innerHTML = html;
|
||||
} else {
|
||||
let footer = dom.createElement("dt-footer");
|
||||
footer.innerHTML = html;
|
||||
let b = dom.querySelector("body");
|
||||
b.appendChild(footer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
export default function(dom, data) {
|
||||
|
||||
var appendFootnoteHoverDiv = (function() {
|
||||
function nodeFromString(str) {
|
||||
var div = dom.createElement("div");
|
||||
div.innerHTML = str;
|
||||
return div.firstChild;
|
||||
}
|
||||
var hover_boxes_container = nodeFromString(`<div id="footnote-hover-boxes-container"></div>`)
|
||||
dom.querySelector("body").appendChild(hover_boxes_container);
|
||||
var hover_n = 0;
|
||||
return function appendHoverDiv(content) {
|
||||
var id = `dt-fn-hover-box-${hover_n}`;
|
||||
hover_n += 1;
|
||||
var str = `<div style="display:none;" class="dt-hover-box" id="${id}" >${content}</div>`;
|
||||
var div = nodeFromString(str);
|
||||
hover_boxes_container.appendChild(div);
|
||||
return id;
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
var fnTags = [].slice.apply(dom.querySelectorAll("dt-fn"));
|
||||
var fnContent = [];
|
||||
fnTags.forEach((el,n) => {
|
||||
var content = el.innerHTML;
|
||||
var ref_id = appendFootnoteHoverDiv(content)
|
||||
fnContent.push(content);
|
||||
n = (n+1)+"";
|
||||
var key = "fn-"+n;
|
||||
var escaped_content = content.replace(/"/g, "'");
|
||||
el.innerHTML = `<sup><span id="${key}" data-hover-ref="${ref_id}" style="cursor:pointer">${n}</span></sup>`;
|
||||
});
|
||||
|
||||
let fnList = dom.querySelector("dt-fn-list");
|
||||
if (fnList) {
|
||||
let ol = dom.createElement("ol");
|
||||
fnContent.forEach(content => {
|
||||
let el = dom.createElement("li");
|
||||
el.innerHTML = content;
|
||||
ol.appendChild(el);
|
||||
})
|
||||
fnList.appendChild(ol);
|
||||
}
|
||||
|
||||
}
|
||||
+32
-24
@@ -1,33 +1,41 @@
|
||||
import ymlParse from "js-yaml";
|
||||
|
||||
export default function(dom, data) {
|
||||
let localData = {};
|
||||
let el = dom.querySelector('script[type="text/front-matter"]');
|
||||
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
if (el) {
|
||||
let text = el.textContent;
|
||||
let localData = ymlParse.safeLoad(text);
|
||||
|
||||
data.title = localData.title;
|
||||
data.description = localData.description;
|
||||
data.published = new Date(localData.published);
|
||||
data.updated = new Date(localData.published || localData.updated);
|
||||
|
||||
data.authors = localData.authors.map((author, i) =>{
|
||||
let a = {};
|
||||
let name = Object.keys(author)[0];
|
||||
let names = name.split(" ");
|
||||
a.firstName = names.slice(0, names.length - 1).join(" ");
|
||||
a.lastName = names[names.length -1];
|
||||
a.personalURL = author[name];
|
||||
if(localData.affiliations[i]) {
|
||||
let affiliation = Object.keys(localData.affiliations[i])[0];
|
||||
a.affiliation = affiliation;
|
||||
a.affiliationURL = localData.affiliations[i][affiliation];
|
||||
}
|
||||
return a;
|
||||
});
|
||||
|
||||
localData = ymlParse.safeLoad(text);
|
||||
}
|
||||
|
||||
data.title = localData.title ? localData.title : "Untitled";
|
||||
data.description = localData.description ? localData.description : "No description.";
|
||||
|
||||
data.authors = localData.authors ? localData.authors : [];
|
||||
|
||||
data.authors = data.authors.map((author, i) =>{
|
||||
let a = {};
|
||||
let name = Object.keys(author)[0];
|
||||
if ((typeof author) === "string") {
|
||||
name = author;
|
||||
} else {
|
||||
a.personalURL = author[name];
|
||||
}
|
||||
let names = name.split(" ");
|
||||
a.name = name;
|
||||
a.firstName = names.slice(0, names.length - 1).join(" ");
|
||||
a.lastName = names[names.length -1];
|
||||
if(localData.affiliations[i]) {
|
||||
let affiliation = Object.keys(localData.affiliations[i])[0];
|
||||
if ((typeof localData.affiliations[i]) === "string") {
|
||||
affiliation = localData.affiliations[i]
|
||||
} else {
|
||||
a.affiliationURL = localData.affiliations[i][affiliation];
|
||||
}
|
||||
a.affiliation = affiliation;
|
||||
}
|
||||
return a;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,167 @@
|
||||
//import xml from "xml";
|
||||
|
||||
export default function(data) {
|
||||
return "crossref";
|
||||
|
||||
|
||||
var date = data.publishedDate;
|
||||
|
||||
var batch_timestamp = Math.floor(Date.now() / 1000);
|
||||
var batch_id = data.authors.length ? data.authors[0].lastName.toLowerCase().slice(0,20) : "Anonymous";
|
||||
batch_id += "_" + date.getFullYear();
|
||||
batch_id += "_" + data.title.split(" ")[0].toLowerCase().slice(0,20) + "_" + batch_timestamp;
|
||||
// generate XML
|
||||
var crf_data =
|
||||
{doi_batch : [
|
||||
|
||||
{ _attr: {
|
||||
version: "4.3.7",
|
||||
xmlns: "http://www.crossref.org/schema/4.3.7",
|
||||
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
||||
"xsi:schemaLocation": "http://www.crossref.org/schema/4.3.7 http://www.crossref.org/schemas/crossref4.3.7.xsd",
|
||||
}},
|
||||
|
||||
{ head: [
|
||||
{doi_batch_id: batch_id},
|
||||
{timestamp: batch_timestamp},
|
||||
{depositor: [
|
||||
{depositor_name: data.journal.publisherName},
|
||||
{email_address: data.journal.publisherEmail},
|
||||
]},
|
||||
{registrant: data.journal.publisherName},
|
||||
]},
|
||||
|
||||
{body: [
|
||||
{journal: [
|
||||
|
||||
{journal_metadata: [
|
||||
{full_title: data.journal.full_title || data.journal.title},
|
||||
{abbrev_title: data.journal.abbrev_title || data.journal.title || data.journal.full_title},
|
||||
{issn: data.journal.issn},
|
||||
{doi_data: [
|
||||
{doi: data.journal.doi},
|
||||
{resource: data.journal.url},
|
||||
]},
|
||||
]},
|
||||
|
||||
{journal_issue: [
|
||||
{publication_date: [
|
||||
{month: date.getMonth()+1},
|
||||
{year: date.getFullYear()},
|
||||
]},
|
||||
{journal_volume: [
|
||||
{volume: data.volume},
|
||||
]},
|
||||
{issue: data.issue},
|
||||
]},
|
||||
|
||||
{journal_article: [
|
||||
{titles: [
|
||||
{title: data.title},
|
||||
]},
|
||||
{ contributors:
|
||||
data.authors.map((author, ind) => (
|
||||
{person_name: [
|
||||
{ _attr: {
|
||||
contributor_role: "author",
|
||||
sequence: (ind == 0)? "first" : "additional"
|
||||
}},
|
||||
{given_name: author.firstName},
|
||||
{surname: author.lastName},
|
||||
{affiliation: author.affiliation}
|
||||
// TODO: ORCID?
|
||||
]}
|
||||
))
|
||||
},
|
||||
{publication_date: [
|
||||
{month: date.getMonth()+1},
|
||||
{day: date.getDate()},
|
||||
{year: date.getFullYear()}
|
||||
]},
|
||||
{ publisher_item: [
|
||||
{item_number: data.doi}
|
||||
]},
|
||||
{doi_data: [
|
||||
{doi: data.doi},
|
||||
//{timestamp: ""},
|
||||
{resource: data.url},
|
||||
]},
|
||||
{citation_list:
|
||||
data.citations.map(key =>
|
||||
citation_xml(key, data.bibliography[key]))
|
||||
}
|
||||
|
||||
]},
|
||||
|
||||
]},
|
||||
]},
|
||||
]};
|
||||
|
||||
return xml(crf_data);
|
||||
}
|
||||
|
||||
function citation_xml(key, ent){
|
||||
if (ent == undefined) return {};
|
||||
var info = [];
|
||||
info.push({_attr: {key: key}});
|
||||
if ("title" in ent)
|
||||
info.push({article_title: ent.title});
|
||||
if ("author" in ent)
|
||||
info.push({author: ent.author.split(" and ")[0].split(",")[0].trim()});
|
||||
if ("journal" in ent)
|
||||
info.push({journal_title: ent.journal});
|
||||
if ("booktitle" in ent)
|
||||
info.push({volume_title: ent.booktitle});
|
||||
if ("volume" in ent)
|
||||
info.push({volume: ent.volume});
|
||||
if ("issue" in ent)
|
||||
info.push({issue: ent.issue});
|
||||
if ("doi" in ent)
|
||||
info.push({doi: ent.doi});
|
||||
return {citation: info}
|
||||
}
|
||||
|
||||
function xml(obj) {
|
||||
//console.log(typeof(obj), obj)
|
||||
if (typeof obj === 'string') return obj;
|
||||
if (typeof obj === 'number') return ""+obj;
|
||||
let keys = Object.keys(obj);
|
||||
if (keys.length != 1) console.error("can't interpret ", obj, "as xml");
|
||||
let name = keys[0];
|
||||
var full_content = obj[name];
|
||||
var attr = {};
|
||||
if (Array.isArray(full_content)){
|
||||
var content = [];
|
||||
for (var i in full_content) {
|
||||
var obj = full_content[i];
|
||||
var obj_name = Object.keys(obj)[0];
|
||||
if ("_attr" == obj_name) {
|
||||
attr = obj["_attr"];
|
||||
} else {
|
||||
//console.log(Object.keys(obj)[0])
|
||||
content.push(obj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
content = full_content;
|
||||
}
|
||||
if (content == undefined){
|
||||
content = "undefined"
|
||||
}
|
||||
|
||||
let attr_string = "";
|
||||
for (var k in attr) {
|
||||
attr_string += ` ${k}=\"${attr[k]}\"`
|
||||
}
|
||||
|
||||
//console.log(typeof content, Array.isArray(content), content instanceof String, content)
|
||||
if (Array.isArray(content)){
|
||||
content = content.map(xml);
|
||||
content = content.join("\n").split("\n");
|
||||
content = content.map(s => " " + s).join("\n")
|
||||
var result = `<${name}${attr_string}>\n${content}\n</${name}>`;
|
||||
} else {
|
||||
content = xml(content);
|
||||
var result = `<${name}${attr_string}>${content}</${name}>`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+42
-12
@@ -6,44 +6,63 @@ dt-header {
|
||||
display: block;
|
||||
position: relative;
|
||||
height: 60px;
|
||||
background-color: none;
|
||||
background-color: hsl(200, 60%, 15%);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
z-index: 2;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
dt-header .content {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
|
||||
height: 60px;
|
||||
height: 70px;
|
||||
}
|
||||
dt-header a {
|
||||
font-size: 16px;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
text-decoration: none;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
padding: 22px 0;
|
||||
}
|
||||
dt-header a:hover {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
dt-header svg {
|
||||
width: 24px;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
margin-right: -2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
@media(min-width: 1080px) {
|
||||
dt-header {
|
||||
height: 70px;
|
||||
}
|
||||
dt-header a {
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
padding: 28px 0;
|
||||
}
|
||||
dt-header .logo {
|
||||
}
|
||||
}
|
||||
dt-header svg path {
|
||||
fill: none;
|
||||
stroke: black;
|
||||
stroke-width: 1;
|
||||
stroke-linejoin: round;
|
||||
stroke: rgba(255, 255, 255, 0.8);
|
||||
stroke-width: 3px;
|
||||
}
|
||||
dt-header .logo {
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
font-size: 17px;
|
||||
font-weight: 200;
|
||||
}
|
||||
dt-header .nav {
|
||||
float: right;
|
||||
font-weight: 300;
|
||||
}
|
||||
dt-header .nav a {
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
margin-left: 24px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -53,10 +72,21 @@ dt-header .nav a {
|
||||
Distill
|
||||
</a>
|
||||
<div class="nav">
|
||||
<a href="/about/">About</a>
|
||||
<a href="/prize/">Prize</a>
|
||||
<a href="/journal/">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
export default function(dom, data) {
|
||||
dom.querySelector('dt-header').innerHTML = html;
|
||||
let el = dom.querySelector("dt-header");
|
||||
if(el) {
|
||||
el.innerHTML = html;
|
||||
} else {
|
||||
let header = dom.createElement("dt-header");
|
||||
header.innerHTML = html;
|
||||
let b = dom.querySelector("body");
|
||||
b.insertBefore(header, b.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import code from './hover-box.txt';
|
||||
|
||||
export default function(dom) {
|
||||
let s = dom.createElement("script");
|
||||
s.textContent = code;
|
||||
dom.querySelector("body").appendChild(s);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
|
||||
function nodeFromString(str) {
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = str;
|
||||
return div.firstChild;
|
||||
}
|
||||
|
||||
function make_hover_css(pos) {
|
||||
var pretty = window.innerWidth > 600;
|
||||
var padding = pretty? 18 : 12;
|
||||
var outer_padding = pretty ? 18 : 0;
|
||||
var bbox = document.querySelector("body").getBoundingClientRect();
|
||||
var left = pos[0] - bbox.left, top = pos[1] - bbox.top;
|
||||
var width = Math.min(window.innerWidth-2*outer_padding, 648);
|
||||
left = Math.min(left, window.innerWidth-width-outer_padding);
|
||||
width = width - 2*padding;
|
||||
return (`position: absolute;
|
||||
background-color: #FFF;
|
||||
opacity: 0.95;
|
||||
max-width: ${width}px;
|
||||
top: ${top}px;
|
||||
left: ${left}px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.25);
|
||||
padding: ${padding}px;
|
||||
border-radius: ${pretty? 3 : 0}px;
|
||||
box-shadow: 0px 2px 10px 2px rgba(0, 0, 0, 0.2);
|
||||
z-index: ${1e6};`);
|
||||
}
|
||||
|
||||
|
||||
function DtHoverBox(div_id) {
|
||||
this.div = document.querySelector("#"+div_id);
|
||||
this.visible = false;
|
||||
this.bindDivEvents();
|
||||
DtHoverBox.box_map[div_id] = this;
|
||||
}
|
||||
|
||||
DtHoverBox.box_map = {};
|
||||
|
||||
DtHoverBox.get_box = function get_box(div_id) {
|
||||
if (div_id in DtHoverBox.box_map) {
|
||||
return DtHoverBox.box_map[div_id];
|
||||
} else {
|
||||
return new DtHoverBox(div_id);
|
||||
}
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.show = function show(pos){
|
||||
this.visible = true;
|
||||
this.div.setAttribute("style", make_hover_css(pos) );
|
||||
for (var box_id in DtHoverBox.box_map) {
|
||||
var box = DtHoverBox.box_map[box_id];
|
||||
if (box != this) box.hide();
|
||||
}
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.showAtNode = function showAtNode(node){
|
||||
var bbox = node.getBoundingClientRect();
|
||||
this.show([bbox.right, bbox.bottom]);
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.hide = function hide(){
|
||||
this.visible = false;
|
||||
if (this.div) this.div.setAttribute("style", "display:none");
|
||||
if (this.timeout) clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.stopTimeout = function stopTimeout() {
|
||||
if (this.timeout) clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.extendTimeout = function extendTimeout(T) {
|
||||
//console.log("extend", T)
|
||||
var this_ = this;
|
||||
this.stopTimeout();
|
||||
this.timeout = setTimeout(function(){this_.hide();}.bind(this), T);
|
||||
}
|
||||
|
||||
// Bind events to a link to open this box
|
||||
DtHoverBox.prototype.bind = function bind(node) {
|
||||
if (typeof node == "string"){
|
||||
node = document.querySelector(node);
|
||||
}
|
||||
|
||||
node.addEventListener("mouseover", function(){
|
||||
if (!this.visible) this.showAtNode(node);
|
||||
this.stopTimeout();
|
||||
}.bind(this));
|
||||
|
||||
node.addEventListener("mouseout", function(){this.extendTimeout(250);}.bind(this));
|
||||
|
||||
node.addEventListener("touchstart", function(e) {
|
||||
if (this.visible) {
|
||||
this.hide();
|
||||
} else {
|
||||
this.showAtNode(node);
|
||||
}
|
||||
// Don't trigger body touchstart event when touching link
|
||||
e.stopPropagation();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
DtHoverBox.prototype.bindDivEvents = function bindDivEvents(){
|
||||
// For mice, same behavior as hovering on links
|
||||
this.div.addEventListener("mouseover", function(){
|
||||
if (!this.visible) this.showAtNode(node);
|
||||
this.stopTimeout();
|
||||
}.bind(this));
|
||||
this.div.addEventListener("mouseout", function(){this.extendTimeout(250);}.bind(this));
|
||||
|
||||
// Don't trigger body touchstart event when touching within box
|
||||
this.div.addEventListener("touchstart", function(e){e.stopPropagation();});
|
||||
// Close box when touching outside box
|
||||
document.body.addEventListener("touchstart", function(){this.hide();}.bind(this));
|
||||
}
|
||||
|
||||
var hover_es = document.querySelectorAll("span[data-hover-ref]");
|
||||
hover_es = [].slice.apply(hover_es);
|
||||
hover_es.forEach(function(e,n){
|
||||
var ref_id = e.getAttribute("data-hover-ref");
|
||||
DtHoverBox.get_box(ref_id).bind(e);
|
||||
})
|
||||
@@ -5,7 +5,6 @@ export default function(dom) {
|
||||
|
||||
let head = dom.querySelector("head");
|
||||
|
||||
|
||||
if (!dom.querySelector("meta[charset]")) {
|
||||
let meta = dom.createElement("meta");
|
||||
meta.setAttribute("charset", "utf-8");
|
||||
|
||||
+69
-39
@@ -1,12 +1,13 @@
|
||||
import favicon from './distill-favicon.base64';
|
||||
import escape from 'escape-html';
|
||||
|
||||
export default function(dom, data) {
|
||||
let head = dom.querySelector("head");
|
||||
let appendHead = html => appendHtml(head, html);
|
||||
|
||||
function meta(name, content) {
|
||||
if (content)
|
||||
appendHead(`<meta name="${name}" content="${content}" >`);
|
||||
function meta(name, content, force) {
|
||||
if (content || force)
|
||||
appendHead(` <meta name="${name}" content="${escape(content)}" >\n`);
|
||||
}
|
||||
|
||||
appendHead(`
|
||||
@@ -19,8 +20,9 @@ export default function(dom, data) {
|
||||
|
||||
appendHead(`
|
||||
<!-- https://schema.org/Article -->
|
||||
<meta property="article:published" itemprop="datePublished" content="${data.published}" />
|
||||
<meta property="article:modified" itemprop="dateModified" content="${data.updated}" />
|
||||
<meta property="article:published" itemprop="datePublished" content="${data.publishedYear}-${data.publishedMonthPadded}-${data.publishedDayPadded}" />
|
||||
<meta property="article:created" itemprop="dateCreated" content="${data.publishedDate}" />
|
||||
<meta property="article:modified" itemprop="dateModified" content="${data.updatedDate}" />
|
||||
`);
|
||||
data.authors.forEach((a) => {
|
||||
appendHtml(head, `
|
||||
@@ -33,7 +35,7 @@ export default function(dom, data) {
|
||||
<meta property="og:title" content="${data.title}"/>
|
||||
<meta property="og:description" content="${data.description}">
|
||||
<meta property="og:url" content="${data.url}"/>
|
||||
<meta property="og:image" content="${data.url}/thumbnail.png"/>
|
||||
<meta property="og:image" content="${data.previewURL}"/>
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<meta property="og:site_name" content="Distill" />
|
||||
`);
|
||||
@@ -44,58 +46,86 @@ export default function(dom, data) {
|
||||
<meta name="twitter:title" content="${data.title}">
|
||||
<meta name="twitter:description" content="${data.description}">
|
||||
<meta name="twitter:url" content="${data.url}">
|
||||
<meta name="twitter:image" content="${data.url}/thumbnail.png">
|
||||
<meta name="twitter:image" content="${data.previewURL}">
|
||||
<meta name="twitter:image:width" content="560">
|
||||
<meta name="twitter:image:height" content="295">
|
||||
`);
|
||||
|
||||
appendHead(`
|
||||
<!-- https://scholar.google.com/intl/en/scholar/inclusion.html#indexing -->
|
||||
`);
|
||||
// if this is a proprer article, generate Google Scholar meta data
|
||||
if (data.doiSuffix){
|
||||
appendHead(`
|
||||
<!-- https://scholar.google.com/intl/en/scholar/inclusion.html#indexing -->\n`);
|
||||
|
||||
meta("citation_title", data.title);
|
||||
meta("citation_fulltext_html_url", data.url);
|
||||
meta("citation_volume", data.volume);
|
||||
meta("citation_issue", data.issue);
|
||||
meta("citation_firstpage", data.doiSuffix? `e${data.doiSuffix}` : undefined);
|
||||
meta("citation_doi", data.doi);
|
||||
meta("citation_title", data.title);
|
||||
//meta("citation_fulltext_html_url", data.url);
|
||||
meta("citation_volume", data.volume);
|
||||
meta("citation_issue", data.issue);
|
||||
meta("citation_firstpage", data.doiSuffix? `e${data.doiSuffix}` : undefined);
|
||||
meta("citation_doi", data.doi);
|
||||
|
||||
let journal = data.journal || {};
|
||||
meta("citation_journal_title", journal.name);
|
||||
meta("citation_journal_abbrev", journal.nameAbbrev);
|
||||
meta("citation_issn", journal.issn);
|
||||
meta("citation_publisher", journal.publisher);
|
||||
let journal = data.journal || {};
|
||||
meta("citation_journal_title", journal.full_title || journal.title);
|
||||
meta("citation_journal_abbrev", journal.abbrev_title);
|
||||
meta("citation_issn", journal.issn);
|
||||
meta("citation_publisher", journal.publisher);
|
||||
meta("citation_fulltext_world_readable", "", true);
|
||||
|
||||
if (data.published){
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
let publishedYear = data.published.getFullYear();
|
||||
let publishedMonthPadded = zeroPad(data.published.getMonth() + 1);
|
||||
let publishedDayPadded = zeroPad(data.published.getDate());
|
||||
meta("citation_publication_date", `${publishedYear}/${publishedMonthPadded}/${publishedDayPadded}`);
|
||||
}
|
||||
if (data.publishedDate){
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
meta("citation_online_date", `${data.publishedYear}/${data.publishedMonthPadded}/${data.publishedDayPadded}`);
|
||||
// Should we do something different here?
|
||||
meta("citation_publication_date", `${data.publishedYear}/${data.publishedMonthPadded}/${data.publishedDayPadded}`);
|
||||
}
|
||||
|
||||
(data.authors || []).forEach((a) => {
|
||||
meta("citation_author", `${a.lastName}, ${a.firstName}`);
|
||||
meta("citation_author_institution", a.affiliation);
|
||||
});
|
||||
(data.authors || []).forEach((a) => {
|
||||
meta("citation_author", `${a.lastName}, ${a.firstName}`);
|
||||
meta("citation_author_institution", a.affiliation);
|
||||
});
|
||||
|
||||
if (data.citations) {
|
||||
data.citations.forEach(key =>
|
||||
meta("citation_reference", citation_meta_content(data.bibliography[key]) )
|
||||
);
|
||||
if (data.citations) {
|
||||
data.citations.forEach(key => {
|
||||
let d = data.bibliography[key];
|
||||
if(!d) {
|
||||
console.warn("No bibliography data fround for " + key)
|
||||
} else {
|
||||
meta("citation_reference", citation_meta_content(data.bibliography[key]) )
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendHtml(el, html) {
|
||||
el.innerHTML += html;
|
||||
}
|
||||
|
||||
function citation_meta_content(ref){
|
||||
// Special test for arxiv
|
||||
var content = `citation_title=${ref.title};`;
|
||||
ref.author.split(" and ").forEach(author => {
|
||||
content += `citation_author=${author.trim()};`;
|
||||
|
||||
let name_strings = ref.author.split(" and ").forEach(name => {
|
||||
name = name.trim();
|
||||
if (name.indexOf(",") != -1){
|
||||
var last = name.split(",")[0].trim();
|
||||
var firsts = name.split(",")[1].trim();
|
||||
} else {
|
||||
var last = name.split(" ").slice(-1)[0].trim();
|
||||
var firsts = name.split(" ").slice(0,-1).join(" ");
|
||||
}
|
||||
content += `citation_author=${firsts} ${last};`;
|
||||
});
|
||||
|
||||
if ("year" in ref) {
|
||||
content += `citation_publication_date=${ref.year};`;
|
||||
}
|
||||
|
||||
var 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);
|
||||
if (arxiv_id_search && arxiv_id_search[1]){
|
||||
content += `citation_arxiv_id=${arxiv_id_search[1]};`;
|
||||
return content;
|
||||
}
|
||||
if ("journal" in ref){
|
||||
content += `citation_journal_title=${ref.journal};`;
|
||||
}
|
||||
|
||||
+141
-46
@@ -1,6 +1,9 @@
|
||||
dt-article {
|
||||
display: block;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
font: 15px/1.55em -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
|
||||
font: 17px/1.55em -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
|
||||
padding-bottom: 72px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
@media(min-width: 1024px) {
|
||||
@@ -9,49 +12,111 @@ dt-article {
|
||||
}
|
||||
}
|
||||
|
||||
dt-article h1 {
|
||||
font-weight: 700;
|
||||
font-size: 32px;
|
||||
line-height: 1.1em;
|
||||
/*-webkit-font-smoothing: antialiased;*/
|
||||
}
|
||||
/* H1 */
|
||||
|
||||
@media(min-width: 1024px) {
|
||||
dt-article h1 {
|
||||
margin-top: 18px;
|
||||
font-weight: 400;
|
||||
font-size: 40px;
|
||||
line-height: 1em;
|
||||
font-family: HoeflerText-Regular, Cochin, Georgia, serif;
|
||||
}
|
||||
@media(min-width: 768px) {
|
||||
dt-article h1 {
|
||||
font-size: 50px;
|
||||
font-size: 46px;
|
||||
margin-top: 48px;
|
||||
margin-bottom: 12px;
|
||||
letter-spacing: -0.025em;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 1024px) {
|
||||
@media(min-width: 1080px) {
|
||||
.centered h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
dt-article h1 {
|
||||
font-size: 50px;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
dt-article > h1:first-of-type,
|
||||
dt-article section > h1:first-of-type {
|
||||
margin-top: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media(min-width: 1200px) {
|
||||
dt-article h1 {
|
||||
font-size: 56px;
|
||||
}
|
||||
|
||||
dt-article > h1:first-of-type {
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
/* H2 */
|
||||
|
||||
dt-article h2 {
|
||||
font-family: HoeflerText-Regular, Cochin, Georgia, serif;
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
font-size: 26px;
|
||||
line-height: 1.25em;
|
||||
margin-top: 12px;
|
||||
margin-top: 36px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
@media(min-width: 1024px) {
|
||||
dt-article h2 {
|
||||
margin-top: 48px;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
dt-article h1 + h2 {
|
||||
padding-bottom: 48px;
|
||||
margin-bottom: 48px;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
dt-article h3 {
|
||||
font-weight: 700;
|
||||
font-weight: 300;
|
||||
font-size: 20px;
|
||||
line-height: 1.4em;
|
||||
margin-top: 24px;
|
||||
margin-bottom: 24px;
|
||||
margin-top: 8px;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
|
||||
@media(min-width: 1080px) {
|
||||
.centered h1 + h2 {
|
||||
text-align: center;
|
||||
}
|
||||
dt-article h1 + h2 {
|
||||
margin-top: 12px;
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
/* H3 */
|
||||
|
||||
dt-article h3 {
|
||||
font-family: HoeflerText-Regular, Georgia, serif;
|
||||
font-weight: 400;
|
||||
font-size: 20px;
|
||||
line-height: 1.4em;
|
||||
margin-top: 36px;
|
||||
margin-bottom: 18px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
dt-article h1 + h3 {
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
@media(min-width: 1024px) {
|
||||
dt-article h3 {
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
/* H4 */
|
||||
|
||||
dt-article h4 {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
@@ -63,33 +128,42 @@ dt-article a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
dt-article p {
|
||||
dt-article p,
|
||||
dt-article ul,
|
||||
dt-article ol {
|
||||
margin-bottom: 24px;
|
||||
font-family: Georgia, serif;
|
||||
}
|
||||
|
||||
dt-article p b,
|
||||
dt-article ul b,
|
||||
dt-article ol b {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
/*font-family: Georgia, serif;*/
|
||||
}
|
||||
|
||||
dt-article p a {
|
||||
/*text-decoration: none;*/
|
||||
/*background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 50%, rgba(0, 0, 0, 0) 50%);*/
|
||||
/*background-repeat: repeat-x;*/
|
||||
/*background-size: 2px 1em;*/
|
||||
/*background-position: 0 1.25em;*/
|
||||
dt-article a {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.4);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
dt-article p .link {
|
||||
dt-article a:hover {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
dt-article .link {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
dt-article ul {
|
||||
padding-left: 20px;
|
||||
dt-article ul,
|
||||
dt-article ol {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
dt-article li {
|
||||
/*margin-bottom: 24px;*/
|
||||
margin-bottom: 24px;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
dt-article pre {
|
||||
@@ -110,6 +184,25 @@ dt-article section {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
dt-article table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
dt-article table th {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
dt-article table td {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
dt-article table th,
|
||||
dt-article table td {
|
||||
font-size: 15px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
/* Figure */
|
||||
|
||||
@@ -157,15 +250,6 @@ dt-article figure figcaption a {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
/*dt-article figure figcaption::before {
|
||||
position: relative;
|
||||
display: block;
|
||||
top: -20px;
|
||||
content: "";
|
||||
width: 25px;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.3);
|
||||
}*/
|
||||
|
||||
dt-article span.equation-mimic {
|
||||
font-family: georgia;
|
||||
font-size: 115%;
|
||||
@@ -177,6 +261,17 @@ dt-article figure figcaption b {
|
||||
color: rgba(0, 0, 0, 1.0);
|
||||
}
|
||||
|
||||
dt-article > dt-code {
|
||||
dt-article > dt-code,
|
||||
dt-article section > dt-code {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt-article .citation {
|
||||
color: #668;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
dt-include {
|
||||
width: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
html {
|
||||
font: 400 15px/1.55em -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
|
||||
}
|
||||
|
||||
html {
|
||||
font: 400 16px/1.55em -apple-system, BlinkMacSystemFont, "Roboto", Helvetica, sans-serif;
|
||||
/*background-color: hsl(223, 9%, 25%);*/
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
/*background-color: hsl(223, 9%, 25%);*/
|
||||
}
|
||||
|
||||
a {
|
||||
color: #004276;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: Cochin, Georgia, serif;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+52
-53
@@ -4,67 +4,66 @@
|
||||
* @author Lea Verou
|
||||
*/
|
||||
|
||||
code {
|
||||
white-space:pre-wrap;
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
border-radius: 2px;
|
||||
padding: 4px 7px;
|
||||
font-size: 15px;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
code {
|
||||
white-space: nowrap;
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
border-radius: 2px;
|
||||
padding: 4px 7px;
|
||||
font-size: 15px;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
pre code {
|
||||
display: block;
|
||||
background: white;
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
pre code {
|
||||
display: block;
|
||||
background: white;
|
||||
border-left: 3px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: black;
|
||||
text-shadow: 0 1px white;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.5;
|
||||
text-shadow: 0 1px white;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
||||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
||||
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
@media print {
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
text-shadow: none;
|
||||
}
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
overflow: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
@@ -73,22 +72,22 @@ pre[class*="language-"] {
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
white-space: normal;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: slategray;
|
||||
color: slategray;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
@@ -98,7 +97,7 @@ pre[class*="language-"] {
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.deleted {
|
||||
color: #905;
|
||||
color: #905;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
@@ -107,7 +106,7 @@ pre[class*="language-"] {
|
||||
.token.char,
|
||||
.token.builtin,
|
||||
.token.inserted {
|
||||
color: #690;
|
||||
color: #690;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
@@ -115,34 +114,34 @@ pre[class*="language-"] {
|
||||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string {
|
||||
color: #a67f59;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
color: #a67f59;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.attr-value,
|
||||
.token.keyword {
|
||||
color: #07a;
|
||||
color: #07a;
|
||||
}
|
||||
|
||||
.token.function {
|
||||
color: #DD4A68;
|
||||
color: #DD4A68;
|
||||
}
|
||||
|
||||
.token.regex,
|
||||
.token.important,
|
||||
.token.variable {
|
||||
color: #e90;
|
||||
color: #e90;
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
+292
-13
@@ -1,6 +1,48 @@
|
||||
/*
|
||||
Column: 60px
|
||||
Gutter: 24px
|
||||
|
||||
Body: 648px
|
||||
- 8 columns
|
||||
- 7 gutters
|
||||
Middle: 816px
|
||||
Page: 984px
|
||||
- 12 columns
|
||||
- 11 gutters
|
||||
*/
|
||||
|
||||
.l-body,
|
||||
.l-body-outset,
|
||||
.l-page,
|
||||
dt-article > * {
|
||||
.l-page-outset,
|
||||
.l-middle,
|
||||
.l-middle-outset,
|
||||
dt-article > div,
|
||||
dt-article > p,
|
||||
dt-article > h1,
|
||||
dt-article > h2,
|
||||
dt-article > h3,
|
||||
dt-article > h4,
|
||||
dt-article > figure,
|
||||
dt-article > table,
|
||||
dt-article > ol,
|
||||
dt-article > ul,
|
||||
dt-article > dt-byline,
|
||||
dt-article > dt-math,
|
||||
dt-article > dt-code,
|
||||
dt-article section > div,
|
||||
dt-article section > p,
|
||||
dt-article section > h1,
|
||||
dt-article section > h2,
|
||||
dt-article section > h3,
|
||||
dt-article section > h4,
|
||||
dt-article section > figure,
|
||||
dt-article section > table,
|
||||
dt-article section > ol,
|
||||
dt-article section > ul,
|
||||
dt-article section > dt-byline,
|
||||
dt-article section > dt-code {
|
||||
width: auto;
|
||||
margin-left: 24px;
|
||||
margin-right: 24px;
|
||||
box-sizing: border-box;
|
||||
@@ -8,8 +50,36 @@ dt-article > * {
|
||||
|
||||
@media(min-width: 768px) {
|
||||
.l-body,
|
||||
.l-body-outset,
|
||||
.l-page,
|
||||
dt-article > * {
|
||||
.l-page-outset,
|
||||
.l-middle,
|
||||
.l-middle-outset,
|
||||
dt-article > div,
|
||||
dt-article > p,
|
||||
dt-article > h1,
|
||||
dt-article > h2,
|
||||
dt-article > h3,
|
||||
dt-article > h4,
|
||||
dt-article > figure,
|
||||
dt-article > table,
|
||||
dt-article > ol,
|
||||
dt-article > ul,
|
||||
dt-article > dt-byline,
|
||||
dt-article > dt-math,
|
||||
dt-article > dt-code,
|
||||
dt-article section > div,
|
||||
dt-article section > p,
|
||||
dt-article section > h1,
|
||||
dt-article section > h2,
|
||||
dt-article section > h3,
|
||||
dt-article section > h4,
|
||||
dt-article section > figure,
|
||||
dt-article section > table,
|
||||
dt-article section > ol,
|
||||
dt-article section > ul,
|
||||
dt-article section > dt-byline,
|
||||
dt-article section > dt-code {
|
||||
margin-left: 72px;
|
||||
margin-right: 72px;
|
||||
}
|
||||
@@ -17,40 +87,75 @@ dt-article > * {
|
||||
|
||||
@media(min-width: 1080px) {
|
||||
.l-body,
|
||||
dt-article > * {
|
||||
dt-article > div,
|
||||
dt-article > p,
|
||||
dt-article > h2,
|
||||
dt-article > h3,
|
||||
dt-article > h4,
|
||||
dt-article > figure,
|
||||
dt-article > table,
|
||||
dt-article > ol,
|
||||
dt-article > ul,
|
||||
dt-article > dt-byline,
|
||||
dt-article > dt-math,
|
||||
dt-article > dt-code,
|
||||
dt-article section > div,
|
||||
dt-article section > p,
|
||||
dt-article section > h2,
|
||||
dt-article section > h3,
|
||||
dt-article section > h4,
|
||||
dt-article section > figure,
|
||||
dt-article section > table,
|
||||
dt-article section > ol,
|
||||
dt-article section > ul,
|
||||
dt-article section > dt-byline,
|
||||
dt-article section > dt-code {
|
||||
margin-left: calc(50% - 984px / 2);
|
||||
width: 648px;
|
||||
}
|
||||
.l-body-outset,
|
||||
dt-article .l-body-outset {
|
||||
margin-left: calc(50% - 984px / 2 - 24px);
|
||||
width: calc(648px + 48px);
|
||||
margin-left: calc(50% - 984px / 2 - 96px/2);
|
||||
width: calc(648px + 96px);
|
||||
}
|
||||
.l-middle,
|
||||
dt-article .l-middle {
|
||||
width: 816px;
|
||||
margin-left: calc(50% - 984px / 2);
|
||||
margin-right: auto;
|
||||
}
|
||||
.l-middle-outset,
|
||||
dt-article .l-middle-outset {
|
||||
width: calc(816px + 96px);
|
||||
margin-left: calc(50% - 984px / 2 - 48px);
|
||||
margin-right: auto;
|
||||
}
|
||||
dt-article > h1,
|
||||
dt-article section > h1,
|
||||
.l-page,
|
||||
dt-article .l-page {
|
||||
dt-article .l-page,
|
||||
dt-article.centered .l-page {
|
||||
width: 984px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.l-page-outset,
|
||||
dt-article .l-page-outset {
|
||||
dt-article .l-page-outset,
|
||||
dt-article.centered .l-page-outset {
|
||||
width: 1080px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.l-screen,
|
||||
dt-article .l-screen {
|
||||
dt-article .l-screen,
|
||||
dt-article.centered .l-screen {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: auto;
|
||||
}
|
||||
.l-screen-inset,
|
||||
dt-article .l-screen-inset {
|
||||
dt-article .l-screen-inset,
|
||||
dt-article.centered .l-screen-inset {
|
||||
margin-left: 24px;
|
||||
margin-right: 24px;
|
||||
width: auto;
|
||||
@@ -61,9 +166,10 @@ dt-article > * {
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
margin-left: 24px;
|
||||
margin-right: calc((100vw - 960px) / 2);
|
||||
margin-right: calc((100vw - 984px) / 2 + 168px);
|
||||
width: calc((984px - 648px) / 2 - 24px);
|
||||
}
|
||||
|
||||
/* Side */
|
||||
.side.l-body,
|
||||
dt-article .side.l-body {
|
||||
@@ -72,7 +178,7 @@ dt-article > * {
|
||||
margin-top: 0;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 984px + 648px) / 2);
|
||||
width: calc(648px / 2 - 24px);
|
||||
width: calc(648px / 2 - 24px - 84px);
|
||||
}
|
||||
.side.l-body-outset,
|
||||
dt-article .side.l-body-outset {
|
||||
@@ -83,13 +189,186 @@ dt-article > * {
|
||||
margin-right: calc((100vw - 984px + 648px - 48px) / 2);
|
||||
width: calc(648px / 2 - 48px + 24px);
|
||||
}
|
||||
.side.l-middle,
|
||||
dt-article .side.l-middle {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: calc(456px - 84px);
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 984px) / 2 + 168px);
|
||||
}
|
||||
.side.l-middle-outset,
|
||||
dt-article .side.l-middle-outset {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 456px;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 984px) / 2 + 168px);
|
||||
}
|
||||
.side.l-page,
|
||||
dt-article .side.l-page {
|
||||
clear: both;
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
margin-left: 48px;
|
||||
width: calc(624px - 84px);
|
||||
margin-right: calc((100vw - 984px) / 2);
|
||||
}
|
||||
.side.l-page-outset,
|
||||
dt-article .side.l-page-outset {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 624px;
|
||||
margin-right: calc((100vw - 984px) / 2);
|
||||
width: calc(960px / 2 - 48px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Centered */
|
||||
|
||||
@media(min-width: 1080px) {
|
||||
.centered .l-body,
|
||||
.centered.l-body,
|
||||
dt-article.centered > div,
|
||||
dt-article.centered > p,
|
||||
dt-article.centered > h2,
|
||||
dt-article.centered > h3,
|
||||
dt-article.centered > h4,
|
||||
dt-article.centered > figure,
|
||||
dt-article.centered > table,
|
||||
dt-article.centered > ol,
|
||||
dt-article.centered > ul,
|
||||
dt-article.centered > dt-byline,
|
||||
dt-article.centered > dt-code,
|
||||
dt-article.centered section > div,
|
||||
dt-article.centered section > p,
|
||||
dt-article.centered section > h2,
|
||||
dt-article.centered section > h3,
|
||||
dt-article.centered section > h4,
|
||||
dt-article.centered section > figure,
|
||||
dt-article.centered section > table,
|
||||
dt-article.cebtered section > ol,
|
||||
dt-article.centered section > ul,
|
||||
dt-article.centered section > dt-byline,
|
||||
dt-article.centered section > dt-code,
|
||||
dt-article section.centered > div,
|
||||
dt-article section.centered > p,
|
||||
dt-article section.centered > h2,
|
||||
dt-article section.centered > h3,
|
||||
dt-article section.centered > h4,
|
||||
dt-article section.centered > figure,
|
||||
dt-article section.centered > table,
|
||||
dt-article section.centered > ol,
|
||||
dt-article section.centered > ul,
|
||||
dt-article section.centered > dt-byline,
|
||||
dt-article section.centered > dt-code {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 648px;
|
||||
}
|
||||
.centered .l-body-outset,
|
||||
.centered.l-body-outset,
|
||||
dt-article.centered .l-body-outset {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: calc(648px + 96px);
|
||||
}
|
||||
dt-article.centered > h1,
|
||||
dt-article.centered section > h1,
|
||||
dt-article section.centered > h1,
|
||||
.centered .l-middle,
|
||||
.centered.l-middle,
|
||||
dt-article.centered .l-middle {
|
||||
width: 816px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.centered .l-middle-outset,
|
||||
.centered.l-middle-outset,
|
||||
dt-article.centered .l-middle-outset {
|
||||
width: calc(816px + 96px);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* page and screen are already centered */
|
||||
|
||||
/* Side */
|
||||
|
||||
.centered .side.l-body,
|
||||
.centered dt-article .side.l-body {
|
||||
clear: both;
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 648px) / 2);
|
||||
width: calc(4 * 60px + 3 * 24px);
|
||||
}
|
||||
.centered .side.l-body-outset,
|
||||
.centered dt-article .side.l-body-outset {
|
||||
clear: both;
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 648px) / 2);
|
||||
width: calc(4 * 60px + 3 * 24px);
|
||||
}
|
||||
.centered .side.l-middle,
|
||||
.centered dt-article .side.l-middle {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 396px;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 984px) / 2 + 168px / 2);
|
||||
}
|
||||
.centered .side.l-middle-outset,
|
||||
.centered dt-article .side.l-middle-outset {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 456px;
|
||||
margin-left: 48px;
|
||||
margin-right: calc((100vw - 984px) / 2 + 168px);
|
||||
}
|
||||
.centered .side.l-page,
|
||||
.centered dt-article .side.l-page {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 480px;
|
||||
margin-right: calc((100vw - 984px) / 2);
|
||||
}
|
||||
.centered .side.l-page-outset,
|
||||
.centered dt-article .side.l-page-outset {
|
||||
clear: both;
|
||||
float: right;
|
||||
width: 480px;
|
||||
margin-right: calc((100vw - 984px) / 2);
|
||||
}
|
||||
.centered .l-gutter,
|
||||
.centered.l-gutter,
|
||||
dt-article.centered .l-gutter {
|
||||
clear: both;
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
margin-left: 24px;
|
||||
margin-right: calc((100vw - 984px) / 2);
|
||||
width: calc((984px - 648px) / 2 - 24px);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Rows and Columns */
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
}
|
||||
.column {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
margin-right: 24px;
|
||||
margin-left: 24px;
|
||||
}
|
||||
.row > .column:first-of-type {
|
||||
margin-left: 0;
|
||||
}
|
||||
.row > .column:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
@media print {
|
||||
@page {
|
||||
size: 8in 11in;
|
||||
}
|
||||
html {
|
||||
}
|
||||
p, code {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
h2, h3 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
dt-header {
|
||||
visibility: hidden;
|
||||
}
|
||||
dt-footer {
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,10 @@ import base from './styles-base.css';
|
||||
import layout from './styles-layout.css';
|
||||
import article from './styles-article.css';
|
||||
import code from './styles-code.css';
|
||||
import print from './styles-print.css';
|
||||
|
||||
export default function(dom) {
|
||||
let s = dom.createElement("style");
|
||||
s.textContent = base + layout + article + code;
|
||||
s.textContent = base + layout + article + code + print;
|
||||
dom.querySelector("head").appendChild(s);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
export default function(dom, data) {
|
||||
|
||||
var textNodes = dom.createTreeWalker(
|
||||
dom.body,
|
||||
dom.defaultView.NodeFilter.SHOW_TEXT
|
||||
);
|
||||
while (textNodes.nextNode()) {
|
||||
var n = textNodes.currentNode,
|
||||
text = n.nodeValue;
|
||||
if (text && acceptNode(n)) {
|
||||
text = quotes(text);
|
||||
text = punctuation(text);
|
||||
n.nodeValue = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function acceptNode(node) {
|
||||
var parent = node.parentElement;
|
||||
var isMath = (parent && parent.getAttribute && parent.getAttribute("class")) ? parent.getAttribute("class").includes("katex") || parent.getAttribute("class").includes("MathJax") : false;
|
||||
return parent &&
|
||||
parent.nodeName !== "SCRIPT" &&
|
||||
parent.nodeName !== "STYLE" &&
|
||||
parent.nodeName !== "CODE" &&
|
||||
parent.nodeName !== "PRE" &&
|
||||
parent.nodeName !== "SPAN" &&
|
||||
parent.nodeName !== "DT-HEADER" &&
|
||||
parent.nodeName !== "DT-BYLINE" &&
|
||||
parent.nodeName !== "DT-MATH" &&
|
||||
parent.nodeName !== "DT-CODE" &&
|
||||
parent.nodeName !== "DT-BIBLIOGRAPHY" &&
|
||||
parent.nodeName !== "DT-FOOTER" &&
|
||||
parent.nodeType !== 8 && //comment nodes
|
||||
!isMath;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* typeset - Typesetting for the web
|
||||
* @version v0.1.6
|
||||
* @link https://github.com/davidmerfield/Typeset.js
|
||||
* @author David Merfield
|
||||
*/
|
||||
// which has a CC0 license
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
|
||||
function punctuation(text){
|
||||
|
||||
// Dashes
|
||||
text = text.replace(/--/g, '\u2014');
|
||||
text = text.replace(/ \u2014 /g,"\u2009\u2014\u2009"); //this has thin spaces
|
||||
|
||||
// The following are temporary commented out because incompatibility
|
||||
// with katex
|
||||
|
||||
// Elipses
|
||||
// text = text.replace(/\.\.\./g,'…');
|
||||
|
||||
// Nbsp for punc with spaces
|
||||
// var NBSP = "\u00a0";
|
||||
// var NBSP_PUNCTUATION_START = /([«¿¡]) /g;
|
||||
// var NBSP_PUNCTUATION_END = / ([\!\?:;\.,‽»])/g;
|
||||
|
||||
// text = text.replace(NBSP_PUNCTUATION_START, '$1' + NBSP);
|
||||
// text = text.replace(NBSP_PUNCTUATION_END, NBSP + '$1');
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function quotes(text) {
|
||||
|
||||
text = text
|
||||
.replace(/(\W|^)"([^\s\!\?:;\.,‽»])/g, '$1\u201c$2') // beginning "
|
||||
.replace(/(\u201c[^"]*)"([^"]*$|[^\u201c"]*\u201c)/g, '$1\u201d$2') // ending "
|
||||
.replace(/([^0-9])"/g,'$1\u201d') // remaining " at end of word
|
||||
.replace(/(\W|^)'(\S)/g, '$1\u2018$2') // beginning '
|
||||
.replace(/([a-z])'([a-z])/ig, '$1\u2019$2') // conjunction's possession
|
||||
.replace(/((\u2018[^']*)|[a-z])'([^0-9]|$)/ig, '$1\u2019$3') // ending '
|
||||
.replace(/(\u2018)([0-9]{2}[^\u2019]*)(\u2018([^0-9]|$)|$|\u2019[a-z])/ig, '\u2019$2$3') // abbrev. years like '93
|
||||
.replace(/(\B|^)\u2018(?=([^\u2019]*\u2019\b)*([^\u2019\u2018]*\W[\u2019\u2018]\b|[^\u2019\u2018]*$))/ig, '$1\u2019') // backwards apostrophe
|
||||
.replace(/'''/g, '\u2034') // triple prime
|
||||
.replace(/("|'')/g, '\u2033') // double prime
|
||||
.replace(/'/g, '\u2032');
|
||||
|
||||
// Allow escaped quotes
|
||||
text = text.replace(/\\“/, '\"');
|
||||
text = text.replace(/\\”/, '\"');
|
||||
text = text.replace(/\\’/, '\'');
|
||||
text = text.replace(/\\‘/, '\'');
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function ligatures(text){
|
||||
|
||||
// text = text.replace(/fi/g, 'fi');
|
||||
// text = text.replace(/fl/g, 'fl');
|
||||
|
||||
return text;
|
||||
};
|
||||
Vendored
+11775
-202
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+157
-9
@@ -2,38 +2,186 @@
|
||||
<meta charset="utf8">
|
||||
<script src="../dist/template.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
||||
|
||||
<script type="text/front-matter">
|
||||
title: Article Title
|
||||
description: Description of the post
|
||||
published: Jan 10, 2017
|
||||
authors:
|
||||
- Chris Olah: http://colah.github.io
|
||||
- Chris Olah:
|
||||
- Shan Carter: http://shancarter.com
|
||||
affiliations:
|
||||
- Google Brain: http://g.co/brain
|
||||
- Google Brain:
|
||||
- Google Brain: http://g.co/brain
|
||||
</script>
|
||||
|
||||
<dt-header></dt-header>
|
||||
<dt-article>
|
||||
<script type="text/article"></script>
|
||||
<h1>Hello World</h1>
|
||||
<h2>A description of the article</h2>
|
||||
<dt-byline></dt-byline>
|
||||
<p>This is the first paragraph of the article.</p>
|
||||
<p>We can also cite <dt-cite key="gregor2015draw"></dt-cite> external publications.</p>
|
||||
<p>This is the first paragraph of the article. Test a long — dash -- here it is.</p>
|
||||
<p>Test for owner's possessive. Test for "quoting a passage." And another sentence. Or two.</p>
|
||||
<p>Here's a test of an inline equation <dt-math>c = a^2 + b^2</dt-math>.</p>
|
||||
<dt-math block>c = \pm\sqrt{a^2 + b^2}</dt-math>
|
||||
<p>We can also cite <dt-cite key="gregor2015draw,mercier2011humans"></dt-cite> external publications. <dt-cite key="dong2014image,dumoulin2016guide,mordvintsev2015inceptionism"></dt-cite> We should also be testing footnotes<dt-fn>This will become a hoverable footnote.</dt-fn>.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>First</th><th>Second</th><th>Third</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>23</td><td>654</td><td>23</td></tr>
|
||||
<tr><td>14</td><td>54</td><td>34</td></tr>
|
||||
<tr><td>234</td><td>54</td><td>23</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Here's a javascript code block.</p>
|
||||
<dt-code block language="javascript">
|
||||
var x = 25;
|
||||
function(x){
|
||||
return x * x;
|
||||
}
|
||||
</dt-code>
|
||||
<p>We also support python.</p>
|
||||
<dt-code block language="python">
|
||||
# Python 3: Fibonacci series up to n
|
||||
def fib(n):
|
||||
a, b = 0, 1
|
||||
while a < n:
|
||||
print(a, end=' ')
|
||||
a, b = b, a+b
|
||||
</dt-code>
|
||||
</dt-article>
|
||||
|
||||
<script type="text/bibliography">
|
||||
@article{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={arXivreprint arXiv:1502.04623},
|
||||
year={2015}
|
||||
journal={arXiv preprint arXiv:1502.04623},
|
||||
year={2015},
|
||||
url ={https://arxiv.org/pdf/1502.04623.pdf}
|
||||
}
|
||||
@article{mercier2011humans,
|
||||
title={Why do humans reason? Arguments for an argumentative theory},
|
||||
author={Mercier, Hugo and Sperber, Dan},
|
||||
journal={Behavioral and brain sciences},
|
||||
volume={34},
|
||||
number={02},
|
||||
pages={57--74},
|
||||
year={2011},
|
||||
publisher={Cambridge Univ Press},
|
||||
doi={10.1017/S0140525X10000968}
|
||||
}
|
||||
|
||||
@article{dong2014image,
|
||||
title={Image super-resolution using deep convolutional networks},
|
||||
author={Dong, Chao and Loy, Chen Change and He, Kaiming and Tang, Xiaoou},
|
||||
journal={arXiv preprint arXiv:1501.00092},
|
||||
year={2014},
|
||||
url={https://arxiv.org/pdf/1501.00092.pdf}
|
||||
}
|
||||
|
||||
@article{dumoulin2016adversarially,
|
||||
title={Adversarially Learned Inference},
|
||||
author={Dumoulin, Vincent and Belghazi, Ishmael and Poole, Ben and Lamb, Alex and Arjovsky, Martin and Mastropietro, Olivier and Courville, Aaron},
|
||||
journal={arXiv preprint arXiv:1606.00704},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1606.00704.pdf}
|
||||
}
|
||||
|
||||
@article{dumoulin2016guide,
|
||||
title={A guide to convolution arithmetic for deep learning},
|
||||
author={Dumoulin, Vincent and Visin, Francesco},
|
||||
journal={arXiv preprint arXiv:1603.07285},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1603.07285.pdf}
|
||||
}
|
||||
|
||||
@article{donahue2016adversarial,
|
||||
title={Adversarial Feature Learning},
|
||||
author={Donahue, Jeff and Kr{\"a}henb{\"u}hl, Philipp and Darrell, Trevor},
|
||||
journal={arXiv preprint arXiv:1605.09782},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1605.09782.pdf}
|
||||
}
|
||||
|
||||
@article{gauthier2014conditional,
|
||||
title={Conditional generative adversarial nets for convolutional face generation},
|
||||
author={Gauthier, Jon},
|
||||
journal={Class Project for Stanford CS231N: Convolutional Neural Networks for Visual Recognition, Winter semester},
|
||||
volume={2014},
|
||||
year={2014},
|
||||
url={http://www.foldl.me/uploads/papers/tr-cgans.pdf}
|
||||
}
|
||||
|
||||
@article{henaff2015geodesics,
|
||||
title={Geodesics of learned representations},
|
||||
author={H{\'e}naff, Olivier J and Simoncelli, Eero P},
|
||||
journal={arXiv preprint arXiv:1511.06394},
|
||||
year={2015},
|
||||
url={https://arxiv.org/pdf/1511.06394.pdf}
|
||||
}
|
||||
|
||||
@article{johnson2016perceptual,
|
||||
title={Perceptual losses for real-time style transfer and super-resolution},
|
||||
author={Johnson, Justin and Alahi, Alexandre and Fei-Fei, Li},
|
||||
journal={arXiv preprint arXiv:1603.08155},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1603.08155.pdf}
|
||||
}
|
||||
|
||||
@article{mordvintsev2015inceptionism,
|
||||
title={Inceptionism: Going deeper into neural networks},
|
||||
author={Mordvintsev, Alexander and Olah, Christopher and Tyka, Mike},
|
||||
journal={Google Research Blog},
|
||||
year={2015},
|
||||
url={https://research.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html}
|
||||
}
|
||||
|
||||
@misc{mordvintsev2016deepdreaming,
|
||||
title={DeepDreaming with TensorFlow},
|
||||
author={Mordvintsev, Alexander},
|
||||
year={2016},
|
||||
url={https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb},
|
||||
}
|
||||
|
||||
@article{radford2015unsupervised,
|
||||
title={Unsupervised representation learning with deep convolutional generative adversarial networks},
|
||||
author={Radford, Alec and Metz, Luke and Chintala, Soumith},
|
||||
journal={arXiv preprint arXiv:1511.06434},
|
||||
year={2015},
|
||||
url={https://arxiv.org/pdf/1511.06434.pdf}
|
||||
}
|
||||
|
||||
@inproceedings{salimans2016improved,
|
||||
title={Improved techniques for training gans},
|
||||
author={Salimans, Tim and Goodfellow, Ian and Zaremba, Wojciech and Cheung, Vicki and Radford, Alec and Chen, Xi},
|
||||
booktitle={Advances in Neural Information Processing Systems},
|
||||
pages={2226--2234},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1606.03498.pdf}
|
||||
}
|
||||
|
||||
@article{shi2016deconvolution,
|
||||
title={Is the deconvolution layer the same as a convolutional layer?},
|
||||
author={Shi, Wenzhe and Caballero, Jose and Theis, Lucas and Huszar, Ferenc and Aitken, Andrew and Ledig, Christian and Wang, Zehan},
|
||||
journal={arXiv preprint arXiv:1609.07009},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1609.07009.pdf}
|
||||
}
|
||||
|
||||
@inproceedings{shi2016real,
|
||||
title={Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network},
|
||||
author={Shi, Wenzhe and Caballero, Jose and Husz{\'a}r, Ferenc and Totz, Johannes and Aitken, Andrew P and Bishop, Rob and Rueckert, Daniel and Wang, Zehan},
|
||||
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
|
||||
pages={1874--1883},
|
||||
year={2016},
|
||||
url={https://arxiv.org/pdf/1609.05158.pdf},
|
||||
doi={10.1109/cvpr.2016.207}
|
||||
}
|
||||
|
||||
</script>
|
||||
<dt-appendix>
|
||||
<h3>Contributions</h3>
|
||||
<p>List of who did what</p>
|
||||
</dt-appendix>
|
||||
<dt-footer></dt-footer>
|
||||
|
||||
+110
-33
@@ -11,34 +11,34 @@
|
||||
.fake-img p {
|
||||
font-family: monospace;
|
||||
color: white;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
margin: 12px 0;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<dt-header></dt-header>
|
||||
<dt-article>
|
||||
<h1>How to Create a Distill Article</h1>
|
||||
<h2>A collection of examples and best practices for creating interactive explanatory articles using the Distill web framework</h2>
|
||||
<p>Distill ships with a CSS framework and a collection of custom web components that make building interactive academic articles easier than with raw HTML, CSS and JavaScript. This reference article details several examples and best practices for how to use both frameworks.</p>
|
||||
<hr>
|
||||
<h2>Getting Started</h2>
|
||||
<p>Here is the smallest distill post.</p>
|
||||
<p>Distill ships with a CSS framework and a collection of custom web components that make building interactive academic articles easier than with raw HTML, CSS and JavaScript. At its simplest, each distill post is just a single HTML file with one special script tag.</p>
|
||||
<dt-code block language="html">
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<script src="../dist/template.min.js"></script>
|
||||
|
||||
<script src="http://distill.pub/template.js"></script>
|
||||
|
||||
<dt-article>
|
||||
<h1>Hello World</h1>
|
||||
</dt-article>
|
||||
</dt-code>
|
||||
<p>A typical distill post will be quite a bit longer than this though. Below is a more complete example. Don’t worry if some of the tags don’t make sense, they’re all documented further in this post.</p>
|
||||
<p>This script tag will modify your post in your browser, adding the distill styling and functionality. When we publish your article, we will bake in these transformations, but during development it’s handy to be able to preview it locally (It even works without a web server).</p>
|
||||
<p>A typical distill post will be quite a bit longer than the one above. Below is a more complete example. Don’t worry if some of the tags don’t make sense, they’re all documented further in this post.</p>
|
||||
<dt-code block language="html">
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<script src="../dist/template.min.js"></script>
|
||||
<script src="http://distill.pub/template.js"></script>
|
||||
|
||||
<script type="text/front-matter">
|
||||
title: Article Title
|
||||
@@ -60,16 +60,20 @@
|
||||
<p>We can also cite <dt-cite key="gregor2015draw"></dt-cite> external publications.</p>
|
||||
</dt-article>
|
||||
|
||||
<dt-appendix>
|
||||
</dt-appendix>
|
||||
|
||||
<script type="text/bibliography">
|
||||
@article{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={arXivreprint arXiv:1502.04623},
|
||||
year={2015}
|
||||
year={2015},
|
||||
url={https://arxiv.org/pdf/1502.04623.pdf}
|
||||
}
|
||||
</script>
|
||||
</dt-code>
|
||||
<hr>
|
||||
<!-- <hr>
|
||||
<h2>Markdown</h2>
|
||||
<p>Markdown is supported as an alternative to html for the <dt-code language="html"><dt-article></dt-code> element. </p>
|
||||
<dt-code block language="html">
|
||||
@@ -85,7 +89,29 @@
|
||||
</dt-article>
|
||||
<script type="text/bibliography"></script>
|
||||
</dt-code>
|
||||
<p>We use <a href="https://github.com/chjj/marked">marked</a> as the rendering engine, with <a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/">github flavored markdown</a> and <a href="https://daringfireball.net/projects/smartypants/">smartypants</a> enabled. In development mode the markdown is translated in the client after the dom content has loaded, but when published, the translation is precompiled.</p>
|
||||
<p>We use <a href="https://github.com/chjj/marked">marked</a> as the rendering engine, with <a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/">github flavored markdown</a> and <a href="https://daringfireball.net/projects/smartypants/">smartypants</a> enabled. In development mode the markdown is translated in the client after the dom content has loaded, but when published, the translation is precompiled.</p> -->
|
||||
|
||||
<hr>
|
||||
<h2>Project Structure</h2>
|
||||
<p>Because all the templating is delivered via a script tag, you are generally free to develop however you are most comfortable. The only requirements are that each article must be its own Github repository. The simplest setup would be a repository that contained a single HTML file, along with any additional assets, like images or javascript files. Note, in this default setup, all files in the root of the repository will be published. Note, also, in this configuration you generally will not even need to run a static local webserver. You can just open the <dt-code>index.html</dt-code> file in your browser to preview.</p>
|
||||
|
||||
<dt-code block language="html">
|
||||
image.jpg
|
||||
index.html
|
||||
script.js
|
||||
</dt-code>
|
||||
|
||||
<p>If you have a more complicated build process, or have files you don’t want published, put your output in a <dt-code>public</dt-code> folder and we will only publish its contents.</p>
|
||||
|
||||
<dt-code block language="html">
|
||||
build/
|
||||
_index.html
|
||||
package.json
|
||||
public/
|
||||
index.html
|
||||
image.jpg
|
||||
</dt-code>
|
||||
|
||||
<hr>
|
||||
<h2>Front Matter</h2>
|
||||
<p>You’ll need to describe some data about you post — title, description, authors, etc. For this use the <dt-code language="html"><script type="text/front-matter"></dt-code> tag.</p>
|
||||
@@ -109,33 +135,45 @@
|
||||
<h2>Citations</h2>
|
||||
<p>Bibtex is the supported way of making academic citations. You first need have a global definition of all your possible citations. For this we’ll use the <dt-code language="html"><script type="text/bibliography"></dt-code> element.</p>
|
||||
<dt-code block language="html">
|
||||
<script type="text/bibliography"">
|
||||
<script type="text/bibliography">
|
||||
@article{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={arXivreprint arXiv:1502.04623},
|
||||
year={2015}
|
||||
}
|
||||
@article{mercier2011humans,
|
||||
title={Why do humans reason? Arguments for an argumentative theory},
|
||||
author={Mercier, Hugo and Sperber, Dan},
|
||||
journal={Behavioral and brain sciences},
|
||||
volume={34},
|
||||
number={02},
|
||||
pages={57--74},
|
||||
year={2011},
|
||||
publisher={Cambridge Univ Press}
|
||||
year={2015},
|
||||
url={https://arxiv.org/pdf/1502.04623.pdf},
|
||||
}
|
||||
</script>
|
||||
</dt-code>
|
||||
<p>(We strongly encourage you to populate the <dt-code>url</dt-code> bibtex field where possible so that we can provide links for citations.)</p>
|
||||
<!-- <p>Like with the <dt-code language="html"><script type="text/front-matter"></dt-code> element, you can alternatively reference an external file with the <dt-code>src</dt-code> attribute. If no <dt-code language="html"><script type="text/bibliography"></dt-code> element is found on the page, a request will automatically be made for <dt-code>bibliography.bib</dt-code>. In production, these files will be inlined into the document.</p>
|
||||
<dt-code block language="html">
|
||||
<script type="text/bibliography" src="bibliography.bib"></script>
|
||||
</dt-code> -->
|
||||
<p>Citations are then used in the article body with the <dt-code language="html"><dt-cite></dt-code> tag. The <dt-code>article</dt-code> attribute is a reference to the id provided in the bibiography.</p>
|
||||
<p>Citations are then used in the article body with the <dt-code language="html"><dt-cite></dt-code> tag. The <dt-code>key</dt-code> attribute is a reference to the id provided in the bibiography. The <dt-code>key</dt-code> attribute can take multiple ids, separated by commas.</p>
|
||||
<dt-code block language="html">
|
||||
<dt-cite ket="gregor2015draw"></dt-cite>
|
||||
<dt-cite key="gregor2015draw"></dt-cite>
|
||||
</dt-code>
|
||||
<script type="text/bibliography">
|
||||
@article{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={arXivreprint arXiv:1502.04623},
|
||||
year={2015},
|
||||
url={https://arxiv.org/pdf/1502.04623.pdf},
|
||||
}
|
||||
</script>
|
||||
<p>The citation is presented inline like this: <dt-cite key="gregor2015draw"></dt-cite> (a number that displays more information on hover). If you have an appendix, a bibliography is automatically created and populated in it.</p>
|
||||
<p>Distill chose a numerical inline citation style to improve readability of citation dense articles and because many of the benefits of longer citations are obviated by displaying more information on hover. However, we consider it good style to mention author last names if you discuss something at length and it fits into the flow well -- the authors are human and it's nice for them to have the community associate them with their work.</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2>Footnotes</h2>
|
||||
<p>Just wrap the text you would like to show up in a footnote in a <dt-code language="html"><dt-fn></dt-code> tag. The number of the footnote will be automatically generated. <dt-fn>This text will be shown on hover.</dt-fn></p>
|
||||
<dt-code block language="html">
|
||||
<dt-fn>This will become a hoverable footnote.</dt-fn>
|
||||
</dt-code>
|
||||
<dt-footnote-body ref="blah"></dt-footnote-body>
|
||||
|
||||
<hr>
|
||||
<h2>Code Blocks</h2>
|
||||
@@ -149,30 +187,69 @@
|
||||
</dt-code>
|
||||
</dt-code>
|
||||
|
||||
<!-- <hr>
|
||||
<h2>Footnotes</h2>
|
||||
<p>This is a <dt-footnote ref="blah" /></p>
|
||||
<dt-footnote-body ref="blah"></dt-footnote-body>
|
||||
<!--
|
||||
<hr>
|
||||
<h2>Math</h2> -->
|
||||
<h2>Math</h2>
|
||||
-->
|
||||
<hr>
|
||||
<h2>Layouts</h2>
|
||||
<p>The main text column is referred to as the body. It is the assumed layout of any direct descendents of the <code>dt-article</code> element.</p>
|
||||
<div class="fake-img l-body"><p>.l-body</p></div>
|
||||
<p>For images you want to display a little larger, try these:</p>
|
||||
<div class="fake-img l-middle"><p>.l-middle</p></div>
|
||||
<div class="fake-img l-page"><p>.l-page</p></div>
|
||||
<p>Occasionally you’ll want to use the full browser width. For this, use screen. You can also inset the element a little from the edge of the browser by appending, you guessed it, <code>inset</code>.</p>
|
||||
<p>All of these have an <dt-code>outset</dt-code> variant if you want to poke out from the body text a little bit. For instance:</p>
|
||||
<div class="fake-img l-body-outset"><p>.l-body-outset</p></div>
|
||||
<div class="fake-img l-middle-outset"><p>.l-middle-outset</p></div>
|
||||
<div class="fake-img l-page-outset"><p>.l-page-outset</p></div>
|
||||
<p>Occasionally you’ll want to use the full browser width. For this, use <dt-code>.l-screen</dt-code>. You can also inset the element a little from the edge of the browser by using the inset variant.</p>
|
||||
<div class="fake-img l-screen"><p>.l-screen</p></div>
|
||||
<div class="fake-img l-screen-inset"><p>.l-screen-inset</p></div>
|
||||
<p>Often you want to position smaller images so as not to completely interrupt the flow of your text. Or perhaps you want to put some text in the margin as an aside or to signal that it’s optional content. For these cases we’ll use the float-based <code>.side</code> layouts.</p>
|
||||
<p>Often you want to position smaller images so as not to completely interrupt the flow of your text. Or perhaps you want to put some text in the margin as an aside or to signal that it’s optional content. For these cases we’ll use the float-based layouts.</p>
|
||||
<div class="fake-img l-body side"><p>.l-body.side</p></div>
|
||||
<div class="fake-img l-middle side"><p>.l-middle.side</p></div>
|
||||
<div class="fake-img l-page side"><p>.l-page.side</p></div>
|
||||
<p>They are all floated to the right and anchored to the right-hand edge of the position you specify. By default, each will take up approximately half of the width of the standard layout position, but you can override the width with a more specific selector. </p>
|
||||
<div class="fake-img l-gutter"><p>.l-gutter</p></div>
|
||||
<p>The final layout is for marginalia, asides, and footnotes. It does not interrupt the normal flow of <code>.l-body</code> sized text except on mobile screen sizes.</p>
|
||||
<p>You can also use an alternate centered layout by adding a <dt-code>centered</dt-code> class to the <dt-code>dt-article</dt-code> element.</p>
|
||||
<dt-code block language="html">
|
||||
<dt-article class="centered">
|
||||
<h1>Hello World</h1>
|
||||
</dt-article>
|
||||
</dt-code>
|
||||
<p>You can toggle it on this article by <a onclick="document.querySelector('dt-article').classList.toggle('centered');">clicking here</a></p>
|
||||
<section class="centered">
|
||||
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
<h2>Appendix</h2>
|
||||
|
||||
<p>An appendix can be added after your article, using the <dt-code language="html"><dt-appendix></dt-code> tag.</p>
|
||||
|
||||
<dt-code block language="html">
|
||||
<dt-article>
|
||||
...
|
||||
</dt-article>
|
||||
|
||||
<dt-appendix>
|
||||
<h3>Appendix Section Title</h3>
|
||||
<p>section content<p>
|
||||
</dt-appendix>
|
||||
</dt-code>
|
||||
|
||||
<p>You may wish to include the following sections in your appendix:</p>
|
||||
<ul>
|
||||
<li><b>Acknowledgments</b>: This is a place to recognize people and institutions. It may also be a good place to acknowledge and cite software that makes your work possible (eg. TensorFlow, OpenAI Gym).</li>
|
||||
<li><b>Author Contributions</b>: We strongly encourage you to include an author contributions statement briefly describing what each author did.</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h2>And You’re Off</h2>
|
||||
<p>That should do it. If you have any questions or bugs to file, feel free to <a href="https://github.com/distillpub/template/issues/new">open an issue on GitHub</a>.</p>
|
||||
<!--
|
||||
<hr>
|
||||
<h2>Including External Files</h2> -->
|
||||
|
||||
</dt-article>
|
||||
<dt-footer></dt-footer>
|
||||
|
||||
@@ -2,15 +2,22 @@ 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 header from "./components/header";
|
||||
import banner from "./components/banner";
|
||||
import byline from "./components/byline";
|
||||
import appendix from "./components/appendix";
|
||||
import footer from "./components/footer";
|
||||
import appendixDistill from "./components/appendix-distill";
|
||||
import citation from "./components/citation";
|
||||
import footnote from "./components/footnote";
|
||||
import DTMath from "./components/dt-math";
|
||||
import markdown from "./components/markdown";
|
||||
import code from "./components/code";
|
||||
import typeset from "./components/typeset";
|
||||
import hoverBox from "./components/hover-box-include";
|
||||
import generateCrossref from "./components/generate-crossref";
|
||||
import header from "./components/header";
|
||||
import footer from "./components/footer";
|
||||
|
||||
function renderImmediately(dom) {
|
||||
html(dom);
|
||||
@@ -22,41 +29,53 @@ function renderOnLoad(dom, data) {
|
||||
bibliography(dom, data);
|
||||
expandData(dom, data);
|
||||
meta(dom, data);
|
||||
header(dom, data);
|
||||
byline(dom, data);
|
||||
appendix(dom, data);
|
||||
footer(dom, data);
|
||||
markdown(dom, data);
|
||||
DTMath(dom, data);
|
||||
code(dom, data);
|
||||
citation(dom, data);
|
||||
footnote(dom, data);
|
||||
typeset(dom, data);
|
||||
hoverBox(dom, data);
|
||||
}
|
||||
|
||||
// If we are in a browser, render automatically.
|
||||
if(window && window.document) {
|
||||
let data = data || {};
|
||||
renderImmediately(window.document);
|
||||
window.document.addEventListener("DOMContentLoaded", (event) => {
|
||||
renderOnLoad(window.document, data);
|
||||
console.log("final data:");
|
||||
for (var k in data) {console.log(" ", k, ": ", data[k])}
|
||||
});
|
||||
// If we are in a browser, render automatically...
|
||||
var browser = new Function("try { return this === window; }catch(e){ return false; }");
|
||||
if (browser) {
|
||||
try {
|
||||
var data = {};
|
||||
renderImmediately(window.document);
|
||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
renderOnLoad(window.document, data);
|
||||
// Add a banner if we're not on localhost.
|
||||
if (window.location.hostname !== "localhost" && window.location.origin !== "file://") {
|
||||
banner(window.document, data);
|
||||
}
|
||||
generateCrossref(data);
|
||||
// console.log(data);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Window not defined");
|
||||
}
|
||||
}
|
||||
|
||||
// For node
|
||||
// If we are in node...
|
||||
function render(dom, data) {
|
||||
renderImmediately(dom);
|
||||
renderOnLoad(dom, data);
|
||||
// Remove script tag so it doesn't run again in the client
|
||||
let s = dom.querySelector('script[src*="distill.pub/template"]');
|
||||
if (s) { s.parentElement.removeChild(s); };
|
||||
}
|
||||
|
||||
// Distill specific rendering
|
||||
function distillify(dom, data) {
|
||||
header(dom, data);
|
||||
appendixDistill(dom, data);
|
||||
footer(dom, data);
|
||||
}
|
||||
|
||||
export {render as render};
|
||||
export {html as html};
|
||||
export {styles as styles};
|
||||
export {frontMatter as frontMatter};
|
||||
export {bibliography as bibliography};
|
||||
export {meta as meta};
|
||||
export {header as header};
|
||||
export {appendix as appendix};
|
||||
export {footer as footer};
|
||||
export {citation as citation};
|
||||
export {markdown as markdown};
|
||||
export {code as code};
|
||||
export {distillify as distillify};
|
||||
export {generateCrossref as generateCrossref};
|
||||
|
||||
+9
-6
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "distill-template",
|
||||
"version": "0.0.8",
|
||||
"version": "1.1.1",
|
||||
"description": "Template for creating Distill articles.",
|
||||
"main": "dist/template.js",
|
||||
"scripts": {
|
||||
"serve": "python3 -m http.server",
|
||||
"start": "rollup -c -w",
|
||||
"build": "rollup -c",
|
||||
"test": "mocha"
|
||||
@@ -17,22 +18,24 @@
|
||||
"url": "https://github.com/distillpub/distill-template/issues"
|
||||
},
|
||||
"homepage": "https://github.com/distillpub/distill-template#readme",
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"bibtex-parse-js": "^0.0.23",
|
||||
"chai": "^3.5.0",
|
||||
"commander": "^2.9.0",
|
||||
"d3-time-format": "^2.0.3",
|
||||
"escape-html": "^1.0.3",
|
||||
"js-yaml": "^3.7.0",
|
||||
"jsdom": "^9.9.1",
|
||||
"jsdom": "^9.10.0",
|
||||
"katex": "^0.7.1",
|
||||
"marked": "^0.3.6",
|
||||
"mocha": "^3.2.0",
|
||||
"mustache": "^2.3.0",
|
||||
"prismjs": "^1.6.0",
|
||||
"rollup": "^0.36.4",
|
||||
"rollup-plugin-buble": "^0.14.0",
|
||||
"rollup-plugin-commonjs": "^7.0.0",
|
||||
"rollup-plugin-livereload": "^0.3.1",
|
||||
"rollup-plugin-node-resolve": "^2.0.0",
|
||||
"rollup-plugin-serve": "^0.1.0",
|
||||
"rollup-plugin-string": "^2.0.2",
|
||||
"rollup-plugin-uglify": "^1.0.1",
|
||||
"rollup-watch": "^2.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
+5
-8
@@ -1,13 +1,10 @@
|
||||
import buble from 'rollup-plugin-buble';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import liveReload from 'rollup-plugin-livereload';
|
||||
import serve from 'rollup-plugin-serve';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
import string from 'rollup-plugin-string';
|
||||
|
||||
const PORT = 8080;
|
||||
console.log(`open http://localhost:${PORT}/`);
|
||||
// const PORT = 8080;
|
||||
// console.log(`open http://localhost:${PORT}/`);
|
||||
|
||||
export default {
|
||||
entry: 'index.js',
|
||||
@@ -16,7 +13,7 @@ export default {
|
||||
{
|
||||
format: 'umd',
|
||||
moduleName: 'dl',
|
||||
dest: `dist/template.js`,
|
||||
dest: `dist/template.v1.js`,
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
@@ -25,7 +22,7 @@ export default {
|
||||
browser: true,
|
||||
}),
|
||||
string({
|
||||
include: ["**/*.svg", "**/*.html", "**/*.css", "**/*.base64"]
|
||||
include: ["**/*.txt", "**/*.svg", "**/*.html", "**/*.css", "**/*.base64"]
|
||||
}),
|
||||
buble({
|
||||
exclude: 'node_modules',
|
||||
@@ -34,6 +31,6 @@ export default {
|
||||
commonjs(),
|
||||
// uglify(),
|
||||
// liveReload(),
|
||||
serve({port: PORT}),
|
||||
// serve({port: PORT}),
|
||||
]
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -2,7 +2,7 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
abab@^1.0.0:
|
||||
abab@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
|
||||
|
||||
@@ -10,11 +10,11 @@ abbrev@1:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"
|
||||
|
||||
acorn-globals@^1.0.4:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf"
|
||||
acorn-globals@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf"
|
||||
dependencies:
|
||||
acorn "^2.1.0"
|
||||
acorn "^4.0.4"
|
||||
|
||||
acorn-jsx@^3.0.1:
|
||||
version "3.0.1"
|
||||
@@ -28,15 +28,11 @@ acorn-object-spread@^1.0.0:
|
||||
dependencies:
|
||||
acorn "^3.1.0"
|
||||
|
||||
acorn@^2.1.0, acorn@^2.4.0:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7"
|
||||
|
||||
acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
|
||||
|
||||
acorn@^4.0.1:
|
||||
acorn@^4.0.1, acorn@^4.0.4:
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a"
|
||||
|
||||
@@ -321,16 +317,26 @@ cryptiles@2.x.x:
|
||||
dependencies:
|
||||
boom "2.x.x"
|
||||
|
||||
cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0":
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.1.tgz#c9e37ef2490e64f6d1baa10fda852257082c25d3"
|
||||
cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0":
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b"
|
||||
|
||||
"cssstyle@>= 0.2.36 < 0.3.0":
|
||||
"cssstyle@>= 0.2.37 < 0.3.0":
|
||||
version "0.2.37"
|
||||
resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54"
|
||||
dependencies:
|
||||
cssom "0.3.x"
|
||||
|
||||
d3-time-format@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.0.3.tgz#3241569b74ddc9c42e0689c0e8a903579fd6280a"
|
||||
dependencies:
|
||||
d3-time "1"
|
||||
|
||||
d3-time@1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.4.tgz#2ceba09a76b7450c992a1ded4e10fc6195e69649"
|
||||
|
||||
dashdash@^1.12.0:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
||||
@@ -377,16 +383,16 @@ diff@1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf"
|
||||
|
||||
distill-template@^0.0.4:
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/distill-template/-/distill-template-0.0.4.tgz#d9d8350001f9f6fc64884e0ad903d733b6856d59"
|
||||
|
||||
ecc-jsbn@~0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
|
||||
dependencies:
|
||||
jsbn "~0.1.0"
|
||||
|
||||
escape-html@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
|
||||
|
||||
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
@@ -642,10 +648,6 @@ iconv-lite@0.4.13:
|
||||
version "0.4.13"
|
||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
|
||||
|
||||
iconv-lite@^0.4.13:
|
||||
version "0.4.15"
|
||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
@@ -763,30 +765,29 @@ jsbn@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd"
|
||||
|
||||
jsdom@^9.9.1:
|
||||
version "9.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.9.1.tgz#84f3972ad394ab963233af8725211bce4d01bfd5"
|
||||
jsdom@^9.10.0:
|
||||
version "9.10.0"
|
||||
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.10.0.tgz#72d04d9fd5f1164d016dc350ef889af6d0d1a25a"
|
||||
dependencies:
|
||||
abab "^1.0.0"
|
||||
acorn "^2.4.0"
|
||||
acorn-globals "^1.0.4"
|
||||
abab "^1.0.3"
|
||||
acorn "^4.0.4"
|
||||
acorn-globals "^3.1.0"
|
||||
array-equal "^1.0.0"
|
||||
content-type-parser "^1.0.1"
|
||||
cssom ">= 0.3.0 < 0.4.0"
|
||||
cssstyle ">= 0.2.36 < 0.3.0"
|
||||
cssom ">= 0.3.2 < 0.4.0"
|
||||
cssstyle ">= 0.2.37 < 0.3.0"
|
||||
escodegen "^1.6.1"
|
||||
html-encoding-sniffer "^1.0.1"
|
||||
iconv-lite "^0.4.13"
|
||||
nwmatcher ">= 1.3.9 < 2.0.0"
|
||||
parse5 "^1.5.1"
|
||||
request "^2.55.0"
|
||||
sax "^1.1.4"
|
||||
symbol-tree ">= 3.1.0 < 4.0.0"
|
||||
tough-cookie "^2.3.1"
|
||||
request "^2.79.0"
|
||||
sax "^1.2.1"
|
||||
symbol-tree "^3.2.1"
|
||||
tough-cookie "^2.3.2"
|
||||
webidl-conversions "^3.0.1"
|
||||
whatwg-encoding "^1.0.1"
|
||||
whatwg-url "^4.1.0"
|
||||
xml-name-validator ">= 2.0.1 < 3.0.0"
|
||||
whatwg-url "^4.3.0"
|
||||
xml-name-validator "^2.0.1"
|
||||
|
||||
json-schema@0.2.3:
|
||||
version "0.2.3"
|
||||
@@ -812,6 +813,12 @@ jsprim@^1.2.2:
|
||||
json-schema "0.2.3"
|
||||
verror "1.3.6"
|
||||
|
||||
katex@^0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/katex/-/katex-0.7.1.tgz#06bb5298efad05e1e7228035ba8e1591f3061b8f"
|
||||
dependencies:
|
||||
match-at "^0.1.0"
|
||||
|
||||
kind-of@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
|
||||
@@ -908,7 +915,11 @@ marked@^0.3.6:
|
||||
version "0.3.6"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7"
|
||||
|
||||
micromatch@^2.1.5:
|
||||
match-at@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/match-at/-/match-at-0.1.0.tgz#f561e7709ff9a105b85cc62c6b8ee7c15bf24f31"
|
||||
|
||||
micromatch@^2.1.5, micromatch@^2.3.11:
|
||||
version "2.3.11"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
|
||||
dependencies:
|
||||
@@ -980,6 +991,10 @@ ms@0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
|
||||
|
||||
mustache@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.0.tgz#4028f7778b17708a489930a6e52ac3bca0da41d0"
|
||||
|
||||
nan@^2.3.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8"
|
||||
@@ -1190,7 +1205,7 @@ repeat-string@^1.5.2:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
|
||||
|
||||
request@^2.55.0, request@^2.79.0:
|
||||
request@^2.79.0:
|
||||
version "2.79.0"
|
||||
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
|
||||
dependencies:
|
||||
@@ -1279,6 +1294,13 @@ rollup-plugin-string@^2.0.2:
|
||||
dependencies:
|
||||
rollup-pluginutils "^1.5.0"
|
||||
|
||||
rollup-plugin-svelte@^1.8.0:
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-svelte/-/rollup-plugin-svelte-1.8.0.tgz#4cefe4fcf453cd051378babb5c4804645acd1652"
|
||||
dependencies:
|
||||
rollup-pluginutils "^2.0.1"
|
||||
svelte "^1.11.2"
|
||||
|
||||
rollup-plugin-uglify@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.1.tgz#11d0b0c8bcd2d07e6908f74fd16b0152390b922a"
|
||||
@@ -1292,6 +1314,13 @@ rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.1:
|
||||
estree-walker "^0.2.1"
|
||||
minimatch "^3.0.2"
|
||||
|
||||
rollup-pluginutils@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0"
|
||||
dependencies:
|
||||
estree-walker "^0.3.0"
|
||||
micromatch "^2.3.11"
|
||||
|
||||
rollup-watch@^2.5.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-watch/-/rollup-watch-2.5.0.tgz#852d660ddecc51696890aa8c22e95ed4558cc5f7"
|
||||
@@ -1304,7 +1333,7 @@ rollup@^0.36.4:
|
||||
dependencies:
|
||||
source-map-support "^0.4.0"
|
||||
|
||||
sax@>=0.6.0, sax@^1.1.4:
|
||||
sax@>=0.6.0, sax@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
|
||||
|
||||
@@ -1409,7 +1438,11 @@ supports-color@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||
|
||||
"symbol-tree@>= 3.1.0 < 4.0.0":
|
||||
svelte@^1.11.2:
|
||||
version "1.15.0"
|
||||
resolved "https://registry.yarnpkg.com/svelte/-/svelte-1.15.0.tgz#d5d00c89fc158bbaf5a19a159236fe56dad6d63c"
|
||||
|
||||
symbol-tree@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.1.tgz#8549dd1d01fa9f893c18cc9ab0b106b4d9b168cb"
|
||||
|
||||
@@ -1438,7 +1471,7 @@ tiny-emitter@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-1.1.0.tgz#ab405a21ffed814a76c19739648093d70654fecb"
|
||||
|
||||
tough-cookie@^2.3.1, tough-cookie@~2.3.0:
|
||||
tough-cookie@^2.3.2, tough-cookie@~2.3.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a"
|
||||
dependencies:
|
||||
@@ -1519,9 +1552,9 @@ whatwg-encoding@^1.0.1:
|
||||
dependencies:
|
||||
iconv-lite "0.4.13"
|
||||
|
||||
whatwg-url@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.2.0.tgz#abf1a3f5ff4bc2005b3f0c2119382631789d8e44"
|
||||
whatwg-url@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.3.0.tgz#92aaee21f4f2a642074357d70ef8500a7cbb171a"
|
||||
dependencies:
|
||||
tr46 "~0.0.3"
|
||||
webidl-conversions "^3.0.0"
|
||||
@@ -1555,7 +1588,7 @@ ws@^1.1.1:
|
||||
options ">=0.0.5"
|
||||
ultron "1.0.x"
|
||||
|
||||
"xml-name-validator@>= 2.0.1 < 3.0.0":
|
||||
xml-name-validator@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user