mirror of
https://github.com/wassname/template.git
synced 2026-06-28 04:24:00 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 758697ab97 | |||
| 4428ad1a5f |
@@ -8,12 +8,10 @@ export default function(dom, data) {
|
||||
}*/
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
console.log(citeTags);
|
||||
citeTags.forEach(el => {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -39,5 +39,12 @@ dt-footer .logo {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ export default function(data) {
|
||||
|
||||
var date = data.published;
|
||||
var batch_timestamp = Math.floor(Date.now() / 1000);
|
||||
console.log(data.authors)
|
||||
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;
|
||||
|
||||
@@ -58,5 +58,13 @@ dt-header .nav a {
|
||||
`
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+17
-13
@@ -282,8 +282,6 @@ function Type$2(tag, options) {
|
||||
|
||||
var type = Type$2;
|
||||
|
||||
/*eslint-disable max-len*/
|
||||
|
||||
var common$4 = common$1;
|
||||
var YAMLException$3 = exception;
|
||||
var Type$1 = type;
|
||||
@@ -895,8 +893,6 @@ function createCommonjsModule(fn, module) {
|
||||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
/*eslint-disable no-bitwise*/
|
||||
|
||||
var NodeBuffer;
|
||||
|
||||
try {
|
||||
@@ -1354,8 +1350,6 @@ var default_full = Schema$6.DEFAULT = new Schema$6({
|
||||
]
|
||||
});
|
||||
|
||||
/*eslint-disable max-len,no-use-before-define*/
|
||||
|
||||
var common = common$1;
|
||||
var YAMLException$1 = exception;
|
||||
var Mark = mark;
|
||||
@@ -2947,8 +2941,6 @@ var loader$1 = {
|
||||
safeLoad: safeLoad_1
|
||||
};
|
||||
|
||||
/*eslint-disable no-use-before-define*/
|
||||
|
||||
var common$7 = common$1;
|
||||
var YAMLException$5 = exception;
|
||||
var DEFAULT_FULL_SCHEMA$2 = default_full;
|
||||
@@ -4358,7 +4350,15 @@ var logo = "<svg viewBox=\"-607 419 64 64\">\n <path style=\"fill: none; stroke
|
||||
var html$1 = "\n<style>\ndt-header {\n display: block;\n position: relative;\n height: 60px;\n background-color: none;\n width: 100%;\n box-sizing: border-box;\n z-index: 2;\n color: rgba(0, 0, 0, 0.8);\n}\ndt-header .content {\n border-bottom: 1px solid rgba(0, 0, 0, 0.3);\n height: 60px;\n}\ndt-header a {\n font-size: 16px;\n height: 60px;\n line-height: 60px;\n text-decoration: none;\n color: rgba(0, 0, 0, 0.8);\n}\ndt-header svg {\n width: 24px;\n position: relative;\n top: 4px;\n margin-right: -2px;\n}\ndt-header svg path {\n fill: none;\n stroke: black;\n stroke-width: 1;\n stroke-linejoin: round;\n}\ndt-header .logo {\n font-size: 16px;\n font-weight: 300;\n}\ndt-header .nav {\n float: right;\n}\ndt-header .nav a {\n font-size: 14px;\n}\n</style>\n\n<div class=\"content l-page\">\n <a href=\"/\" class=\"logo\">\n " + logo + "\n Distill\n </a>\n <div class=\"nav\">\n </div>\n</div>\n";
|
||||
|
||||
var header = function(dom, data) {
|
||||
dom.querySelector('dt-header').innerHTML = html$1;
|
||||
var el = dom.querySelector("dt-header");
|
||||
if(el) {
|
||||
el.innerHTML = html$1;
|
||||
} else {
|
||||
var header = dom.createElement("dt-header");
|
||||
header.innerHTML = html$1;
|
||||
var b = dom.querySelector("body");
|
||||
b.insertBefore(header, b.firstChild);
|
||||
}
|
||||
};
|
||||
|
||||
var html$2 = "\n<style>\n dt-appendix {\n display: block;\n font-family: \"Open Sans\";\n font-size: 14px;\n line-height: 24px;\n margin-bottom: 0;\n border-top: 1px solid rgba(0,0,0,0.1);\n color: rgba(0,0,0,0.5);\n background: rgba(0,0,0,0.025);\n padding-top: 36px;\n padding-right: 24px;\n padding-bottom: 60px;\n padding-left: 24px;\n }\n dt-appendix h3 {\n font-size: 16px;\n font-weight: 500;\n margin-top: 18px;\n margin-bottom: 18px;\n color: rgba(0,0,0,0.65);\n }\n dt-appendix .citation {\n font-size: 11px;\n line-height: 15px;\n border-left: 1px solid rgba(0, 0, 0, 0.1);\n padding-left: 18px;\n border: 1px solid rgba(0,0,0,0.1);\n background: rgba(0, 0, 0, 0.02);\n padding: 10px 18px;\n border-radius: 3px;\n color: rgba(150, 150, 150, 1);\n overflow: hidden;\n margin-top: -12px;\n }\n dt-appendix .references {\n font-size: 12px;\n line-height: 20px;\n }\n dt-appendix a {\n color: rgba(0, 0, 0, 0.6);\n }\n</style>\n\n<div class=\"l-body\">\n <h3>References</h3>\n <dt-bibliography></dt-bibliography>\n <h3 id=\"citation\">Errors, Reuse, and Citation</h3>\n <p>If you see mistakes or want to suggest changes, please submit a pull request on <a class=\"github\">github</a>.</p>\n <p>Diagrams and text are licensed under Creative Commons Attribution <a href=\"https://creativecommons.org/licenses/by/2.0/\">CC-BY 2.0</a>, unless noted otherwise, with the 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>\n <p>For attribution in academic contexts, please cite this work as</p>\n <pre class=\"citation short\"></pre>\n <p>BibTeX citation</p>\n <pre class=\"citation long\"></pre>\n</div>\n";
|
||||
@@ -4388,7 +4388,14 @@ var html$3 = "\n<style>\ndt-footer {\n display: block;\n color: rgba(255, 255,
|
||||
|
||||
var footer = function(dom, data) {
|
||||
var el = dom.querySelector("dt-footer");
|
||||
if(el) { el.innerHTML = html$3; }
|
||||
if(el) {
|
||||
el.innerHTML = html$3;
|
||||
} else {
|
||||
var footer = dom.createElement("dt-footer");
|
||||
footer.innerHTML = html$3;
|
||||
var b = dom.querySelector("body");
|
||||
b.appendChild(footer);
|
||||
}
|
||||
};
|
||||
|
||||
var citation = function(dom, data) {
|
||||
@@ -4401,12 +4408,10 @@ var citation = function(dom, data) {
|
||||
}*/
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
console.log(citeTags);
|
||||
citeTags.forEach(function (el) {
|
||||
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;
|
||||
}
|
||||
@@ -6660,7 +6665,6 @@ var generateCrossref = function(data) {
|
||||
|
||||
var date = data.published;
|
||||
var batch_timestamp = Math.floor(Date.now() / 1000);
|
||||
console.log(data.authors);
|
||||
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;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,10 +1,8 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf8">
|
||||
<script src="../dist/template.js"></script>
|
||||
|
||||
<script type="text/front-matter">
|
||||
title: Article Title
|
||||
description: Description of the post
|
||||
published: Jan 10, 2017
|
||||
authors:
|
||||
- Chris Olah: http://colah.github.io
|
||||
@@ -14,7 +12,6 @@
|
||||
- Google Brain: http://g.co/brain
|
||||
</script>
|
||||
|
||||
<dt-header></dt-header>
|
||||
<dt-article>
|
||||
<script type="text/article"></script>
|
||||
<h1>Hello World</h1>
|
||||
@@ -36,4 +33,3 @@
|
||||
<h3>Contributions</h3>
|
||||
<p>List of who did what</p>
|
||||
</dt-appendix>
|
||||
<dt-footer></dt-footer>
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
}
|
||||
</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>
|
||||
@@ -29,7 +28,7 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<script src="../dist/template.min.js"></script>
|
||||
|
||||
|
||||
<dt-article>
|
||||
<h1>Hello World</h1>
|
||||
</dt-article>
|
||||
@@ -175,4 +174,3 @@
|
||||
<h2>Including External Files</h2> -->
|
||||
|
||||
</dt-article>
|
||||
<dt-footer></dt-footer>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "distill-template",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.16",
|
||||
"description": "Template for creating Distill articles.",
|
||||
"main": "dist/template.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user