diff --git a/components.js b/components.js index 5df8ed7..f3da422 100644 --- a/components.js +++ b/components.js @@ -1,4 +1,5 @@ import "webcomponents.js/webcomponents-hi-ce.js"; + import * as frontMatter from "./components/d-front-matter"; import * as title from "./components/d-title"; import * as byline from "./components/d-byline"; @@ -10,23 +11,17 @@ import * as appendix from "./components/d-appendix"; import * as distillAppendix from "./components/distill-appendix"; import * as bibliography from "./components/d-bibliography"; import * as references from "./components/d-references"; +import { css as codeCss } from "./components/d-code"; +import * as math from "./components/d-math"; + +let codeStyle = document.createElement("style"); +codeStyle.textContent = codeCss; +document.querySelector("head").appendChild(codeStyle); document.addEventListener("DOMContentLoaded", function() { // Render byline with authors list. // Render distill appendix with distill journal data. - document.querySelector("distill-appendix").render([]); + // document.querySelector("distill-appendix").render([]); }) - -export {frontMatter as frontMatter}; -export {title as title}; -export {byline as byline}; -export {article as article}; -export {abstract as abstract}; -export {toc as toc}; -export {styles as styles}; -export {appendix as appendix}; -export {distillAppendix as distillAppendix}; -export {bibliography as bibliography}; -export {references as references}; \ No newline at end of file diff --git a/components/d-code.js b/components/d-code.js new file mode 100644 index 0000000..4cd5775 --- /dev/null +++ b/components/d-code.js @@ -0,0 +1,199 @@ +import Prism from "prismjs"; +import "prismjs/components/prism-python"; +import "prismjs/components/prism-clike"; + +export class Code extends HTMLElement { + + constructor() { + super(); + + const options = {childList: true}; + let observer = new MutationObserver( (mutations) => { + observer.disconnect(); + this.formatCode(); + observer.observe(this, options); + }) + observer.observe(this, options); + this.formatCode(); + } + + formatCode() { + + // check if we have content to render + let content = this.textContent; + if (!content) { return; } + + // check if language can be highlighted + this.languageName = this.getAttribute('language'); + const language = Prism.languages[this.languageName]; + if (language == undefined) { + console.warn(`Distill does not support highlighting your code block in "${this.languageName}".`); + return; + } + + this.innerHTML = ""; + const c = document.createElement("code"); + if (this.hasAttribute("block")) { + // Let's normalize the tab indents + content = content.replace(/\n/, ""); + const tabs = content.match(/\s*/); + content = content.replace(new RegExp("\n" + tabs, "g"), "\n"); + content = content.trim(); + const p = document.createElement("pre"); + p.appendChild(c); + this.appendChild(p); + } else { + this.appendChild(c); + } + + c.setAttribute("class", "language-" + this.languageName); + c.innerHTML = Prism.highlight(content, language); + } +} + +customElements.define("d-code", Code); + +export const css = ` +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-left: 3px solid rgba(0, 0, 0, 0.05); + padding: 0 0 0 24px; +} + + +code[class*="language-"], +pre[class*="language-"] { + 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; + + -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; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +` diff --git a/components/d-math.js b/components/d-math.js new file mode 100644 index 0000000..f768122 --- /dev/null +++ b/components/d-math.js @@ -0,0 +1,36 @@ +import katex from "katex"; + +export const html = ` + +`; + +export class Math extends HTMLElement { + + constructor() { + super(); + + const options = {childList: true}; + let observer = new MutationObserver( (mutations) => { + observer.disconnect(); + this.renderComponent(); + observer.observe(this, options); + }) + // try a first render + this.renderComponent(); + // listen for changes + observer.observe(this, options); + } + + renderComponent() { + const displayMode = this.hasAttribute("block"); + const options = { displayMode: displayMode }; + const renderedMath = katex.renderToString(this.textContent, options); + this.innerHTML = html + renderedMath + } +} + +customElements.define("d-math", Math); diff --git a/dist/components.js b/dist/components.js index 20a6a6f..20cd8ea 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,8 +1,8 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.dl = global.dl || {}))); -}(this, (function (exports) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; (function(){ /* @@ -28,87 +28,53 @@ The complete set of contributors may be found at http://polymer.github.io/CONTRI Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -'use strict';(function(){function V(b){function a(a,e){Object.defineProperty(a,"innerHTML",{enumerable:e.enumerable,configurable:!0,get:e.get,set:function(a){var f=this,d=void 0;g(this)&&(d=[],t(this,function(b){b!==f&&d.push(b);}));e.set.call(this,a);if(d){ for(var c=0;c]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g, q={J:function(a,b){a.href&&a.setAttribute("href",q.w(a.getAttribute("href"),b));a.src&&a.setAttribute("src",q.w(a.getAttribute("src"),b));if("style"===a.localName){var c=q.D(a.textContent,b,r);a.textContent=q.D(c,b,t);}},D:function(a,b,c){return a.replace(c,function(a,c,d,e){a=d.replace(/["']/g,"");b&&(a=q.F(a,b));return c+"'"+a+"'"+e})},w:function(a,b){return a&&p.test(a)?a:q.F(a,b)},F:function(a,b){if(void 0===q.v){q.v=!1;try{var c=new URL("b","http://a");c.pathname="c%20d";q.v="http://a/c%20d"=== -c.href;}catch(na){}}if(q.v){ return(new URL(a,b)).href; }c=q.G;c||(c=document.implementation.createHTMLDocument("temp"),q.G=c,c.B=c.createElement("base"),c.head.appendChild(c.B),c.A=c.createElement("a"));c.B.href=b;c.A.href=a;return c.A.href||a}},x={async:!0,load:function(a,b,c){if(a){ if(a.match(/^data:/)){a=a.split(",");var d=a[1],d=-1e.status?b(d,a):c(d);};e.send();} }else { c("error: href must be specified"); }}},v=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent);h.prototype.f=function(a){ -var this$1 = this; -a=a.querySelectorAll("link[rel=import]");for(var b=0,c=a.length;be.status?b(d,a):c(d);};e.send();}else c("error: href must be specified");}},v=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent);h.prototype.f=function(a){a=a.querySelectorAll("link[rel=import]");for(var b=0,c=a.length;b 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { start -= 1; - if (this$1.position - start > (maxLength / 2 - 1)) { + if (this.position - start > (maxLength / 2 - 1)) { head = ' ... '; start += 5; break; @@ -256,7 +220,7 @@ Mark$1.prototype.getSnippet = function getSnippet(indent, maxLength) { while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { end += 1; - if (end - this$1.position > (maxLength / 2 - 1)) { + if (end - this.position > (maxLength / 2 - 1)) { tail = ' ... '; end -= 5; break; @@ -353,8 +317,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; @@ -384,8 +346,6 @@ function compileList(schema, name, result) { function compileMap(/* lists... */) { - var arguments$1 = arguments; - var result = { scalar: {}, sequence: {}, @@ -398,7 +358,7 @@ function compileMap(/* lists... */) { } for (index = 0, length = arguments.length; index < length; index += 1) { - arguments$1[index].forEach(collectType); + arguments[index].forEach(collectType); } return result; } @@ -497,7 +457,7 @@ var failsafe = new Schema$5({ var Type$6 = type; function resolveYamlNull(data) { - if (data === null) { return true; } + if (data === null) return true; var max = data.length; @@ -530,7 +490,7 @@ var _null = new Type$6('tag:yaml.org,2002:null', { var Type$7 = type; function resolveYamlBoolean(data) { - if (data === null) { return false; } + if (data === null) return false; var max = data.length; @@ -579,14 +539,14 @@ function isDecCode(c) { } function resolveYamlInteger(data) { - if (data === null) { return false; } + if (data === null) return false; var max = data.length, index = 0, hasDigits = false, ch; - if (!max) { return false; } + if (!max) return false; ch = data[index]; @@ -597,7 +557,7 @@ function resolveYamlInteger(data) { if (ch === '0') { // 0 - if (index + 1 === max) { return true; } + if (index + 1 === max) return true; ch = data[++index]; // base 2, base 8, base 16 @@ -608,8 +568,8 @@ function resolveYamlInteger(data) { for (; index < max; index++) { ch = data[index]; - if (ch === '_') { continue; } - if (ch !== '0' && ch !== '1') { return false; } + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; hasDigits = true; } return hasDigits; @@ -622,8 +582,8 @@ function resolveYamlInteger(data) { for (; index < max; index++) { ch = data[index]; - if (ch === '_') { continue; } - if (!isHexCode(data.charCodeAt(index))) { return false; } + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits; @@ -632,8 +592,8 @@ function resolveYamlInteger(data) { // base 8 for (; index < max; index++) { ch = data[index]; - if (ch === '_') { continue; } - if (!isOctCode(data.charCodeAt(index))) { return false; } + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits; @@ -643,18 +603,18 @@ function resolveYamlInteger(data) { for (; index < max; index++) { ch = data[index]; - if (ch === '_') { continue; } - if (ch === ':') { break; } + if (ch === '_') continue; + if (ch === ':') break; if (!isDecCode(data.charCodeAt(index))) { return false; } hasDigits = true; } - if (!hasDigits) { return false; } + if (!hasDigits) return false; // if !base60 - done; - if (ch !== ':') { return true; } + if (ch !== ':') return true; // base60 almost not used, no needs to optimize return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); @@ -670,16 +630,16 @@ function constructYamlInteger(data) { ch = value[0]; if (ch === '-' || ch === '+') { - if (ch === '-') { sign = -1; } + if (ch === '-') sign = -1; value = value.slice(1); ch = value[0]; } - if (value === '0') { return 0; } + if (value === '0') return 0; if (ch === '0') { - if (value[1] === 'b') { return sign * parseInt(value.slice(2), 2); } - if (value[1] === 'x') { return sign * parseInt(value, 16); } + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); return sign * parseInt(value, 8); } @@ -739,9 +699,9 @@ var YAML_FLOAT_PATTERN = new RegExp( '|\\.(?:nan|NaN|NAN))$'); function resolveYamlFloat(data) { - if (data === null) { return false; } + if (data === null) return false; - if (!YAML_FLOAT_PATTERN.test(data)) { return false; } + if (!YAML_FLOAT_PATTERN.test(data)) return false; return true; } @@ -876,9 +836,9 @@ var YAML_TIMESTAMP_REGEXP = new RegExp( '(?::([0-9][0-9]))?))?$'); // [11] tz_minute function resolveYamlTimestamp(data) { - if (data === null) { return false; } - if (YAML_DATE_REGEXP.exec(data) !== null) { return true; } - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) { return true; } + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; return false; } @@ -887,9 +847,9 @@ function constructYamlTimestamp(data) { delta = null, tz_hour, tz_minute, date; match = YAML_DATE_REGEXP.exec(data); - if (match === null) { match = YAML_TIMESTAMP_REGEXP.exec(data); } + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - if (match === null) { throw new Error('Date resolve error'); } + if (match === null) throw new Error('Date resolve error'); // match: [1] year [2] month [3] day @@ -921,12 +881,12 @@ function constructYamlTimestamp(data) { tz_hour = +(match[10]); tz_minute = +(match[11] || 0); delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') { delta = -delta; } + if (match[9] === '-') delta = -delta; } date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - if (delta) { date.setTime(date.getTime() - delta); } + if (delta) date.setTime(date.getTime() - delta); return date; } @@ -966,8 +926,6 @@ function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } -/*eslint-disable no-bitwise*/ - var NodeBuffer; try { @@ -984,7 +942,7 @@ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 function resolveYamlBinary(data) { - if (data === null) { return false; } + if (data === null) return false; var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; @@ -993,10 +951,10 @@ function resolveYamlBinary(data) { code = map.indexOf(data.charAt(idx)); // Skip CR/LF - if (code > 64) { continue; } + if (code > 64) continue; // Fail on illegal characters - if (code < 0) { return false; } + if (code < 0) return false; bitlen += 6; } @@ -1041,7 +999,7 @@ function constructYamlBinary(data) { } // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { return new NodeBuffer(result); } + if (NodeBuffer) return new NodeBuffer(result); return result; } @@ -1106,7 +1064,7 @@ var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; var _toString = Object.prototype.toString; function resolveYamlOmap(data) { - if (data === null) { return true; } + if (data === null) return true; var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data; @@ -1115,19 +1073,19 @@ function resolveYamlOmap(data) { pair = object[index]; pairHasKey = false; - if (_toString.call(pair) !== '[object Object]') { return false; } + if (_toString.call(pair) !== '[object Object]') return false; for (pairKey in pair) { if (_hasOwnProperty$1.call(pair, pairKey)) { - if (!pairHasKey) { pairHasKey = true; } - else { return false; } + if (!pairHasKey) pairHasKey = true; + else return false; } } - if (!pairHasKey) { return false; } + if (!pairHasKey) return false; - if (objectKeys.indexOf(pairKey) === -1) { objectKeys.push(pairKey); } - else { return false; } + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; } return true; @@ -1148,7 +1106,7 @@ var Type$14 = type; var _toString$1 = Object.prototype.toString; function resolveYamlPairs(data) { - if (data === null) { return true; } + if (data === null) return true; var index, length, pair, keys, result, object = data; @@ -1158,11 +1116,11 @@ function resolveYamlPairs(data) { for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; - if (_toString$1.call(pair) !== '[object Object]') { return false; } + if (_toString$1.call(pair) !== '[object Object]') return false; keys = Object.keys(pair); - if (keys.length !== 1) { return false; } + if (keys.length !== 1) return false; result[index] = [ keys[0], pair[keys[0]] ]; } @@ -1171,7 +1129,7 @@ function resolveYamlPairs(data) { } function constructYamlPairs(data) { - if (data === null) { return []; } + if (data === null) return []; var index, length, pair, keys, result, object = data; @@ -1200,13 +1158,13 @@ var Type$15 = type; var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; function resolveYamlSet(data) { - if (data === null) { return true; } + if (data === null) return true; var key, object = data; for (key in object) { if (_hasOwnProperty$2.call(object, key)) { - if (object[key] !== null) { return false; } + if (object[key] !== null) return false; } } @@ -1272,8 +1230,8 @@ var _undefined = new Type$16('tag:yaml.org,2002:js/undefined', { var Type$17 = type; function resolveJavascriptRegExp(data) { - if (data === null) { return false; } - if (data.length === 0) { return false; } + if (data === null) return false; + if (data.length === 0) return false; var regexp = data, tail = /\/([gim]*)$/.exec(data), @@ -1282,11 +1240,11 @@ function resolveJavascriptRegExp(data) { // if regexp starts with '/' it can have modifiers and must be properly closed // `/foo/gim` - modifiers tail can be maximum 3 chars if (regexp[0] === '/') { - if (tail) { modifiers = tail[1]; } + if (tail) modifiers = tail[1]; - if (modifiers.length > 3) { return false; } + if (modifiers.length > 3) return false; // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; } + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; } return true; @@ -1299,7 +1257,7 @@ function constructJavascriptRegExp(data) { // `/foo/gim` - tail can be maximum 4 chars if (regexp[0] === '/') { - if (tail) { modifiers = tail[1]; } + if (tail) modifiers = tail[1]; regexp = regexp.slice(1, regexp.length - modifiers.length - 1); } @@ -1309,9 +1267,9 @@ function constructJavascriptRegExp(data) { function representJavascriptRegExp(object /*, style*/) { var result = '/' + object.source + '/'; - if (object.global) { result += 'g'; } - if (object.multiline) { result += 'm'; } - if (object.ignoreCase) { result += 'i'; } + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; return result; } @@ -1343,13 +1301,13 @@ try { esprima = _require$1('esprima'); } catch (_) { /*global window */ - if (typeof window !== 'undefined') { esprima = window.esprima; } + if (typeof window !== 'undefined') esprima = window.esprima; } var Type$18 = type; function resolveJavascriptFunction(data) { - if (data === null) { return false; } + if (data === null) return false; try { var source = '(' + data + ')', @@ -1425,8 +1383,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; @@ -2533,7 +2489,7 @@ function readTagProperty(state) { ch = state.input.charCodeAt(state.position); - if (ch !== 0x21/* ! */) { return false; } + if (ch !== 0x21/* ! */) return false; if (state.tag !== null) { throwError(state, 'duplication of a tag property'); @@ -2623,7 +2579,7 @@ function readAnchorProperty(state) { ch = state.input.charCodeAt(state.position); - if (ch !== 0x26/* & */) { return false; } + if (ch !== 0x26/* & */) return false; if (state.anchor !== null) { throwError(state, 'duplication of an anchor property'); @@ -2650,7 +2606,7 @@ function readAlias(state) { ch = state.input.charCodeAt(state.position); - if (ch !== 0x2A/* * */) { return false; } + if (ch !== 0x2A/* * */) return false; ch = state.input.charCodeAt(++state.position); _position = state.position; @@ -2878,7 +2834,7 @@ function readDocument(state) { break; } - if (is_EOL(ch)) { break; } + if (is_EOL(ch)) break; _position = state.position; @@ -2889,7 +2845,7 @@ function readDocument(state) { directiveArgs.push(state.input.slice(_position, state.position)); } - if (ch !== 0) { readLineBreak(state); } + if (ch !== 0) readLineBreak(state); if (_hasOwnProperty.call(directiveHandlers, directiveName)) { directiveHandlers[directiveName](state, directiveName, directiveArgs); @@ -3018,8 +2974,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; @@ -3077,7 +3031,7 @@ var DEPRECATED_BOOLEANS_SYNTAX = [ function compileStyleMap(schema, map) { var result, keys, index, length, tag, style, type; - if (map === null) { return {}; } + if (map === null) return {}; result = {}; keys = Object.keys(map); @@ -3162,7 +3116,7 @@ function indentString(string, spaces) { position = next + 1; } - if (line.length && line !== '\n') { result += ind; } + if (line.length && line !== '\n') result += ind; result += line; } @@ -3437,7 +3391,7 @@ function foldString(string, width) { // otherwise settles for the shortest line over the limit. // NB. More-indented lines *cannot* be folded, as that would add an extra \n. function foldLine(line, width) { - if (line === '' || line[0] === ' ') { return line; } + if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space. var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. @@ -3501,7 +3455,7 @@ function writeFlowSequence(state, level, object) { for (index = 0, length = object.length; index < length; index += 1) { // Write only valid elements. if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) { _result += ', '; } + if (index !== 0) _result += ', '; _result += state.dump; } } @@ -3543,7 +3497,7 @@ function writeFlowMapping(state, level, object) { for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; - if (index !== 0) { pairBuffer += ', '; } + if (index !== 0) pairBuffer += ', '; objectKey = objectKeyList[index]; objectValue = object[objectKey]; @@ -3552,7 +3506,7 @@ function writeFlowMapping(state, level, object) { continue; // Skip this pair because of invalid key; } - if (state.dump.length > 1024) { pairBuffer += '? '; } + if (state.dump.length > 1024) pairBuffer += '? '; pairBuffer += state.dump + ': '; @@ -3744,7 +3698,7 @@ function writeNode(state, level, object, block, compact, iskey) { writeScalar(state, state.dump, level, iskey); } } else { - if (state.skipInvalid) { return false; } + if (state.skipInvalid) return false; throw new YAMLException$5('unacceptable kind of an object to dump ' + type); } @@ -3804,9 +3758,9 @@ function dump$1(input, options) { var state = new State$1(options); - if (!state.noRefs) { getDuplicateReferences(input, state); } + if (!state.noRefs) getDuplicateReferences(input, state); - if (writeNode(state, 0, input, true, true)) { return state.dump + '\n'; } + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; return ''; } @@ -3896,9 +3850,9 @@ class FrontMatter extends HTMLElement { this.data = {}; } connectedCallback() { - var el = this.querySelector("script"); + let el = this.querySelector("script"); if (el) { - var text = el.textContent; + let text = el.textContent; this.parse(index.safeLoad(text)); } } @@ -3908,20 +3862,20 @@ class FrontMatter extends HTMLElement { this.data.authors = localData.authors ? localData.authors : []; - this.data.authors = this.data.authors.map(function (author, i) { - var a = {}; - var name = Object.keys(author)[0]; + this.data.authors = this.data.authors.map((author, i) =>{ + let a = {}; + let name = Object.keys(author)[0]; if ((typeof author) === "string") { name = author; } else { a.personalURL = author[name]; } - var names = name.split(" "); + 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]) { - var affiliation = Object.keys(localData.affiliations[i])[0]; + let affiliation = Object.keys(localData.affiliations[i])[0]; if ((typeof localData.affiliations[i]) === "string") { affiliation = localData.affiliations[i]; } else { @@ -3936,20 +3890,14 @@ class FrontMatter extends HTMLElement { customElements.define(FrontMatter.is, FrontMatter); -var dFrontMatter = Object.freeze({ - default: FrontMatter -}); - // import '@webcomponents/shadycss/scoping-shim'; -var Template = function (name, templateString, useShadow) { - if ( useShadow === void 0 ) useShadow = true; - - var template = document.createElement('template'); +const Template = (name, templateString, useShadow = false) => { + const template = document.createElement('template'); template.innerHTML = templateString; // ShadyCSS.prepareTemplate(template, name); - return function (superclass) { + return (superclass) => { return class extends superclass { constructor() { super(); @@ -4026,7 +3974,7 @@ function page(selector) { `; } -var T = Template("d-title", ` +const T = Template("d-title", ` `, false); -var mustacheTemplate = ` +const mustacheTemplate = `