You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2018/01/18 08:53:09 UTC
[myfaces-tobago] 01/02: * Add migration script for the layout
properties. * Update Prism to 1.9.0 + language-bash support.
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit f166cebfa622e4845eafe3f06b7b546b5650ee25
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Jan 17 17:13:21 2018 +0100
* Add migration script for the layout properties.
* Update Prism to 1.9.0 + language-bash support.
---
.../tobago/example/demo/Migration4Controller.java | 33 +
.../50-migration/96-migration/migrate4-layout.sh | 51 ++
.../50-migration/96-migration/migration40.xhtml | 65 +-
.../tobago-example-demo/src/main/webapp/main.xhtml | 4 +-
.../src/main/webapp/script/prism-1.9.0.js | 894 +++++++++++++++++++++
.../src/main/webapp/script/prism.js | 682 ----------------
.../webapp/style/{prism.css => prism-1.9.0.css} | 6 +-
7 files changed, 1026 insertions(+), 709 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Migration4Controller.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Migration4Controller.java
new file mode 100644
index 0000000..6bffe3f
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Migration4Controller.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.example.demo;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.io.Serializable;
+
+@Singleton
+@Named
+public class Migration4Controller extends SourceFileReader implements Serializable {
+
+ public String getScriptSource() {
+ return getSource("migrate4-layout.sh");
+ }
+}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migrate4-layout.sh b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migrate4-layout.sh
new file mode 100644
index 0000000..7d73dc4
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migrate4-layout.sh
@@ -0,0 +1,51 @@
+#! /bin/bash
+
+# Script to replace the layout attribute syntax from Tobago 3.0 to 4.0
+# (not very fast and might be optimized, but need only to run one time per project)
+# usage: run this file "migrate-layout.sh" in the project parent directory.
+# it will process all files in all subfolder with suffix .xhtml
+
+function replace_segment_one {
+ file=$1
+ sed -i -E "s/(extraSmall|small|medium|large|extraLarge)=\"([^\"^ ]*)([0-9]+);([0-9]+)/\1=\"\2\3seg \4/g" $file
+}
+
+function replace_segment_last {
+ file=$1
+ sed -i -E "s/(extraSmall|small|medium|large|extraLarge)=\"([^\"]*)([0-9]+)\"/\1=\"\2\3seg\"/g" $file
+}
+
+function replace_columns_rows {
+ file=$1
+ sed -i -E "s/(columns|rows)=\"([^\"]*)([0-9]+)\*/\1=\"\2\3fr/g" $file
+}
+
+function replace_columns_rows_one {
+ file=$1
+ sed -i -E "s/(columns|rows)=\"([^\"]*)\*/\1=\"\21fr/g" $file
+}
+
+find . -name "*.xhtml" | while read file; do
+
+ echo "Processing file $file"
+
+ for i in `seq 1 11`;
+ do
+ replace_segment_one $file
+ done
+
+ replace_segment_last $file
+
+ for i in `seq 1 20`;
+ do
+ replace_columns_rows $file
+ done
+
+ for i in `seq 1 20`;
+ do
+ replace_columns_rows_one $file
+ done
+
+# only on Windows:
+# unix2dos -q $file
+done
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
index bca1be0..3e23851 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
@@ -32,8 +32,7 @@
<ul>
<li><tc:link link="" fragment="page:mainForm:taglib" label="Tag library"/></li>
<li><tc:link link="" fragment="page:mainForm:markups" label="Markups"/></li>
- <li><tc:link link="" fragment="page:mainForm:flexLayout" label="<tc:flexLayout>"/></li>
- <li><tc:link link="" fragment="page:mainForm:segmentLayout" label="<tc:segmentLayout>"/></li>
+ <li><tc:link link="" fragment="page:mainForm:layout" label="Layout Manager"/></li>
<li><tc:link link="" fragment="page:mainForm:css" label="CSS / Bootstrap"/></li>
<li><tc:link link="" fragment="page:mainForm:theme" label="Theme building"/></li>
<li><tc:link link="" fragment="page:mainForm:crlf" label="CRLF in textarea"/></li>
@@ -120,28 +119,48 @@
</ul>
</tc:section>
- <tc:section id="flexLayout" label="<tc:flexLayout>">
- <p>Column/row attribute values are now space separated. The '*' character is replaced by 'fr'.</p>
- <p>Instead of <code class="language-markup"><tc:flexLayout column="200px;auto;1*;2*;10rem"></code>
- you can write <code class="language-markup"><tc:flexLayout column="200px auto 1fr 2fr 10rem"></code>.</p>
- <p>The old syntax is deprecated but still possible.</p>
- </tc:section>
- <tc:section id="segmentLayout" label="<tc:segmentLayout>">
- <p>Attribute values are now space seperated. Integer values now have the unit 'seg'.</p>
- <p>The old syntax is deprecated but still possible.</p>
- <p>The 12 columns of a segment layout are no longer filled up.</p>
- <p>Explained on the example <code>medium="3seg 4seg"</code>:</p>
- <ul>
- <li>Result in Tobago3: The first child of the segment layout spans 3 columns, the second 4 columns,
- the third 5 columns (filled up) and the fourth 3 columns again.
- </li>
- <li>Result in Tobago4: The first child spans 3 columns, the second 4 columns, the third 3columns again and the
- fourth 4 columns.
- </li>
- </ul>
- <p>There are also two new 'auto' and '1fr' attribute values. For more information see
- <tc:link label="tc:segmentLayout" outcome="/content/30-concept/16-layout/30-segment/segment-layout.xhtml"/>.</p>
+ <tc:section id="layout" label="Layout Manager">
+
+ <tc:section id="flexLayout" label="<tc:flexLayout>">
+ <p>Column/row attribute values are now space separated. The '*' character is replaced by 'fr'.</p>
+ <p>Instead of <code class="language-markup"><tc:flexLayout column="200px;auto;1*;2*;10rem"></code>
+ you can write <code class="language-markup"><tc:flexLayout column="200px auto 1fr 2fr 10rem"></code>.</p>
+ <p>The old syntax is deprecated but still possible.</p>
+ </tc:section>
+
+ <tc:section id="segmentLayout" label="<tc:segmentLayout>">
+ <p>Attribute values are now space seperated. Integer values now have the unit 'seg'.</p>
+ <p>The old syntax is deprecated but still possible.</p>
+ <p>The 12 columns of a segment layout are no longer filled up.</p>
+ <p>Explained on the example <code>medium="3seg 4seg"</code>:</p>
+ <ul>
+ <li>Result in Tobago3: The first child of the segment layout spans 3 columns, the second 4 columns,
+ the third 5 columns (filled up) and the fourth 3 columns again.
+ </li>
+ <li>Result in Tobago4: The first child spans 3 columns, the second 4 columns, the third 3columns again and the
+ fourth 4 columns.
+ </li>
+ </ul>
+ <p>There are also two new 'auto' and '1fr' attribute values. For more information see
+ <tc:link label="tc:segmentLayout" outcome="/content/30-concept/16-layout/30-segment/segment-layout.xhtml"/>.
+ </p>
+ </tc:section>
+
+ <tc:section id="gridLayout" label="<tc:gridLayout>">
+ <p>The attribute syntax for columns and rows has also been changed. See script below.</p>
+ </tc:section>
+
+ <tc:section id="sheet" label="<tc:sheet>">
+ <p>The attribute syntax for columns has also been changed. See script below.</p>
+ </tc:section>
+
+ <tc:section id="layout-script" label="Migration script for layout attributes">
+ <p>Here is a simple <tc:link label="migration script" link="migrate4-layout.sh"/>, that may help you to change the layout attributes in the
+ facelets XHTML files.</p>
+ <pre><code class="language-bash"><tc:out value="#{migration4Controller.scriptSource}"/></code></pre>
+ </tc:section>
+
</tc:section>
<tc:section id="css" label="CSS / Bootstrap">
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
index d350050..78c776a 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
@@ -32,9 +32,9 @@
-->
<tc:script file="#{request.contextPath}/script/demo.js"/>
- <tc:script file="#{request.contextPath}/script/prism.js"/>
+ <tc:script file="#{request.contextPath}/script/prism-1.9.0.js"/>
<tc:style file="#{request.contextPath}/style/demo.css"/>
- <tc:style file="#{request.contextPath}/style/prism.css"/>
+ <tc:style file="#{request.contextPath}/style/prism-1.9.0.css"/>
<tc:meta name="keywords" content="jsf, tobago, demo"/>
<tc:meta name="robots" content="noindex" rendered="#{metaController.renderNoindex}"/>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/script/prism-1.9.0.js b/tobago-example/tobago-example-demo/src/main/webapp/script/prism-1.9.0.js
new file mode 100644
index 0000000..274ba9b
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/script/prism-1.9.0.js
@@ -0,0 +1,894 @@
+/* PrismJS 1.9.0
+http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+java+less */
+var _self = (typeof window !== 'undefined')
+ ? window // if in browser
+ : (
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
+ ? self // if in worker
+ : {} // if in node js
+ );
+
+/**
+ * Prism: Lightweight, robust, elegant syntax highlighting
+ * MIT license http://www.opensource.org/licenses/mit-license.php/
+ * @author Lea Verou http://lea.verou.me
+ */
+
+var Prism = (function(){
+
+// Private helper vars
+ var lang = /\blang(?:uage)?-(\w+)\b/i;
+ var uniqueId = 0;
+
+ var _ = _self.Prism = {
+ manual: _self.Prism && _self.Prism.manual,
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
+ util: {
+ encode: function (tokens) {
+ if (tokens instanceof Token) {
+ return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
+ } else if (_.util.type(tokens) === 'Array') {
+ return tokens.map(_.util.encode);
+ } else {
+ return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
+ }
+ },
+
+ type: function (o) {
+ return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
+ },
+
+ objId: function (obj) {
+ if (!obj['__id']) {
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
+ }
+ return obj['__id'];
+ },
+
+ // Deep clone a language definition (e.g. to extend it)
+ clone: function (o) {
+ var type = _.util.type(o);
+
+ switch (type) {
+ case 'Object':
+ var clone = {};
+
+ for (var key in o) {
+ if (o.hasOwnProperty(key)) {
+ clone[key] = _.util.clone(o[key]);
+ }
+ }
+
+ return clone;
+
+ case 'Array':
+ return o.map(function(v) { return _.util.clone(v); });
+ }
+
+ return o;
+ }
+ },
+
+ languages: {
+ extend: function (id, redef) {
+ var lang = _.util.clone(_.languages[id]);
+
+ for (var key in redef) {
+ lang[key] = redef[key];
+ }
+
+ return lang;
+ },
+
+ /**
+ * Insert a token before another token in a language literal
+ * As this needs to recreate the object (we cannot actually insert before keys in object literals),
+ * we cannot just provide an object, we need anobject and a key.
+ * @param inside The key (or language id) of the parent
+ * @param before The key to insert before. If not provided, the function appends instead.
+ * @param insert Object with the key/value pairs to insert
+ * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
+ */
+ insertBefore: function (inside, before, insert, root) {
+ root = root || _.languages;
+ var grammar = root[inside];
+
+ if (arguments.length == 2) {
+ insert = arguments[1];
+
+ for (var newToken in insert) {
+ if (insert.hasOwnProperty(newToken)) {
+ grammar[newToken] = insert[newToken];
+ }
+ }
+
+ return grammar;
+ }
+
+ var ret = {};
+
+ for (var token in grammar) {
+
+ if (grammar.hasOwnProperty(token)) {
+
+ if (token == before) {
+
+ for (var newToken in insert) {
+
+ if (insert.hasOwnProperty(newToken)) {
+ ret[newToken] = insert[newToken];
+ }
+ }
+ }
+
+ ret[token] = grammar[token];
+ }
+ }
+
+ // Update references in other language definitions
+ _.languages.DFS(_.languages, function(key, value) {
+ if (value === root[inside] && key != inside) {
+ this[key] = ret;
+ }
+ });
+
+ return root[inside] = ret;
+ },
+
+ // Traverse a language definition with Depth First Search
+ DFS: function(o, callback, type, visited) {
+ visited = visited || {};
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ callback.call(o, i, o[i], type || i);
+
+ if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
+ visited[_.util.objId(o[i])] = true;
+ _.languages.DFS(o[i], callback, null, visited);
+ }
+ else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
+ visited[_.util.objId(o[i])] = true;
+ _.languages.DFS(o[i], callback, i, visited);
+ }
+ }
+ }
+ }
+ },
+ plugins: {},
+
+ highlightAll: function(async, callback) {
+ _.highlightAllUnder(document, async, callback);
+ },
+
+ highlightAllUnder: function(container, async, callback) {
+ var env = {
+ callback: callback,
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
+ };
+
+ _.hooks.run("before-highlightall", env);
+
+ var elements = env.elements || container.querySelectorAll(env.selector);
+
+ for (var i=0, element; element = elements[i++];) {
+ _.highlightElement(element, async === true, env.callback);
+ }
+ },
+
+ highlightElement: function(element, async, callback) {
+ // Find language
+ var language, grammar, parent = element;
+
+ while (parent && !lang.test(parent.className)) {
+ parent = parent.parentNode;
+ }
+
+ if (parent) {
+ language = (parent.className.match(lang) || [,''])[1].toLowerCase();
+ grammar = _.languages[language];
+ }
+
+ // Set language on the element, if not present
+ element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
+
+ if (element.parentNode) {
+ // Set language on the parent, for styling
+ parent = element.parentNode;
+
+ if (/pre/i.test(parent.nodeName)) {
+ parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
+ }
+ }
+
+ var code = element.textContent;
+
+ var env = {
+ element: element,
+ language: language,
+ grammar: grammar,
+ code: code
+ };
+
+ _.hooks.run('before-sanity-check', env);
+
+ if (!env.code || !env.grammar) {
+ if (env.code) {
+ _.hooks.run('before-highlight', env);
+ env.element.textContent = env.code;
+ _.hooks.run('after-highlight', env);
+ }
+ _.hooks.run('complete', env);
+ return;
+ }
+
+ _.hooks.run('before-highlight', env);
+
+ if (async && _self.Worker) {
+ var worker = new Worker(_.filename);
+
+ worker.onmessage = function(evt) {
+ env.highlightedCode = evt.data;
+
+ _.hooks.run('before-insert', env);
+
+ env.element.innerHTML = env.highlightedCode;
+
+ callback && callback.call(env.element);
+ _.hooks.run('after-highlight', env);
+ _.hooks.run('complete', env);
+ };
+
+ worker.postMessage(JSON.stringify({
+ language: env.language,
+ code: env.code,
+ immediateClose: true
+ }));
+ }
+ else {
+ env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
+
+ _.hooks.run('before-insert', env);
+
+ env.element.innerHTML = env.highlightedCode;
+
+ callback && callback.call(element);
+
+ _.hooks.run('after-highlight', env);
+ _.hooks.run('complete', env);
+ }
+ },
+
+ highlight: function (text, grammar, language) {
+ var tokens = _.tokenize(text, grammar);
+ return Token.stringify(_.util.encode(tokens), language);
+ },
+
+ matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
+ var Token = _.Token;
+
+ for (var token in grammar) {
+ if(!grammar.hasOwnProperty(token) || !grammar[token]) {
+ continue;
+ }
+
+ if (token == target) {
+ return;
+ }
+
+ var patterns = grammar[token];
+ patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
+
+ for (var j = 0; j < patterns.length; ++j) {
+ var pattern = patterns[j],
+ inside = pattern.inside,
+ lookbehind = !!pattern.lookbehind,
+ greedy = !!pattern.greedy,
+ lookbehindLength = 0,
+ alias = pattern.alias;
+
+ if (greedy && !pattern.pattern.global) {
+ // Without the global flag, lastIndex won't work
+ var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
+ pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
+ }
+
+ pattern = pattern.pattern || pattern;
+
+ // Don’t cache length as it changes during the loop
+ for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
+
+ var str = strarr[i];
+
+ if (strarr.length > text.length) {
+ // Something went terribly wrong, ABORT, ABORT!
+ return;
+ }
+
+ if (str instanceof Token) {
+ continue;
+ }
+
+ pattern.lastIndex = 0;
+
+ var match = pattern.exec(str),
+ delNum = 1;
+
+ // Greedy patterns can override/remove up to two previously matched tokens
+ if (!match && greedy && i != strarr.length - 1) {
+ pattern.lastIndex = pos;
+ match = pattern.exec(text);
+ if (!match) {
+ break;
+ }
+
+ var from = match.index + (lookbehind ? match[1].length : 0),
+ to = match.index + match[0].length,
+ k = i,
+ p = pos;
+
+ for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
+ p += strarr[k].length;
+ // Move the index i to the element in strarr that is closest to from
+ if (from >= p) {
+ ++i;
+ pos = p;
+ }
+ }
+
+ /*
+ * If strarr[i] is a Token, then the match starts inside another Token, which is invalid
+ * If strarr[k - 1] is greedy we are in conflict with another greedy pattern
+ */
+ if (strarr[i] instanceof Token || strarr[k - 1].greedy) {
+ continue;
+ }
+
+ // Number of tokens to delete and replace with the new match
+ delNum = k - i;
+ str = text.slice(pos, p);
+ match.index -= pos;
+ }
+
+ if (!match) {
+ if (oneshot) {
+ break;
+ }
+
+ continue;
+ }
+
+ if(lookbehind) {
+ lookbehindLength = match[1].length;
+ }
+
+ var from = match.index + lookbehindLength,
+ match = match[0].slice(lookbehindLength),
+ to = from + match.length,
+ before = str.slice(0, from),
+ after = str.slice(to);
+
+ var args = [i, delNum];
+
+ if (before) {
+ ++i;
+ pos += before.length;
+ args.push(before);
+ }
+
+ var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
+
+ args.push(wrapped);
+
+ if (after) {
+ args.push(after);
+ }
+
+ Array.prototype.splice.apply(strarr, args);
+
+ if (delNum != 1)
+ _.matchGrammar(text, strarr, grammar, i, pos, true, token);
+
+ if (oneshot)
+ break;
+ }
+ }
+ }
+ },
+
+ tokenize: function(text, grammar, language) {
+ var strarr = [text];
+
+ var rest = grammar.rest;
+
+ if (rest) {
+ for (var token in rest) {
+ grammar[token] = rest[token];
+ }
+
+ delete grammar.rest;
+ }
+
+ _.matchGrammar(text, strarr, grammar, 0, 0, false);
+
+ return strarr;
+ },
+
+ hooks: {
+ all: {},
+
+ add: function (name, callback) {
+ var hooks = _.hooks.all;
+
+ hooks[name] = hooks[name] || [];
+
+ hooks[name].push(callback);
+ },
+
+ run: function (name, env) {
+ var callbacks = _.hooks.all[name];
+
+ if (!callbacks || !callbacks.length) {
+ return;
+ }
+
+ for (var i=0, callback; callback = callbacks[i++];) {
+ callback(env);
+ }
+ }
+ }
+ };
+
+ var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
+ this.type = type;
+ this.content = content;
+ this.alias = alias;
+ // Copy of the full string this token was created from
+ this.length = (matchedStr || "").length|0;
+ this.greedy = !!greedy;
+ };
+
+ Token.stringify = function(o, language, parent) {
+ if (typeof o == 'string') {
+ return o;
+ }
+
+ if (_.util.type(o) === 'Array') {
+ return o.map(function(element) {
+ return Token.stringify(element, language, o);
+ }).join('');
+ }
+
+ var env = {
+ type: o.type,
+ content: Token.stringify(o.content, language, parent),
+ tag: 'span',
+ classes: ['token', o.type],
+ attributes: {},
+ language: language,
+ parent: parent
+ };
+
+ if (o.alias) {
+ var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
+ Array.prototype.push.apply(env.classes, aliases);
+ }
+
+ _.hooks.run('wrap', env);
+
+ var attributes = Object.keys(env.attributes).map(function(name) {
+ return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
+ }).join(' ');
+
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
+
+ };
+
+ if (!_self.document) {
+ if (!_self.addEventListener) {
+ // in Node.js
+ return _self.Prism;
+ }
+
+ if (!_.disableWorkerMessageHandler) {
+ // In worker
+ _self.addEventListener('message', function (evt) {
+ var message = JSON.parse(evt.data),
+ lang = message.language,
+ code = message.code,
+ immediateClose = message.immediateClose;
+
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
+ if (immediateClose) {
+ _self.close();
+ }
+ }, false);
+ }
+
+ return _self.Prism;
+ }
+
+//Get current script and highlight
+ var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
+
+ if (script) {
+ _.filename = script.src;
+
+ if (!_.manual && !script.hasAttribute('data-manual')) {
+ if(document.readyState !== "loading") {
+ if (window.requestAnimationFrame) {
+ window.requestAnimationFrame(_.highlightAll);
+ } else {
+ window.setTimeout(_.highlightAll, 16);
+ }
+ }
+ else {
+ document.addEventListener('DOMContentLoaded', _.highlightAll);
+ }
+ }
+ }
+
+ return _self.Prism;
+
+})();
+
+if (typeof module !== 'undefined' && module.exports) {
+ module.exports = Prism;
+}
+
+// hack for components to work correctly in node.js
+if (typeof global !== 'undefined') {
+ global.Prism = Prism;
+}
+;
+Prism.languages.markup = {
+ 'comment': /<!--[\s\S]*?-->/,
+ 'prolog': /<\?[\s\S]+?\?>/,
+ 'doctype': /<!DOCTYPE[\s\S]+?>/i,
+ 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
+ 'tag': {
+ pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
+ inside: {
+ 'tag': {
+ pattern: /^<\/?[^\s>\/]+/i,
+ inside: {
+ 'punctuation': /^<\/?/,
+ 'namespace': /^[^\s>\/:]+:/
+ }
+ },
+ 'attr-value': {
+ pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
+ inside: {
+ 'punctuation': [
+ /^=/,
+ {
+ pattern: /(^|[^\\])["']/,
+ lookbehind: true
+ }
+ ]
+ }
+ },
+ 'punctuation': /\/?>/,
+ 'attr-name': {
+ pattern: /[^\s>\/]+/,
+ inside: {
+ 'namespace': /^[^\s>\/:]+:/
+ }
+ }
+
+ }
+ },
+ 'entity': /&#?[\da-z]{1,8};/i
+};
+
+Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
+ Prism.languages.markup['entity'];
+
+// Plugin to make entity title show the real entity, idea by Roman Komarov
+Prism.hooks.add('wrap', function(env) {
+
+ if (env.type === 'entity') {
+ env.attributes['title'] = env.content.replace(/&/, '&');
+ }
+});
+
+Prism.languages.xml = Prism.languages.markup;
+Prism.languages.html = Prism.languages.markup;
+Prism.languages.mathml = Prism.languages.markup;
+Prism.languages.svg = Prism.languages.markup;
+
+Prism.languages.css = {
+ 'comment': /\/\*[\s\S]*?\*\//,
+ 'atrule': {
+ pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
+ inside: {
+ 'rule': /@[\w-]+/
+ // See rest below
+ }
+ },
+ 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
+ 'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
+ 'string': {
+ pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ greedy: true
+ },
+ 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
+ 'important': /\B!important\b/i,
+ 'function': /[-a-z0-9]+(?=\()/i,
+ 'punctuation': /[(){};:]/
+};
+
+Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
+
+if (Prism.languages.markup) {
+ Prism.languages.insertBefore('markup', 'tag', {
+ 'style': {
+ pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
+ lookbehind: true,
+ inside: Prism.languages.css,
+ alias: 'language-css',
+ greedy: true
+ }
+ });
+
+ Prism.languages.insertBefore('inside', 'attr-value', {
+ 'style-attr': {
+ pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
+ inside: {
+ 'attr-name': {
+ pattern: /^\s*style/i,
+ inside: Prism.languages.markup.tag.inside
+ },
+ 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
+ 'attr-value': {
+ pattern: /.+/i,
+ inside: Prism.languages.css
+ }
+ },
+ alias: 'language-css'
+ }
+ }, Prism.languages.markup.tag);
+};
+Prism.languages.clike = {
+ 'comment': [
+ {
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
+ lookbehind: true
+ },
+ {
+ pattern: /(^|[^\\:])\/\/.*/,
+ lookbehind: true
+ }
+ ],
+ 'string': {
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ greedy: true
+ },
+ 'class-name': {
+ pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
+ lookbehind: true,
+ inside: {
+ punctuation: /[.\\]/
+ }
+ },
+ 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'function': /[a-z0-9_]+(?=\()/i,
+ 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
+ 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
+ 'punctuation': /[{}[\];(),.:]/
+};
+
+Prism.languages.javascript = Prism.languages.extend('clike', {
+ 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
+ 'number': /\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
+ 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,
+ 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
+});
+
+Prism.languages.insertBefore('javascript', 'keyword', {
+ 'regex': {
+ pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
+ lookbehind: true,
+ greedy: true
+ },
+ // This must be declared before keyword because we use "function" inside the look-forward
+ 'function-variable': {
+ pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
+ alias: 'function'
+ }
+});
+
+Prism.languages.insertBefore('javascript', 'string', {
+ 'template-string': {
+ pattern: /`(?:\\[\s\S]|[^\\`])*`/,
+ greedy: true,
+ inside: {
+ 'interpolation': {
+ pattern: /\$\{[^}]+\}/,
+ inside: {
+ 'interpolation-punctuation': {
+ pattern: /^\$\{|\}$/,
+ alias: 'punctuation'
+ },
+ rest: Prism.languages.javascript
+ }
+ },
+ 'string': /[\s\S]+/
+ }
+ }
+});
+
+if (Prism.languages.markup) {
+ Prism.languages.insertBefore('markup', 'tag', {
+ 'script': {
+ pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
+ lookbehind: true,
+ inside: Prism.languages.javascript,
+ alias: 'language-javascript',
+ greedy: true
+ }
+ });
+}
+
+Prism.languages.js = Prism.languages.javascript;
+
+(function(Prism) {
+ var insideString = {
+ variable: [
+ // Arithmetic Environment
+ {
+ pattern: /\$?\(\([\s\S]+?\)\)/,
+ inside: {
+ // If there is a $ sign at the beginning highlight $(( and )) as variable
+ variable: [{
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
+ lookbehind: true
+ },
+ /^\$\(\(/
+ ],
+ number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,
+ // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
+ operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
+ // If there is no $ sign at the beginning highlight (( and )) as punctuation
+ punctuation: /\(\(?|\)\)?|,|;/
+ }
+ },
+ // Command Substitution
+ {
+ pattern: /\$\([^)]+\)|`[^`]+`/,
+ inside: {
+ variable: /^\$\(|^`|\)$|`$/
+ }
+ },
+ /\$(?:[\w#?*!@]+|\{[^}]+\})/i
+ ]
+ };
+
+ Prism.languages.bash = {
+ 'shebang': {
+ pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
+ alias: 'important'
+ },
+ 'comment': {
+ pattern: /(^|[^"{\\])#.*/,
+ lookbehind: true
+ },
+ 'string': [
+ //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
+ {
+ pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,
+ lookbehind: true,
+ greedy: true,
+ inside: insideString
+ },
+ {
+ pattern: /(["'])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
+ greedy: true,
+ inside: insideString
+ }
+ ],
+ 'variable': insideString.variable,
+ // Originally based on http://ss64.com/bash/
+ 'function': {
+ pattern: /(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash| [...]
+ lookbehind: true
+ },
+ 'keyword': {
+ pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,
+ lookbehind: true
+ },
+ 'boolean': {
+ pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,
+ lookbehind: true
+ },
+ 'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
+ 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
+ };
+
+ var inside = insideString.variable[1].inside;
+ inside['function'] = Prism.languages.bash['function'];
+ inside.keyword = Prism.languages.bash.keyword;
+ inside.boolean = Prism.languages.bash.boolean;
+ inside.operator = Prism.languages.bash.operator;
+ inside.punctuation = Prism.languages.bash.punctuation;
+})(Prism);
+
+Prism.languages.java = Prism.languages.extend('clike', {
+ 'keyword': /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
+ 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
+ 'operator': {
+ pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
+ lookbehind: true
+ }
+});
+
+Prism.languages.insertBefore('java','function', {
+ 'annotation': {
+ alias: 'punctuation',
+ pattern: /(^|[^.])@\w+/,
+ lookbehind: true
+ }
+});
+
+/* FIXME :
+ :extend() is not handled specifically : its highlighting is buggy.
+ Mixin usage must be inside a ruleset to be highlighted.
+ At-rules (e.g. import) containing interpolations are buggy.
+ Detached rulesets are highlighted as at-rules.
+ A comment before a mixin usage prevents the latter to be properly highlighted.
+ */
+
+Prism.languages.less = Prism.languages.extend('css', {
+ 'comment': [
+ /\/\*[\s\S]*?\*\//,
+ {
+ pattern: /(^|[^\\])\/\/.*/,
+ lookbehind: true
+ }
+ ],
+ 'atrule': {
+ pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,
+ inside: {
+ 'punctuation': /[:()]/
+ }
+ },
+ // selectors and mixins are considered the same
+ 'selector': {
+ pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,
+ inside: {
+ // mixin parameters
+ 'variable': /@+[\w-]+/
+ }
+ },
+
+ 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
+ 'punctuation': /[{}();:,]/,
+ 'operator': /[+\-*\/]/
+});
+
+// Invert function and punctuation positions
+Prism.languages.insertBefore('less', 'punctuation', {
+ 'function': Prism.languages.less.function
+});
+
+Prism.languages.insertBefore('less', 'property', {
+ 'variable': [
+ // Variable declaration (the colon must be consumed!)
+ {
+ pattern: /@[\w-]+\s*:/,
+ inside: {
+ "punctuation": /:/
+ }
+ },
+
+ // Variable usage
+ /@@?[\w-]+/
+ ],
+ 'mixin-usage': {
+ pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
+ lookbehind: true,
+ alias: 'function'
+ }
+});
+
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/script/prism.js b/tobago-example/tobago-example-demo/src/main/webapp/script/prism.js
deleted file mode 100644
index 105ef92..0000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/script/prism.js
+++ /dev/null
@@ -1,682 +0,0 @@
-/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+java+less */
-var _self = (typeof window !== 'undefined')
- ? window // if in browser
- : (
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
- ? self // if in worker
- : {} // if in node js
- );
-
-/**
- * Prism: Lightweight, robust, elegant syntax highlighting
- * MIT license http://www.opensource.org/licenses/mit-license.php/
- * @author Lea Verou
- */
-
-var Prism = (function(){
-
-// Private helper vars
-var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
-
-var _ = _self.Prism = {
- util: {
- encode: function (tokens) {
- if (tokens instanceof Token) {
- return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
- } else if (_.util.type(tokens) === 'Array') {
- return tokens.map(_.util.encode);
- } else {
- return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
- }
- },
-
- type: function (o) {
- return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
- },
-
- // Deep clone a language definition (e.g. to extend it)
- clone: function (o) {
- var type = _.util.type(o);
-
- switch (type) {
- case 'Object':
- var clone = {};
-
- for (var key in o) {
- if (o.hasOwnProperty(key)) {
- clone[key] = _.util.clone(o[key]);
- }
- }
-
- return clone;
-
- case 'Array':
- // Check for existence for IE8
- return o.map && o.map(function(v) { return _.util.clone(v); });
- }
-
- return o;
- }
- },
-
- languages: {
- extend: function (id, redef) {
- var lang = _.util.clone(_.languages[id]);
-
- for (var key in redef) {
- lang[key] = redef[key];
- }
-
- return lang;
- },
-
- /**
- * Insert a token before another token in a language literal
- * As this needs to recreate the object (we cannot actually insert before keys in object literals),
- * we cannot just provide an object, we need anobject and a key.
- * @param inside The key (or language id) of the parent
- * @param before The key to insert before. If not provided, the function appends instead.
- * @param insert Object with the key/value pairs to insert
- * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
- */
- insertBefore: function (inside, before, insert, root) {
- root = root || _.languages;
- var grammar = root[inside];
-
- if (arguments.length == 2) {
- insert = arguments[1];
-
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- grammar[newToken] = insert[newToken];
- }
- }
-
- return grammar;
- }
-
- var ret = {};
-
- for (var token in grammar) {
-
- if (grammar.hasOwnProperty(token)) {
-
- if (token == before) {
-
- for (var newToken in insert) {
-
- if (insert.hasOwnProperty(newToken)) {
- ret[newToken] = insert[newToken];
- }
- }
- }
-
- ret[token] = grammar[token];
- }
- }
-
- // Update references in other language definitions
- _.languages.DFS(_.languages, function(key, value) {
- if (value === root[inside] && key != inside) {
- this[key] = ret;
- }
- });
-
- return root[inside] = ret;
- },
-
- // Traverse a language definition with Depth First Search
- DFS: function(o, callback, type) {
- for (var i in o) {
- if (o.hasOwnProperty(i)) {
- callback.call(o, i, o[i], type || i);
-
- if (_.util.type(o[i]) === 'Object') {
- _.languages.DFS(o[i], callback);
- }
- else if (_.util.type(o[i]) === 'Array') {
- _.languages.DFS(o[i], callback, i);
- }
- }
- }
- }
- },
- plugins: {},
-
- highlightAll: function(async, callback) {
- var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
-
- for (var i=0, element; element = elements[i++];) {
- _.highlightElement(element, async === true, callback);
- }
- },
-
- highlightElement: function(element, async, callback) {
- // Find language
- var language, grammar, parent = element;
-
- while (parent && !lang.test(parent.className)) {
- parent = parent.parentNode;
- }
-
- if (parent) {
- language = (parent.className.match(lang) || [,''])[1];
- grammar = _.languages[language];
- }
-
- // Set language on the element, if not present
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
-
- // Set language on the parent, for styling
- parent = element.parentNode;
-
- if (/pre/i.test(parent.nodeName)) {
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
- }
-
- var code = element.textContent;
-
- var env = {
- element: element,
- language: language,
- grammar: grammar,
- code: code
- };
-
- if (!code || !grammar) {
- _.hooks.run('complete', env);
- return;
- }
-
- _.hooks.run('before-highlight', env);
-
- if (async && _self.Worker) {
- var worker = new Worker(_.filename);
-
- worker.onmessage = function(evt) {
- env.highlightedCode = evt.data;
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(env.element);
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- };
-
- worker.postMessage(JSON.stringify({
- language: env.language,
- code: env.code,
- immediateClose: true
- }));
- }
- else {
- env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(element);
-
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- }
- },
-
- highlight: function (text, grammar, language) {
- var tokens = _.tokenize(text, grammar);
- return Token.stringify(_.util.encode(tokens), language);
- },
-
- tokenize: function(text, grammar, language) {
- var Token = _.Token;
-
- var strarr = [text];
-
- var rest = grammar.rest;
-
- if (rest) {
- for (var token in rest) {
- grammar[token] = rest[token];
- }
-
- delete grammar.rest;
- }
-
- tokenloop: for (var token in grammar) {
- if(!grammar.hasOwnProperty(token) || !grammar[token]) {
- continue;
- }
-
- var patterns = grammar[token];
- patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
-
- for (var j = 0; j < patterns.length; ++j) {
- var pattern = patterns[j],
- inside = pattern.inside,
- lookbehind = !!pattern.lookbehind,
- lookbehindLength = 0,
- alias = pattern.alias;
-
- pattern = pattern.pattern || pattern;
-
- for (var i=0; i<strarr.length; i++) { // Don’t cache length as it changes during the loop
-
- var str = strarr[i];
-
- if (strarr.length > text.length) {
- // Something went terribly wrong, ABORT, ABORT!
- break tokenloop;
- }
-
- if (str instanceof Token) {
- continue;
- }
-
- pattern.lastIndex = 0;
-
- var match = pattern.exec(str);
-
- if (match) {
- if(lookbehind) {
- lookbehindLength = match[1].length;
- }
-
- var from = match.index - 1 + lookbehindLength,
- match = match[0].slice(lookbehindLength),
- len = match.length,
- to = from + len,
- before = str.slice(0, from + 1),
- after = str.slice(to + 1);
-
- var args = [i, 1];
-
- if (before) {
- args.push(before);
- }
-
- var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias);
-
- args.push(wrapped);
-
- if (after) {
- args.push(after);
- }
-
- Array.prototype.splice.apply(strarr, args);
- }
- }
- }
- }
-
- return strarr;
- },
-
- hooks: {
- all: {},
-
- add: function (name, callback) {
- var hooks = _.hooks.all;
-
- hooks[name] = hooks[name] || [];
-
- hooks[name].push(callback);
- },
-
- run: function (name, env) {
- var callbacks = _.hooks.all[name];
-
- if (!callbacks || !callbacks.length) {
- return;
- }
-
- for (var i=0, callback; callback = callbacks[i++];) {
- callback(env);
- }
- }
- }
-};
-
-var Token = _.Token = function(type, content, alias) {
- this.type = type;
- this.content = content;
- this.alias = alias;
-};
-
-Token.stringify = function(o, language, parent) {
- if (typeof o == 'string') {
- return o;
- }
-
- if (_.util.type(o) === 'Array') {
- return o.map(function(element) {
- return Token.stringify(element, language, o);
- }).join('');
- }
-
- var env = {
- type: o.type,
- content: Token.stringify(o.content, language, parent),
- tag: 'span',
- classes: ['token', o.type],
- attributes: {},
- language: language,
- parent: parent
- };
-
- if (env.type == 'comment') {
- env.attributes['spellcheck'] = 'true';
- }
-
- if (o.alias) {
- var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
- Array.prototype.push.apply(env.classes, aliases);
- }
-
- _.hooks.run('wrap', env);
-
- var attributes = '';
-
- for (var name in env.attributes) {
- attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"';
- }
-
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
-
-};
-
-if (!_self.document) {
- if (!_self.addEventListener) {
- // in Node.js
- return _self.Prism;
- }
- // In worker
- _self.addEventListener('message', function(evt) {
- var message = JSON.parse(evt.data),
- lang = message.language,
- code = message.code,
- immediateClose = message.immediateClose;
-
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
- if (immediateClose) {
- _self.close();
- }
- }, false);
-
- return _self.Prism;
-}
-
-// Get current script and highlight
-var script = document.getElementsByTagName('script');
-
-script = script[script.length - 1];
-
-if (script) {
- _.filename = script.src;
-
- if (document.addEventListener && !script.hasAttribute('data-manual')) {
- document.addEventListener('DOMContentLoaded', _.highlightAll);
- }
-}
-
-return _self.Prism;
-
-})();
-
-if (typeof module !== 'undefined' && module.exports) {
- module.exports = Prism;
-}
-
-// hack for components to work correctly in node.js
-if (typeof global !== 'undefined') {
- global.Prism = Prism;
-}
-;
-Prism.languages.markup = {
- 'comment': /<!--[\w\W]*?-->/,
- 'prolog': /<\?[\w\W]+?\?>/,
- 'doctype': /<!DOCTYPE[\w\W]+?>/,
- 'cdata': /<!\[CDATA\[[\w\W]*?]]>/i,
- 'tag': {
- pattern: /<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,
- inside: {
- 'tag': {
- pattern: /^<\/?[^\s>\/]+/i,
- inside: {
- 'punctuation': /^<\/?/,
- 'namespace': /^[^\s>\/:]+:/
- }
- },
- 'attr-value': {
- pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,
- inside: {
- 'punctuation': /[=>"']/
- }
- },
- 'punctuation': /\/?>/,
- 'attr-name': {
- pattern: /[^\s>\/]+/,
- inside: {
- 'namespace': /^[^\s>\/:]+:/
- }
- }
-
- }
- },
- 'entity': /&#?[\da-z]{1,8};/i
-};
-
-// Plugin to make entity title show the real entity, idea by Roman Komarov
-Prism.hooks.add('wrap', function(env) {
-
- if (env.type === 'entity') {
- env.attributes['title'] = env.content.replace(/&/, '&');
- }
-});
-
-Prism.languages.xml = Prism.languages.markup;
-Prism.languages.html = Prism.languages.markup;
-Prism.languages.mathml = Prism.languages.markup;
-Prism.languages.svg = Prism.languages.markup;
-
-Prism.languages.css = {
- 'comment': /\/\*[\w\W]*?\*\//,
- 'atrule': {
- pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
- inside: {
- 'rule': /@[\w-]+/
- // See rest below
- }
- },
- 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
- 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
- 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
- 'property': /(\b|\B)[\w-]+(?=\s*:)/i,
- 'important': /\B!important\b/i,
- 'function': /[-a-z0-9]+(?=\()/i,
- 'punctuation': /[(){};:]/
-};
-
-Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
-
-if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'style': {
- pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/i,
- inside: {
- 'tag': {
- pattern: /<style[\w\W]*?>|<\/style>/i,
- inside: Prism.languages.markup.tag.inside
- },
- rest: Prism.languages.css
- },
- alias: 'language-css'
- }
- });
-
- Prism.languages.insertBefore('inside', 'attr-value', {
- 'style-attr': {
- pattern: /\s*style=("|').*?\1/i,
- inside: {
- 'attr-name': {
- pattern: /^\s*style/i,
- inside: Prism.languages.markup.tag.inside
- },
- 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
- 'attr-value': {
- pattern: /.+/i,
- inside: Prism.languages.css
- }
- },
- alias: 'language-css'
- }
- }, Prism.languages.markup.tag);
-};
-Prism.languages.clike = {
- 'comment': [
- {
- pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true
- }
- ],
- 'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- 'class-name': {
- pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
- lookbehind: true,
- inside: {
- punctuation: /(\.|\\)/
- }
- },
- 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
- 'boolean': /\b(true|false)\b/,
- 'function': /[a-z0-9_]+(?=\()/i,
- 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
- 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
- 'punctuation': /[{}[\];(),.:]/
-};
-
-Prism.languages.javascript = Prism.languages.extend('clike', {
- 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,
- 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
- 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
-});
-
-Prism.languages.insertBefore('javascript', 'keyword', {
- 'regex': {
- pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
- lookbehind: true
- }
-});
-
-Prism.languages.insertBefore('javascript', 'class-name', {
- 'template-string': {
- pattern: /`(?:\\`|\\?[^`])*`/,
- inside: {
- 'interpolation': {
- pattern: /\$\{[^}]+\}/,
- inside: {
- 'interpolation-punctuation': {
- pattern: /^\$\{|\}$/,
- alias: 'punctuation'
- },
- rest: Prism.languages.javascript
- }
- },
- 'string': /[\s\S]+/
- }
- }
-});
-
-if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'script': {
- pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i,
- inside: {
- 'tag': {
- pattern: /<script[\w\W]*?>|<\/script>/i,
- inside: Prism.languages.markup.tag.inside
- },
- rest: Prism.languages.javascript
- },
- alias: 'language-javascript'
- }
- });
-}
-
-Prism.languages.js = Prism.languages.javascript;
-Prism.languages.java = Prism.languages.extend('clike', {
- 'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
- 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
- 'operator': {
- pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
- lookbehind: true
- }
-});
-/* FIXME :
- :extend() is not handled specifically : its highlighting is buggy.
- Mixin usage must be inside a ruleset to be highlighted.
- At-rules (e.g. import) containing interpolations are buggy.
- Detached rulesets are highlighted as at-rules.
- A comment before a mixin usage prevents the latter to be properly highlighted.
- */
-
-Prism.languages.less = Prism.languages.extend('css', {
- 'comment': [
- /\/\*[\w\W]*?\*\//,
- {
- pattern: /(^|[^\\])\/\/.*/,
- lookbehind: true
- }
- ],
- 'atrule': {
- pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,
- inside: {
- 'punctuation': /[:()]/
- }
- },
- // selectors and mixins are considered the same
- 'selector': {
- pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,
- inside: {
- // mixin parameters
- 'variable': /@+[\w-]+/
- }
- },
-
- 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
- 'punctuation': /[{}();:,]/,
- 'operator': /[+\-*\/]/
-});
-
-// Invert function and punctuation positions
-Prism.languages.insertBefore('less', 'punctuation', {
- 'function': Prism.languages.less.function
-});
-
-Prism.languages.insertBefore('less', 'property', {
- 'variable': [
- // Variable declaration (the colon must be consumed!)
- {
- pattern: /@[\w-]+\s*:/,
- inside: {
- "punctuation": /:/
- }
- },
-
- // Variable usage
- /@@?[\w-]+/
- ],
- 'mixin-usage': {
- pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
- lookbehind: true,
- alias: 'function'
- }
-});
-
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/style/prism.css b/tobago-example/tobago-example-demo/src/main/webapp/style/prism-1.9.0.css
similarity index 93%
rename from tobago-example/tobago-example-demo/src/main/webapp/style/prism.css
rename to tobago-example/tobago-example-demo/src/main/webapp/style/prism-1.9.0.css
index 6e9eed2..fef9367 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/style/prism.css
+++ b/tobago-example/tobago-example-demo/src/main/webapp/style/prism-1.9.0.css
@@ -1,4 +1,5 @@
-/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+java+less */
+/* PrismJS 1.9.0
+http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+java+less */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
@@ -8,9 +9,9 @@
code[class*="language-"],
pre[class*="language-"] {
color: black;
+ background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
- direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
@@ -63,6 +64,7 @@ pre[class*="language-"] {
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
+ white-space: normal;
}
.token.comment,
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.