mirror of
https://github.com/wassname/template.git
synced 2026-08-18 12:30:46 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12d78fed92 | ||
|
|
722db5947e |
@@ -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;
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Vendored
+18
-12
@@ -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");
|
||||||
@@ -6661,7 +6667,7 @@ if(window && window.document) {
|
|||||||
// For node
|
// For node
|
||||||
function render(dom, data) {
|
function render(dom, data) {
|
||||||
renderImmediately(dom);
|
renderImmediately(dom);
|
||||||
renderOnload(dom, data);
|
renderOnLoad(dom, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.render = render;
|
exports.render = render;
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -44,7 +44,7 @@ if(window && window.document) {
|
|||||||
// For node
|
// For node
|
||||||
function render(dom, data) {
|
function render(dom, data) {
|
||||||
renderImmediately(dom);
|
renderImmediately(dom);
|
||||||
renderOnload(dom, data);
|
renderOnLoad(dom, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {render as render};
|
export {render as render};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "distill-template",
|
"name": "distill-template",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"description": "Template for creating Distill articles.",
|
"description": "Template for creating Distill articles.",
|
||||||
"main": "dist/template.js",
|
"main": "dist/template.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user