mirror of
https://github.com/wassname/template.git
synced 2026-10-30 13:50:34 +08:00
Bibliography data working
This commit is contained in:
1 parent
d6934fae51
commit
037996bd06
10 files changed
+60
-66
No files matched your search
@@ -73,5 +73,6 @@ const html = `
|
||||
// })
|
||||
|
||||
export default function(dom, data) {
|
||||
dom.querySelector('dt-appendix').innerHTML = html;
|
||||
let el = dom.querySelector('dt-appendix')
|
||||
if (el) el.innerHTML = html;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import bibtexParse from "bibtex-parse-js";
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('script[type="text/bibliography"]');
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
|
||||
let rawBib = el.textContent;
|
||||
console.log(rawBib, bibtexParse.toJSON(rawBib))
|
||||
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 citationKeys = el.getAttribute("key").split(",");
|
||||
citationKeys.forEach(key => {
|
||||
if (bibliography[key]) {
|
||||
citations[key] = bibliography[key];
|
||||
} else {
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
});
|
||||
});
|
||||
data.citations = citations;
|
||||
console.log(data.citations)
|
||||
}
|
||||
@@ -13,13 +13,15 @@ export default function(dom, data) {
|
||||
});
|
||||
|
||||
let bibEl = dom.querySelector("dt-bibliography");
|
||||
let ol = dom.createElement("ol");
|
||||
citations.forEach(citation => {
|
||||
let el = dom.createElement("li");
|
||||
el.textContent = bibliography_cite(citation);
|
||||
ol.appendChild(el);
|
||||
})
|
||||
bibEl.appendChild(ol);
|
||||
if (bibEl) {
|
||||
let ol = dom.createElement("ol");
|
||||
citations.forEach(citation => {
|
||||
let el = dom.createElement("li");
|
||||
el.textContent = bibliography_cite(citation);
|
||||
ol.appendChild(el);
|
||||
})
|
||||
bibEl.appendChild(ol);
|
||||
}
|
||||
|
||||
function inline_cite(key){
|
||||
if (key in data.citations){
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import bibtexParse from "bibtex-parse-js";
|
||||
|
||||
export default function(dom, data) {
|
||||
|
||||
//TODO populate bibliography
|
||||
|
||||
let rawBib = `
|
||||
@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}
|
||||
}`;
|
||||
|
||||
var 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 citationKeys = el.textContent.split(",");
|
||||
citationKeys.forEach(key => {
|
||||
if (bibliography[key]) {
|
||||
citations[key] = bibliography[key];
|
||||
} else {
|
||||
console.warn("No bibliography entry found for: " + key);
|
||||
}
|
||||
});
|
||||
});
|
||||
data.citations = citations;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import logo from "./distill-logo.svg";
|
||||
|
||||
const html = `
|
||||
let html = `
|
||||
<style>
|
||||
dt-footer {
|
||||
display: block;
|
||||
@@ -38,5 +38,6 @@ dt-footer .logo {
|
||||
`;
|
||||
|
||||
export default function(dom, data) {
|
||||
dom.querySelector('dt-footer').innerHTML = html;
|
||||
let el = dom.querySelector("dt-footer");
|
||||
if(el) el.innerHTML = html;
|
||||
}
|
||||
@@ -2,8 +2,11 @@ import ymlParse from "js-yaml";
|
||||
|
||||
export default function(dom, data) {
|
||||
let el = dom.querySelector('script[type="text/front-matter"]');
|
||||
|
||||
//TODO If we don't have a local element, make a request for the document.
|
||||
|
||||
let text = el.textContent;
|
||||
let localData = ymlParse.load(text);
|
||||
let localData = ymlParse.safeLoad(text);
|
||||
|
||||
data.title = localData.title;
|
||||
data.description = localData.description;
|
||||
@@ -11,12 +14,14 @@ export default function(dom, data) {
|
||||
let a = {};
|
||||
let name = Object.keys(author)[0];
|
||||
let names = name.split(" ");
|
||||
let affiliation = Object.keys(localData.affiliations[i])[0];
|
||||
a.firstName = names.slice(0, names.length - 1).join(" ");
|
||||
a.lastName = names[names.length -1];
|
||||
a.personalURL = author[name];
|
||||
a.affiliation = affiliation;
|
||||
a.afiiliationURL = localData.affiliations[i][affiliation];
|
||||
if(localData.affiliations[i]) {
|
||||
let affiliation = Object.keys(localData.affiliations[i])[0];
|
||||
a.affiliation = affiliation;
|
||||
a.affiliationURL = localData.affiliations[i][affiliation];
|
||||
}
|
||||
return a;
|
||||
});
|
||||
}
|
||||
Vendored
+3
-3
@@ -1,4 +1,4 @@
|
||||
var dl=function(){"use strict";function t(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t,e){t.innerHTML+=e}function i(t){var e="citation_title="+t.title+";";return t.author.split(" and ").forEach(function(t){e+="citation_author="+t.trim()+";"}),"journal"in t&&(e+="citation_journal_title="+t.journal+";"),"volume"in t&&(e+="citation_volume="+t.volume+";"),("issue"in t||"number"in t)&&(e+="citation_number="+(t.issue||t.number)+";"),e}function r(t){return"undefined"==typeof t||null===t}function o(t){return"object"==typeof t&&null!==t}function a(t){return Array.isArray(t)?t:r(t)?[]:[t]}function s(t,e){var n,i,r,o;if(e)for(o=Object.keys(e),n=0,i=o.length;n<i;n+=1)r=o[n],t[r]=e[r];return t}function l(t,e){var n,i="";for(n=0;n<e;n+=1)i+=t;return i}function c(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t}function u(t,e){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}function p(t,e,n,i,r){this.name=t,this.buffer=e,this.position=n,this.line=i,this.column=r}function h(t){var e={};return null!==t&&Object.keys(t).forEach(function(n){t[n].forEach(function(t){e[String(t)]=n})}),e}function d(t,e){if(e=e||{},Object.keys(e).forEach(function(e){if(Ze.indexOf(e)===-1)throw new Ve('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=h(e.styleAliases||null),Xe.indexOf(this.kind)===-1)throw new Ve('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}function f(t,e,n){var i=[];return t.include.forEach(function(t){n=f(t,e,n)}),t[e].forEach(function(t){n.forEach(function(e,n){e.tag===t.tag&&e.kind===t.kind&&i.push(n)}),n.push(t)}),n.filter(function(t,e){return i.indexOf(e)===-1})}function g(){function t(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}var e,n,i=arguments,r={scalar:{},sequence:{},mapping:{},fallback:{}};for(e=0,n=arguments.length;e<n;e+=1)i[e].forEach(t);return r}function m(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach(function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new en("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=f(this,"implicit",[]),this.compiledExplicit=f(this,"explicit",[]),this.compiledTypeMap=g(this.compiledImplicit,this.compiledExplicit)}function b(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)}function y(){return null}function x(t){return null===t}function v(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)}function k(t){return"true"===t||"True"===t||"TRUE"===t}function w(t){return"[object Boolean]"===Object.prototype.toString.call(t)}function A(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function C(t){return 48<=t&&t<=55}function S(t){return 48<=t&&t<=57}function _(t){if(null===t)return!1;var e,n=t.length,i=0,r=!1;if(!n)return!1;if(e=t[i],"-"!==e&&"+"!==e||(e=t[++i]),"0"===e){if(i+1===n)return!0;if(e=t[++i],"b"===e){for(i++;i<n;i++)if(e=t[i],"_"!==e){if("0"!==e&&"1"!==e)return!1;r=!0}return r}if("x"===e){for(i++;i<n;i++)if(e=t[i],"_"!==e){if(!A(t.charCodeAt(i)))return!1;r=!0}return r}for(;i<n;i++)if(e=t[i],"_"!==e){if(!C(t.charCodeAt(i)))return!1;r=!0}return r}for(;i<n;i++)if(e=t[i],"_"!==e){if(":"===e)break;if(!S(t.charCodeAt(i)))return!1;r=!0}return!!r&&(":"!==e||/^(:[0-5]?[0-9])+$/.test(t.slice(i)))}function E(t){var e,n,i=t,r=1,o=[];return i.indexOf("_")!==-1&&(i=i.replace(/_/g,"")),e=i[0],"-"!==e&&"+"!==e||("-"===e&&(r=-1),i=i.slice(1),e=i[0]),"0"===i?0:"0"===e?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):i.indexOf(":")!==-1?(i.split(":").forEach(function(t){o.unshift(parseInt(t,10))}),i=0,n=1,o.forEach(function(t){i+=t*n,n*=60}),r*i):r*parseInt(i,10)}function j(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1===0&&!yn.isNegativeZero(t)}function O(t){return null!==t&&!!An.test(t)}function L(t){var e,n,i,r;return e=t.replace(/_/g,"").toLowerCase(),n="-"===e[0]?-1:1,r=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(t){r.unshift(parseFloat(t,10))}),e=0,i=1,r.forEach(function(t){e+=t*i,i*=60}),n*e):n*parseFloat(e,10)}function I(t,e){var n;if(isNaN(t))switch(e){case"lowercase":retuLine truncated
|
||||
var e=t.createElement("style");e.textContent=ye+xe+ve+ke,t.querySelector("head").appendChild(e)},Ae="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ce=e(function(t,e){!function(t){function e(){this.months=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],this.notKey=[",","{","}"," ","="],this.pos=0,this.input="",this.entries=new Array,this.currentEntry="",this.setInput=function(t){this.input=t},this.getEntries=function(){return this.entries},this.isWhitespace=function(t){return" "==t||"\r"==t||"\t"==t||"\n"==t},this.match=function(t,e){if(void 0!=e&&null!=e||(e=!0),this.skipWhitespace(e),this.input.substring(this.pos,this.pos+t.length)!=t)throw"Token mismatch, expected "+t+", found "+this.input.substring(this.pos);this.pos+=t.length,this.skipWhitespace(e)},this.tryMatch=function(t,e){return void 0!=e&&null!=e||(e=!0),this.skipWhitespace(e),this.input.substring(this.pos,this.pos+t.length)==t},this.matchAt=function(){for(var t=this;this.input.length>this.pos&&"@"!=this.input[this.pos];)t.pos++;return"@"==this.input[this.pos]},this.skipWhitespace=function(t){for(var e=this;this.isWhitespace(this.input[this.pos]);)e.pos++;if("%"==this.input[this.pos]&&1==t){for(;"\n"!=this.input[this.pos];)e.pos++;this.skipWhitespace(t)}},this.value_braces=function(){var t=this,e=0;this.match("{",!1);for(var n=this.pos,i=!1;;){if(!i)if("}"==t.input[t.pos]){if(!(e>0)){var r=t.pos;return t.match("}",!1),t.input.substring(n,r)}e--}else if("{"==t.input[t.pos])e++;else if(t.pos>=t.input.length-1)throw"Unterminated value";i="\\"==t.input[t.pos]&&0==i,t.pos++}},this.value_comment=function(){for(var t=this,e="",n=0;!this.tryMatch("}",!1)||0!=n;){if(e+=t.input[t.pos],"{"==t.input[t.pos]&&n++,"}"==t.input[t.pos]&&n--,t.pos>=t.input.length-1)throw"Unterminated value:"+t.input.substring(start);t.pos++}return e},this.value_quotes=function(){var t=this;this.match('"',!1);for(var e=this.pos,n=!1;;){if(!n){if('"'==t.input[t.pos]){var i=t.pos;return t.match('"',!1),t.input.substring(e,i)}if(t.pos>=t.input.length-1)throw"Unterminated value:"+t.input.substring(e)}n="\\"==t.input[t.pos]&&0==n,t.pos++}},this.single_value=function(){var t=this.pos;if(this.tryMatch("{"))return this.value_braces();if(this.tryMatch('"'))return this.value_quotes();var e=this.key();if(e.match("^[0-9]+$"))return e;if(this.months.indexOf(e.toLowerCase())>=0)return e.toLowerCase();throw"Value expected:"+this.input.substring(t)+" for key: "+e},this.value=function(){var t=this,e=[];for(e.push(this.single_value());this.tryMatch("#");)t.match("#"),e.push(t.single_value());return e.join("")},this.key=function(){for(var t=this,e=this.pos;;){if(t.pos>=t.input.length)throw"Runaway key";if(t.notKey.indexOf(t.input[t.pos])>=0)return t.input.substring(e,t.pos);t.pos++}},this.key_equals_value=function(){var t=this.key();if(this.tryMatch("=")){this.match("=");var e=this.value();return[t,e]}throw"... = value expected, equals sign missing:"+this.input.substring(this.pos)},this.key_value_list=function(){var t=this,e=this.key_equals_value();for(this.currentEntry.entryTags={},this.currentEntry.entryTags[e[0]]=e[1];this.tryMatch(",")&&(t.match(","),!t.tryMatch("}"));)e=t.key_equals_value(),t.currentEntry.entryTags[e[0]]=e[1]},this.entry_body=function(t){this.currentEntry={},this.currentEntry.citationKey=this.key(),this.currentEntry.entryType=t.substring(1),this.match(","),this.key_value_list(),this.entries.push(this.currentEntry)},this.directive=function(){return this.match("@"),"@"+this.key()},this.preamble=function(){this.currentEntry={},this.currentEntry.entryType="PREAMBLE",this.currentEntry.entry=this.value_comment(),this.entries.push(this.currentEntry)},this.comment=function(){this.currentEntry={},this.currentEntry.entryType="COMMENT",this.currentEntry.entry=this.value_comment(),this.entries.push(this.currentEntry)},this.entry=function(t){this.entry_body(t)},this.bibtex=function(){for(var t=this;this.matchAt();){var e=t.directive();t.match("{"),"@STRING"==e?t.string():"@PREAMBLE"==e?t.preamble():"@COMMENT"==e?t.comment():t.entry(e),t.match("}")}}}t.toJSON=function(t){var n=new e;return n.setInput(t),n.bibtex(),n.entries},t.toBibtex=function(t){var e="";for(var n in t){if(e+="@"+t[n].entryType,e+="{",t[n].citationKey&&(e+=t[n].citationKey+", "),t[n].entry&&(e+=t[n].entry),t[n].entryTags){var i="";for(var r in t[n].entryTags)0!=i.length&&(i+=", "),i+=r+"= {"+t[n].entryTags[r]+"}";e+=i}e+="}\n\n"}return e}}(e)}),Se=function(t,e){var n="\n @article{gregor2015draw,\n title={DRAW: A recurrent neural network for image generation},\n author={Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan},\n journal={arXivreprint arXiv:1502.04623},\n year={2015}\n }\n @article{mercier2011humans,\n title={Why do humans reason? Arguments for an argumentative theory},\n author={Mercier, Hugo and Sperber, Dan},\n journal={Behavioral and brain sciences},\n volume=Line truncated
|
||||
i.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,o&&o.call(u.element),i.hooks.run("after-highlight",u),i.hooks.run("complete",u)},p.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=i.highlight(u.code,u.grammar,u.language),i.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,o&&o.call(n),i.hooks.run("after-highlight",u),i.hooks.run("complete",u)},highlight:function(t,e,n){var o=i.tokenize(t,e);return r.stringify(i.util.encode(o),n)},tokenize:function(t,e,n){var r=i.Token,o=[t],a=e.rest;if(a){for(var s in a)e[s]=a[s];delete e.rest}t:for(var s in e)if(e.hasOwnProperty(s)&&e[s]){var l=e[s];l="Array"===i.util.type(l)?l:[l];for(var c=0;c<l.length;++c){var u=l[c],p=u.inside,h=!!u.lookbehind,d=!!u.greedy,f=0,g=u.alias;if(d&&!u.pattern.global){var m=u.pattern.toString().match(/[imuy]*$/)[0];u.pattern=RegExp(u.pattern.source,m+"g")}u=u.pattern||u;for(var b=0,y=0;b<o.length;y+=o[b].length,++b){var x=o[b];if(o.length>t.length)break t;if(!(x instanceof r)){u.lastIndex=0;var v=u.exec(x),k=1;if(!v&&d&&b!=o.length-1){if(u.lastIndex=y,v=u.exec(t),!v)break;for(var w=v.index+(h?v[1].length:0),A=v.index+v[0].length,C=b,S=y,_=o.length;C<_&&S<A;++C)S+=o[C].length,w>=S&&(++b,y=S);if(o[b]instanceof r||o[C-1].greedy)continue;k=C-b,x=t.slice(y,S),v.index-=y}if(v){h&&(f=v[1].length);var w=v.index+f,v=v[0].slice(f),A=w+v.length,E=x.slice(0,w),j=x.slice(A),O=[b,k];E&&O.push(E);var L=new r(s,p?i.tokenize(v,p):v,g,v,d);O.push(L),j&&O.push(j),Array.prototype.splice.apply(o,O)}}}}}return o},hooks:{all:{},add:function(t,e){var n=i.hooks.all;n[t]=n[t]||[],n[t].push(e)},run:function(t,e){var n=i.hooks.all[t];if(n&&n.length)for(var r,o=0;r=n[o++];)r(e)}}},r=i.Token=function(t,e,n,i,r){this.type=t,this.content=e,this.alias=n,this.length=0|(i||"").length,this.greedy=!!r};if(r.stringify=function(t,e,n){if("string"==typeof t)return t;if("Array"===i.util.type(t))return t.map(function(n){return r.stringify(n,e,t)}).join("");var o={type:t.type,content:r.stringify(t.content,e,n),tag:"span",classes:["token",t.type],attributes:{},language:e,parent:n};if("comment"==o.type&&(o.attributes.spellcheck="true"),t.alias){var a="Array"===i.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(o.classes,a)}i.hooks.run("wrap",o);var s=Object.keys(o.attributes).map(function(t){return t+'="'+(o.attributes[t]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+(s?" "+s:"")+">"+o.content+"</"+o.tag+">"},!e.document)return e.addEventListener?(e.addEventListener("message",function(t){var n=JSON.parse(t.data),r=n.language,o=n.code,a=n.immediateClose;e.postMessage(i.highlight(o,i.languages[r],r)),a&&e.close()},!1),e.Prism):e.Prism;var o=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return o&&(i.filename=o.src,document.addEventListener&&!o.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(i.highlightAll):window.setTimeout(i.highlightAll,16):document.addEventListener("DOMContentLoaded",i.highlightAll))),e.Prism}();t.exports&&(t.exports=n),"undefined"!=typeof Ae&&(Ae.Prism=n),n.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/i,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},n.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:n.languages.css,alias:"language-css"}}),n.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:n.languages.css}},alias:"language-css"}},n.languages.markup.tag)),n.languages.clike={commentLine truncated
|
||||
var dl=function(){"use strict";function t(t){return"undefined"==typeof t||null===t}function e(t){return"object"==typeof t&&null!==t}function n(e){return Array.isArray(e)?e:t(e)?[]:[e]}function i(t,e){var n,i,r,o;if(e)for(o=Object.keys(e),n=0,i=o.length;n<i;n+=1)r=o[n],t[r]=e[r];return t}function r(t,e){var n,i="";for(n=0;n<e;n+=1)i+=t;return i}function o(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t}function a(t,e){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}function s(t,e,n,i,r){this.name=t,this.buffer=e,this.position=n,this.line=i,this.column=r}function l(t){var e={};return null!==t&&Object.keys(t).forEach(function(n){t[n].forEach(function(t){e[String(t)]=n})}),e}function c(t,e){if(e=e||{},Object.keys(e).forEach(function(e){if(Me.indexOf(e)===-1)throw new Ne('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=l(e.styleAliases||null),Fe.indexOf(this.kind)===-1)throw new Ne('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}function u(t,e,n){var i=[];return t.include.forEach(function(t){n=u(t,e,n)}),t[e].forEach(function(t){n.forEach(function(e,n){e.tag===t.tag&&e.kind===t.kind&&i.push(n)}),n.push(t)}),n.filter(function(t,e){return i.indexOf(e)===-1})}function p(){function t(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}var e,n,i=arguments,r={scalar:{},sequence:{},mapping:{},fallback:{}};for(e=0,n=arguments.length;e<n;e+=1)i[e].forEach(t);return r}function h(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach(function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new De("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=u(this,"implicit",[]),this.compiledExplicit=u(this,"explicit",[]),this.compiledTypeMap=p(this.compiledImplicit,this.compiledExplicit)}function d(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)}function f(){return null}function g(t){return null===t}function m(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)}function b(t){return"true"===t||"True"===t||"TRUE"===t}function y(t){return"[object Boolean]"===Object.prototype.toString.call(t)}function x(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function v(t){return 48<=t&&t<=55}function k(t){return 48<=t&&t<=57}function w(t){if(null===t)return!1;var e,n=t.length,i=0,r=!1;if(!n)return!1;if(e=t[i],"-"!==e&&"+"!==e||(e=t[++i]),"0"===e){if(i+1===n)return!0;if(e=t[++i],"b"===e){for(i++;i<n;i++)if(e=t[i],"_"!==e){if("0"!==e&&"1"!==e)return!1;r=!0}return r}if("x"===e){for(i++;i<n;i++)if(e=t[i],"_"!==e){if(!x(t.charCodeAt(i)))return!1;r=!0}return r}for(;i<n;i++)if(e=t[i],"_"!==e){if(!v(t.charCodeAt(i)))return!1;r=!0}return r}for(;i<n;i++)if(e=t[i],"_"!==e){if(":"===e)break;if(!k(t.charCodeAt(i)))return!1;r=!0}return!!r&&(":"!==e||/^(:[0-5]?[0-9])+$/.test(t.slice(i)))}function A(t){var e,n,i=t,r=1,o=[];return i.indexOf("_")!==-1&&(i=i.replace(/_/g,"")),e=i[0],"-"!==e&&"+"!==e||("-"===e&&(r=-1),i=i.slice(1),e=i[0]),"0"===i?0:"0"===e?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):i.indexOf(":")!==-1?(i.split(":").forEach(function(t){o.unshift(parseInt(t,10))}),i=0,n=1,o.forEach(function(t){i+=t*n,n*=60}),r*i):r*parseInt(i,10)}function C(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1===0&&!tn.isNegativeZero(t)}function S(t){return null!==t&&!!an.test(t)}function _(t){var e,n,i,r;return e=t.replace(/_/g,"").toLowerCase(),n="-"===e[0]?-1:1,r=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(t){r.unshift(parseFloat(t,10))}),e=0,i=1,r.forEach(function(t){e+=t*i,i*=60}),n*e):n*parseFloat(e,10)}function E(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(rn.isNegativeZero(t))return"-0.0";return n=t.toString(10),sn.test(n)?n.replace("e",".e"):n}function j(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!==0||rn.Line truncated
|
||||
var e=t.createElement("style");e.textContent=ye+xe+ve+ke,t.querySelector("head").appendChild(e)},Ae=t,Ce=e,Se=n,_e=r,Ee=o,je=i,Oe={isNothing:Ae,isObject:Ce,toArray:Se,repeat:_e,isNegativeZero:Ee,extend:je};a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e};var Le=a,Ie=Oe;s.prototype.getSnippet=function(t,e){var n,i,r,o,a,s=this;if(!this.buffer)return null;for(t=t||4,e=e||75,n="",i=this.position;i>0&&"\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1))===-1;)if(i-=1,s.position-i>e/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;o<this.buffer.length&&"\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(o))===-1;)if(o+=1,o-s.position>e/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),Ie.repeat(" ",t)+n+a+r+"\n"+Ie.repeat(" ",t+this.position-i+n.length)+"^"},s.prototype.toString=function(t){var e,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet(),e&&(n+=":\n"+e)),n};var Te=s,Ne=Le,Me=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Fe=["scalar","sequence","mapping"],qe=c,ze=Oe,De=Le,$e=qe;h.DEFAULT=null,h.create=function(){var t,e;switch(arguments.length){case 1:t=h.DEFAULT,e=arguments[0];break;case 2:t=arguments[0],e=arguments[1];break;default:throw new De("Wrong number of arguments for Schema.create function")}if(t=ze.toArray(t),e=ze.toArray(e),!t.every(function(t){return t instanceof h}))throw new De("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!e.every(function(t){return t instanceof $e}))throw new De("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new h({include:t,explicit:e})};var Pe,Re=h,Ue=qe,We=new Ue("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),Be=qe,He=new Be("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),Ye=qe,Ge=new Ye("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}}),Ke=Re,Je=new Ke({explicit:[We,He,Ge]}),Ve=qe,Ze=new Ve("tag:yaml.org,2002:null",{kind:"scalar",resolve:d,construct:f,predicate:g,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"}),Xe=qe,Qe=new Xe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:m,construct:b,predicate:y,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"}),tn=Oe,en=qe,nn=new en("tag:yaml.org,2002:int",{kind:"scalar",resolve:w,construct:A,predicate:C,represent:{binary:function(t){return"0b"+t.toString(2)},octal:function(t){return"0"+t.toString(8)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return"0x"+t.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),rn=Oe,on=qe,an=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),sn=/^[-+]?[0-9]+e/,ln=new on("tag:yaml.org,2002:float",{kind:"scalar",resolve:S,construct:_,predicate:j,represent:E,defaultStyle:"lowercase"}),cn=Re,un=new cn({include:[Je],implicit:[Ze,Qe,nn,ln]}),pn=Re,hn=new pn({include:[un]}),dn=qe,fn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),gn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),mn=new dn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:O,construct:L,instanceOf:Date,represent:I}),bn=qe,yn=new bn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:T}),xn="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};try{var vn=N;Pe=vn("buffer").Buffer}catch(t){}var kn,wn=qe,An="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",Cn=new wn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:F,construct:q,predicate:D,represent:z}),Sn=qe,_n=Object.prototype.hasOwnProperty,En=Object.prototype.toString,jn=new Sn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:$,construct:P}),On=qe,Ln=Object.prototype.toString,In=new On("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:R,construct:U}),Tn=qe,Nn=Object.prototype.hasOwnProperty,Mn=new Tn("tag:yaml.org,2002:set",{kind:"mapping",resolve:W,construct:B}),Fn=Re,qn=new Fn({include:[hn],implicit:[mn,yn],explicit:[Cn,jn,In,Mn]}),zn=qe,Dn=new zn("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:H,construct:Y,predicate:K,represent:G}),$n=qe,Pn=new
Line truncated
|
||||
},n.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):t},n.prototype.mangle=function(t){if(!this.options.mangle)return t;for(var e,n="",i=t.length,r=0;r<i;r++)e=t.charCodeAt(r),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},i.prototype.code=function(t,e,n){if(this.options.highlight){var i=this.options.highlight(t,e);null!=i&&i!==t&&(n=!0,t=i)}return e?'<pre><code class="'+this.options.langPrefix+o(e,!0)+'">'+(n?t:o(t,!0))+"\n</code></pre>\n":"<pre><code>"+(n?t:o(t,!0))+"\n</code></pre>"},i.prototype.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},i.prototype.html=function(t){return t},i.prototype.heading=function(t,e,n){return"<h"+e+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+t+"</h"+e+">\n"},i.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"</"+n+">\n"},i.prototype.listitem=function(t){return"<li>"+t+"</li>\n"},i.prototype.paragraph=function(t){return"<p>"+t+"</p>\n"},i.prototype.table=function(t,e){return"<table>\n<thead>\n"+t+"</thead>\n<tbody>\n"+e+"</tbody>\n</table>\n"},i.prototype.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},i.prototype.tablecell=function(t,e){var n=e.header?"th":"td",i=e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">";return i+t+"</"+n+">\n"},i.prototype.strong=function(t){return"<strong>"+t+"</strong>"},i.prototype.em=function(t){return"<em>"+t+"</em>"},i.prototype.codespan=function(t){return"<code>"+t+"</code>"},i.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.prototype.del=function(t){return"<del>"+t+"</del>"},i.prototype.link=function(t,e,n){if(this.options.sanitize){try{var i=decodeURIComponent(a(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(t){return""}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:"))return""}var r='<a href="'+t+'"';return e&&(r+=' title="'+e+'"'),r+=">"+n+"</a>"},i.prototype.image=function(t,e,n){var i='<img src="'+t+'" alt="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=this.options.xhtml?"/>":">"},i.prototype.text=function(t){return t},r.parse=function(t,e,n){var i=new r(e,n);return i.parse(t)},r.prototype.parse=function(t){var e=this;this.inline=new n(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var i="";this.next();)i+=e.tok();return i},r.prototype.next=function(){return this.token=this.tokens.pop()},r.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},r.prototype.parseText=function(){for(var t=this,e=this.token.text;"text"===this.peek().type;)e+="\n"+t.next().text;return this.inline.output(e)},r.prototype.tok=function(){var t=this;switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,n,i,r,o,a="",s="";for(i="",e=0;e<this.token.header.length;e++)r={header:!0,align:t.token.align[e]},i+=t.renderer.tablecell(t.inline.output(t.token.header[e]),{header:!0,align:t.token.align[e]});for(a+=this.renderer.tablerow(i),e=0;e<this.token.cells.length;e++){for(n=t.token.cells[e],i="",o=0;o<n.length;o++)i+=t.renderer.tablecell(t.inline.output(n[o]),{header:!1,align:t.token.align[o]});s+=t.renderer.tablerow(i)}return this.renderer.table(a,s);case"blockquote_start":for(var s="";"blockquote_end"!==this.next().type;)s+=t.tok();return this.renderer.blockquote(s);case"list_start":for(var s="",l=this.token.ordered;"list_end"!==this.next().type;)s+=t.tok();return this.renderer.list(s,l);case"list_item_start":for(var s="";"list_item_end"!==this.next().type;)s+="text"===t.token.type?t.parseText():t.tok();return this.renderer.listitem(s);case"loose_item_start":for(var s="";"list_item_end"!==this.next().type;)s+=t.tok();return this.renderer.listitem(s);case"html":var c=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(c);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},l.exec=l,u.options=u.setOptions=function(t){return c(u.defaults,t),u},u.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new i,xhtml:!1},u.Parser=r,u.parser=r.parse,u.Renderer=i,u.Lexer=e,u.lexer=e.lex,u.InlineLexer=n,u.inlineLexer=n.output,u.parse=u,t.exports=u}).call(function(){return this||("undefined"!=typeof window?window:xn)}())});Rr.setOptions({gfm:!0,smartypants:!0});var Ur=function(t,e){var n=[].slice.call(t.querySelectorALine truncated
|
||||
//# sourceMappingURL=template.min.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":null,"sources":["../components/meta.js","../node_modules/js-yaml/lib/js-yaml/common.js","../node_modules/js-yaml/lib/js-yaml/exception.js","../node_modules/js-yaml/lib/js-yaml/mark.js","../node_modules/js-yaml/lib/js-yaml/type.js","../node_modules/js-yaml/lib/js-yaml/schema.js","../node_modules/js-yaml/lib/js-yaml/type/null.js","../node_modules/js-yaml/lib/js-yaml/type/bool.js","../node_modules/js-yaml/lib/js-yaml/type/int.js","../node_modules/js-yaml/lib/js-yaml/type/float.js","../node_modules/js-yaml/lib/js-yaml/type/timestamp.js","../node_modules/js-yaml/lib/js-yaml/type/merge.js","../node_modules/js-yaml/lib/js-yaml/type/binary.js","../node_modules/js-yaml/lib/js-yaml/type/omap.js","../node_modules/js-yaml/lib/js-yaml/type/pairs.js","../node_modules/js-yaml/lib/js-yaml/type/set.js","../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js","../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js","../node_modules/js-yaml/lib/js-yaml/type/js/function.js","../node_modules/js-yaml/lib/js-yaml/loader.js","../node_modules/js-yaml/lib/js-yaml/dumper.js","../node_modules/js-yaml/lib/js-yaml.js","../index.js","../components/html.js","../components/styles.js","../node_modules/bibtex-parse-js/bibtexParse.js","../components/cite-data.js","../components/header.js","../components/appendix.js","../components/footer.js","../components/citation.js","../node_modules/marked/lib/marked.js","../components/markdown.js","../node_modules/prismjs/prism.js","../components/code.js","../test-data.js","../node_modules/js-yaml/lib/js-yaml/type/str.js","../node_modules/js-yaml/lib/js-yaml/type/seq.js","../node_modules/js-yaml/lib/js-yaml/type/map.js","../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js","../node_modules/js-yaml/lib/js-yaml/schema/json.js","../node_modules/js-yaml/lib/js-yaml/schema/core.js","../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js","../node_modules/js-yaml/lib/js-yaml/schema/default_full.js","../node_modules/js-yaml/index.js","../components/front-matter.js"],"sourcesContent":["export default function(dom, data) {\n let head = dom.querySelector(\"head\");\n \n appendHtml(head, `\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge,chrome=1\">\n <link rel=\"icon\" type=\"image/png\" href=\"/favicon.png\">\n <link href=\"/rss.xml\" rel=\"alternate\" type=\"application/rss+xml\" title=\"Articles from Distill\">\n <link rel=\"canonical\" href=\"${data.url}\">\n <title>${data.title}</title>\n `);\n\n appendHtml(head, `\n <!-- https://schema.org/Article -->\n <meta property=\"article:published\" itemprop=\"datePublished\" content=\"${data.publishedDate}\" />\n <meta property=\"article:modified\" itemprop=\"dateModified\" content=\"${data.updatedDate}\" />\n `);\n data.authors.forEach((a) => {\n appendHtml(head, `\n <meta property=\"article:author\" content=\"${a.firstName} ${a.lastName}\" />`)\n });\n\n appendHtml(head, `\n <!-- https://developers.facebook.com/docs/sharing/webmasters#markup -->\n <meta property=\"og:type\" content=\"article\"/>\n <meta property=\"og:title\" content=\"${data.title}\"/>\n <meta property=\"og:description\" content=\"${data.description}\">\n <meta property=\"og:url\" content=\"${data.url}\"/>\n <meta property=\"og:image\" content=\"${data.url}/thumbnail.png\"/>\n <meta property=\"og:locale\" content=\"en_US\" />\n <meta property=\"og:site_name\" content=\"Distill\" />\n `);\n\n appendHtml(head, `\n <!-- https://dev.twitter.com/cards/types/summary -->\n <meta name=\"twitter:card\" content=\"summary_large_image\">\n <meta name=\"twitter:title\" content=\"${data.title}\">\n <meta name=\"twitter:description\" content=\"${data.description}\">\n <meta name=\"twitter:url\" content=\"${data.url}\">\n <meta name=\"twitter:image\" content=\"${data.url}/thumbnail.png\">\n <meta name=\"twitter:image:width\" content=\"560\">\n <meta name=\"twitter:image:height\" content=\"295\">\n `);\n\n appendHtml(head, `\n <!-- https://scholar.google.com/intl/en/scholar/inclusion.html#indexing -->\n <meta name=\"citation_title\" content=\"${data.title}\">\n <meta name=\"citation_publication_date\" content=\"${data.publishedYear}/${data.publishedMonthPadded}/${data.publishedDayPadded}\">\n <meta name=\"citation_fulltext_html_url\" content=\"${data.url}\">\n <meta name=\"citation_volume\" content=\"${data.volume}\">\n <meta name=\"citation_issue\" content=\"${data.issue}\">\n <meta name=\"citation_journal_title\" content=\"${data.journal.name}\">\n <meta name=\"citation_journal_abbrev\" content=\"${data.journal.nameAbbrev}\"/>\n <meta name=\"citation_firstpage\" content=\"e${data.doiSuffix}\"/>\n <meta name=\"citation_doi\" content=\"${data.doi}\">\n <meta name=\"citation_issn\" content=\"${data.journal.issn}\">\n <meta name=\"citation_publisher\" content=\"${data.journal.publisher}\"/>\n `);\n data.authors.forEach((a) => {\n appendHtml(head,Line truncated
|
||||
{"version":3,"file":null,"sources":["../node_modules/js-yaml/lib/js-yaml/common.js","../node_modules/js-yaml/lib/js-yaml/exception.js","../node_modules/js-yaml/lib/js-yaml/mark.js","../node_modules/js-yaml/lib/js-yaml/type.js","../node_modules/js-yaml/lib/js-yaml/schema.js","../node_modules/js-yaml/lib/js-yaml/type/null.js","../node_modules/js-yaml/lib/js-yaml/type/bool.js","../node_modules/js-yaml/lib/js-yaml/type/int.js","../node_modules/js-yaml/lib/js-yaml/type/float.js","../node_modules/js-yaml/lib/js-yaml/type/timestamp.js","../node_modules/js-yaml/lib/js-yaml/type/merge.js","../node_modules/js-yaml/lib/js-yaml/type/binary.js","../node_modules/js-yaml/lib/js-yaml/type/omap.js","../node_modules/js-yaml/lib/js-yaml/type/pairs.js","../node_modules/js-yaml/lib/js-yaml/type/set.js","../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js","../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js","../node_modules/js-yaml/lib/js-yaml/type/js/function.js","../node_modules/js-yaml/lib/js-yaml/loader.js","../node_modules/js-yaml/lib/js-yaml/dumper.js","../node_modules/js-yaml/lib/js-yaml.js","../components/meta.js","../index.js","../components/html.js","../components/styles.js","../node_modules/js-yaml/lib/js-yaml/type/str.js","../node_modules/js-yaml/lib/js-yaml/type/seq.js","../node_modules/js-yaml/lib/js-yaml/type/map.js","../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js","../node_modules/js-yaml/lib/js-yaml/schema/json.js","../node_modules/js-yaml/lib/js-yaml/schema/core.js","../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js","../node_modules/js-yaml/lib/js-yaml/schema/default_full.js","../node_modules/js-yaml/index.js","../components/front-matter.js","../node_modules/bibtex-parse-js/bibtexParse.js","../components/bibliography.js","../components/header.js","../components/appendix.js","../components/footer.js","../components/citation.js","../node_modules/marked/lib/marked.js","../components/markdown.js","../node_modules/prismjs/prism.js","../components/code.js","../test-data.js"],"sourcesContent":["'use strict';\n\n\nfunction isNothing(subject) {\n return (typeof subject === 'undefined') || (subject === null);\n}\n\n\nfunction isObject(subject) {\n return (typeof subject === 'object') && (subject !== null);\n}\n\n\nfunction toArray(sequence) {\n if (Array.isArray(sequence)) return sequence;\n else if (isNothing(sequence)) return [];\n\n return [ sequence ];\n}\n\n\nfunction extend(target, source) {\n var index, length, key, sourceKeys;\n\n if (source) {\n sourceKeys = Object.keys(source);\n\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\n key = sourceKeys[index];\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n\nfunction repeat(string, count) {\n var result = '', cycle;\n\n for (cycle = 0; cycle < count; cycle += 1) {\n result += string;\n }\n\n return result;\n}\n\n\nfunction isNegativeZero(number) {\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);\n}\n\n\nmodule.exports.isNothing = isNothing;\nmodule.exports.isObject = isObject;\nmodule.exports.toArray = toArray;\nmodule.exports.repeat = repeat;\nmodule.exports.isNegativeZero = isNegativeZero;\nmodule.exports.extend = extend;\n","// YAML error class. http://stackoverflow.com/questions/8458984\n//\n'use strict';\n\nfunction YAMLException(reason, mark) {\n // Super constructor\n Error.call(this);\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor);\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || '';\n }\n\n this.name = 'YAMLException';\n this.reason = reason;\n this.mark = mark;\n this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');\n}\n\n\n// Inherit from Error\nYAMLException.prototype = Object.create(Error.prototype);\nYAMLException.prototype.constructor = YAMLException;\n\n\nYAMLException.prototype.toString = function toString(compact) {\n var result = this.name + ': ';\n\n result += this.reason || '(unknown reason)';\n\n if (!compact && this.mark) {\n result += ' ' + this.mark.toString();\n }\n\n return result;\n};\n\n\nmodule.exports = YAMLException;\n","'use strict';\n\n\nvar common = require('./common');\n\n\nfunction Mark(name, buffer, position, line, column) {\n this.name = name;\n this.buffer = buffer;\n this.position = position;\n this.line = line;\n this.column = column;\n}\n\n\nMark.prototype.getSnippet = function getSnippet(indent, maxLength) {\n var head, start, tail, end, snippet;\n\n if (!this.buffer) return null;\n\n indent = indent || 4;\n maxLength = maxLength || 75;\n\n head = '';\n start = this.position;\n\n while (start > 0 && '\\x00\\r\\n\\x85\\u2028\\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {\n start -= 1;\n if (this.positioLine truncated
|
||||
@@ -18,7 +18,7 @@
|
||||
<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 article="gregor2015draw"></dt-cite> external publications.</p>
|
||||
<p>We can also cite <dt-cite key="gregor2015draw"></dt-cite> external publications.</p>
|
||||
</dt-article>
|
||||
|
||||
<script type="text/bibliography">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import html from "./components/html";
|
||||
import styles from "./components/styles";
|
||||
import citeData from "./components/cite-data";
|
||||
import frontMatter from "./components/front-matter";
|
||||
import bibliography from "./components/bibliography";
|
||||
import meta from "./components/meta";
|
||||
import header from "./components/header";
|
||||
import appendix from "./components/appendix";
|
||||
@@ -9,15 +10,14 @@ import citation from "./components/citation";
|
||||
import markdown from "./components/markdown";
|
||||
import code from "./components/code";
|
||||
import testData from "./test-data";
|
||||
import frontMatter from "./components/front-matter";
|
||||
|
||||
|
||||
function render(dom, data) {
|
||||
html(dom);
|
||||
styles(dom);
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
citeData(dom, data);
|
||||
frontMatter(dom, data);
|
||||
bibliography(dom, data);
|
||||
meta(dom, data);
|
||||
header(dom, data);
|
||||
appendix(dom, data);
|
||||
|
||||
Reference in new issue
Block a user