From a2650f1ebd247e1a5c3412630d10a9b34c790bf3 Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 25 Mar 2015 17:27:03 +0100 Subject: [PATCH] Ajout base formation Javascript --- javascript/.editorconfig | 7 + javascript/README.md | 16 + javascript/base/cover.md | 6 + javascript/base/fonctions-1.md | 29 + javascript/base/fonctions-2.md | 18 + javascript/base/fonctions-3.md | 8 + javascript/base/historique.md | 16 + javascript/base/index.html | 31 + javascript/base/index.md | 28 + javascript/base/langage.md | 9 + javascript/base/plan.md | 46 + javascript/base/structures-1.md | 31 + javascript/base/structures-2.md | 27 + javascript/base/structures-3.md | 28 + javascript/base/tableaux-1.md | 30 + javascript/base/tableaux-2.md | 48 + javascript/base/variables-1.md | 33 + javascript/base/variables-2.md | 25 + javascript/bower.json | 20 + .../bower_components/remark/.bower.json | 42 + .../bower_components/remark/.travis.yml | 3 + javascript/bower_components/remark/LICENCE | 20 + javascript/bower_components/remark/README.md | 116 + .../remark/boilerplate-local.html | 50 + .../remark/boilerplate-remote.html | 46 + .../remark/boilerplate-single.html | 44 + javascript/bower_components/remark/bower.json | 31 + .../bower_components/remark/out/remark.js | 6491 +++++++++++++++++ .../bower_components/remark/out/remark.min.js | 6 + javascript/cadoles-remark-macros.js | 10 + javascript/cadoles-theme.css | 47 + 31 files changed, 7362 insertions(+) create mode 100644 javascript/.editorconfig create mode 100644 javascript/README.md create mode 100644 javascript/base/cover.md create mode 100644 javascript/base/fonctions-1.md create mode 100644 javascript/base/fonctions-2.md create mode 100644 javascript/base/fonctions-3.md create mode 100644 javascript/base/historique.md create mode 100644 javascript/base/index.html create mode 100644 javascript/base/index.md create mode 100644 javascript/base/langage.md create mode 100644 javascript/base/plan.md create mode 100644 javascript/base/structures-1.md create mode 100644 javascript/base/structures-2.md create mode 100644 javascript/base/structures-3.md create mode 100644 javascript/base/tableaux-1.md create mode 100644 javascript/base/tableaux-2.md create mode 100644 javascript/base/variables-1.md create mode 100644 javascript/base/variables-2.md create mode 100644 javascript/bower.json create mode 100644 javascript/bower_components/remark/.bower.json create mode 100644 javascript/bower_components/remark/.travis.yml create mode 100644 javascript/bower_components/remark/LICENCE create mode 100644 javascript/bower_components/remark/README.md create mode 100644 javascript/bower_components/remark/boilerplate-local.html create mode 100644 javascript/bower_components/remark/boilerplate-remote.html create mode 100644 javascript/bower_components/remark/boilerplate-single.html create mode 100644 javascript/bower_components/remark/bower.json create mode 100644 javascript/bower_components/remark/out/remark.js create mode 100644 javascript/bower_components/remark/out/remark.min.js create mode 100644 javascript/cadoles-remark-macros.js create mode 100644 javascript/cadoles-theme.css diff --git a/javascript/.editorconfig b/javascript/.editorconfig new file mode 100644 index 0000000..81d2021 --- /dev/null +++ b/javascript/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/javascript/README.md b/javascript/README.md new file mode 100644 index 0000000..9e89bb8 --- /dev/null +++ b/javascript/README.md @@ -0,0 +1,16 @@ +# Formations Javascript + +Les formations Javascript sont au format HTML et utilisent la librairie [remark](https://github.com/gnab/remark). + +## Générer le PDF de la formation + +Utiliser le script `generate-pdf.sh` + +## Visualiser une des formations + +``` +cd formations +python -m SimpleHTTPServer +``` + +Puis ouvrir votre navigateur sur l'adresse `http://localhost:8080/javascript/` diff --git a/javascript/base/cover.md b/javascript/base/cover.md new file mode 100644 index 0000000..44ae479 --- /dev/null +++ b/javascript/base/cover.md @@ -0,0 +1,6 @@ +# .cadoles-blue[Formation Javascript] + +## .cadoles-blue[EOLE] +### William Petit + +### 02 Avril 2015 diff --git a/javascript/base/fonctions-1.md b/javascript/base/fonctions-1.md new file mode 100644 index 0000000..3174e4d --- /dev/null +++ b/javascript/base/fonctions-1.md @@ -0,0 +1,29 @@ +# .cadoles-slide-title[Fonctions (1/3)] +.cadoles-clearfix[ +**Déclaration et invocation** +] +```js +// Déclaration +function myFunc() { + return 'Hello from myFunc'; +} + +var myFunc2 = function() { + return 'Hello from myFunc2'; +}; + +// Invocation +myFunc(); // -> 'Hello from myFunc' +myFunc2(); // -> 'Hello from myFunc2' +``` +**Arguments** + +Comme les variables, les arguments d'une fonction en Javascript ne sont pas typés, et leur nombre n'est pas fixe. +```js +function myFunc(arg1, arg2) { + console.log(arg1, arg2); +} + +myFunc('foo', 'bar'); // -> affiche 'foo bar' dans la console; +myFunc('foo', 'bar', 'baz'); // Pas d'erreur +``` diff --git a/javascript/base/fonctions-2.md b/javascript/base/fonctions-2.md new file mode 100644 index 0000000..57190a0 --- /dev/null +++ b/javascript/base/fonctions-2.md @@ -0,0 +1,18 @@ +# .cadoles-slide-title[Fonctions (2/3)] + +.cadoles-clearfix[ +**La variable `arguments`** +] + +Dans le contexte d'exécution d'un fonction, la variable `arguments` permet de manipuler les arguments, même si ceux ci n'ont pas été déclarés par la fonction. +```js +function myFunc() { + console.log(arguments.length, arguments[0], arguments[1]); +} + +myFunc('arg1', 'arg2'); // Affiche '2 "arg1" "arg2"' dans la console +myFunc(); // Affiche '0 undefined undefined' dans la console +``` +**Contexte d'exécution et `this`** + +En Javascript, le mot clé `this` permet d'obtenir une référence vers le contexte d'exécution. diff --git a/javascript/base/fonctions-3.md b/javascript/base/fonctions-3.md new file mode 100644 index 0000000..f66b1f6 --- /dev/null +++ b/javascript/base/fonctions-3.md @@ -0,0 +1,8 @@ +# .cadoles-slide-title[Fonctions (3/3)] + +.cadoles-clearfix[ +**"Levage" de fonctions** +] +```js + +``` diff --git a/javascript/base/historique.md b/javascript/base/historique.md new file mode 100644 index 0000000..3d4dab5 --- /dev/null +++ b/javascript/base/historique.md @@ -0,0 +1,16 @@ +# .cadoles-slide-title[Historique] + +.cadoles-list.cadoles-clearfix[ + +- Créé en 1995 par [Brendan Eich](https://fr.wikipedia.org/wiki/Brendan_Eich) pour [Netscape](https://fr.wikipedia.org/wiki/Netscape_Communications); +- Normalisé par le standard [ECMAScript](https://fr.wikipedia.org/wiki/ECMAScript) en juin 1997; +- Actuellement en version 1.8.5, implémentant la version 5 de la norme ECMA-262; +- La version 6 de la norme ECMA-262 devrait sortir à la mi 2015. + +] + +.cadoles-list[ + +- Premier langage en terme de volume de dépôts créés sur [Github](https://github.com/) (d'après [Githut.info](http://githut.info/)). + +] diff --git a/javascript/base/index.html b/javascript/base/index.html new file mode 100644 index 0000000..f8c5ded --- /dev/null +++ b/javascript/base/index.html @@ -0,0 +1,31 @@ + + + + Cadoles - Formation Javascript + + + + + + + + + + diff --git a/javascript/base/index.md b/javascript/base/index.md new file mode 100644 index 0000000..1da6ffe --- /dev/null +++ b/javascript/base/index.md @@ -0,0 +1,28 @@ +class: middle, center +![:include](cover.md) +--- +![:include](plan.md) +--- +![:include](historique.md) +--- +![:include](langage.md) +--- +![:include](variables-1.md) +--- +![:include](variables-2.md) +--- +![:include](structures-1.md) +--- +![:include](structures-2.md) +--- +![:include](structures-3.md) +--- +![:include](fonctions-1.md) +--- +![:include](fonctions-2.md) +--- +![:include](fonctions-3.md) +--- +![:include](tableaux-1.md) +--- +![:include](tableaux-2.md) diff --git a/javascript/base/langage.md b/javascript/base/langage.md new file mode 100644 index 0000000..b0f174f --- /dev/null +++ b/javascript/base/langage.md @@ -0,0 +1,9 @@ +# .cadoles-slide-title[Le langage] + +.cadoles-list.cadoles-clearfix[ +- Variables +- Structures de contrôles +- Fonctions +- Tableaux +- Objets +] diff --git a/javascript/base/plan.md b/javascript/base/plan.md new file mode 100644 index 0000000..ea18c5f --- /dev/null +++ b/javascript/base/plan.md @@ -0,0 +1,46 @@ +# .cadoles-slide-title[Plan] + +.cadoles-list.cadoles-clearfix[ + +- Historique +- Le langage +- L'héritage prototypal +- Modularisation +- L'écosystème Javascript +- Les alternatives + +] + +??? + +## Plan complet + +- Historique +- Le langage + - Variables + - Structures de contrôles + - Fonctions + - Tableaux + - Objets +- L'héritage prototypal +- Modularisation + - État des lieux + - Variable globale + - AMD + - CommonJS + - Modules ES6 +- L'écosystème Javascript + - Outils de debug + - Console de débogage + - Tests unitaires + - Linting + - `'use strict';` + - Gestionnaires de paquets + - Pipeline d'intégration + - Grunt + - Gulp +- Les alternatives + - CoffeeScript + - Dart + - TypeScript + - Haxe diff --git a/javascript/base/structures-1.md b/javascript/base/structures-1.md new file mode 100644 index 0000000..5f5d88d --- /dev/null +++ b/javascript/base/structures-1.md @@ -0,0 +1,31 @@ +# .cadoles-slide-title[ Structures de contrôle (1/3) ] + +.cadoles-clearfix[ +**Tests et conditions** +] +```js +// Opérateurs de comparaison: <, >, >=, <=, ==, ===, !=, !== + +var test = 1; + +if(test < 1) { + console.log('test est strictement inférieur à 1'); +} else if(test > 1) { + console.log('test est strictement supérieur à 2'); +} else { + console.log('test est égal à 1'); +} + +test = 'foo'; + +switch(test) { + case 'foo': + console.log('foo !'); + break; + case 'bar': + console.log('bar !'); + break; + default: + console.log('default !'); +} +``` diff --git a/javascript/base/structures-2.md b/javascript/base/structures-2.md new file mode 100644 index 0000000..e15f46c --- /dev/null +++ b/javascript/base/structures-2.md @@ -0,0 +1,27 @@ +# .cadoles-slide-title[Structures de contrôle (2/3)] + +.cadoles-clearfix[ +**Tests, transitivité, égalité stricte et petites subtilités** +] +```js +var test; + +test = 1 == '1'; // -> true +test = 1 === '1'; // -> false + +test = 0 == false; // -> true +test = 0 === false; // -> false + +test = 1 == true; // -> true +test = 1 === true; // -> false + +test = '' == false; // -> true +test = '' === false; // -> false + +test = [] == false; // -> true +test = [] === false; // -> false + +test = undefined == null; // -> true +test = undefined == false; // -> false +test = NaN == NaN; // -> false +``` diff --git a/javascript/base/structures-3.md b/javascript/base/structures-3.md new file mode 100644 index 0000000..5600c89 --- /dev/null +++ b/javascript/base/structures-3.md @@ -0,0 +1,28 @@ +# .cadoles-slide-title[Structures de contrôle (3/3)] + +.cadoles-clearfix[ +**Itérations** +] +```js +for(var i = 0; i < 5; i++) { + console.log(i); +} + +var j = 5; + +while(j > 0) { + console.log('Loop:', j); + j -= 1; +} + +j = 0; + +do { + console.log('Loop:', j); + j += 1; +} while(j < 5); + +``` +** Instructions de contrôle des boucles ** +- `break;` Sort de la boucle +- `continue;` Interromp la boucle et passe à l'itération suivante diff --git a/javascript/base/tableaux-1.md b/javascript/base/tableaux-1.md new file mode 100644 index 0000000..590a007 --- /dev/null +++ b/javascript/base/tableaux-1.md @@ -0,0 +1,30 @@ +# .cadoles-slide-title[Tableaux (1/2)] + +.cadoles-clearfix[ +**Différentes notations** +] +```js +var arr = [1, 2, 3]; // A préférer +arr = new Array(1, 2, 3); + +// Attention ! +arr = new Array(3); // -> [undefined, undefined, undefined] +``` +**Manipulation d'un tableau** +```js +var arr = [1, 2, 3]; + +// Propriétés +arr.length // -> 3 +arr[0] // -> 1 + +// Méthodes (liste non exhaustive) +arr.push(4); // -> [1, 2, 3, 4] +arr.pop(); // -> [1, 2, 3] +arr.unshift(0); // -> [0, 1, 2, 3] +arr.shift(); // -> [1, 2, 3] +arr.indexOf(2) // -> 1 +arr = [2, 3, 1]; +arr.sort(); // -> [1, 2, 3] +arr.join(', '); // -> '1, 2, 3' +``` diff --git a/javascript/base/tableaux-2.md b/javascript/base/tableaux-2.md new file mode 100644 index 0000000..0237f50 --- /dev/null +++ b/javascript/base/tableaux-2.md @@ -0,0 +1,48 @@ +# .cadoles-slide-title[Tableaux (2/2)] + +.cadoles-clearfix[ +**Méthodes de parcours et transformations** +] +```js +var arr = [1, 2, 3]; + +// Traverser le tableau +arr.forEach(function(item, index) { + console.log('Item:', item, 'Index:', index); +}); + +// Transformer un tableau +var square = arr.map(function(item, index) { + return item*item; +}); // -> [1, 4, 9] + +// Réduire un tableau +var sum = arr.reduce(function(memo, item, index) { + return memo+item; +}, 0); // -> 6 +``` +**Exercice** +```js +var arr = [15, 20, 15, 16, -1, 4]; + +var max = arr.??(function(??) { + ?? +}, ??); + +console.log(max); // -> 20 +``` +??? + +Solution Exo +```js +var arr = [15, 20, 15, 16, -1, 4]; + +var max = arr.reduce(function(memo, item, index) { + if(!memo) { + memo = item; + } else if(item >= memo) { + memo = item; + } + return memo; +}); +``` diff --git a/javascript/base/variables-1.md b/javascript/base/variables-1.md new file mode 100644 index 0000000..32a85d1 --- /dev/null +++ b/javascript/base/variables-1.md @@ -0,0 +1,33 @@ +# .cadoles-slide-title[Variables (1/2)] + +.cadoles-clearfix[ +Javascript est un langage **faiblement typé**. +] +```js +var foo; // Une variable peut être déclarée, avec ou sans valeur +var bar = 'hello world !'; + +// Elle peut changer de type de valeur en cours d'exécution +bar = 5 + +// Incrémentation... + +bar += 1; // -> 6 +bar -= 2; // -> 4 + +// ... ou concaténation +bar = 'hello'; +bar += ' world !'; +console.log(bar); // -> 'hello world !' + +``` +**À votre avis ?** +```js +var foo = 'foo'; +foo += 1; +console.log(foo) // Résultat ? + +var bar = 'bar'; +bar -= 1; +console.log(bar) // Résultat ? +``` diff --git a/javascript/base/variables-2.md b/javascript/base/variables-2.md new file mode 100644 index 0000000..ae47b39 --- /dev/null +++ b/javascript/base/variables-2.md @@ -0,0 +1,25 @@ +# .cadoles-slide-title[Variables (2/2)] + +.cadoles-clearfix[ +**Types** +] +```js +var foo; + +// Types primaires + +foo = 0; // Number, pas de distinction entre nombres flottants ou entiers +foo = 'baz'; // String, peut être délimité par ' ou ", pas de signification particulière +foo = true; // Boolean + +// Types composites + +foo = { prop1: 'World' }; // Object +foo = [1, 2, 3]; // Array + +// Types spéciaux + +foo = undefined; +foo = null; +foo = NaN; +``` diff --git a/javascript/bower.json b/javascript/bower.json new file mode 100644 index 0000000..5be948e --- /dev/null +++ b/javascript/bower.json @@ -0,0 +1,20 @@ +{ + "name": "javascript", + "version": "0.0.0", + "authors": [ + "William Petit " + ], + "license": "CC BY-NC-SA 2.0", + "homepage": "https://www.cadoles.com/wordpress/formations/", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "remark": "~0.10.2" + } +} diff --git a/javascript/bower_components/remark/.bower.json b/javascript/bower_components/remark/.bower.json new file mode 100644 index 0000000..2f056a8 --- /dev/null +++ b/javascript/bower_components/remark/.bower.json @@ -0,0 +1,42 @@ +{ + "name": "remark", + "homepage": "http://remarkjs.com/", + "authors": [ + "Ole Petter Bang " + ], + "description": "A simple, in-browser, markdown-driven slideshow tool.", + "main": "out/remark.js", + "keywords": [ + "Markdown", + "Slides" + ], + "license": "MIT", + "ignore": [ + ".gitignore", + ".gitmodules", + ".jshintignore", + ".jshintrc", + "HISTORY.md", + "LICENSE", + "make.js", + "Makefile", + "package.json", + "bower_components", + "node_modules", + "src", + "test", + "vendor", + "out/tests.js" + ], + "version": "0.10.2", + "_release": "0.10.2", + "_resolution": { + "type": "version", + "tag": "v0.10.2", + "commit": "359f491fae0e53b2e8102b6a264a236fc28b5480" + }, + "_source": "https://github.com/gnab/remark.git", + "_target": "~0.10.2", + "_originalSource": "remark", + "_direct": true +} \ No newline at end of file diff --git a/javascript/bower_components/remark/.travis.yml b/javascript/bower_components/remark/.travis.yml new file mode 100644 index 0000000..e02e6b4 --- /dev/null +++ b/javascript/bower_components/remark/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/javascript/bower_components/remark/LICENCE b/javascript/bower_components/remark/LICENCE new file mode 100644 index 0000000..9d142fc --- /dev/null +++ b/javascript/bower_components/remark/LICENCE @@ -0,0 +1,20 @@ +Copyright (c) 2011-2013 Ole Petter Bang + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/javascript/bower_components/remark/README.md b/javascript/bower_components/remark/README.md new file mode 100644 index 0000000..4d3cc82 --- /dev/null +++ b/javascript/bower_components/remark/README.md @@ -0,0 +1,116 @@ +# remark + +[![Build Status](https://travis-ci.org/gnab/remark.svg?branch=develop)](https://travis-ci.org/gnab/remark) + +A simple, in-browser, markdown-driven slideshow tool targeted at people who know their way around HTML and CSS, featuring: + +- Markdown formatting, with smart extensions +- Presenter mode, with cloned slideshow view +- Syntax highlighting, supporting a range of languages +- Slide scaling, thus similar appearance on all devices / resolutions +- Touch support for smart phones and pads, i.e. swipe to navigate slides + +Check out [this remark slideshow](http://gnab.github.com/remark) for a brief introduction. + +To render your Markdown-based slideshow on the fly, checkout [Remarkise](https://gnab.github.io/remark/remarkise). + +### Getting Started + +It takes only a few, simple steps to get up and running with remark: + +1. Create a HTML file to contain your slideshow (see below) +2. Open the HTML file in a decent browser +3. Edit the Markdown and/or CSS styles as needed, save and refresh! + +Below is a boilerplate HTML file to get you started: + +```html + + + + Title + + + + + + + + + +``` + +### Moving On + +For more information on using remark, please check out the [wiki](http://github.com/gnab/remark/wiki) pages. + +### Real-world remark slideshows + +On using remark: + +- [The Official remark Slideshow](http://gnab.github.com/remark) +- [Coloured Terminal Listings in remark](http://joshbode.github.com/remark/ansi.html) by [joshbode](https://github.com/joshbode) + +Other interesting stuff: + +- [gnab.github.com/editorjs](http://gnab.github.com/editorjs) +- [judoole.github.com/GroovyBDD](http://judoole.github.com/GroovyBDD) +- [kjbekkelund.github.com/nith-coffeescript](http://kjbekkelund.github.com/nith-coffeescript) +- [kjbekkelund.github.com/js-architecture-backbone](http://kjbekkelund.github.com/js-architecture-backbone) +- [bekkopen.github.com/infrastruktur-som-kode](http://bekkopen.github.com/infrastruktur-som-kode) +- [ivarconr.github.com/Test-Driven-Web-Development/slides](http://ivarconr.github.com/Test-Driven-Web-Development/slides) +- [havard.github.com/node.js-intro-norwegian](http://havard.github.com/node.js-intro-norwegian) +- [mobmad.github.com/js-tdd-erfaringer](http://mobmad.github.com/js-tdd-erfaringer) +- [torgeir.github.com/busterjs-lightning-talk](http://torgeir.github.com/busterjs-lightning-talk) +- [roberto.github.com/ruby-sinform-2012](http://roberto.github.com/ruby-sinform-2012) +- [http://asmeurer.github.io/python3-presentation/slides.html](http://asmeurer.github.io/python3-presentation/slides.html) + +### Other systems integrating with remark + +- [http://platon.io](http://platon.io) +- [http://markdowner.com](http://markdowner.com) +- [http://remarks.sinaapp.com](http://remarks.sinaapp.com/) + +### Credits + +- [torgeir](http://github.com/torgeir), for invaluable advice and feedback. +- [kjbekkelund](https://github.com/kjbekkelund), for numerous pull requests. +- [gureckis](https://github.com/gureckis), for several pull requests. +- [freakboy3742](https://github.com/freakboy3742), for several pull requests. + +### License + +remark is licensed under the MIT license. See LICENSE for further +details. diff --git a/javascript/bower_components/remark/boilerplate-local.html b/javascript/bower_components/remark/boilerplate-local.html new file mode 100644 index 0000000..45136db --- /dev/null +++ b/javascript/bower_components/remark/boilerplate-local.html @@ -0,0 +1,50 @@ + + + + My Awesome Presentation + + + + + + + + + diff --git a/javascript/bower_components/remark/boilerplate-remote.html b/javascript/bower_components/remark/boilerplate-remote.html new file mode 100644 index 0000000..4f20ae8 --- /dev/null +++ b/javascript/bower_components/remark/boilerplate-remote.html @@ -0,0 +1,46 @@ + + + + My Awesome Presentation + + + + + + + + + diff --git a/javascript/bower_components/remark/boilerplate-single.html b/javascript/bower_components/remark/boilerplate-single.html new file mode 100644 index 0000000..439aa90 --- /dev/null +++ b/javascript/bower_components/remark/boilerplate-single.html @@ -0,0 +1,44 @@ + + + + My Awesome Presentation + + + + + + + + diff --git a/javascript/bower_components/remark/bower.json b/javascript/bower_components/remark/bower.json new file mode 100644 index 0000000..815cb88 --- /dev/null +++ b/javascript/bower_components/remark/bower.json @@ -0,0 +1,31 @@ +{ + "name": "remark", + "homepage": "http://remarkjs.com/", + "authors": [ + "Ole Petter Bang " + ], + "description": "A simple, in-browser, markdown-driven slideshow tool.", + "main": "out/remark.js", + "keywords": [ + "Markdown", + "Slides" + ], + "license": "MIT", + "ignore": [ + ".gitignore", + ".gitmodules", + ".jshintignore", + ".jshintrc", + "HISTORY.md", + "LICENSE", + "make.js", + "Makefile", + "package.json", + "bower_components", + "node_modules", + "src", + "test", + "vendor", + "out/tests.js" + ] +} diff --git a/javascript/bower_components/remark/out/remark.js b/javascript/bower_components/remark/out/remark.js new file mode 100644 index 0000000..b2f0fdb --- /dev/null +++ b/javascript/bower_components/remark/out/remark.js @@ -0,0 +1,6491 @@ +require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +} + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],1:[function(require,module,exports){ +(function(process){if (!process.EventEmitter) process.EventEmitter = function () {}; + +var EventEmitter = exports.EventEmitter = process.EventEmitter; +var isArray = typeof Array.isArray === 'function' + ? Array.isArray + : function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]' + } +; +function indexOf (xs, x) { + if (xs.indexOf) return xs.indexOf(x); + for (var i = 0; i < xs.length; i++) { + if (x === xs[i]) return i; + } + return -1; +} + +// By default EventEmitters will print a warning if more than +// 10 listeners are added to it. This is a useful default which +// helps finding memory leaks. +// +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +var defaultMaxListeners = 10; +EventEmitter.prototype.setMaxListeners = function(n) { + if (!this._events) this._events = {}; + this._events.maxListeners = n; +}; + + +EventEmitter.prototype.emit = function(type) { + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events || !this._events.error || + (isArray(this._events.error) && !this._events.error.length)) + { + if (arguments[1] instanceof Error) { + throw arguments[1]; // Unhandled 'error' event + } else { + throw new Error("Uncaught, unspecified 'error' event."); + } + return false; + } + } + + if (!this._events) return false; + var handler = this._events[type]; + if (!handler) return false; + + if (typeof handler == 'function') { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + var args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + return true; + + } else if (isArray(handler)) { + var args = Array.prototype.slice.call(arguments, 1); + + var listeners = handler.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i].apply(this, args); + } + return true; + + } else { + return false; + } +}; + +// EventEmitter is defined in src/node_events.cc +// EventEmitter.prototype.emit() is also defined there. +EventEmitter.prototype.addListener = function(type, listener) { + if ('function' !== typeof listener) { + throw new Error('addListener only takes instances of Function'); + } + + if (!this._events) this._events = {}; + + // To avoid recursion in the case that type == "newListeners"! Before + // adding it to the listeners, first emit "newListeners". + this.emit('newListener', type, listener); + + if (!this._events[type]) { + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + } else if (isArray(this._events[type])) { + + // Check for listener leak + if (!this._events[type].warned) { + var m; + if (this._events.maxListeners !== undefined) { + m = this._events.maxListeners; + } else { + m = defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + console.trace(); + } + } + + // If we've already got an array, just append. + this._events[type].push(listener); + } else { + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + var self = this; + self.on(type, function g() { + self.removeListener(type, g); + listener.apply(this, arguments); + }); + + return this; +}; + +EventEmitter.prototype.removeListener = function(type, listener) { + if ('function' !== typeof listener) { + throw new Error('removeListener only takes instances of Function'); + } + + // does not use listeners(), so no side effect of creating _events[type] + if (!this._events || !this._events[type]) return this; + + var list = this._events[type]; + + if (isArray(list)) { + var i = indexOf(list, listener); + if (i < 0) return this; + list.splice(i, 1); + if (list.length == 0) + delete this._events[type]; + } else if (this._events[type] === listener) { + delete this._events[type]; + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + if (arguments.length === 0) { + this._events = {}; + return this; + } + + // does not use listeners(), so no side effect of creating _events[type] + if (type && this._events && this._events[type]) this._events[type] = null; + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + if (!this._events) this._events = {}; + if (!this._events[type]) this._events[type] = []; + if (!isArray(this._events[type])) { + this._events[type] = [this._events[type]]; + } + return this._events[type]; +}; + +})(require("__browserify_process")) +},{"__browserify_process":2}],3:[function(require,module,exports){ +var Api = require('./remark/api') + , polyfills = require('./polyfills') + , styler = require('components/styler') + ; + +// Expose API as `remark` +window.remark = new Api(); + +// Apply polyfills as needed +polyfills.apply(); + +// Apply embedded styles to document +styler.styleDocument(); + +},{"components/styler":"t5Lx4S","./remark/api":4,"./polyfills":5}],"components/styler":[function(require,module,exports){ +module.exports=require('t5Lx4S'); +},{}],"t5Lx4S":[function(require,module,exports){ +var resources = require('../../resources') + , highlighter = require('../../highlighter') + ; + +module.exports = { + styleDocument: styleDocument +, setPageSize: setPageSize +}; + +// Applies bundled styles to document +function styleDocument () { + var headElement, styleElement, style; + + // Bail out if document has already been styled + if (getRemarkStylesheet()) { + return; + } + + headElement = document.getElementsByTagName('head')[0]; + styleElement = document.createElement('style'); + styleElement.type = 'text/css'; + + // Set title in order to enable lookup + styleElement.title = 'remark'; + + // Set document styles + styleElement.innerHTML = resources.documentStyles; + + // Append highlighting styles + for (style in highlighter.styles) { + if (highlighter.styles.hasOwnProperty(style)) { + styleElement.innerHTML = styleElement.innerHTML + + highlighter.styles[style]; + } + } + + // Put element first to prevent overriding user styles + headElement.insertBefore(styleElement, headElement.firstChild); +} + +function setPageSize (size) { + var stylesheet = getRemarkStylesheet() + , pageRule = getPageRule(stylesheet) + ; + + pageRule.style.size = size; +} + +// Locates the embedded remark stylesheet +function getRemarkStylesheet () { + var i, l = document.styleSheets.length; + + for (i = 0; i < l; ++i) { + if (document.styleSheets[i].title === 'remark') { + return document.styleSheets[i]; + } + } +} + +// Locates the CSS @page rule +function getPageRule (stylesheet) { + var i, l = stylesheet.cssRules.length; + + for (i = 0; i < l; ++i) { + if (stylesheet.cssRules[i] instanceof window.CSSPageRule) { + return stylesheet.cssRules[i]; + } + } +} + +},{"../../resources":6,"../../highlighter":7}],5:[function(require,module,exports){ +exports.apply = function () { + forEach([Array, window.NodeList, window.HTMLCollection], extend); +}; + +function forEach (list, f) { + var i; + + for (i = 0; i < list.length; ++i) { + f(list[i], i); + } +} + +function extend (object) { + var prototype = object && object.prototype; + + if (!prototype) { + return; + } + + prototype.forEach = prototype.forEach || function (f) { + forEach(this, f); + }; + + prototype.filter = prototype.filter || function (f) { + var result = []; + + this.forEach(function (element) { + if (f(element, result.length)) { + result.push(element); + } + }); + + return result; + }; + + prototype.map = prototype.map || function (f) { + var result = []; + + this.forEach(function (element) { + result.push(f(element, result.length)); + }); + + return result; + }; +} +},{}],"components/timer":[function(require,module,exports){ +module.exports=require('yAcg0L'); +},{}],"yAcg0L":[function(require,module,exports){ +var utils = require('../../utils'); + +module.exports = TimerViewModel; + +function TimerViewModel (events, element) { + var self = this; + + self.events = events; + self.element = element; + + self.startTime = null; + self.pauseStart = null; + self.pauseLength = 0; + + element.innerHTML = '0:00:00'; + + setInterval(function() { + self.updateTimer(); + }, 100); + + events.on('start', function () { + // When we do the first slide change, start the clock. + self.startTime = new Date(); + }); + + events.on('resetTimer', function () { + // If we reset the timer, clear everything. + self.startTime = null; + self.pauseStart = null; + self.pauseLength = 0; + self.element.innerHTML = '0:00:00'; + }); + + events.on('pause', function () { + self.pauseStart = new Date(); + }); + + events.on('resume', function () { + self.pauseLength += new Date() - self.pauseStart; + self.pauseStart = null; + }); +} + +TimerViewModel.prototype.updateTimer = function () { + var self = this; + + if (self.startTime) { + var millis; + // If we're currently paused, measure elapsed time from the pauseStart. + // Otherwise, use "now". + if (self.pauseStart) { + millis = self.pauseStart - self.startTime - self.pauseLength; + } else { + millis = new Date() - self.startTime - self.pauseLength; + } + + var seconds = Math.floor(millis / 1000) % 60; + var minutes = Math.floor(millis / 60000) % 60; + var hours = Math.floor(millis / 3600000); + + self.element.innerHTML = hours + (minutes > 9 ? ':' : ':0') + minutes + (seconds > 9 ? ':' : ':0') + seconds; + } +}; + +},{"../../utils":8}],6:[function(require,module,exports){ +/* Automatically generated */ + +module.exports = { + documentStyles: "html.remark-container,body.remark-container{height:100%;width:100%;-webkit-print-color-adjust:exact;}.remark-container{background:#d7d8d2;margin:0;overflow:hidden;}.remark-container:focus{outline-style:solid;outline-width:1px;}:-webkit-full-screen .remark-container{width:100%;height:100%;}.remark-slides-area{position:relative;height:100%;width:100%;}.remark-slide-container{display:none;position:absolute;height:100%;width:100%;page-break-after:always;}.remark-slide-scaler{background-color:transparent;overflow:hidden;position:absolute;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top-left;-moz-box-shadow:0 0 30px #888;-webkit-box-shadow:0 0 30px #888;box-shadow:0 0 30px #888;}.remark-slide{height:100%;width:100%;display:table;table-layout:fixed;}.remark-slide>.left{text-align:left;}.remark-slide>.center{text-align:center;}.remark-slide>.right{text-align:right;}.remark-slide>.top{vertical-align:top;}.remark-slide>.middle{vertical-align:middle;}.remark-slide>.bottom{vertical-align:bottom;}.remark-slide-content{background-color:#fff;background-position:center;background-repeat:no-repeat;display:table-cell;font-size:20px;padding:1em 4em 1em 4em;}.remark-slide-content h1{font-size:55px;}.remark-slide-content h2{font-size:45px;}.remark-slide-content h3{font-size:35px;}.remark-slide-content .left{display:block;text-align:left;}.remark-slide-content .center{display:block;text-align:center;}.remark-slide-content .right{display:block;text-align:right;}.remark-slide-number{bottom:12px;opacity:0.5;position:absolute;right:20px;}.remark-slide-notes{border-top:3px solid black;position:absolute;display:none;}.remark-code{font-size:18px;}.remark-code-line{min-height:1em;}.remark-code-line-highlighted{background-color:rgba(255, 255, 0, 0.5);}.remark-code-span-highlighted{background-color:rgba(255, 255, 0, 0.5);padding:1px 2px 2px 2px;}.remark-visible{display:block;z-index:2;}.remark-fading{display:block;z-index:1;}.remark-fading .remark-slide-scaler{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;}.remark-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;display:none;background:#000;z-index:2;}.remark-pause{bottom:0;top:0;right:0;left:0;display:none;position:absolute;z-index:1000;}.remark-pause .remark-pause-lozenge{margin-top:30%;text-align:center;}.remark-pause .remark-pause-lozenge span{color:white;background:black;border:2px solid black;border-radius:20px;padding:20px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:42pt;font-weight:bold;}.remark-container.remark-presenter-mode.remark-pause-mode .remark-pause{display:block;}.remark-container.remark-presenter-mode.remark-pause-mode .remark-backdrop{display:block;opacity:0.5;}.remark-help{bottom:0;top:0;right:0;left:0;display:none;position:absolute;z-index:1000;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top-left;}.remark-help .remark-help-content{color:white;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:12pt;position:absolute;top:5%;bottom:10%;height:10%;left:5%;width:90%;}.remark-help .remark-help-content h1{font-size:36px;}.remark-help .remark-help-content td{color:white;font-size:12pt;padding:10px;}.remark-help .remark-help-content td:first-child{padding-left:0;}.remark-help .remark-help-content .key{background:white;color:black;min-width:1em;display:inline-block;padding:3px 6px;text-align:center;border-radius:4px;font-size:14px;}.remark-help .dismiss{top:85%;}.remark-container.remark-help-mode .remark-help{display:block;}.remark-container.remark-help-mode .remark-backdrop{display:block;opacity:0.95;}.remark-preview-area{bottom:2%;left:2%;display:none;opacity:0.5;position:absolute;height:47.25%;width:48%;}.remark-preview-area .remark-slide-container{display:block;}.remark-notes-area{background:#e7e8e2;bottom:0;display:none;left:52%;overflow:hidden;position:absolute;right:0;top:0;}.remark-notes-area .remark-top-area{height:50px;left:20px;position:absolute;right:10px;top:10px;}.remark-notes-area .remark-bottom-area{position:absolute;top:75px;bottom:10px;left:20px;right:10px;}.remark-notes-area .remark-bottom-area .remark-toggle{display:block;text-decoration:none;font-family:Helvetica,arial,freesans,clean,sans-serif;border-bottom:1px solid #ccc;height:21px;font-size:0.75em;font-weight:bold;text-transform:uppercase;color:#666;text-shadow:#f5f5f5 1px 1px 1px;}.remark-notes-area .remark-bottom-area .remark-notes-current-area{height:70%;position:relative;}.remark-notes-area .remark-bottom-area .remark-notes-current-area .remark-notes{clear:both;border-top:1px solid #f5f5f5;position:absolute;top:22px;bottom:0px;left:0px;right:0px;overflow-y:auto;margin-bottom:20px;}.remark-notes-area .remark-bottom-area .remark-notes-preview-area{height:30%;position:relative;}.remark-notes-area .remark-bottom-area .remark-notes-preview-area .remark-notes-preview{border-top:1px solid #f5f5f5;position:absolute;top:22px;bottom:0px;left:0px;right:0px;overflow-y:auto;}.remark-notes-area .remark-bottom-area .remark-notes>*:first-child,.remark-notes-area .remark-bottom-area .remark-notes-preview>*:first-child{margin-top:5px;}.remark-notes-area .remark-bottom-area .remark-notes>*:last-child,.remark-notes-area .remark-bottom-area .remark-notes-preview>*:last-child{margin-bottom:0;}.remark-toolbar{color:#979892;vertical-align:middle;}.remark-toolbar .remark-toolbar-link{border:2px solid #d7d8d2;color:#979892;display:inline-block;padding:2px 2px;text-decoration:none;text-align:center;min-width:20px;}.remark-toolbar .remark-toolbar-link:hover{border-color:#979892;color:#676862;}.remark-toolbar .remark-toolbar-timer{border:2px solid black;border-radius:10px;background:black;color:white;display:inline-block;float:right;padding:5px 10px;font-family:sans-serif;font-weight:bold;font-size:175%;text-decoration:none;text-align:center;}.remark-container.remark-presenter-mode .remark-slides-area{top:2%;left:2%;height:47.25%;width:48%;}.remark-container.remark-presenter-mode .remark-preview-area{display:block;}.remark-container.remark-presenter-mode .remark-notes-area{display:block;}.remark-container.remark-blackout-mode:not(.remark-presenter-mode) .remark-backdrop{display:block;opacity:0.99;}.remark-container.remark-mirrored-mode:not(.remark-presenter-mode) .remark-slides-area{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);}@media print{.remark-container{overflow:visible;background-color:#fff;} .remark-container.remark-presenter-mode .remark-slides-area{top:0px;left:0px;height:100%;width:681px;} .remark-container.remark-presenter-mode .remark-preview-area,.remark-container.remark-presenter-mode .remark-notes-area{display:none;} .remark-container.remark-presenter-mode .remark-slide-notes{display:block;margin-left:30px;width:621px;} .remark-slide-container{display:block;position:relative;} .remark-slide-scaler{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;}}@page {margin:0;}", + containerLayout: "
\n
\n
\n +\n -\n \n
\n
\n
\n
\n
Notes for current slide
\n
\n
\n
\n
Notes for next slide
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n Paused\n
\n
\n
\n
\n

Help

\n

Keyboard shortcuts

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n ,\n ,\n Pg Up,\n k\n Go to previous slide
\n ,\n ,\n Pg Dn,\n Space,\n j\n Go to next slide
\n Home\n Go to first slide
\n End\n Go to last slide
\n b /\n m /\n f\n Toggle blackout / mirrored / fullscreen mode
\n c\n Clone slideshow
\n p\n Toggle presenter mode
\n t\n Restart the presentation timer
\n ?,\n h\n Toggle this help
\n
\n
\n \n \n \n \n \n
\n Esc\n Back to slideshow
\n
\n
\n" +}; + +},{}],7:[function(require,module,exports){ +(function(){/* Automatically generated */ + +var hljs = new (/* +Syntax highlighting with language autodetection. +http://highlightjs.org/ +*/ + +function() { + + /* Utility functions */ + + function escape(value) { + return value.replace(/&/gm, '&').replace(//gm, '>'); + } + + function tag(node) { + return node.nodeName.toLowerCase(); + } + + function testRe(re, lexeme) { + var match = re && re.exec(lexeme); + return match && match.index == 0; + } + + function blockLanguage(block) { + var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/); + classes = classes.map(function(c) {return c.replace(/^lang(uage)?-/, '');}); + return classes.filter(function(c) {return getLanguage(c) || c == 'no-highlight';})[0]; + } + + function inherit(parent, obj) { + var result = {}; + for (var key in parent) + result[key] = parent[key]; + if (obj) + for (var key in obj) + result[key] = obj[key]; + return result; + }; + + /* Stream merging */ + + function nodeStream(node) { + var result = []; + (function _nodeStream(node, offset) { + for (var child = node.firstChild; child; child = child.nextSibling) { + if (child.nodeType == 3) + offset += child.nodeValue.length; + else if (tag(child) == 'br') + offset += 1; + else if (child.nodeType == 1) { + result.push({ + event: 'start', + offset: offset, + node: child + }); + offset = _nodeStream(child, offset); + result.push({ + event: 'stop', + offset: offset, + node: child + }); + } + } + return offset; + })(node, 0); + return result; + } + + function mergeStreams(original, highlighted, value) { + var processed = 0; + var result = ''; + var nodeStack = []; + + function selectStream() { + if (!original.length || !highlighted.length) { + return original.length ? original : highlighted; + } + if (original[0].offset != highlighted[0].offset) { + return (original[0].offset < highlighted[0].offset) ? original : highlighted; + } + + /* + To avoid starting the stream just before it should stop the order is + ensured that original always starts first and closes last: + + if (event1 == 'start' && event2 == 'start') + return original; + if (event1 == 'start' && event2 == 'stop') + return highlighted; + if (event1 == 'stop' && event2 == 'start') + return original; + if (event1 == 'stop' && event2 == 'stop') + return highlighted; + + ... which is collapsed to: + */ + return highlighted[0].event == 'start' ? original : highlighted; + } + + function open(node) { + function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} + result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; + } + + function close(node) { + result += ''; + } + + function render(event) { + (event.event == 'start' ? open : close)(event.node); + } + + while (original.length || highlighted.length) { + var stream = selectStream(); + result += escape(value.substr(processed, stream[0].offset - processed)); + processed = stream[0].offset; + if (stream == original) { + /* + On any opening or closing tag of the original markup we first close + the entire highlighted node stack, then render the original tag along + with all the following original tags at the same offset and then + reopen all the tags on the highlighted stack. + */ + nodeStack.reverse().forEach(close); + do { + render(stream.splice(0, 1)[0]); + stream = selectStream(); + } while (stream == original && stream.length && stream[0].offset == processed); + nodeStack.reverse().forEach(open); + } else { + if (stream[0].event == 'start') { + nodeStack.push(stream[0].node); + } else { + nodeStack.pop(); + } + render(stream.splice(0, 1)[0]); + } + } + return result + escape(value.substr(processed)); + } + + /* Initialization */ + + function compileLanguage(language) { + + function reStr(re) { + return (re && re.source) || re; + } + + function langRe(value, global) { + return RegExp( + reStr(value), + 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') + ); + } + + function compileMode(mode, parent) { + if (mode.compiled) + return; + mode.compiled = true; + + mode.keywords = mode.keywords || mode.beginKeywords; + if (mode.keywords) { + var compiled_keywords = {}; + + function flatten(className, str) { + if (language.case_insensitive) { + str = str.toLowerCase(); + } + str.split(' ').forEach(function(kw) { + var pair = kw.split('|'); + compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; + }); + } + + if (typeof mode.keywords == 'string') { // string + flatten('keyword', mode.keywords); + } else { + Object.keys(mode.keywords).forEach(function (className) { + flatten(className, mode.keywords[className]); + }); + } + mode.keywords = compiled_keywords; + } + mode.lexemesRe = langRe(mode.lexemes || /\b[A-Za-z0-9_]+\b/, true); + + if (parent) { + if (mode.beginKeywords) { + mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b'; + } + if (!mode.begin) + mode.begin = /\B|\b/; + mode.beginRe = langRe(mode.begin); + if (!mode.end && !mode.endsWithParent) + mode.end = /\B|\b/; + if (mode.end) + mode.endRe = langRe(mode.end); + mode.terminator_end = reStr(mode.end) || ''; + if (mode.endsWithParent && parent.terminator_end) + mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; + } + if (mode.illegal) + mode.illegalRe = langRe(mode.illegal); + if (mode.relevance === undefined) + mode.relevance = 1; + if (!mode.contains) { + mode.contains = []; + } + var expanded_contains = []; + mode.contains.forEach(function(c) { + if (c.variants) { + c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));}); + } else { + expanded_contains.push(c == 'self' ? mode : c); + } + }); + mode.contains = expanded_contains; + mode.contains.forEach(function(c) {compileMode(c, mode);}); + + if (mode.starts) { + compileMode(mode.starts, parent); + } + + var terminators = + mode.contains.map(function(c) { + return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin; + }) + .concat([mode.terminator_end, mode.illegal]) + .map(reStr) + .filter(Boolean); + mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}}; + + mode.continuation = {}; + } + + compileMode(language); + } + + /* + Core highlighting function. Accepts a language name, or an alias, and a + string with the code to highlight. Returns an object with the following + properties: + + - relevance (int) + - value (an HTML string with highlighting markup) + + */ + function highlight(name, value, ignore_illegals, continuation) { + + function subMode(lexeme, mode) { + for (var i = 0; i < mode.contains.length; i++) { + if (testRe(mode.contains[i].beginRe, lexeme)) { + return mode.contains[i]; + } + } + } + + function endOfMode(mode, lexeme) { + if (testRe(mode.endRe, lexeme)) { + return mode; + } + if (mode.endsWithParent) { + return endOfMode(mode.parent, lexeme); + } + } + + function isIllegal(lexeme, mode) { + return !ignore_illegals && testRe(mode.illegalRe, lexeme); + } + + function keywordMatch(mode, match) { + var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; + return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; + } + + function buildSpan(classname, insideSpan, leaveOpen, noPrefix) { + var classPrefix = noPrefix ? '' : options.classPrefix, + openSpan = ''; + + return openSpan + insideSpan + closeSpan; + } + + function processKeywords() { + if (!top.keywords) + return escape(mode_buffer); + var result = ''; + var last_index = 0; + top.lexemesRe.lastIndex = 0; + var match = top.lexemesRe.exec(mode_buffer); + while (match) { + result += escape(mode_buffer.substr(last_index, match.index - last_index)); + var keyword_match = keywordMatch(top, match); + if (keyword_match) { + relevance += keyword_match[1]; + result += buildSpan(keyword_match[0], escape(match[0])); + } else { + result += escape(match[0]); + } + last_index = top.lexemesRe.lastIndex; + match = top.lexemesRe.exec(mode_buffer); + } + return result + escape(mode_buffer.substr(last_index)); + } + + function processSubLanguage() { + if (top.subLanguage && !languages[top.subLanguage]) { + return escape(mode_buffer); + } + var result = top.subLanguage ? highlight(top.subLanguage, mode_buffer, true, top.continuation.top) : highlightAuto(mode_buffer); + // Counting embedded language score towards the host language may be disabled + // with zeroing the containing mode relevance. Usecase in point is Markdown that + // allows XML everywhere and makes every XML snippet to have a much larger Markdown + // score. + if (top.relevance > 0) { + relevance += result.relevance; + } + if (top.subLanguageMode == 'continuous') { + top.continuation.top = result.top; + } + return buildSpan(result.language, result.value, false, true); + } + + function processBuffer() { + return top.subLanguage !== undefined ? processSubLanguage() : processKeywords(); + } + + function startNewMode(mode, lexeme) { + var markup = mode.className? buildSpan(mode.className, '', true): ''; + if (mode.returnBegin) { + result += markup; + mode_buffer = ''; + } else if (mode.excludeBegin) { + result += escape(lexeme) + markup; + mode_buffer = ''; + } else { + result += markup; + mode_buffer = lexeme; + } + top = Object.create(mode, {parent: {value: top}}); + } + + function processLexeme(buffer, lexeme) { + + mode_buffer += buffer; + if (lexeme === undefined) { + result += processBuffer(); + return 0; + } + + var new_mode = subMode(lexeme, top); + if (new_mode) { + result += processBuffer(); + startNewMode(new_mode, lexeme); + return new_mode.returnBegin ? 0 : lexeme.length; + } + + var end_mode = endOfMode(top, lexeme); + if (end_mode) { + var origin = top; + if (!(origin.returnEnd || origin.excludeEnd)) { + mode_buffer += lexeme; + } + result += processBuffer(); + do { + if (top.className) { + result += ''; + } + relevance += top.relevance; + top = top.parent; + } while (top != end_mode.parent); + if (origin.excludeEnd) { + result += escape(lexeme); + } + mode_buffer = ''; + if (end_mode.starts) { + startNewMode(end_mode.starts, ''); + } + return origin.returnEnd ? 0 : lexeme.length; + } + + if (isIllegal(lexeme, top)) + throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '') + '"'); + + /* + Parser should not reach this point as all types of lexemes should be caught + earlier, but if it does due to some bug make sure it advances at least one + character forward to prevent infinite looping. + */ + mode_buffer += lexeme; + return lexeme.length || 1; + } + + var language = getLanguage(name); + if (!language) { + throw new Error('Unknown language: "' + name + '"'); + } + + compileLanguage(language); + var top = continuation || language; + var result = ''; + for(var current = top; current != language; current = current.parent) { + if (current.className) { + result += buildSpan(current.className, result, true); + } + } + var mode_buffer = ''; + var relevance = 0; + try { + var match, count, index = 0; + while (true) { + top.terminators.lastIndex = index; + match = top.terminators.exec(value); + if (!match) + break; + count = processLexeme(value.substr(index, match.index - index), match[0]); + index = match.index + count; + } + processLexeme(value.substr(index)); + for(var current = top; current.parent; current = current.parent) { // close dangling modes + if (current.className) { + result += ''; + } + }; + return { + relevance: relevance, + value: result, + language: name, + top: top + }; + } catch (e) { + if (e.message.indexOf('Illegal') != -1) { + return { + relevance: 0, + value: escape(value) + }; + } else { + throw e; + } + } + } + + /* + Highlighting with language detection. Accepts a string with the code to + highlight. Returns an object with the following properties: + + - language (detected language) + - relevance (int) + - value (an HTML string with highlighting markup) + - second_best (object with the same structure for second-best heuristically + detected language, may be absent) + + */ + function highlightAuto(text, languageSubset) { + languageSubset = languageSubset || options.languages || Object.keys(languages); + var result = { + relevance: 0, + value: escape(text) + }; + var second_best = result; + languageSubset.forEach(function(name) { + if (!getLanguage(name)) { + return; + } + var current = highlight(name, text, false); + current.language = name; + if (current.relevance > second_best.relevance) { + second_best = current; + } + if (current.relevance > result.relevance) { + second_best = result; + result = current; + } + }); + if (second_best.language) { + result.second_best = second_best; + } + return result; + } + + /* + Post-processing of the highlighted markup: + + - replace TABs with something more useful + - replace real line-breaks with '
' for non-pre containers + + */ + function fixMarkup(value) { + if (options.tabReplace) { + value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) { + return p1.replace(/\t/g, options.tabReplace); + }); + } + if (options.useBR) { + value = value.replace(/\n/g, '
'); + } + return value; + } + + /* + Applies highlighting to a DOM node containing code. Accepts a DOM node and + two optional parameters for fixMarkup. + */ + function highlightBlock(block) { + var text = options.useBR ? block.innerHTML + .replace(/\n/g,'').replace(/
|
]*>/g, '\n').replace(/<[^>]*>/g,'') + : block.textContent; + var language = blockLanguage(block); + if (language == 'no-highlight') + return; + var result = language ? highlight(language, text, true) : highlightAuto(text); + var original = nodeStream(block); + if (original.length) { + var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'); + pre.innerHTML = result.value; + result.value = mergeStreams(original, nodeStream(pre), text); + } + result.value = fixMarkup(result.value); + + block.innerHTML = result.value; + block.className += ' hljs ' + (!language && result.language || ''); + block.result = { + language: result.language, + re: result.relevance + }; + if (result.second_best) { + block.second_best = { + language: result.second_best.language, + re: result.second_best.relevance + }; + } + } + + var options = { + classPrefix: 'hljs-', + tabReplace: null, + useBR: false, + languages: undefined + }; + + /* + Updates highlight.js global options with values passed in the form of an object + */ + function configure(user_options) { + options = inherit(options, user_options); + } + + /* + Applies highlighting to all
..
blocks on a page. + */ + function initHighlighting() { + if (initHighlighting.called) + return; + initHighlighting.called = true; + + var blocks = document.querySelectorAll('pre code'); + Array.prototype.forEach.call(blocks, highlightBlock); + } + + /* + Attaches highlighting to the page load event. + */ + function initHighlightingOnLoad() { + addEventListener('DOMContentLoaded', initHighlighting, false); + addEventListener('load', initHighlighting, false); + } + + var languages = {}; + var aliases = {}; + + function registerLanguage(name, language) { + var lang = languages[name] = language(this); + if (lang.aliases) { + lang.aliases.forEach(function(alias) {aliases[alias] = name;}); + } + } + + function listLanguages() { + return Object.keys(languages); + } + + function getLanguage(name) { + return languages[name] || languages[aliases[name]]; + } + + /* Interface definition */ + + this.highlight = highlight; + this.highlightAuto = highlightAuto; + this.fixMarkup = fixMarkup; + this.highlightBlock = highlightBlock; + this.configure = configure; + this.initHighlighting = initHighlighting; + this.initHighlightingOnLoad = initHighlightingOnLoad; + this.registerLanguage = registerLanguage; + this.listLanguages = listLanguages; + this.getLanguage = getLanguage; + this.inherit = inherit; + + // Common regexps + this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*'; + this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*'; + this.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; + this.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float + this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... + this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; + + // Common modes + this.BACKSLASH_ESCAPE = { + begin: '\\\\[\\s\\S]', relevance: 0 + }; + this.APOS_STRING_MODE = { + className: 'string', + begin: '\'', end: '\'', + illegal: '\\n', + contains: [this.BACKSLASH_ESCAPE] + }; + this.QUOTE_STRING_MODE = { + className: 'string', + begin: '"', end: '"', + illegal: '\\n', + contains: [this.BACKSLASH_ESCAPE] + }; + this.PHRASAL_WORDS_MODE = { + begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/ + }; + this.C_LINE_COMMENT_MODE = { + className: 'comment', + begin: '//', end: '$', + contains: [this.PHRASAL_WORDS_MODE] + }; + this.C_BLOCK_COMMENT_MODE = { + className: 'comment', + begin: '/\\*', end: '\\*/', + contains: [this.PHRASAL_WORDS_MODE] + }; + this.HASH_COMMENT_MODE = { + className: 'comment', + begin: '#', end: '$', + contains: [this.PHRASAL_WORDS_MODE] + }; + this.NUMBER_MODE = { + className: 'number', + begin: this.NUMBER_RE, + relevance: 0 + }; + this.C_NUMBER_MODE = { + className: 'number', + begin: this.C_NUMBER_RE, + relevance: 0 + }; + this.BINARY_NUMBER_MODE = { + className: 'number', + begin: this.BINARY_NUMBER_RE, + relevance: 0 + }; + this.CSS_NUMBER_MODE = { + className: 'number', + begin: this.NUMBER_RE + '(' + + '%|em|ex|ch|rem' + + '|vw|vh|vmin|vmax' + + '|cm|mm|in|pt|pc|px' + + '|deg|grad|rad|turn' + + '|s|ms' + + '|Hz|kHz' + + '|dpi|dpcm|dppx' + + ')?', + relevance: 0 + }; + this.REGEXP_MODE = { + className: 'regexp', + begin: /\//, end: /\/[gim]*/, + illegal: /\n/, + contains: [ + this.BACKSLASH_ESCAPE, + { + begin: /\[/, end: /\]/, + relevance: 0, + contains: [this.BACKSLASH_ESCAPE] + } + ] + }; + this.TITLE_MODE = { + className: 'title', + begin: this.IDENT_RE, + relevance: 0 + }; + this.UNDERSCORE_TITLE_MODE = { + className: 'title', + begin: this.UNDERSCORE_IDENT_RE, + relevance: 0 + }; +} +)() + , languages = [{name:"javascript",create:/* +Language: JavaScript +*/ + +function(hljs) { + return { + aliases: ['js'], + keywords: { + keyword: + 'in if for while finally var new function do return void else break catch ' + + 'instanceof with throw case default try this switch continue typeof delete ' + + 'let yield const class', + literal: + 'true false null undefined NaN Infinity', + built_in: + 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + + 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + + 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + + 'TypeError URIError Number Math Date String RegExp Array Float32Array ' + + 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + + 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + + 'module console window document' + }, + contains: [ + { + className: 'pi', + begin: /^\s*('|")use strict('|")/, + relevance: 10 + }, + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + hljs.C_NUMBER_MODE, + { // "value" container + begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*', + keywords: 'return throw case', + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + hljs.REGEXP_MODE, + { // E4X + begin: /;/, + relevance: 0, + subLanguage: 'xml' + } + ], + relevance: 0 + }, + { + className: 'function', + beginKeywords: 'function', end: /\{/, excludeEnd: true, + contains: [ + hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}), + { + className: 'params', + begin: /\(/, end: /\)/, + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE + ], + illegal: /["'\(]/ + } + ], + illegal: /\[|%/ + }, + { + begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something` + }, + { + begin: '\\.' + hljs.IDENT_RE, relevance: 0 // hack: prevents detection of keywords after dots + } + ] + }; +} +},{name:"ruby",create:/* +Language: Ruby +Author: Anton Kovalyov +Contributors: Peter Leonov , Vasily Polovnyov , Loren Segal +*/ + +function(hljs) { + var RUBY_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?'; + var RUBY_KEYWORDS = + 'and false then defined module in return redo if BEGIN retry end for true self when ' + + 'next until do begin unless END rescue nil else break undef not super class case ' + + 'require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor'; + var YARDOCTAG = { + className: 'yardoctag', + begin: '@[A-Za-z]+' + }; + var COMMENT = { + className: 'comment', + variants: [ + { + begin: '#', end: '$', + contains: [YARDOCTAG] + }, + { + begin: '^\\=begin', end: '^\\=end', + contains: [YARDOCTAG], + relevance: 10 + }, + { + begin: '^__END__', end: '\\n$' + } + ] + }; + var SUBST = { + className: 'subst', + begin: '#\\{', end: '}', + keywords: RUBY_KEYWORDS + }; + var STRING = { + className: 'string', + contains: [hljs.BACKSLASH_ESCAPE, SUBST], + variants: [ + {begin: /'/, end: /'/}, + {begin: /"/, end: /"/}, + {begin: '%[qw]?\\(', end: '\\)'}, + {begin: '%[qw]?\\[', end: '\\]'}, + {begin: '%[qw]?{', end: '}'}, + { + begin: '%[qw]?<', end: '>', + relevance: 10 + }, + { + begin: '%[qw]?/', end: '/', + relevance: 10 + }, + { + begin: '%[qw]?%', end: '%', + relevance: 10 + }, + { + begin: '%[qw]?-', end: '-', + relevance: 10 + }, + { + begin: '%[qw]?\\|', end: '\\|', + relevance: 10 + }, + { + // \B in the beginning suppresses recognition of ?-sequences where ? + // is the last character of a preceding identifier, as in: `func?4` + begin: /\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/ + } + ] + }; + var PARAMS = { + className: 'params', + begin: '\\(', end: '\\)', + keywords: RUBY_KEYWORDS + }; + + var RUBY_DEFAULT_CONTAINS = [ + STRING, + COMMENT, + { + className: 'class', + beginKeywords: 'class module', end: '$|;', + illegal: /=/, + contains: [ + hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}), + { + className: 'inheritance', + begin: '<\\s*', + contains: [{ + className: 'parent', + begin: '(' + hljs.IDENT_RE + '::)?' + hljs.IDENT_RE + }] + }, + COMMENT + ] + }, + { + className: 'function', + beginKeywords: 'def', end: ' |$|;', + relevance: 0, + contains: [ + hljs.inherit(hljs.TITLE_MODE, {begin: RUBY_METHOD_RE}), + PARAMS, + COMMENT + ] + }, + { + className: 'constant', + begin: '(::)?(\\b[A-Z]\\w*(::)?)+', + relevance: 0 + }, + { + className: 'symbol', + begin: ':', + contains: [STRING, {begin: RUBY_METHOD_RE}], + relevance: 0 + }, + { + className: 'symbol', + begin: hljs.UNDERSCORE_IDENT_RE + '(\\!|\\?)?:', + relevance: 0 + }, + { + className: 'number', + begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', + relevance: 0 + }, + { + className: 'variable', + begin: '(\\$\\W)|((\\$|\\@\\@?)(\\w+))' + }, + { // regexp container + begin: '(' + hljs.RE_STARTERS_RE + ')\\s*', + contains: [ + COMMENT, + { + className: 'regexp', + contains: [hljs.BACKSLASH_ESCAPE, SUBST], + illegal: /\n/, + variants: [ + {begin: '/', end: '/[a-z]*'}, + {begin: '%r{', end: '}[a-z]*'}, + {begin: '%r\\(', end: '\\)[a-z]*'}, + {begin: '%r!', end: '![a-z]*'}, + {begin: '%r\\[', end: '\\][a-z]*'} + ] + } + ], + relevance: 0 + } + ]; + SUBST.contains = RUBY_DEFAULT_CONTAINS; + PARAMS.contains = RUBY_DEFAULT_CONTAINS; + + return { + aliases: ['rb', 'gemspec', 'podspec', 'thor'], + keywords: RUBY_KEYWORDS, + contains: RUBY_DEFAULT_CONTAINS + }; +} +},{name:"python",create:/* +Language: Python +*/ + +function(hljs) { + var PROMPT = { + className: 'prompt', begin: /^(>>>|\.\.\.) / + }; + var STRING = { + className: 'string', + contains: [hljs.BACKSLASH_ESCAPE], + variants: [ + { + begin: /(u|b)?r?'''/, end: /'''/, + contains: [PROMPT], + relevance: 10 + }, + { + begin: /(u|b)?r?"""/, end: /"""/, + contains: [PROMPT], + relevance: 10 + }, + { + begin: /(u|r|ur)'/, end: /'/, + relevance: 10 + }, + { + begin: /(u|r|ur)"/, end: /"/, + relevance: 10 + }, + { + begin: /(b|br)'/, end: /'/ + }, + { + begin: /(b|br)"/, end: /"/ + }, + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE + ] + }; + var NUMBER = { + className: 'number', relevance: 0, + variants: [ + {begin: hljs.BINARY_NUMBER_RE + '[lLjJ]?'}, + {begin: '\\b(0o[0-7]+)[lLjJ]?'}, + {begin: hljs.C_NUMBER_RE + '[lLjJ]?'} + ] + }; + var PARAMS = { + className: 'params', + begin: /\(/, end: /\)/, + contains: ['self', PROMPT, NUMBER, STRING] + }; + var FUNC_CLASS_PROTO = { + end: /:/, + illegal: /[${=;\n]/, + contains: [hljs.UNDERSCORE_TITLE_MODE, PARAMS] + }; + + return { + aliases: ['py', 'gyp'], + keywords: { + keyword: + 'and elif is global as in if from raise for except finally print import pass return ' + + 'exec else break not with class assert yield try while continue del or def lambda ' + + 'nonlocal|10 None True False', + built_in: + 'Ellipsis NotImplemented' + }, + illegal: /(<\/|->|\?)/, + contains: [ + PROMPT, + NUMBER, + STRING, + hljs.HASH_COMMENT_MODE, + hljs.inherit(FUNC_CLASS_PROTO, {className: 'function', beginKeywords: 'def', relevance: 10}), + hljs.inherit(FUNC_CLASS_PROTO, {className: 'class', beginKeywords: 'class'}), + { + className: 'decorator', + begin: /@/, end: /$/ + }, + { + begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3 + } + ] + }; +} +},{name:"bash",create:/* +Language: Bash +Author: vah +Contributrors: Benjamin Pannell +*/ + +function(hljs) { + var VAR = { + className: 'variable', + variants: [ + {begin: /\$[\w\d#@][\w\d_]*/}, + {begin: /\$\{(.*?)\}/} + ] + }; + var QUOTE_STRING = { + className: 'string', + begin: /"/, end: /"/, + contains: [ + hljs.BACKSLASH_ESCAPE, + VAR, + { + className: 'variable', + begin: /\$\(/, end: /\)/, + contains: [hljs.BACKSLASH_ESCAPE] + } + ] + }; + var APOS_STRING = { + className: 'string', + begin: /'/, end: /'/ + }; + + return { + aliases: ['sh', 'zsh'], + lexemes: /-?[a-z\.]+/, + keywords: { + keyword: + 'if then else elif fi for break continue while in do done exit return set '+ + 'declare case esac export exec', + literal: + 'true false', + built_in: + 'printf echo read cd pwd pushd popd dirs let eval unset typeset readonly '+ + 'getopts source shopt caller type hash bind help sudo', + operator: + '-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster + }, + contains: [ + { + className: 'shebang', + begin: /^#![^\n]+sh\s*$/, + relevance: 10 + }, + { + className: 'function', + begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, + returnBegin: true, + contains: [hljs.inherit(hljs.TITLE_MODE, {begin: /\w[\w\d_]*/})], + relevance: 0 + }, + hljs.HASH_COMMENT_MODE, + hljs.NUMBER_MODE, + QUOTE_STRING, + APOS_STRING, + VAR + ] + }; +} +},{name:"java",create:/* +Language: Java +Author: Vsevolod Solovyov +*/ + +function(hljs) { + var KEYWORDS = + 'false synchronized int abstract float private char boolean static null if const ' + + 'for true while long throw strictfp finally protected import native final return void ' + + 'enum else break transient new catch instanceof byte super volatile case assert short ' + + 'package default double public try this switch continue throws'; + return { + aliases: ['jsp'], + keywords: KEYWORDS, + illegal: /<\//, + contains: [ + { + className: 'javadoc', + begin: '/\\*\\*', end: '\\*/', + contains: [{ + className: 'javadoctag', begin: '(^|\\s)@[A-Za-z]+' + }], + relevance: 10 + }, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + { + beginKeywords: 'protected public private', end: /[{;=]/, + keywords: KEYWORDS, + contains: [ + { + className: 'class', + beginKeywords: 'class interface', endsWithParent: true, excludeEnd: true, + illegal: /[:"<>]/, + contains: [ + { + beginKeywords: 'extends implements', + relevance: 10 + }, + hljs.UNDERSCORE_TITLE_MODE + ] + }, + { + begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true, + contains: [ + hljs.UNDERSCORE_TITLE_MODE + ] + } + ] + }, + hljs.C_NUMBER_MODE, + { + className: 'annotation', begin: '@[A-Za-z]+' + } + ] + }; +} +},{name:"php",create:/* +Language: PHP +Author: Victor Karamzin +Contributors: Evgeny Stepanischev , Ivan Sagalaev +*/ + +function(hljs) { + var VARIABLE = { + className: 'variable', begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' + }; + var PREPROCESSOR = { + className: 'preprocessor', begin: /<\?(php)?|\?>/ + }; + var STRING = { + className: 'string', + contains: [hljs.BACKSLASH_ESCAPE, PREPROCESSOR], + variants: [ + { + begin: 'b"', end: '"' + }, + { + begin: 'b\'', end: '\'' + }, + hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), + hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}) + ] + }; + var NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]}; + return { + aliases: ['php3', 'php4', 'php5', 'php6'], + case_insensitive: true, + keywords: + 'and include_once list abstract global private echo interface as static endswitch ' + + 'array null if endwhile or const for endforeach self var while isset public ' + + 'protected exit foreach throw elseif include __FILE__ empty require_once do xor ' + + 'return parent clone use __CLASS__ __LINE__ else break print eval new ' + + 'catch __METHOD__ case exception default die require __FUNCTION__ ' + + 'enddeclare final try switch continue endfor endif declare unset true false ' + + 'trait goto instanceof insteadof __DIR__ __NAMESPACE__ ' + + 'yield finally', + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.HASH_COMMENT_MODE, + { + className: 'comment', + begin: '/\\*', end: '\\*/', + contains: [ + { + className: 'phpdoc', + begin: '\\s@[A-Za-z]+' + }, + PREPROCESSOR + ] + }, + { + className: 'comment', + begin: '__halt_compiler.+?;', endsWithParent: true, + keywords: '__halt_compiler', lexemes: hljs.UNDERSCORE_IDENT_RE + }, + { + className: 'string', + begin: '<<<[\'"]?\\w+[\'"]?$', end: '^\\w+;', + contains: [hljs.BACKSLASH_ESCAPE] + }, + PREPROCESSOR, + VARIABLE, + { + className: 'function', + beginKeywords: 'function', end: /[;{]/, excludeEnd: true, + illegal: '\\$|\\[|%', + contains: [ + hljs.UNDERSCORE_TITLE_MODE, + { + className: 'params', + begin: '\\(', end: '\\)', + contains: [ + 'self', + VARIABLE, + hljs.C_BLOCK_COMMENT_MODE, + STRING, + NUMBER + ] + } + ] + }, + { + className: 'class', + beginKeywords: 'class interface', end: '{', excludeEnd: true, + illegal: /[:\(\$"]/, + contains: [ + { + beginKeywords: 'extends implements', + relevance: 10 + }, + hljs.UNDERSCORE_TITLE_MODE + ] + }, + { + beginKeywords: 'namespace', end: ';', + illegal: /[\.']/, + contains: [hljs.UNDERSCORE_TITLE_MODE] + }, + { + beginKeywords: 'use', end: ';', + contains: [hljs.UNDERSCORE_TITLE_MODE] + }, + { + begin: '=>' // No markup, just a relevance booster + }, + STRING, + NUMBER + ] + }; +} +},{name:"perl",create:/* +Language: Perl +Author: Peter Leonov +*/ + +function(hljs) { + var PERL_KEYWORDS = 'getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ' + + 'ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime ' + + 'readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qq' + + 'fileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent ' + + 'shutdown dump chomp connect getsockname die socketpair close flock exists index shmget' + + 'sub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr ' + + 'unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 ' + + 'getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline ' + + 'endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand ' + + 'mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink ' + + 'getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr ' + + 'untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link ' + + 'getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller ' + + 'lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and ' + + 'sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 ' + + 'chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach ' + + 'tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedir' + + 'ioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe ' + + 'atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when'; + var SUBST = { + className: 'subst', + begin: '[$@]\\{', end: '\\}', + keywords: PERL_KEYWORDS + }; + var METHOD = { + begin: '->{', end: '}' + // contains defined later + }; + var VAR = { + className: 'variable', + variants: [ + {begin: /\$\d/}, + {begin: /[\$\%\@\*](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/}, + {begin: /[\$\%\@\*][^\s\w{]/, relevance: 0} + ] + }; + var COMMENT = { + className: 'comment', + begin: '^(__END__|__DATA__)', end: '\\n$', + relevance: 5 + }; + var STRING_CONTAINS = [hljs.BACKSLASH_ESCAPE, SUBST, VAR]; + var PERL_DEFAULT_CONTAINS = [ + VAR, + hljs.HASH_COMMENT_MODE, + COMMENT, + { + className: 'comment', + begin: '^\\=\\w', end: '\\=cut', endsWithParent: true + }, + METHOD, + { + className: 'string', + contains: STRING_CONTAINS, + variants: [ + { + begin: 'q[qwxr]?\\s*\\(', end: '\\)', + relevance: 5 + }, + { + begin: 'q[qwxr]?\\s*\\[', end: '\\]', + relevance: 5 + }, + { + begin: 'q[qwxr]?\\s*\\{', end: '\\}', + relevance: 5 + }, + { + begin: 'q[qwxr]?\\s*\\|', end: '\\|', + relevance: 5 + }, + { + begin: 'q[qwxr]?\\s*\\<', end: '\\>', + relevance: 5 + }, + { + begin: 'qw\\s+q', end: 'q', + relevance: 5 + }, + { + begin: '\'', end: '\'', + contains: [hljs.BACKSLASH_ESCAPE] + }, + { + begin: '"', end: '"' + }, + { + begin: '`', end: '`', + contains: [hljs.BACKSLASH_ESCAPE] + }, + { + begin: '{\\w+}', + contains: [], + relevance: 0 + }, + { + begin: '\-?\\w+\\s*\\=\\>', + contains: [], + relevance: 0 + } + ] + }, + { + className: 'number', + begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', + relevance: 0 + }, + { // regexp container + begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*', + keywords: 'split return print reverse grep', + relevance: 0, + contains: [ + hljs.HASH_COMMENT_MODE, + COMMENT, + { + className: 'regexp', + begin: '(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*', + relevance: 10 + }, + { + className: 'regexp', + begin: '(m|qr)?/', end: '/[a-z]*', + contains: [hljs.BACKSLASH_ESCAPE], + relevance: 0 // allows empty "//" which is a common comment delimiter in other languages + } + ] + }, + { + className: 'sub', + beginKeywords: 'sub', end: '(\\s*\\(.*?\\))?[;{]', + relevance: 5 + }, + { + className: 'operator', + begin: '-\\w\\b', + relevance: 0 + } + ]; + SUBST.contains = PERL_DEFAULT_CONTAINS; + METHOD.contains = PERL_DEFAULT_CONTAINS; + + return { + aliases: ['pl'], + keywords: PERL_KEYWORDS, + contains: PERL_DEFAULT_CONTAINS + }; +} +},{name:"cpp",create:/* +Language: C++ +Author: Ivan Sagalaev +Contributors: Evgeny Stepanischev , Zaven Muradyan +*/ + +function(hljs) { + var CPP_KEYWORDS = { + keyword: 'false int float while private char catch export virtual operator sizeof ' + + 'dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace ' + + 'unsigned long throw volatile static protected bool template mutable if public friend ' + + 'do return goto auto void enum else break new extern using true class asm case typeid ' + + 'short reinterpret_cast|10 default double register explicit signed typename try this ' + + 'switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype ' + + 'noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary', + built_in: 'std string cin cout cerr clog stringstream istringstream ostringstream ' + + 'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' + + 'unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos ' + + 'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' + + 'fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' + + 'isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow ' + + 'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' + + 'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' + + 'vfprintf vprintf vsprintf' + }; + return { + aliases: ['c', 'h', 'c++', 'h++'], + keywords: CPP_KEYWORDS, + illegal: '"]', + keywords: 'include', + illegal: '\\n' + }, + hljs.C_LINE_COMMENT_MODE + ] + }, + { + className: 'stl_container', + begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', + keywords: CPP_KEYWORDS, + relevance: 10, + contains: ['self'] + }, + { + begin: hljs.IDENT_RE + '::' + } + ] + }; +} +},{name:"objectivec",create:/* +Language: Objective C +Author: Valerii Hiora +Contributors: Angel G. Olloqui +*/ + +function(hljs) { + var OBJC_KEYWORDS = { + keyword: + 'int float while char export sizeof typedef const struct for union ' + + 'unsigned long volatile static bool mutable if do return goto void ' + + 'enum else break extern asm case short default double register explicit ' + + 'signed typename this switch continue wchar_t inline readonly assign ' + + 'self synchronized id ' + + 'nonatomic super unichar IBOutlet IBAction strong weak ' + + '@private @protected @public @try @property @end @throw @catch @finally ' + + '@synthesize @dynamic @selector @optional @required', + literal: + 'false true FALSE TRUE nil YES NO NULL', + built_in: + 'NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView ' + + 'UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread ' + + 'UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool ' + + 'UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray ' + + 'NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController ' + + 'UINavigationBar UINavigationController UITabBarController UIPopoverController ' + + 'UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController ' + + 'NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor ' + + 'UIFont UIApplication NSNotFound NSNotificationCenter NSNotification ' + + 'UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar ' + + 'NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection ' + + 'UIInterfaceOrientation MPMoviePlayerController dispatch_once_t ' + + 'dispatch_queue_t dispatch_sync dispatch_async dispatch_once' + }; + var LEXEMES = /[a-zA-Z@][a-zA-Z0-9_]*/; + var CLASS_KEYWORDS = '@interface @class @protocol @implementation'; + return { + aliases: ['m', 'mm', 'objc', 'obj-c'], + keywords: OBJC_KEYWORDS, lexemes: LEXEMES, + illegal: '' + } + ] + }, + { + className: 'preprocessor', + begin: '#', + end: '$' + }, + { + className: 'class', + begin: '(' + CLASS_KEYWORDS.split(' ').join('|') + ')\\b', end: '({|$)', excludeEnd: true, + keywords: CLASS_KEYWORDS, lexemes: LEXEMES, + contains: [ + hljs.UNDERSCORE_TITLE_MODE + ] + }, + { + className: 'variable', + begin: '\\.'+hljs.UNDERSCORE_IDENT_RE, + relevance: 0 + } + ] + }; +} +},{name:"cs",create:/* +Language: C# +Author: Jason Diamond +*/ + +function(hljs) { + var KEYWORDS = + // Normal keywords. + 'abstract as base bool break byte case catch char checked const continue decimal ' + + 'default delegate do double else enum event explicit extern false finally fixed float ' + + 'for foreach goto if implicit in int interface internal is lock long new null ' + + 'object operator out override params private protected public readonly ref return sbyte ' + + 'sealed short sizeof stackalloc static string struct switch this throw true try typeof ' + + 'uint ulong unchecked unsafe ushort using virtual volatile void while async await ' + + // Contextual keywords. + 'ascending descending from get group into join let orderby partial select set value var ' + + 'where yield'; + return { + keywords: KEYWORDS, + illegal: /::/, + contains: [ + { + className: 'comment', + begin: '///', end: '$', returnBegin: true, + contains: [ + { + className: 'xmlDocTag', + variants: [ + { + begin: '///', relevance: 0 + }, + { + begin: '' + }, + { + begin: '' + } + ] + } + ] + }, + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + { + className: 'preprocessor', + begin: '#', end: '$', + keywords: 'if else elif endif define undef warning error line region endregion pragma checksum' + }, + { + className: 'string', + begin: '@"', end: '"', + contains: [{begin: '""'}] + }, + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + hljs.C_NUMBER_MODE, + { + beginKeywords: 'protected public private internal', end: /[{;=]/, + keywords: KEYWORDS, + contains: [ + { + beginKeywords: 'class namespace interface', + starts: { + contains: [hljs.TITLE_MODE] + } + }, + { + begin: hljs.IDENT_RE + '\\s*\\(', returnBegin: true, + contains: [ + hljs.TITLE_MODE + ] + } + ] + } + ] + }; +} +},{name:"sql",create:/* + Language: SQL + Contributors: Nikolay Lisienko , Heiko August , Travis Odom + */ + +function(hljs) { + var COMMENT_MODE = { + className: 'comment', + begin: '--', end: '$' + }; + return { + case_insensitive: true, + illegal: /[<>]/, + contains: [ + { + className: 'operator', + beginKeywords: + 'begin end start commit rollback savepoint lock alter create drop rename call '+ + 'delete do handler insert load replace select truncate update set show pragma grant '+ + 'merge describe use explain help declare prepare execute deallocate savepoint release '+ + 'unlock purge reset change stop analyze cache flush optimize repair kill '+ + 'install uninstall checksum restore check backup', + end: /;/, endsWithParent: true, + keywords: { + keyword: + 'abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter ' + + 'analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup ' + + 'before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by ' + + 'cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length ' + + 'character_length charindex charset check checksum checksum_agg choose close coalesce ' + + 'coercibility collate collation collationproperty column columns columns_updated commit compress concat ' + + 'concat_ws concurrent connect connection connection_id consistent constraint constraints continue ' + + 'contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist ' + + 'curdate current current_date current_time current_timestamp current_user cursor curtime data database ' + + 'databases datalength date_add date_format date_sub dateadd datediff datefromparts datename ' + + 'datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear ' + + 'deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt ' + + 'des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct ' + + 'distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec ' + + 'engine engines eomonth errors escape escaped event eventdata events except exception exec execute ' + + 'exists exp explain export_set extended external extract fast fetch field fields find_in_set ' + + 'first first_value floor flush for force foreign format found found_rows from from_base64 ' + + 'from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant ' + + 'grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help ' + + 'hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore ' + + 'iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner ' + + 'innodb input insert install instr intersect into is is_free_lock is_ipv4 ' + + 'is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill ' + + 'language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level ' + + 'like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile ' + + 'logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max ' + + 'md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names ' + + 'national natural nchar next no no_write_to_binlog not now nullif nvarchar oct ' + + 'octet_length of old_password on only open optimize option optionally or ord order outer outfile output ' + + 'pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add ' + + 'period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges ' + + 'procedure procedure_analyze processlist profile profiles public publishingservername purge quarter ' + + 'query quick quote quotename radians rand read references regexp relative relaylog release ' + + 'release_lock rename repair repeat replace replicate reset restore restrict return returns reverse ' + + 'revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll ' + + 'sec_to_time second section select serializable server session session_user set sha sha1 sha2 share ' + + 'show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex ' + + 'sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache ' + + 'sql_small_result sql_variant_property sqlstate sqrt square start starting status std ' + + 'stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff ' + + 'subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset ' + + 'system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time ' + + 'time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour ' + + 'timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation ' + + 'trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress ' + + 'uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade ' + + 'upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short ' + + 'validate_password_strength value values var var_pop var_samp variables variance varp ' + + 'version view warnings week weekday weekofyear weight_string when whenever where with work write xml ' + + 'xor year yearweek zon', + literal: + 'true false null', + built_in: + 'array bigint binary bit blob boolean char character date dec decimal float int integer interval number ' + + 'numeric real serial smallint varchar varying int8 serial8 text' + }, + contains: [ + { + className: 'string', + begin: '\'', end: '\'', + contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}] + }, + { + className: 'string', + begin: '"', end: '"', + contains: [hljs.BACKSLASH_ESCAPE, {begin: '""'}] + }, + { + className: 'string', + begin: '`', end: '`', + contains: [hljs.BACKSLASH_ESCAPE] + }, + hljs.C_NUMBER_MODE, + hljs.C_BLOCK_COMMENT_MODE, + COMMENT_MODE + ] + }, + hljs.C_BLOCK_COMMENT_MODE, + COMMENT_MODE + ] + }; +} +},{name:"xml",create:/* +Language: HTML, XML +*/ + +function(hljs) { + var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; + var PHP = { + begin: /<\?(php)?(?!\w)/, end: /\?>/, + subLanguage: 'php', subLanguageMode: 'continuous' + }; + var TAG_INTERNALS = { + endsWithParent: true, + illegal: /]+/} + ] + } + ] + } + ] + }; + return { + aliases: ['html', 'xhtml', 'rss', 'atom', 'xsl', 'plist'], + case_insensitive: true, + contains: [ + { + className: 'doctype', + begin: '', + relevance: 10, + contains: [{begin: '\\[', end: '\\]'}] + }, + { + className: 'comment', + begin: '', + relevance: 10 + }, + { + className: 'cdata', + begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', + relevance: 10 + }, + { + className: 'tag', + /* + The lookahead pattern (?=...) ensures that 'begin' only matches + '|$)', end: '>', + keywords: {title: 'style'}, + contains: [TAG_INTERNALS], + starts: { + end: '', returnEnd: true, + subLanguage: 'css' + } + }, + { + className: 'tag', + // See the comment in the ",returnEnd:true,subLanguage:"css"}},{className:"tag",begin:"|$)",end:">",keywords:{title:"script"},contains:[TAG_INTERNALS],starts:{end:"",returnEnd:true,subLanguage:"javascript"}},{begin:"<%",end:"%>",subLanguage:"vbscript"},PHP,{className:"pi",begin:/<\?\w+/,end:/\?>/,relevance:10},{className:"tag",begin:"",contains:[{className:"title",begin:"[^ /><]+",relevance:0},TAG_INTERNALS]}]}}},{name:"css",create:function(hljs){var IDENT_RE="[a-zA-Z-][a-zA-Z0-9_-]*";var FUNCTION={className:"function",begin:IDENT_RE+"\\(",returnBegin:true,excludeEnd:true,end:"\\("};return{case_insensitive:true,illegal:"[=/|']",contains:[hljs.C_BLOCK_COMMENT_MODE,{className:"id",begin:"\\#[A-Za-z0-9_-]+"},{className:"class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},{className:"attr_selector",begin:"\\[",end:"\\]",illegal:"$"},{className:"pseudo",begin:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{className:"at_rule",begin:"@(font-face|page)",lexemes:"[a-z-]+",keywords:"font-face page"},{className:"at_rule",begin:"@",end:"[{;]",contains:[{className:"keyword",begin:/\S+/},{begin:/\s/,endsWithParent:true,excludeEnd:true,relevance:0,contains:[FUNCTION,hljs.APOS_STRING_MODE,hljs.QUOTE_STRING_MODE,hljs.CSS_NUMBER_MODE]}]},{className:"tag",begin:IDENT_RE,relevance:0},{className:"rules",begin:"{",end:"}",illegal:"[^\\s]",relevance:0,contains:[hljs.C_BLOCK_COMMENT_MODE,{className:"rule",begin:"[^\\s]",returnBegin:true,end:";",endsWithParent:true,contains:[{className:"attribute",begin:"[A-Z\\_\\.\\-]+",end:":",excludeEnd:true,illegal:"[^\\s]",starts:{className:"value",endsWithParent:true,excludeEnd:true,contains:[FUNCTION,hljs.CSS_NUMBER_MODE,hljs.QUOTE_STRING_MODE,hljs.APOS_STRING_MODE,hljs.C_BLOCK_COMMENT_MODE,{className:"hexcolor",begin:"#[0-9A-Fa-f]+"},{className:"important",begin:"!important"}]}}]}]}]}}},{name:"scala",create:function(hljs){var ANNOTATION={className:"annotation",begin:"@[A-Za-z]+"};var STRING={className:"string",begin:'u?r?"""',end:'"""',relevance:10};var SYMBOL={className:"symbol",begin:"'\\w[\\w\\d_]*(?!')"};return{keywords:"type yield lazy override def with val var false true sealed abstract private trait "+"object null if for while throw finally protected extends import final return else "+"break new catch super class case package default try this match continue throws",contains:[{className:"javadoc",begin:"/\\*\\*",end:"\\*/",contains:[{className:"javadoctag",begin:"@[A-Za-z]+"}],relevance:10},hljs.C_LINE_COMMENT_MODE,hljs.C_BLOCK_COMMENT_MODE,STRING,hljs.QUOTE_STRING_MODE,SYMBOL,{className:"class",begin:"((case )?class |object |trait )",end:"({|$)",excludeEnd:true,illegal:":",keywords:"case class trait object",contains:[{beginKeywords:"extends with",relevance:10},hljs.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)",contains:[hljs.QUOTE_STRING_MODE,STRING,ANNOTATION]}]},hljs.C_NUMBER_MODE,ANNOTATION]}}},{name:"coffeescript",create:function(hljs){var KEYWORDS={keyword:"in if for while finally new do return else break catch instanceof throw try this "+"switch continue typeof delete debugger super "+"then unless until loop of by when and or is isnt not",literal:"true false null undefined "+"yes no on off",reserved:"case default function var void with const let enum export import native "+"__hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module global window document"};var JS_IDENT_RE="[A-Za-z$_][0-9A-Za-z$_]*";var TITLE=hljs.inherit(hljs.TITLE_MODE,{begin:JS_IDENT_RE});var SUBST={className:"subst",begin:/#\{/,end:/}/,keywords:KEYWORDS};var EXPRESSIONS=[hljs.BINARY_NUMBER_MODE,hljs.inherit(hljs.C_NUMBER_MODE,{starts:{end:"(\\s*/)?",relevance:0}}),{className:"string",variants:[{begin:/'''/,end:/'''/,contains:[hljs.BACKSLASH_ESCAPE]},{begin:/'/,end:/'/,contains:[hljs.BACKSLASH_ESCAPE]},{begin:/"""/,end:/"""/,contains:[hljs.BACKSLASH_ESCAPE,SUBST]},{begin:/"/,end:/"/,contains:[hljs.BACKSLASH_ESCAPE,SUBST]}]},{className:"regexp",variants:[{begin:"///",end:"///",contains:[SUBST,hljs.HASH_COMMENT_MODE]},{begin:"//[gim]*",relevance:0},{begin:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"}]},{className:"property",begin:"@"+JS_IDENT_RE},{begin:"`",end:"`",excludeBegin:true,excludeEnd:true,subLanguage:"javascript"}]; +SUBST.contains=EXPRESSIONS;return{aliases:["coffee","cson","iced"],keywords:KEYWORDS,contains:EXPRESSIONS.concat([{className:"comment",begin:"###",end:"###"},hljs.HASH_COMMENT_MODE,{className:"function",begin:"("+JS_IDENT_RE+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",end:"[-=]>",returnBegin:true,contains:[TITLE,{className:"params",begin:"\\(",returnBegin:true,contains:[{begin:/\(/,end:/\)/,keywords:KEYWORDS,contains:["self"].concat(EXPRESSIONS)}]}]},{className:"class",beginKeywords:"class",end:"$",illegal:/[:="\[\]]/,contains:[{beginKeywords:"extends",endsWithParent:true,illegal:/[:="\[\]]/,contains:[TITLE]},TITLE]},{className:"attribute",begin:JS_IDENT_RE+":",end:":",returnBegin:true,excludeEnd:true,relevance:0}])}}},{name:"lisp",create:function(hljs){var LISP_IDENT_RE="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*";var LISP_SIMPLE_NUMBER_RE="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?";var SHEBANG={className:"shebang",begin:"^#!",end:"$"};var LITERAL={className:"literal",begin:"\\b(t{1}|nil)\\b"};var NUMBER={className:"number",variants:[{begin:LISP_SIMPLE_NUMBER_RE,relevance:0},{begin:"#b[0-1]+(/[0-1]+)?"},{begin:"#o[0-7]+(/[0-7]+)?"},{begin:"#x[0-9a-f]+(/[0-9a-f]+)?"},{begin:"#c\\("+LISP_SIMPLE_NUMBER_RE+" +"+LISP_SIMPLE_NUMBER_RE,end:"\\)"}]};var STRING=hljs.inherit(hljs.QUOTE_STRING_MODE,{illegal:null});var COMMENT={className:"comment",begin:";",end:"$"};var VARIABLE={className:"variable",begin:"\\*",end:"\\*"};var KEYWORD={className:"keyword",begin:"[:&]"+LISP_IDENT_RE};var QUOTED_LIST={begin:"\\(",end:"\\)",contains:["self",LITERAL,STRING,NUMBER]};var QUOTED={className:"quoted",contains:[NUMBER,STRING,VARIABLE,KEYWORD,QUOTED_LIST],variants:[{begin:"['`]\\(",end:"\\)"},{begin:"\\(quote ",end:"\\)",keywords:{title:"quote"}}]};var LIST={className:"list",begin:"\\(",end:"\\)"};var BODY={endsWithParent:true,relevance:0};LIST.contains=[{className:"title",begin:LISP_IDENT_RE},BODY];BODY.contains=[QUOTED,LIST,LITERAL,NUMBER,STRING,COMMENT,VARIABLE,KEYWORD];return{illegal:/\S/,contains:[NUMBER,SHEBANG,LITERAL,STRING,COMMENT,QUOTED,LIST]}}},{name:"clojure",create:function(hljs){var keywords={built_in:"def cond apply if-not if-let if not not= = < < > <= <= >= == + / * - rem "+"quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? "+"set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? "+"class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? "+"string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . "+"inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last "+"drop-while while intern condp case reduced cycle split-at split-with repeat replicate "+"iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext "+"nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends "+"add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler "+"set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter "+"monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or "+"when when-not when-let comp juxt partial sequence memoize constantly complement identity assert "+"peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast "+"sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import "+"refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! "+"assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger "+"bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline "+"flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking "+"assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! "+"reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! "+"new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty "+"hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list "+"disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer "+"chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate "+"unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta "+"lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"};var CLJ_IDENT_RE="[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$';]+";var SIMPLE_NUMBER_RE="[\\s:\\(\\{]+\\d+(\\.\\d+)?";var NUMBER={className:"number",begin:SIMPLE_NUMBER_RE,relevance:0};var STRING=hljs.inherit(hljs.QUOTE_STRING_MODE,{illegal:null});var COMMENT={className:"comment",begin:";",end:"$",relevance:0};var COLLECTION={className:"collection",begin:"[\\[\\{]",end:"[\\]\\}]"};var HINT={className:"comment",begin:"\\^"+CLJ_IDENT_RE};var HINT_COL={className:"comment",begin:"\\^\\{",end:"\\}"};var KEY={className:"attribute",begin:"[:]"+CLJ_IDENT_RE};var LIST={className:"list",begin:"\\(",end:"\\)"};var BODY={endsWithParent:true,keywords:{literal:"true false nil"},relevance:0};var TITLE={keywords:keywords,lexemes:CLJ_IDENT_RE,className:"title",begin:CLJ_IDENT_RE,starts:BODY};LIST.contains=[{className:"comment",begin:"comment"},TITLE,BODY];BODY.contains=[LIST,STRING,HINT,HINT_COL,COMMENT,KEY,COLLECTION,NUMBER];COLLECTION.contains=[LIST,STRING,HINT,COMMENT,KEY,COLLECTION,NUMBER];return{aliases:["clj"],illegal:/\S/,contains:[COMMENT,LIST,{className:"prompt",begin:/^=> /,starts:{end:/\n\n|\Z/}}]}}},{name:"http",create:function(hljs){return{illegal:"\\S",contains:[{className:"status",begin:"^HTTP/[0-9\\.]+",end:"$",contains:[{className:"number",begin:"\\b\\d{3}\\b"}]},{className:"request",begin:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",returnBegin:true,end:"$",contains:[{className:"string",begin:" ",end:" ",excludeBegin:true,excludeEnd:true}]},{className:"attribute",begin:"^\\w",end:": ",excludeEnd:true,illegal:"\\n|\\s|=",starts:{className:"string",end:"$"}},{begin:"\\n\\n",starts:{subLanguage:"",endsWithParent:true}}]}}},{name:"haskell",create:function(hljs){var COMMENT={className:"comment",variants:[{begin:"--",end:"$"},{begin:"{-",end:"-}",contains:["self"]}]};var PRAGMA={className:"pragma",begin:"{-#",end:"#-}"};var PREPROCESSOR={className:"preprocessor",begin:"^#",end:"$"};var CONSTRUCTOR={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0};var LIST={className:"container",begin:"\\(",end:"\\)",illegal:'"',contains:[PRAGMA,COMMENT,PREPROCESSOR,{className:"type",begin:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},hljs.inherit(hljs.TITLE_MODE,{begin:"[_a-z][\\w']*"})]};var RECORD={className:"container",begin:"{",end:"}",contains:LIST.contains};return{aliases:["hs"],keywords:"let in if then else case of where do module import hiding "+"qualified type data newtype deriving class instance as default "+"infix infixl infixr foreign export ccall stdcall cplusplus "+"jvm dotnet safe unsafe family forall mdo proc rec",contains:[{className:"module",begin:"\\bmodule\\b",end:"where",keywords:"module where",contains:[LIST,COMMENT],illegal:"\\W\\.|;"},{className:"import",begin:"\\bimport\\b",end:"$",keywords:"import|0 qualified as hiding",contains:[LIST,COMMENT],illegal:"\\W\\.|;"},{className:"class",begin:"^(\\s*)?(class|instance)\\b",end:"where",keywords:"class family instance where",contains:[CONSTRUCTOR,LIST,COMMENT]},{className:"typedef",begin:"\\b(data|(new)?type)\\b",end:"$",keywords:"data family type newtype deriving",contains:[PRAGMA,COMMENT,CONSTRUCTOR,LIST,RECORD]},{className:"default",beginKeywords:"default",end:"$",contains:[CONSTRUCTOR,LIST,COMMENT]},{className:"infix",beginKeywords:"infix infixl infixr",end:"$",contains:[hljs.C_NUMBER_MODE,COMMENT]},{className:"foreign",begin:"\\bforeign\\b",end:"$",keywords:"foreign import export ccall stdcall cplusplus jvm "+"dotnet safe unsafe",contains:[CONSTRUCTOR,hljs.QUOTE_STRING_MODE,COMMENT]},{className:"shebang",begin:"#!\\/usr\\/bin\\/env runhaskell",end:"$"},PRAGMA,COMMENT,PREPROCESSOR,hljs.QUOTE_STRING_MODE,hljs.C_NUMBER_MODE,CONSTRUCTOR,hljs.inherit(hljs.TITLE_MODE,{begin:"^[_a-z][\\w']*"}),{begin:"->|<-"}]}}}];for(var i=0;i"});source=source.replace(/&/g,"&");source=source.replace(/"/g,'"');return source}},{events:1,"./highlighter":7,"./converter":9,"./parser":10,"./dom":11,"./controllers/defaultController":12,"./views/slideshowView":13,"./models/slideshow":14,"./macros":15}],11:[function(require,module,exports){module.exports=Dom;function Dom(){}Dom.prototype.XMLHttpRequest=XMLHttpRequest;Dom.prototype.getHTMLElement=function(){return document.getElementsByTagName("html")[0]};Dom.prototype.getBodyElement=function(){return document.body};Dom.prototype.getElementById=function(id){return document.getElementById(id)};Dom.prototype.getLocationHash=function(){return window.location.hash};Dom.prototype.setLocationHash=function(hash){if(typeof window.history.replaceState==="function"){window.history.replaceState(undefined,undefined,hash)}else{window.location.hash=hash}}},{}],15:[function(require,module,exports){var macros=module.exports={};macros.hello=function(){return"hello!"}},{}],10:[function(require,module,exports){!function(){var Lexer=require("./lexer");module.exports=Parser;function Parser(){}Parser.prototype.parse=function(src,macros){var self=this,lexer=new Lexer,tokens=lexer.lex(cleanInput(src)),slides=[],stack=[createSlide()];macros=macros||{};tokens.forEach(function(token){switch(token.type){case"text":case"code":case"fences":appendTo(stack[stack.length-1],token.text);break;case"def":stack[0].links[token.id]={href:token.href,title:token.title};break;case"macro":var macro=macros[token.name];if(typeof macro!=="function"){throw new Error('Macro "'+token.name+'" not found. '+"You need to define macro using remark.macros['"+token.name+"'] = function () { ... };")}var value=macro.apply(token.obj,token.args);if(typeof value==="string"){value=self.parse(value,macros);appendTo(stack[stack.length-1],value[0].content[0])}else{appendTo(stack[stack.length-1],value===undefined?"":value.toString())}break;case"content_start":stack.push(createContentClass(token));break;case"content_end":appendTo(stack[stack.length-2],stack[stack.length-1]);stack.pop();break;case"separator":slides.push(stack[0]);stack=[createSlide()];stack[0].properties.continued=(token.text==="--").toString();break;case"notes_separator":stack[0].notes=[];break}});slides.push(stack[0]);slides.forEach(function(slide){slide.content[0]=extractProperties(slide.content[0]||"",slide.properties)});return slides.filter(function(slide){var exclude=(slide.properties.exclude||"").toLowerCase();if(exclude==="true"){return false}return true})};function createSlide(){return{content:[],properties:{continued:"false"},links:{}}}function createContentClass(token){return{"class":token.classes.join(" "),block:token.block,content:[]}}function appendTo(element,content){var target=element.content;if(element.notes!==undefined){target=element.notes}var lastIdx=target.length-1;if(typeof target[lastIdx]==="string"&&typeof content==="string"){target[lastIdx]+=content}else{target.push(content)}}function extractProperties(source,properties){var propertyFinder=/^\n*([-\w]+):([^$\n]*)/i,match;while((match=propertyFinder.exec(source))!==null){source=source.substr(0,match.index)+source.substr(match.index+match[0].length);properties[match[1].trim()]=match[2].trim();propertyFinder.lastIndex=match.index}return source}function cleanInput(source){var getMatchCaptures=function(source,pattern){var results=[],match;while((match=pattern.exec(source))!==null)results.push(match[1]);return results};var leadingWhitespacePattern=/^([ \t]*)[^ \t\n]/gm;var whitespace=getMatchCaptures(source,leadingWhitespacePattern).map(function(s){return s.length});var minWhitespace=Math.min.apply(Math,whitespace);var trimWhitespacePattern=new RegExp("^[ \\t]{0,"+minWhitespace+"}","gm");return source.replace(trimWhitespacePattern,"")}}()},{"./lexer":16}],13:[function(require,module,exports){var SlideView=require("./slideView"),Timer=require("components/timer"),NotesView=require("./notesView"),Scaler=require("../scaler"),resources=require("../resources"),utils=require("../utils"),printing=require("components/printing");module.exports=SlideshowView;function SlideshowView(events,dom,containerElement,slideshow){var self=this;self.events=events;self.dom=dom;self.slideshow=slideshow;self.scaler=new Scaler(events,slideshow);self.slideViews=[];self.configureContainerElement(containerElement);self.configureChildElements();self.updateDimensions();self.scaleElements();self.updateSlideViews();self.timer=new Timer(events,self.timerElement);events.on("slidesChanged",function(){self.updateSlideViews()});events.on("hideSlide",function(slideIndex){self.elementArea.getElementsByClassName("remark-fading").forEach(function(slide){utils.removeClass(slide,"remark-fading")});self.hideSlide(slideIndex)});events.on("showSlide",function(slideIndex){self.showSlide(slideIndex)});events.on("forcePresenterMode",function(){if(!utils.hasClass(self.containerElement,"remark-presenter-mode")){utils.toggleClass(self.containerElement,"remark-presenter-mode");self.scaleElements();printing.setPageOrientation("landscape")}});events.on("togglePresenterMode",function(){utils.toggleClass(self.containerElement,"remark-presenter-mode");self.scaleElements();if(utils.hasClass(self.containerElement,"remark-presenter-mode")){printing.setPageOrientation("portrait")}else{printing.setPageOrientation("landscape")}});events.on("toggleHelp",function(){utils.toggleClass(self.containerElement,"remark-help-mode")});events.on("toggleBlackout",function(){utils.toggleClass(self.containerElement,"remark-blackout-mode")});events.on("toggleMirrored",function(){utils.toggleClass(self.containerElement,"remark-mirrored-mode")});events.on("hideOverlay",function(){utils.removeClass(self.containerElement,"remark-blackout-mode");utils.removeClass(self.containerElement,"remark-help-mode")});events.on("pause",function(){utils.toggleClass(self.containerElement,"remark-pause-mode")});events.on("resume",function(){utils.toggleClass(self.containerElement,"remark-pause-mode")});handleFullscreen(self)}function handleFullscreen(self){var requestFullscreen=utils.getPrefixedProperty(self.containerElement,"requestFullScreen"),cancelFullscreen=utils.getPrefixedProperty(document,"cancelFullScreen");self.events.on("toggleFullscreen",function(){var fullscreenElement=utils.getPrefixedProperty(document,"fullscreenElement")||utils.getPrefixedProperty(document,"fullScreenElement");if(!fullscreenElement&&requestFullscreen){requestFullscreen.call(self.containerElement,Element.ALLOW_KEYBOARD_INPUT)}else if(cancelFullscreen){cancelFullscreen.call(document)}self.scaleElements()})}SlideshowView.prototype.isEmbedded=function(){return this.containerElement!==this.dom.getBodyElement()};SlideshowView.prototype.configureContainerElement=function(element){var self=this;self.containerElement=element;utils.addClass(element,"remark-container");if(element===self.dom.getBodyElement()){utils.addClass(self.dom.getHTMLElement(),"remark-container");forwardEvents(self.events,window,["hashchange","resize","keydown","keypress","mousewheel","message","DOMMouseScroll"]);forwardEvents(self.events,self.containerElement,["touchstart","touchmove","touchend","click","contextmenu"])}else{element.style.position="absolute";element.tabIndex=-1;forwardEvents(self.events,window,["resize"]);forwardEvents(self.events,element,["keydown","keypress","mousewheel","touchstart","touchmove","touchend"])}self.events.on("tap",function(endX){if(endX-1){self.showSlide(self.slideshow.getCurrentSlideIndex())}};SlideshowView.prototype.scaleSlideBackgroundImages=function(dimensions){var self=this;self.slideViews.forEach(function(slideView){slideView.scaleBackgroundImage(dimensions)})};SlideshowView.prototype.showSlide=function(slideIndex){var self=this,slideView=self.slideViews[slideIndex],nextSlideView=self.slideViews[slideIndex+1];self.events.emit("beforeShowSlide",slideIndex);slideView.show();if(nextSlideView){self.previewArea.innerHTML=nextSlideView.containerElement.outerHTML}else{self.previewArea.innerHTML=""}self.events.emit("afterShowSlide",slideIndex)};SlideshowView.prototype.hideSlide=function(slideIndex){var self=this,slideView=self.slideViews[slideIndex];self.events.emit("beforeHideSlide",slideIndex);slideView.hide();self.events.emit("afterHideSlide",slideIndex)};SlideshowView.prototype.updateDimensions=function(){var self=this,dimensions=self.scaler.dimensions;self.helpElement.style.width=dimensions.width+"px";self.helpElement.style.height=dimensions.height+"px";self.scaleSlideBackgroundImages(dimensions);self.scaleElements()};SlideshowView.prototype.scaleElements=function(){var self=this;self.slideViews.forEach(function(slideView){slideView.scale(self.elementArea)});if(self.previewArea.children.length){self.scaler.scaleToFit(self.previewArea.children[0].children[0],self.previewArea)}self.scaler.scaleToFit(self.helpElement,self.containerElement);self.scaler.scaleToFit(self.pauseElement,self.containerElement)}},{"components/timer":"yAcg0L","components/printing":"nZr0zp","./slideView":17,"./notesView":18,"../resources":6,"../utils":8,"../scaler":19}],14:[function(require,module,exports){var Navigation=require("./slideshow/navigation"),Events=require("./slideshow/events"),utils=require("../utils"),Slide=require("./slide"),Parser=require("../parser"),macros=require("../macros");module.exports=Slideshow;function Slideshow(events,options){var self=this,slides=[],links={};options=options||{};Events.call(self,events);Navigation.call(self,events);self.loadFromString=loadFromString;self.update=update;self.getLinks=getLinks;self.getSlides=getSlides;self.getSlideCount=getSlideCount;self.getSlideByName=getSlideByName;self.togglePresenterMode=togglePresenterMode;self.toggleHelp=toggleHelp;self.toggleBlackout=toggleBlackout;self.toggleMirrored=toggleMirrored;self.toggleFullscreen=toggleFullscreen;self.createClone=createClone;self.resetTimer=resetTimer;self.getRatio=getOrDefault("ratio","4:3");self.getHighlightStyle=getOrDefault("highlightStyle","default");self.getHighlightLanguage=getOrDefault("highlightLanguage","");self.getSlideNumberFormat=getOrDefault("slideNumberFormat","%current% / %total%");loadFromString(options.source);events.on("toggleBlackout",function(){if(self.clone&&!self.clone.closed){self.clone.postMessage("toggleBlackout","*")}});function loadFromString(source){source=source||"";slides=createSlides(source,options);expandVariables(slides);links={};slides.forEach(function(slide){for(var id in slide.links){if(slide.links.hasOwnProperty(id)){links[id]=slide.links[id]}}});events.emit("slidesChanged")}function update(){events.emit("resize")}function getLinks(){return links}function getSlides(){return slides.map(function(slide){return slide})}function getSlideCount(){return slides.length}function getSlideByName(name){return slides.byName[name]}function togglePresenterMode(){events.emit("togglePresenterMode")}function toggleHelp(){events.emit("toggleHelp")}function toggleBlackout(){events.emit("toggleBlackout")}function toggleMirrored(){events.emit("toggleMirrored")}function toggleFullscreen(){events.emit("toggleFullscreen")}function createClone(){events.emit("createClone")}function resetTimer(){events.emit("resetTimer")}function getOrDefault(key,defaultValue){return function(){if(options[key]===undefined){return defaultValue}return options[key]}}}function createSlides(slideshowSource,options){var parser=new Parser,parsedSlides=parser.parse(slideshowSource,macros),slides=[],byName={},layoutSlide;slides.byName={};parsedSlides.forEach(function(slide,i){var template,slideViewModel;if(slide.properties.continued==="true"&&i>0){template=slides[slides.length-1]}else if(byName[slide.properties.template]){template=byName[slide.properties.template]}else if(slide.properties.layout==="false"){layoutSlide=undefined}else if(layoutSlide&&slide.properties.layout!=="true"){template=layoutSlide}if(slide.properties.continued==="true"&&options.countIncrementalSlides===false&&slide.properties.count===undefined){slide.properties.count="false"}slideViewModel=new Slide(slides.length,slide,template);if(slide.properties.layout==="true"){layoutSlide=slideViewModel}if(slide.properties.name){byName[slide.properties.name]=slideViewModel}if(slide.properties.layout!=="true"){slides.push(slideViewModel);if(slide.properties.name){slides.byName[slide.properties.name]=slideViewModel}}});return slides}function expandVariables(slides){slides.forEach(function(slide){slide.expandVariables()})}},{"./slideshow/events":20,"./slideshow/navigation":21,"./slide":22,"../utils":8,"../parser":10,"../macros":15}],12:[function(require,module,exports){!function(){module.exports=Controller;var keyboard=require("./inputs/keyboard"),mouse=require("./inputs/mouse"),touch=require("./inputs/touch"),message=require("./inputs/message"),location=require("./inputs/location");function Controller(events,dom,slideshowView,options){options=options||{};message.register(events);location.register(events,dom,slideshowView);keyboard.register(events);mouse.register(events,options);touch.register(events,options);addApiEventListeners(events,slideshowView,options)}function addApiEventListeners(events,slideshowView,options){events.on("pause",function(event){keyboard.unregister(events);mouse.unregister(events);touch.unregister(events)});events.on("resume",function(event){keyboard.register(events);mouse.register(events,options);touch.register(events,options)})}}()},{"./inputs/keyboard":23,"./inputs/mouse":24,"./inputs/touch":25,"./inputs/message":26,"./inputs/location":27}],16:[function(require,module,exports){module.exports=Lexer;var CODE=1,INLINE_CODE=2,CONTENT=3,FENCES=4,DEF=5,DEF_HREF=6,DEF_TITLE=7,MACRO=8,MACRO_ARGS=9,MACRO_OBJ=10,SEPARATOR=11,NOTES_SEPARATOR=12;var regexByName={CODE:/(?:^|\n)( {4}[^\n]+\n*)+/,INLINE_CODE:/`([^`]+?)`/,CONTENT:/(?:\\)?((?:\.[a-zA-Z_\-][a-zA-Z\-_0-9]*)+)\[/,FENCES:/(?:^|\n) *(`{3,}|~{3,}) *(?:\S+)? *\n(?:[\s\S]+?)\s*\4 *(?:\n+|$)/,DEF:/(?:^|\n) *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,MACRO:/!\[:([^\] ]+)([^\]]*)\](?:\(([^\)]*)\))?/,SEPARATOR:/(?:^|\n)(---?)(?:\n|$)/,NOTES_SEPARATOR:/(?:^|\n)(\?{3})(?:\n|$)/};var block=replace(/CODE|INLINE_CODE|CONTENT|FENCES|DEF|MACRO|SEPARATOR|NOTES_SEPARATOR/,regexByName),inline=replace(/CODE|INLINE_CODE|CONTENT|FENCES|DEF|MACRO/,regexByName);function Lexer(){}Lexer.prototype.lex=function(src){var tokens=lex(src,block),i;for(i=tokens.length-2;i>=0;i--){if(tokens[i].type==="text"&&tokens[i+1].type==="text"){tokens[i].text+=tokens[i+1].text;tokens.splice(i+1,1)}}return tokens};function lex(src,regex,tokens){var cap,text;tokens=tokens||[];while((cap=regex.exec(src))!==null){if(cap.index>0){tokens.push({type:"text",text:src.substring(0,cap.index)})}if(cap[CODE]){tokens.push({type:"code",text:cap[0]})}else if(cap[INLINE_CODE]){tokens.push({type:"text",text:cap[0]})}else if(cap[FENCES]){tokens.push({type:"fences",text:cap[0]})}else if(cap[DEF]){tokens.push({type:"def",id:cap[DEF],href:cap[DEF_HREF],title:cap[DEF_TITLE]})}else if(cap[MACRO]){tokens.push({type:"macro",name:cap[MACRO],args:(cap[MACRO_ARGS]||"").split(",").map(trim),obj:cap[MACRO_OBJ]})}else if(cap[SEPARATOR]){tokens.push({type:"separator",text:cap[SEPARATOR]})}else if(cap[NOTES_SEPARATOR]){tokens.push({type:"notes_separator",text:cap[NOTES_SEPARATOR]})}else if(cap[CONTENT]){text=getTextInBrackets(src,cap.index+cap[0].length);if(text!==undefined){src=src.substring(text.length+1);if(cap[0][0]!=="\\"){tokens.push({type:"content_start",classes:cap[CONTENT].substring(1).split("."),block:text.indexOf("\n")!==-1});lex(text,inline,tokens);tokens.push({type:"content_end",block:text.indexOf("\n")!==-1})}else{tokens.push({type:"text",text:cap[0].substring(1)+text+"]"})}}else{tokens.push({type:"text",text:cap[0]})}}src=src.substring(cap.index+cap[0].length)}if(src||!src&&tokens.length===0){tokens.push({type:"text",text:src})}return tokens}function replace(regex,replacements){return new RegExp(regex.source.replace(/\w{2,}/g,function(key){return replacements[key].source}))}function trim(text){if(typeof text==="string"){return text.trim()}return text}function getTextInBrackets(src,offset){var depth=1,pos=offset,chr;while(depth>0&&pos0||event.detail<0){events.emit("gotoPreviousSlide")}else if(event.wheelDeltaY<0||event.detail>0){events.emit("gotoNextSlide")}};events.on("mousewheel",scrollHandler);events.on("DOMMouseScroll",scrollHandler)}}function removeMouseEventListeners(events){events.removeAllListeners("click");events.removeAllListeners("contextmenu");events.removeAllListeners("mousewheel")}},{}],23:[function(require,module,exports){exports.register=function(events){addKeyboardEventListeners(events)};exports.unregister=function(events){removeKeyboardEventListeners(events)};function addKeyboardEventListeners(events){events.on("keydown",function(event){if(event.metaKey||event.ctrlKey){return}switch(event.keyCode){case 33:case 37:case 38:events.emit("gotoPreviousSlide");break;case 32:case 34:case 39:case 40:events.emit("gotoNextSlide");break;case 36:events.emit("gotoFirstSlide");break;case 35:events.emit("gotoLastSlide");break;case 27:events.emit("hideOverlay");break}});events.on("keypress",function(event){if(event.metaKey||event.ctrlKey){return}switch(String.fromCharCode(event.which)){case"j":events.emit("gotoNextSlide");break;case"k":events.emit("gotoPreviousSlide");break;case"b":events.emit("toggleBlackout");break;case"m":events.emit("toggleMirrored");break;case"c":events.emit("createClone");break;case"p":events.emit("togglePresenterMode");break;case"f":events.emit("toggleFullscreen");break;case"t":events.emit("resetTimer");break;case"h":case"?":events.emit("toggleHelp");break}})}function removeKeyboardEventListeners(events){events.removeAllListeners("keydown");events.removeAllListeners("keypress")}},{}],25:[function(require,module,exports){exports.register=function(events,options){addTouchEventListeners(events,options)};exports.unregister=function(events){removeTouchEventListeners(events)};function addTouchEventListeners(events,options){var touch,startX,endX;if(options.touch===false){return}var isTap=function(){return Math.abs(startX-endX)<10};var handleTap=function(){events.emit("tap",endX)};var handleSwipe=function(){if(startX>endX){events.emit("gotoNextSlide")}else{events.emit("gotoPreviousSlide")}};events.on("touchstart",function(event){touch=event.touches[0];startX=touch.clientX});events.on("touchend",function(event){if(event.target.nodeName.toUpperCase()==="A"){return}touch=event.changedTouches[0];endX=touch.clientX;if(isTap()){handleTap()}else{handleSwipe()}});events.on("touchmove",function(event){event.preventDefault()})}function removeTouchEventListeners(events){events.removeAllListeners("touchstart");events.removeAllListeners("touchend");events.removeAllListeners("touchmove")}},{}],21:[function(require,module,exports){module.exports=Navigation;function Navigation(events){var self=this,currentSlideIndex=-1,started=null;self.getCurrentSlideIndex=getCurrentSlideIndex;self.gotoSlide=gotoSlide;self.gotoPreviousSlide=gotoPreviousSlide;self.gotoNextSlide=gotoNextSlide;self.gotoFirstSlide=gotoFirstSlide;self.gotoLastSlide=gotoLastSlide;self.pause=pause;self.resume=resume;events.on("gotoSlide",gotoSlide);events.on("gotoPreviousSlide",gotoPreviousSlide);events.on("gotoNextSlide",gotoNextSlide);events.on("gotoFirstSlide",gotoFirstSlide);events.on("gotoLastSlide",gotoLastSlide);events.on("slidesChanged",function(){if(currentSlideIndex>self.getSlideCount()){currentSlideIndex=self.getSlideCount()}});events.on("createClone",function(){if(!self.clone||self.clone.closed){self.clone=window.open(location.href,"_blank","location=no")}else{self.clone.focus()}});events.on("resetTimer",function(){started=false});function pause(){events.emit("pause")}function resume(){events.emit("resume")}function getCurrentSlideIndex(){return currentSlideIndex}function gotoSlideByIndex(slideIndex,noMessage){var alreadyOnSlide=slideIndex===currentSlideIndex,slideOutOfRange=slideIndex<0||slideIndex>self.getSlideCount()-1;if(noMessage===undefined)noMessage=false;if(alreadyOnSlide||slideOutOfRange){return}if(currentSlideIndex!==-1){events.emit("hideSlide",currentSlideIndex,false)}if(started===null){started=false}else if(started===false){events.emit("start");started=true}events.emit("showSlide",slideIndex);currentSlideIndex=slideIndex;events.emit("slideChanged",slideIndex+1);if(!noMessage){if(self.clone&&!self.clone.closed){self.clone.postMessage("gotoSlide:"+(currentSlideIndex+1),"*")}if(window.opener){window.opener.postMessage("gotoSlide:"+(currentSlideIndex+1),"*")}}}function gotoSlide(slideNoOrName,noMessage){var slideIndex=getSlideIndex(slideNoOrName);gotoSlideByIndex(slideIndex,noMessage)}function gotoPreviousSlide(){gotoSlideByIndex(currentSlideIndex-1)}function gotoNextSlide(){gotoSlideByIndex(currentSlideIndex+1)}function gotoFirstSlide(){gotoSlideByIndex(0)}function gotoLastSlide(){gotoSlideByIndex(self.getSlideCount()-1)}function getSlideIndex(slideNoOrName){var slideNo,slide;if(typeof slideNoOrName==="number"){return slideNoOrName-1}slideNo=parseInt(slideNoOrName,10);if(slideNo.toString()===slideNoOrName){return slideNo-1}if(slideNoOrName.match(/^p\d+$/)){events.emit("forcePresenterMode");return parseInt(slideNoOrName.substr(1),10)-1}slide=self.getSlideByName(slideNoOrName);if(slide){return slide.getSlideIndex()}return 0}}},{}],20:[function(require,module,exports){var EventEmitter=require("events").EventEmitter;module.exports=Events;function Events(events){var self=this,externalEvents=new EventEmitter;externalEvents.setMaxListeners(0);self.on=function(){externalEvents.on.apply(externalEvents,arguments);return self};["showSlide","hideSlide","beforeShowSlide","afterShowSlide","beforeHideSlide","afterHideSlide"].map(function(eventName){events.on(eventName,function(slideIndex){var slide=self.getSlides()[slideIndex];externalEvents.emit(eventName,slide)})})}},{events:1}],22:[function(require,module,exports){module.exports=Slide;function Slide(slideIndex,slide,template){var self=this;self.properties=slide.properties||{};self.links=slide.links||{};self.content=slide.content||[];self.notes=slide.notes||"";self.getSlideIndex=function(){return slideIndex};if(template){inherit(self,template)}}function inherit(slide,template){inheritProperties(slide,template);inheritContent(slide,template);inheritNotes(slide,template)}function inheritProperties(slide,template){var property,value;for(property in template.properties){if(!template.properties.hasOwnProperty(property)||ignoreProperty(property)){continue}value=[template.properties[property]];if(property==="class"&&slide.properties[property]){value.push(slide.properties[property])}if(property==="class"||slide.properties[property]===undefined){slide.properties[property]=value.join(", ")}}}function ignoreProperty(property){return property==="name"||property==="layout"||property==="count"}function inheritContent(slide,template){var expandedVariables;slide.properties.content=slide.content.slice();slide.content=template.content.slice();expandedVariables=slide.expandVariables(true);if(expandedVariables.content===undefined){slide.content=slide.content.concat(slide.properties.content)}delete slide.properties.content}function inheritNotes(slide,template){if(template.notes){slide.notes=template.notes+"\n\n"+slide.notes}}Slide.prototype.expandVariables=function(contentOnly,content,expandResult){var properties=this.properties,i;content=content!==undefined?content:this.content;expandResult=expandResult||{};for(i=0;icontainerHeight/ratio.height){scale=containerHeight/dimensions.height}else{scale=containerWidth/dimensions.width}scaledWidth=dimensions.width*scale;scaledHeight=dimensions.height*scale;left=(containerWidth-scaledWidth)/2;top=(containerHeight-scaledHeight)/2;element.style["-webkit-transform"]="scale("+scale+")";element.style.MozTransform="scale("+scale+")";element.style.left=Math.max(left,0)+"px";element.style.top=Math.max(top,0)+"px"};function getRatio(slideshow){var ratioComponents=slideshow.getRatio().split(":"),ratio;ratio={width:parseInt(ratioComponents[0],10),height:parseInt(ratioComponents[1],10)};ratio.ratio=ratio.width/ratio.height;return ratio}function getDimensions(ratio){return{width:Math.floor(referenceWidth/referenceRatio*ratio.ratio),height:referenceHeight}}},{}],26:[function(require,module,exports){exports.register=function(events){addMessageEventListeners(events)};function addMessageEventListeners(events){events.on("message",navigateByMessage);function navigateByMessage(message){var cap;if((cap=/^gotoSlide:(\d+)$/.exec(message.data))!==null){events.emit("gotoSlide",parseInt(cap[1],10),true)}else if(message.data==="toggleBlackout"){events.emit("toggleBlackout")}}}},{}],27:[function(require,module,exports){exports.register=function(events,dom,slideshowView){addLocationEventListeners(events,dom,slideshowView)};function addLocationEventListeners(events,dom,slideshowView){if(slideshowView.isEmbedded()){events.emit("gotoSlide",1)}else{events.on("hashchange",navigateByHash); +events.on("slideChanged",updateHash);navigateByHash()}function navigateByHash(){var slideNoOrName=(dom.getLocationHash()||"").substr(1);events.emit("gotoSlide",slideNoOrName)}function updateHash(slideNoOrName){dom.setLocationHash("#"+slideNoOrName)}}},{}],18:[function(require,module,exports){var converter=require("../converter");module.exports=NotesView;function NotesView(events,element,slideViewsAccessor){var self=this;self.events=events;self.element=element;self.slideViewsAccessor=slideViewsAccessor;self.configureElements();events.on("showSlide",function(slideIndex){self.showSlide(slideIndex)})}NotesView.prototype.showSlide=function(slideIndex){var self=this,slideViews=self.slideViewsAccessor(),slideView=slideViews[slideIndex],nextSlideView=slideViews[slideIndex+1];self.notesElement.innerHTML=slideView.notesElement.innerHTML;if(nextSlideView){self.notesPreviewElement.innerHTML=nextSlideView.notesElement.innerHTML}else{self.notesPreviewElement.innerHTML=""}};NotesView.prototype.configureElements=function(){var self=this;self.notesElement=self.element.getElementsByClassName("remark-notes")[0];self.notesPreviewElement=self.element.getElementsByClassName("remark-notes-preview")[0];self.notesElement.addEventListener("mousewheel",function(event){event.stopPropagation()});self.notesPreviewElement.addEventListener("mousewheel",function(event){event.stopPropagation()});self.toolbarElement=self.element.getElementsByClassName("remark-toolbar")[0];var commands={increase:function(){self.notesElement.style.fontSize=(parseFloat(self.notesElement.style.fontSize)||1)+.1+"em";self.notesPreviewElement.style.fontsize=self.notesElement.style.fontSize},decrease:function(){self.notesElement.style.fontSize=(parseFloat(self.notesElement.style.fontSize)||1)-.1+"em";self.notesPreviewElement.style.fontsize=self.notesElement.style.fontSize}};self.toolbarElement.getElementsByTagName("a").forEach(function(link){link.addEventListener("click",function(e){var command=e.target.hash.substr(1);commands[command]();e.preventDefault()})})}},{"../converter":9}],17:[function(require,module,exports){var SlideNumber=require("components/slide-number"),converter=require("../converter"),highlighter=require("../highlighter"),utils=require("../utils");module.exports=SlideView;function SlideView(events,slideshow,scaler,slide){var self=this;self.events=events;self.slideshow=slideshow;self.scaler=scaler;self.slide=slide;self.slideNumber=new SlideNumber(slide,slideshow);self.configureElements();self.updateDimensions();self.events.on("propertiesChanged",function(changes){if(changes.hasOwnProperty("ratio")){self.updateDimensions()}})}SlideView.prototype.updateDimensions=function(){var self=this,dimensions=self.scaler.dimensions;self.scalingElement.style.width=dimensions.width+"px";self.scalingElement.style.height=dimensions.height+"px"};SlideView.prototype.scale=function(containerElement){var self=this;self.scaler.scaleToFit(self.scalingElement,containerElement)};SlideView.prototype.show=function(){utils.addClass(this.containerElement,"remark-visible");utils.removeClass(this.containerElement,"remark-fading")};SlideView.prototype.hide=function(){var self=this;utils.removeClass(this.containerElement,"remark-visible");utils.addClass(this.containerElement,"remark-fading");setTimeout(function(){utils.removeClass(self.containerElement,"remark-fading")},1e3)};SlideView.prototype.configureElements=function(){var self=this;self.containerElement=document.createElement("div");self.containerElement.className="remark-slide-container";self.scalingElement=document.createElement("div");self.scalingElement.className="remark-slide-scaler";self.element=document.createElement("div");self.element.className="remark-slide";self.contentElement=createContentElement(self.events,self.slideshow,self.slide);self.notesElement=createNotesElement(self.slideshow,self.slide.notes);self.contentElement.appendChild(self.slideNumber.element);self.element.appendChild(self.contentElement);self.scalingElement.appendChild(self.element);self.containerElement.appendChild(self.scalingElement);self.containerElement.appendChild(self.notesElement)};SlideView.prototype.scaleBackgroundImage=function(dimensions){var self=this,styles=window.getComputedStyle(this.contentElement),backgroundImage=styles.backgroundImage,match,image,scale;if((match=/^url\(("?)([^\)]+?)\1\)/.exec(backgroundImage))!==null){image=new Image;image.onload=function(){if(image.width>dimensions.width||image.height>dimensions.height){if(!self.originalBackgroundSize){self.originalBackgroundSize=self.contentElement.style.backgroundSize;self.originalBackgroundPosition=self.contentElement.style.backgroundPosition;self.backgroundSizeSet=true;if(dimensions.width/image.width'+line+""});if(lines.length&&lines[lines.length-1].indexOf("><")!==-1){lines.pop()}block.innerHTML=lines.join("")}function highlightBlockLines(block,lines){lines.forEach(function(i){utils.addClass(block.childNodes[i],"remark-code-line-highlighted")})}function highlightBlockSpans(block){var pattern=/([^\\`])`([^`]+?)`/g,replacement='$1$2';block.childNodes.forEach(function(element){element.innerHTML=element.innerHTML.replace(pattern,replacement)})}},{"components/slide-number":"aIW4aw","../converter":9,"../highlighter":7,"../utils":8}],9:[function(require,module,exports){var marked=require("marked"),converter=module.exports={},element=document.createElement("div");marked.setOptions({gfm:true,tables:true,breaks:false,pedantic:true,sanitize:false,smartLists:true,langPrefix:""});converter.convertMarkdown=function(content,links,inline){element.innerHTML=convertMarkdown(content,links||{},inline);element.innerHTML=element.innerHTML.replace(/

\s*<\/p>/g,"");return element.innerHTML.replace(/\n\r?$/,"")};function convertMarkdown(content,links,insideContentClass){var i,tag,markdown="",html;for(i=0;i';markdown+=convertMarkdown(content[i].content,links,true);markdown+=""}}var tokens=marked.Lexer.lex(markdown.replace(/^\s+/,""));tokens.links=links;html=marked.Parser.parse(tokens);if(insideContentClass){element.innerHTML=html;if(element.children.length===1&&element.children[0].tagName==="P"){html=element.children[0].innerHTML}}return html}},{marked:28}],28:[function(require,module,exports){!function(global){!function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.url.exec(src)){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);out+=this.outputLink(cap,{href:cap[2],title:cap[3]});continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}out+=this.outputLink(cap,link);continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"

"+(escaped?code:escape(code,true))+"\n
"}return'
'+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"
\n"+quote+"
\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return"
\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}.call(function(){return this||(typeof window!=="undefined"?window:global)}())}(window)},{}]},{},[3]); + diff --git a/javascript/cadoles-remark-macros.js b/javascript/cadoles-remark-macros.js new file mode 100644 index 0000000..01f8587 --- /dev/null +++ b/javascript/cadoles-remark-macros.js @@ -0,0 +1,10 @@ +(function() { + + remark.macros.include = function() { + var req = new XMLHttpRequest(); + req.open('GET', this, false); + req.send(); + return remark.convert(req.responseText.replace(/\r\n/g, '\n')); + }; + +}()); diff --git a/javascript/cadoles-theme.css b/javascript/cadoles-theme.css new file mode 100644 index 0000000..1afbcb4 --- /dev/null +++ b/javascript/cadoles-theme.css @@ -0,0 +1,47 @@ +/* Thème Cadoles */ + +ul { + list-style: none; +} + +ul li:before { + content: "\25B8 "; + color: #5379B4; + margin-right: 5px; +} + +ul > li { + line-height: 1.5em; +} + +.remark-slide-content { + background-image: url('../beamer-skel/img/banner01.png'), url('../beamer-skel/img/logo-cadoles-01.png'); + background-position: top center, center 98% !important; + background-size: contain, 150px !important; +} + +.remark-code-line { + font-size: 0.85em; +} + +.cadoles-slide-title { + color: white; + float: left; + clear: right; + font-size: 50px; + margin-top: -40px; + margin-left: -50px; + margin-bottom: 50px; +} + +.cadoles-slide-title:after { + content: ''; + clear: both; +} + +.cadoles-blue { color: #5379B4; } +.cadoles-clearfix { clear: both; } +.cadoles-list > ul { font-size: 1.5em; } +.cadoles-list > ul ul { font-size: 1em; } +.cadoles-small { font-size: 0.8em; } +.cadoles-xs { font-size: 0.7em; }