2019-03-04 14:32:38 +01:00
|
|
|
/*! highlight.js v9.11.0 | BSD3 License | git.io/hljslicense */
|
|
|
|
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value).replace('"',""")+'"'}s+="<"+t(e)+E.map.call(e.attributes,r).join("")+">"}function u(e){s+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var l=0,s="",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='<span class="'+a,o=t?"":C;return i+=e+'">',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=""}function v(e){L+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n)
|
|
|
|
c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});hljs.registerLanguage("roboconf",function(a){var e="[a-zA-Z-_][^\\n{]+\\{",n={cN:"attribute",b:/[a-zA-Z-_]+/,e:/\s*:/,eE:!0,starts:{e:";",r:0,c:[{cN:"variable",b:/\.[a-zA-Z-_]+/},{cN:"keyword",b:/\(optional\)/}]}};return{aliases:["graph","instances"],cI:!0,k:"import",c:[{b:"^facet "+e,e:"}",k:"facet",c:[n,a.HCM]},{b:"^\\s*instance of "+e,e:"}",k:"name count channels instance-data instance-state instance of",i:/\S/,c:["self",n,a.HCM]},{b:"^"+e,e:"}",c:[n,a.HCM]},a.HCM]}});hljs.registerLanguage("vim",function(e){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev
|
|
|
|
|
2019-03-08 15:07:59 +01:00
|
|
|
/* highlightjs-line-numbers.js 2.6.0 | (C) 2018 Yauheni Pakala | MIT License | github.com/wcoder/highlightjs-line-numbers.js */
|
|
|
|
!function(n,e){"use strict";function t(){var n=e.createElement("style");n.type="text/css",n.innerHTML=g(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[v,L,b]),e.getElementsByTagName("head")[0].appendChild(n)}function r(t){"interactive"===e.readyState||"complete"===e.readyState?i(t):n.addEventListener("DOMContentLoaded",function(){i(t)})}function i(t){try{var r=e.querySelectorAll("code.hljs,code.nohighlight");for(var i in r)r.hasOwnProperty(i)&&l(r[i],t)}catch(o){n.console.error("LineNumbers error: ",o)}}function l(n,e){"object"==typeof n&&f(function(){n.innerHTML=s(n,e)})}function o(n,e){if("string"==typeof n){var t=document.createElement("code");return t.innerHTML=n,s(t,e)}}function s(n,e){e=e||{singleLine:!1};var t=e.singleLine?0:1;return c(n),a(n.innerHTML,t)}function a(n,e){var t=u(n);if(""===t[t.length-1].trim()&&t.pop(),t.length>e){for(var r="",i=0,l=t.length;i<l;i++)r+=g('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[j,m,L,b,p,i+1,t[i].length>0?t[i]:" "]);return g('<table class="{0}">{1}</table>',[v,r])}return n}function c(n){var e=n.childNodes;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];h(r.textContent)>0&&(r.childNodes.length>0?c(r):d(r.parentNode))}}function d(n){var e=n.className;if(/hljs-/.test(e)){for(var t=u(n.innerHTML),r=0,i="";r<t.length;r++){var l=t[r].length>0?t[r]:" ";i+=g('<span class="{0}">{1}</span>\n',[e,l])}n.innerHTML=i.trim()}}function u(n){return 0===n.length?[]:n.split(y)}function h(n){return(n.trim().match(y)||[]).length}function f(e){n.setTimeout(e,0)}function g(n,e){return n.replace(/\{(\d+)\}/g,function(n,t){return e[t]?e[t]:n})}var v="hljs-ln",m="hljs-ln-line",p="hljs-ln-code",j="hljs-ln-numbers",L="hljs-ln-n",b="data-line-number",y=/\r\n|\r|\n/g;n.hljs?(n.hljs.initLineNumbersOnLoad=r,n.hljs.lineNumbersBlock=l,n.hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);
|
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
/**
|
|
|
|
* This reveal.js plugin is wrapper around the highlight.js
|
|
|
|
* syntax highlighting library.
|
|
|
|
*/
|
|
|
|
(function( root, factory ) {
|
|
|
|
if (typeof define === 'function' && define.amd) {
|
|
|
|
root.RevealHighlight = factory();
|
|
|
|
} else if( typeof exports === 'object' ) {
|
|
|
|
module.exports = factory();
|
|
|
|
} else {
|
|
|
|
// Browser globals (root is window)
|
|
|
|
root.RevealHighlight = factory();
|
|
|
|
}
|
|
|
|
}( this, function() {
|
|
|
|
|
2016-11-22 23:42:21 +01:00
|
|
|
// Function to perform a better "data-trim" on code snippets
|
|
|
|
// Will slice an indentation amount on each line of the snippet (amount based on the line having the lowest indentation length)
|
|
|
|
function betterTrim(snippetEl) {
|
|
|
|
// Helper functions
|
|
|
|
function trimLeft(val) {
|
|
|
|
// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
|
|
|
return val.replace(/^[\s\uFEFF\xA0]+/g, '');
|
|
|
|
}
|
|
|
|
function trimLineBreaks(input) {
|
|
|
|
var lines = input.split('\n');
|
|
|
|
|
|
|
|
// Trim line-breaks from the beginning
|
|
|
|
for (var i = 0; i < lines.length; i++) {
|
|
|
|
if (lines[i].trim() === '') {
|
|
|
|
lines.splice(i--, 1);
|
|
|
|
} else break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Trim line-breaks from the end
|
|
|
|
for (var i = lines.length-1; i >= 0; i--) {
|
|
|
|
if (lines[i].trim() === '') {
|
|
|
|
lines.splice(i, 1);
|
|
|
|
} else break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return lines.join('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Main function for betterTrim()
|
|
|
|
return (function(snippetEl) {
|
|
|
|
var content = trimLineBreaks(snippetEl.innerHTML);
|
|
|
|
var lines = content.split('\n');
|
|
|
|
// Calculate the minimum amount to remove on each line start of the snippet (can be 0)
|
|
|
|
var pad = lines.reduce(function(acc, line) {
|
|
|
|
if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {
|
|
|
|
return line.length - trimLeft(line).length;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, Number.POSITIVE_INFINITY);
|
|
|
|
// Slice each line with this amount
|
|
|
|
return lines.map(function(line, index) {
|
|
|
|
return line.slice(pad);
|
|
|
|
})
|
|
|
|
.join('\n');
|
|
|
|
})(snippetEl);
|
|
|
|
}
|
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
var RevealHighlight = {
|
2019-03-04 14:32:38 +01:00
|
|
|
init: function() {
|
2013-04-28 20:12:31 +02:00
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
// Read the plugin config options and provide fallbacks
|
|
|
|
var config = Reveal.getConfig().highlight || {};
|
|
|
|
config.highlightOnLoad = typeof config.highlightOnLoad === 'boolean' ? config.highlightOnLoad : true;
|
|
|
|
config.escapeHTML = typeof config.escapeHTML === 'boolean' ? config.escapeHTML : true;
|
|
|
|
|
|
|
|
[].slice.call( document.querySelectorAll( '.reveal pre code' ) ).forEach( function( block ) {
|
2019-03-04 14:32:38 +01:00
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
// Trim whitespace if the "data-trim" attribute is present
|
|
|
|
if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) {
|
|
|
|
block.innerHTML = betterTrim( block );
|
2019-03-04 14:32:38 +01:00
|
|
|
}
|
2013-04-28 20:12:31 +02:00
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
// Escape HTML tags unless the "data-noescape" attrbute is present
|
|
|
|
if( config.escapeHTML && !block.hasAttribute( 'data-noescape' )) {
|
|
|
|
block.innerHTML = block.innerHTML.replace( /</g,"<").replace(/>/g, '>' );
|
2019-03-04 14:32:38 +01:00
|
|
|
}
|
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
// Re-highlight when focus is lost (for contenteditable code)
|
|
|
|
block.addEventListener( 'focusout', function( event ) {
|
2019-03-04 14:32:38 +01:00
|
|
|
hljs.highlightBlock( event.currentTarget );
|
|
|
|
}, false );
|
2013-05-01 21:44:53 +02:00
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
if( config.highlightOnLoad ) {
|
|
|
|
RevealHighlight.highlightBlock( block );
|
|
|
|
}
|
2019-03-08 15:07:59 +01:00
|
|
|
} );
|
2019-03-04 14:32:38 +01:00
|
|
|
|
|
|
|
// lofi xbrowser Promise.resolve()
|
|
|
|
return { then: function( resolve ) { resolve(); }};
|
|
|
|
|
2019-03-08 15:07:59 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Highlights a code block. If the <code> node has the
|
|
|
|
* 'line-numbers' class we also generate slide numbers.
|
|
|
|
*/
|
|
|
|
highlightBlock: function( block ) {
|
|
|
|
|
|
|
|
hljs.highlightBlock( block );
|
|
|
|
|
2019-03-11 15:48:03 +01:00
|
|
|
if( block.hasAttribute( 'data-line-numbers' ) ) {
|
2019-03-12 13:17:50 +01:00
|
|
|
hljs.lineNumbersBlock( block, { singleLine: true } );
|
2019-03-08 15:07:59 +01:00
|
|
|
|
2019-03-11 15:48:03 +01:00
|
|
|
// hljs.lineNumbersBlock runs async code on the next cycle,
|
|
|
|
// so we need to do the same to execute after it's done
|
2019-03-12 13:17:50 +01:00
|
|
|
setTimeout( RevealHighlight.highlightLines.bind( this, block ), 0 );
|
2019-03-08 15:07:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Visually emphasize specific lines within a code block.
|
|
|
|
* This onnly works on blocks with line numbering turned on.
|
|
|
|
*
|
|
|
|
* @param {HTMLElement} block a <code> block
|
|
|
|
* @param {String} [linesToHighlight] The lines that should be
|
|
|
|
* highlighted in this format:
|
|
|
|
* "1" = highlights line 1
|
|
|
|
* "2,5" = highlights lines 2 & 5
|
|
|
|
* "2,5-7" = highlights lines 2, 5, 6 & 7
|
|
|
|
*/
|
|
|
|
highlightLines: function( block, linesToHighlight ) {
|
|
|
|
|
2019-03-11 15:48:03 +01:00
|
|
|
linesToHighlight = linesToHighlight || block.getAttribute( 'data-line-numbers' );
|
2019-03-08 15:07:59 +01:00
|
|
|
|
2019-03-11 16:12:25 +01:00
|
|
|
if( typeof linesToHighlight === 'string' && linesToHighlight !== '' ) {
|
2019-03-08 15:07:59 +01:00
|
|
|
|
|
|
|
linesToHighlight.split( ',' ).forEach( function( lineNumbers ) {
|
|
|
|
|
2019-03-11 16:12:25 +01:00
|
|
|
// Ensure that we looking at a valid slide number (1 or 1-2)
|
|
|
|
if( /^[\d-]+$/.test( lineNumbers ) ) {
|
2019-03-08 15:07:59 +01:00
|
|
|
|
2019-03-11 16:12:25 +01:00
|
|
|
lineNumbers = lineNumbers.split( '-' )
|
2019-03-08 15:07:59 +01:00
|
|
|
|
2019-03-11 16:12:25 +01:00
|
|
|
var lineStart = lineNumbers[0];
|
|
|
|
var lineEnd = lineNumbers[1] || lineStart;
|
|
|
|
|
|
|
|
[].slice.call( block.querySelectorAll( 'table tr:nth-child(n+'+lineStart+'):nth-child(-n+'+lineEnd+')' ) ).forEach( function( lineElement ) {
|
|
|
|
lineElement.classList.add( 'highlight-line' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
}
|
2019-03-08 15:07:59 +01:00
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-28 20:12:31 +02:00
|
|
|
}
|
|
|
|
}
|
2012-10-28 23:09:54 +01:00
|
|
|
|
2019-03-12 13:17:50 +01:00
|
|
|
Reveal.registerPlugin( 'highlight', RevealHighlight );
|
|
|
|
|
|
|
|
return RevealHighlight;
|
|
|
|
|
|
|
|
}));
|