Compare commits

...
8 Commits
Author SHA1 Message Date
Shan Carter 12d78fed92 0.0.8 2017-01-09 16:42:39 -08:00
Shan Carter 722db5947e bump 2017-01-09 16:42:35 -08:00
Shan Carter cec3f6ab0b 0.0.7 2017-01-09 16:31:21 -08:00
Shan Carter 7e510b858e Fixes 2017-01-09 16:31:16 -08:00
Shan Carter 715dbec2a1 0.0.6 2017-01-09 15:50:20 -08:00
Shan Carter 953991f3f7 fixing main path 2017-01-09 15:50:15 -08:00
Shan Carter 998d88a927 0.0.5 2017-01-09 15:44:25 -08:00
Shan Carter fa20821af9 Building 2017-01-09 15:44:18 -08:00
7 changed files with 99 additions and 60 deletions
+10 -7
View File
@@ -15,15 +15,18 @@ export default function(dom, data) {
let citations = []; let citations = [];
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite")); var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
citeTags.forEach(el => { citeTags.forEach(el => {
let citationKeys = el.getAttribute("key").split(","); let key = el.getAttribute("key");
citationKeys.forEach(key => { if (key) {
if (citations.indexOf(key) == -1){ let citationKeys = key.split(",");
citations.push(key); citationKeys.forEach(key => {
if (! (key in bibliography)){ if (citations.indexOf(key) == -1){
citations.push(key);
if (! (key in bibliography)){
console.warn("No bibliography entry found for: " + key); console.warn("No bibliography entry found for: " + key);
}
} }
} });
}); }
}); });
data.bibliography = bibliography; data.bibliography = bibliography;
data.citations = citations; data.citations = citations;
+7 -4
View File
@@ -10,10 +10,13 @@ export default function(dom, data) {
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite")); var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
console.log(citeTags); console.log(citeTags);
citeTags.forEach(el => { citeTags.forEach(el => {
var keys = el.getAttribute("key").split(","); var key = el.getAttribute("key");
console.log(keys) if (key) {
var cite_string = inline_cite_short(keys); var keys = key.split(",");
el.innerHTML = cite_string; console.log(keys)
var cite_string = inline_cite_short(keys);
el.innerHTML = cite_string;
}
}); });
let bibEl = dom.querySelector("dt-bibliography"); let bibEl = dom.querySelector("dt-bibliography");
+48 -27
View File
@@ -4201,15 +4201,18 @@ var bibliography = function(dom, data) {
var citations = []; var citations = [];
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite")); var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
citeTags.forEach(function (el) { citeTags.forEach(function (el) {
var citationKeys = el.getAttribute("key").split(","); var key = el.getAttribute("key");
citationKeys.forEach(function (key) { if (key) {
if (citations.indexOf(key) == -1){ var citationKeys = key.split(",");
citations.push(key); citationKeys.forEach(function (key) {
if (! (key in bibliography)){ if (citations.indexOf(key) == -1){
citations.push(key);
if (! (key in bibliography)){
console.warn("No bibliography entry found for: " + key); console.warn("No bibliography entry found for: " + key);
}
} }
} });
}); }
}); });
data.bibliography = bibliography; data.bibliography = bibliography;
data.citations = citations; data.citations = citations;
@@ -4383,10 +4386,13 @@ var citation = function(dom, data) {
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite")); var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
console.log(citeTags); console.log(citeTags);
citeTags.forEach(function (el) { citeTags.forEach(function (el) {
var keys = el.getAttribute("key").split(","); var key = el.getAttribute("key");
console.log(keys); if (key) {
var cite_string = inline_cite_short(keys); var keys = key.split(",");
el.innerHTML = cite_string; console.log(keys);
var cite_string = inline_cite_short(keys);
el.innerHTML = cite_string;
}
}); });
var bibEl = dom.querySelector("dt-bibliography"); var bibEl = dom.querySelector("dt-bibliography");
@@ -6625,29 +6631,43 @@ var code$1 = function(dom, data) {
}); });
}; };
function render(dom, data) { var generateCrossref = function(data) {
data = data || {}; return "crossref";
};
function renderImmediately(dom) {
html(dom); html(dom);
styles(dom); styles(dom);
dom.addEventListener("DOMContentLoaded", function(event) { }
frontMatter(dom, data);
bibliography(dom, data); function renderOnLoad(dom, data) {
expandData(dom, data); frontMatter(dom, data);
meta(dom, data); bibliography(dom, data);
header(dom, data); expandData(dom, data);
appendix(dom, data); meta(dom, data);
footer(dom, data); header(dom, data);
markdown(dom, data); appendix(dom, data);
code$1(dom, data); footer(dom, data);
citation(dom, data); markdown(dom, data);
code$1(dom, data);
citation(dom, data);
}
// If we are in a browser, render automatically.
if(window && window.document) {
var data = data || {};
renderImmediately(window.document);
window.document.addEventListener("DOMContentLoaded", function (event) {
renderOnLoad(window.document, data);
console.log("final data:"); console.log("final data:");
for (var k in data) {console.log(" ", k, ": ", data[k]);} for (var k in data) {console.log(" ", k, ": ", data[k]);}
}); });
} }
// If we are in a browser, run render automatically. // For node
if(window && window.document) { function render(dom, data) {
render(window.document); renderImmediately(dom);
renderOnLoad(dom, data);
} }
exports.render = render; exports.render = render;
@@ -6662,6 +6682,7 @@ exports.footer = footer;
exports.citation = citation; exports.citation = citation;
exports.markdown = markdown; exports.markdown = markdown;
exports.code = code$1; exports.code = code$1;
exports.generateCrossref = generateCrossref;
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
+1 -1
View File
File diff suppressed because one or more lines are too long
+27 -19
View File
@@ -10,32 +10,41 @@ import footer from "./components/footer";
import citation from "./components/citation"; import citation from "./components/citation";
import markdown from "./components/markdown"; import markdown from "./components/markdown";
import code from "./components/code"; import code from "./components/code";
import generateCrossref from "./components/generate-crossref"; import generateCrossref from "./components/generate-crossref";
function render(dom, data) { function renderImmediately(dom) {
data = data || {};
html(dom); html(dom);
styles(dom); styles(dom);
dom.addEventListener("DOMContentLoaded", function(event) { }
frontMatter(dom, data);
bibliography(dom, data); function renderOnLoad(dom, data) {
expandData(dom, data); frontMatter(dom, data);
meta(dom, data); bibliography(dom, data);
header(dom, data); expandData(dom, data);
appendix(dom, data); meta(dom, data);
footer(dom, data); header(dom, data);
markdown(dom, data); appendix(dom, data);
code(dom, data); footer(dom, data);
citation(dom, data); markdown(dom, data);
console.log("final data:") code(dom, data);
citation(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])} for (var k in data) {console.log(" ", k, ": ", data[k])}
}); });
} }
// If we are in a browser, run render automatically. // For node
if(window && window.document) { function render(dom, data) {
render(window.document); renderImmediately(dom);
renderOnLoad(dom, data);
} }
export {render as render}; export {render as render};
@@ -50,5 +59,4 @@ export {footer as footer};
export {citation as citation}; export {citation as citation};
export {markdown as markdown}; export {markdown as markdown};
export {code as code}; export {code as code};
export {generateCrossref as generateCrossref}; export {generateCrossref as generateCrossref};
+2 -2
View File
@@ -1,8 +1,8 @@
{ {
"name": "distill-template", "name": "distill-template",
"version": "0.0.4", "version": "0.0.8",
"description": "Template for creating Distill articles.", "description": "Template for creating Distill articles.",
"main": "dist/distill.js", "main": "dist/template.js",
"scripts": { "scripts": {
"start": "rollup -c -w", "start": "rollup -c -w",
"build": "rollup -c", "build": "rollup -c",
+4
View File
@@ -377,6 +377,10 @@ diff@1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" 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: ecc-jsbn@~0.1.1:
version "0.1.1" version "0.1.1"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"