mirror of https://github.com/abpframework/abp.git
380 changed files with 21090 additions and 2 deletions
@ -0,0 +1,335 @@ |
|||||
|
/* eslint-env amd, node */ |
||||
|
|
||||
|
// https://github.com/umdjs/umd/blob/master/templates/returnExports.js
|
||||
|
(function (root, factory) { |
||||
|
'use strict'; |
||||
|
|
||||
|
if (typeof define === 'function' && define.amd) { |
||||
|
// AMD. Register as an anonymous module.
|
||||
|
define([], factory); |
||||
|
} else if (typeof module === 'object' && module.exports) { |
||||
|
// Node. Does not work with strict CommonJS, but
|
||||
|
// only CommonJS-like environments that support module.exports,
|
||||
|
// like Node.
|
||||
|
module.exports = factory(); |
||||
|
} else { |
||||
|
// Browser globals (root is window)
|
||||
|
root.AnchorJS = factory(); |
||||
|
root.anchors = new root.AnchorJS(); |
||||
|
} |
||||
|
}(this, function () { |
||||
|
'use strict'; |
||||
|
|
||||
|
function AnchorJS(options) { |
||||
|
this.options = options || {}; |
||||
|
this.elements = []; |
||||
|
|
||||
|
/** |
||||
|
* Assigns options to the internal options object, and provides defaults. |
||||
|
* @param {Object} opts - Options object |
||||
|
*/ |
||||
|
function _applyRemainingDefaultOptions(opts) { |
||||
|
opts.icon = opts.hasOwnProperty('icon') ? opts.icon : '\ue9cb'; // Accepts characters (and also URLs?), like '#', '¶', '❡', or '§'.
|
||||
|
opts.visible = opts.hasOwnProperty('visible') ? opts.visible : 'hover'; // Also accepts 'always' & 'touch'
|
||||
|
opts.placement = opts.hasOwnProperty('placement') ? opts.placement : 'right'; // Also accepts 'left'
|
||||
|
opts.ariaLabel = opts.hasOwnProperty('ariaLabel') ? opts.ariaLabel : 'Anchor'; // Accepts any text.
|
||||
|
opts.class = opts.hasOwnProperty('class') ? opts.class : ''; // Accepts any class name.
|
||||
|
// Using Math.floor here will ensure the value is Number-cast and an integer.
|
||||
|
opts.truncate = opts.hasOwnProperty('truncate') ? Math.floor(opts.truncate) : 64; // Accepts any value that can be typecast to a number.
|
||||
|
} |
||||
|
|
||||
|
_applyRemainingDefaultOptions(this.options); |
||||
|
|
||||
|
/** |
||||
|
* Checks to see if this device supports touch. Uses criteria pulled from Modernizr: |
||||
|
* https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40
|
||||
|
* @return {Boolean} - true if the current device supports touch. |
||||
|
*/ |
||||
|
this.isTouchDevice = function() { |
||||
|
return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Add anchor links to page elements. |
||||
|
* @param {String|Array|Nodelist} selector - A CSS selector for targeting the elements you wish to add anchor links |
||||
|
* to. Also accepts an array or nodeList containing the relavant elements. |
||||
|
* @return {this} - The AnchorJS object |
||||
|
*/ |
||||
|
this.add = function(selector) { |
||||
|
var elements, |
||||
|
elsWithIds, |
||||
|
idList, |
||||
|
elementID, |
||||
|
i, |
||||
|
index, |
||||
|
count, |
||||
|
tidyText, |
||||
|
newTidyText, |
||||
|
readableID, |
||||
|
anchor, |
||||
|
visibleOptionToUse, |
||||
|
indexesToDrop = []; |
||||
|
|
||||
|
// We reapply options here because somebody may have overwritten the default options object when setting options.
|
||||
|
// For example, this overwrites all options but visible:
|
||||
|
//
|
||||
|
// anchors.options = { visible: 'always'; }
|
||||
|
_applyRemainingDefaultOptions(this.options); |
||||
|
|
||||
|
visibleOptionToUse = this.options.visible; |
||||
|
if (visibleOptionToUse === 'touch') { |
||||
|
visibleOptionToUse = this.isTouchDevice() ? 'always' : 'hover'; |
||||
|
} |
||||
|
|
||||
|
// Provide a sensible default selector, if none is given.
|
||||
|
if (!selector) { |
||||
|
selector = 'h2, h3, h4, h5, h6'; |
||||
|
} |
||||
|
|
||||
|
elements = _getElements(selector); |
||||
|
|
||||
|
if (elements.length === 0) { |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
_addBaselineStyles(); |
||||
|
|
||||
|
// We produce a list of existing IDs so we don't generate a duplicate.
|
||||
|
elsWithIds = document.querySelectorAll('[id]'); |
||||
|
idList = [].map.call(elsWithIds, function assign(el) { |
||||
|
return el.id; |
||||
|
}); |
||||
|
|
||||
|
for (i = 0; i < elements.length; i++) { |
||||
|
if (this.hasAnchorJSLink(elements[i])) { |
||||
|
indexesToDrop.push(i); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
if (elements[i].hasAttribute('id')) { |
||||
|
elementID = elements[i].getAttribute('id'); |
||||
|
} else if (elements[i].hasAttribute('data-anchor-id')) { |
||||
|
elementID = elements[i].getAttribute('data-anchor-id'); |
||||
|
} else { |
||||
|
tidyText = this.urlify(elements[i].textContent); |
||||
|
|
||||
|
// Compare our generated ID to existing IDs (and increment it if needed)
|
||||
|
// before we add it to the page.
|
||||
|
newTidyText = tidyText; |
||||
|
count = 0; |
||||
|
do { |
||||
|
if (index !== undefined) { |
||||
|
newTidyText = tidyText + '-' + count; |
||||
|
} |
||||
|
|
||||
|
index = idList.indexOf(newTidyText); |
||||
|
count += 1; |
||||
|
} while (index !== -1); |
||||
|
index = undefined; |
||||
|
idList.push(newTidyText); |
||||
|
|
||||
|
elements[i].setAttribute('id', newTidyText); |
||||
|
elementID = newTidyText; |
||||
|
} |
||||
|
|
||||
|
readableID = elementID.replace(/-/g, ' '); |
||||
|
|
||||
|
// The following code builds the following DOM structure in a more effiecient (albeit opaque) way.
|
||||
|
// '<a class="anchorjs-link ' + this.options.class + '" href="#' + elementID + '" aria-label="Anchor" data-anchorjs-icon="' + this.options.icon + '"></a>';
|
||||
|
anchor = document.createElement('a'); |
||||
|
anchor.className = 'anchorjs-link ' + this.options.class; |
||||
|
anchor.href = '#' + elementID; |
||||
|
anchor.setAttribute('aria-label', this.options.ariaLabel); |
||||
|
anchor.setAttribute('data-anchorjs-icon', this.options.icon); |
||||
|
|
||||
|
if (visibleOptionToUse === 'always') { |
||||
|
anchor.style.opacity = '1'; |
||||
|
} |
||||
|
|
||||
|
if (this.options.icon === '\ue9cb') { |
||||
|
anchor.style.font = '1em/1 anchorjs-icons'; |
||||
|
|
||||
|
// We set lineHeight = 1 here because the `anchorjs-icons` font family could otherwise affect the
|
||||
|
// height of the heading. This isn't the case for icons with `placement: left`, so we restore
|
||||
|
// line-height: inherit in that case, ensuring they remain positioned correctly. For more info,
|
||||
|
// see https://github.com/bryanbraun/anchorjs/issues/39.
|
||||
|
if (this.options.placement === 'left') { |
||||
|
anchor.style.lineHeight = 'inherit'; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (this.options.placement === 'left') { |
||||
|
anchor.style.position = 'absolute'; |
||||
|
anchor.style.marginLeft = '-1em'; |
||||
|
anchor.style.paddingRight = '0.5em'; |
||||
|
elements[i].insertBefore(anchor, elements[i].firstChild); |
||||
|
} else { // if the option provided is `right` (or anything else).
|
||||
|
anchor.style.paddingLeft = '0.375em'; |
||||
|
elements[i].appendChild(anchor); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
for (i = 0; i < indexesToDrop.length; i++) { |
||||
|
elements.splice(indexesToDrop[i] - i, 1); |
||||
|
} |
||||
|
this.elements = this.elements.concat(elements); |
||||
|
|
||||
|
return this; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Removes all anchorjs-links from elements targed by the selector. |
||||
|
* @param {String|Array|Nodelist} selector - A CSS selector string targeting elements with anchor links, |
||||
|
* OR a nodeList / array containing the DOM elements. |
||||
|
* @return {this} - The AnchorJS object |
||||
|
*/ |
||||
|
this.remove = function(selector) { |
||||
|
var index, |
||||
|
domAnchor, |
||||
|
elements = _getElements(selector); |
||||
|
|
||||
|
for (var i = 0; i < elements.length; i++) { |
||||
|
domAnchor = elements[i].querySelector('.anchorjs-link'); |
||||
|
if (domAnchor) { |
||||
|
// Drop the element from our main list, if it's in there.
|
||||
|
index = this.elements.indexOf(elements[i]); |
||||
|
if (index !== -1) { |
||||
|
this.elements.splice(index, 1); |
||||
|
} |
||||
|
// Remove the anchor from the DOM.
|
||||
|
elements[i].removeChild(domAnchor); |
||||
|
} |
||||
|
} |
||||
|
return this; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Removes all anchorjs links. Mostly used for tests. |
||||
|
*/ |
||||
|
this.removeAll = function() { |
||||
|
this.remove(this.elements); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Urlify - Refine text so it makes a good ID. |
||||
|
* |
||||
|
* To do this, we remove apostrophes, replace nonsafe characters with hyphens, |
||||
|
* remove extra hyphens, truncate, trim hyphens, and make lowercase. |
||||
|
* |
||||
|
* @param {String} text - Any text. Usually pulled from the webpage element we are linking to. |
||||
|
* @return {String} - hyphen-delimited text for use in IDs and URLs. |
||||
|
*/ |
||||
|
this.urlify = function(text) { |
||||
|
// Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\ (newlines, tabs, backspace, & vertical tabs)
|
||||
|
var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g, |
||||
|
urlText; |
||||
|
|
||||
|
// The reason we include this _applyRemainingDefaultOptions is so urlify can be called independently,
|
||||
|
// even after setting options. This can be useful for tests or other applications.
|
||||
|
if (!this.options.truncate) { |
||||
|
_applyRemainingDefaultOptions(this.options); |
||||
|
} |
||||
|
|
||||
|
// Note: we trim hyphens after truncating because truncating can cause dangling hyphens.
|
||||
|
// Example string: // " ⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean."
|
||||
|
urlText = text.trim() // "⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean."
|
||||
|
.replace(/\'/gi, '') // "⚡⚡ Dont forget: URL fragments should be i18n-friendly, hyphenated, short, and clean."
|
||||
|
.replace(nonsafeChars, '-') // "⚡⚡-Dont-forget--URL-fragments-should-be-i18n-friendly--hyphenated--short--and-clean-"
|
||||
|
.replace(/-{2,}/g, '-') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-short-and-clean-"
|
||||
|
.substring(0, this.options.truncate) // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-"
|
||||
|
.replace(/^-+|-+$/gm, '') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated"
|
||||
|
.toLowerCase(); // "⚡⚡-dont-forget-url-fragments-should-be-i18n-friendly-hyphenated"
|
||||
|
|
||||
|
return urlText; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Determines if this element already has an AnchorJS link on it. |
||||
|
* Uses this technique: http://stackoverflow.com/a/5898748/1154642
|
||||
|
* @param {HTMLElemnt} el - a DOM node |
||||
|
* @return {Boolean} true/false |
||||
|
*/ |
||||
|
this.hasAnchorJSLink = function(el) { |
||||
|
var hasLeftAnchor = el.firstChild && ((' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1), |
||||
|
hasRightAnchor = el.lastChild && ((' ' + el.lastChild.className + ' ').indexOf(' anchorjs-link ') > -1); |
||||
|
|
||||
|
return hasLeftAnchor || hasRightAnchor || false; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Turns a selector, nodeList, or array of elements into an array of elements (so we can use array methods). |
||||
|
* It also throws errors on any other inputs. Used to handle inputs to .add and .remove. |
||||
|
* @param {String|Array|Nodelist} input - A CSS selector string targeting elements with anchor links, |
||||
|
* OR a nodeList / array containing the DOM elements. |
||||
|
* @return {Array} - An array containing the elements we want. |
||||
|
*/ |
||||
|
function _getElements(input) { |
||||
|
var elements; |
||||
|
if (typeof input === 'string' || input instanceof String) { |
||||
|
// See https://davidwalsh.name/nodelist-array for the technique transforming nodeList -> Array.
|
||||
|
elements = [].slice.call(document.querySelectorAll(input)); |
||||
|
// I checked the 'input instanceof NodeList' test in IE9 and modern browsers and it worked for me.
|
||||
|
} else if (Array.isArray(input) || input instanceof NodeList) { |
||||
|
elements = [].slice.call(input); |
||||
|
} else { |
||||
|
throw new Error('The selector provided to AnchorJS was invalid.'); |
||||
|
} |
||||
|
return elements; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* _addBaselineStyles |
||||
|
* Adds baseline styles to the page, used by all AnchorJS links irregardless of configuration. |
||||
|
*/ |
||||
|
function _addBaselineStyles() { |
||||
|
// We don't want to add global baseline styles if they've been added before.
|
||||
|
if (document.head.querySelector('style.anchorjs') !== null) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var style = document.createElement('style'), |
||||
|
linkRule = |
||||
|
' .anchorjs-link {' + |
||||
|
' opacity: 0;' + |
||||
|
' text-decoration: none;' + |
||||
|
' -webkit-font-smoothing: antialiased;' + |
||||
|
' -moz-osx-font-smoothing: grayscale;' + |
||||
|
' }', |
||||
|
hoverRule = |
||||
|
' *:hover > .anchorjs-link,' + |
||||
|
' .anchorjs-link:focus {' + |
||||
|
' opacity: 1;' + |
||||
|
' }', |
||||
|
anchorjsLinkFontFace = |
||||
|
' @font-face {' + |
||||
|
' font-family: "anchorjs-icons";' + // Icon from icomoon; 10px wide & 10px tall; 2 empty below & 4 above
|
||||
|
' src: url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype");' + |
||||
|
' }', |
||||
|
pseudoElContent = |
||||
|
' [data-anchorjs-icon]::after {' + |
||||
|
' content: attr(data-anchorjs-icon);' + |
||||
|
' }', |
||||
|
firstStyleEl; |
||||
|
|
||||
|
style.className = 'anchorjs'; |
||||
|
style.appendChild(document.createTextNode('')); // Necessary for Webkit.
|
||||
|
|
||||
|
// We place it in the head with the other style tags, if possible, so as to
|
||||
|
// not look out of place. We insert before the others so these styles can be
|
||||
|
// overridden if necessary.
|
||||
|
firstStyleEl = document.head.querySelector('[rel="stylesheet"], style'); |
||||
|
if (firstStyleEl === undefined) { |
||||
|
document.head.appendChild(style); |
||||
|
} else { |
||||
|
document.head.insertBefore(style, firstStyleEl); |
||||
|
} |
||||
|
|
||||
|
style.sheet.insertRule(linkRule, style.sheet.cssRules.length); |
||||
|
style.sheet.insertRule(hoverRule, style.sheet.cssRules.length); |
||||
|
style.sheet.insertRule(pseudoElContent, style.sheet.cssRules.length); |
||||
|
style.sheet.insertRule(anchorjsLinkFontFace, style.sheet.cssRules.length); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return AnchorJS; |
||||
|
})); |
||||
@ -0,0 +1,978 @@ |
|||||
|
/*! |
||||
|
* clipboard.js v2.0.4 |
||||
|
* https://zenorocha.github.io/clipboard.js
|
||||
|
* |
||||
|
* Licensed MIT © Zeno Rocha |
||||
|
*/ |
||||
|
(function webpackUniversalModuleDefinition(root, factory) { |
||||
|
if(typeof exports === 'object' && typeof module === 'object') |
||||
|
module.exports = factory(); |
||||
|
else if(typeof define === 'function' && define.amd) |
||||
|
define([], factory); |
||||
|
else if(typeof exports === 'object') |
||||
|
exports["ClipboardJS"] = factory(); |
||||
|
else |
||||
|
root["ClipboardJS"] = factory(); |
||||
|
})(this, function() { |
||||
|
return /******/ (function(modules) { // webpackBootstrap
|
||||
|
/******/ // The module cache
|
||||
|
/******/ var installedModules = {}; |
||||
|
/******/ |
||||
|
/******/ // The require function
|
||||
|
/******/ function __webpack_require__(moduleId) { |
||||
|
/******/ |
||||
|
/******/ // Check if module is in cache
|
||||
|
/******/ if(installedModules[moduleId]) { |
||||
|
/******/ return installedModules[moduleId].exports; |
||||
|
/******/ } |
||||
|
/******/ // Create a new module (and put it into the cache)
|
||||
|
/******/ var module = installedModules[moduleId] = { |
||||
|
/******/ i: moduleId, |
||||
|
/******/ l: false, |
||||
|
/******/ exports: {} |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // Execute the module function
|
||||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||
|
/******/ |
||||
|
/******/ // Flag the module as loaded
|
||||
|
/******/ module.l = true; |
||||
|
/******/ |
||||
|
/******/ // Return the exports of the module
|
||||
|
/******/ return module.exports; |
||||
|
/******/ } |
||||
|
/******/ |
||||
|
/******/ |
||||
|
/******/ // expose the modules object (__webpack_modules__)
|
||||
|
/******/ __webpack_require__.m = modules; |
||||
|
/******/ |
||||
|
/******/ // expose the module cache
|
||||
|
/******/ __webpack_require__.c = installedModules; |
||||
|
/******/ |
||||
|
/******/ // define getter function for harmony exports
|
||||
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||
|
/******/ if(!__webpack_require__.o(exports, name)) { |
||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||
|
/******/ } |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // define __esModule on exports
|
||||
|
/******/ __webpack_require__.r = function(exports) { |
||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||
|
/******/ } |
||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // create a fake namespace object
|
||||
|
/******/ // mode & 1: value is a module id, require it
|
||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||
|
/******/ // mode & 4: return value when already ns object
|
||||
|
/******/ // mode & 8|1: behave like require
|
||||
|
/******/ __webpack_require__.t = function(value, mode) { |
||||
|
/******/ if(mode & 1) value = __webpack_require__(value); |
||||
|
/******/ if(mode & 8) return value; |
||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||
|
/******/ var ns = Object.create(null); |
||||
|
/******/ __webpack_require__.r(ns); |
||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||
|
/******/ return ns; |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
|
/******/ __webpack_require__.n = function(module) { |
||||
|
/******/ var getter = module && module.__esModule ? |
||||
|
/******/ function getDefault() { return module['default']; } : |
||||
|
/******/ function getModuleExports() { return module; }; |
||||
|
/******/ __webpack_require__.d(getter, 'a', getter); |
||||
|
/******/ return getter; |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||
|
/******/ |
||||
|
/******/ // __webpack_public_path__
|
||||
|
/******/ __webpack_require__.p = ""; |
||||
|
/******/ |
||||
|
/******/ |
||||
|
/******/ // Load entry module and return exports
|
||||
|
/******/ return __webpack_require__(__webpack_require__.s = 0); |
||||
|
/******/ }) |
||||
|
/************************************************************************/ |
||||
|
/******/ ([ |
||||
|
/* 0 */ |
||||
|
/***/ (function(module, exports, __webpack_require__) { |
||||
|
|
||||
|
"use strict"; |
||||
|
|
||||
|
|
||||
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
||||
|
|
||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
||||
|
|
||||
|
var _clipboardAction = __webpack_require__(1); |
||||
|
|
||||
|
var _clipboardAction2 = _interopRequireDefault(_clipboardAction); |
||||
|
|
||||
|
var _tinyEmitter = __webpack_require__(3); |
||||
|
|
||||
|
var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); |
||||
|
|
||||
|
var _goodListener = __webpack_require__(4); |
||||
|
|
||||
|
var _goodListener2 = _interopRequireDefault(_goodListener); |
||||
|
|
||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
|
||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
||||
|
|
||||
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
||||
|
|
||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
||||
|
|
||||
|
/** |
||||
|
* Base class which takes one or more elements, adds event listeners to them, |
||||
|
* and instantiates a new `ClipboardAction` on each click. |
||||
|
*/ |
||||
|
var Clipboard = function (_Emitter) { |
||||
|
_inherits(Clipboard, _Emitter); |
||||
|
|
||||
|
/** |
||||
|
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
||||
|
* @param {Object} options |
||||
|
*/ |
||||
|
function Clipboard(trigger, options) { |
||||
|
_classCallCheck(this, Clipboard); |
||||
|
|
||||
|
var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); |
||||
|
|
||||
|
_this.resolveOptions(options); |
||||
|
_this.listenClick(trigger); |
||||
|
return _this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Defines if attributes would be resolved using internal setter functions |
||||
|
* or custom functions that were passed in the constructor. |
||||
|
* @param {Object} options |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
_createClass(Clipboard, [{ |
||||
|
key: 'resolveOptions', |
||||
|
value: function resolveOptions() { |
||||
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
||||
|
|
||||
|
this.action = typeof options.action === 'function' ? options.action : this.defaultAction; |
||||
|
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; |
||||
|
this.text = typeof options.text === 'function' ? options.text : this.defaultText; |
||||
|
this.container = _typeof(options.container) === 'object' ? options.container : document.body; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Adds a click event listener to the passed trigger. |
||||
|
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'listenClick', |
||||
|
value: function listenClick(trigger) { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) { |
||||
|
return _this2.onClick(e); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Defines a new `ClipboardAction` on each click event. |
||||
|
* @param {Event} e |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'onClick', |
||||
|
value: function onClick(e) { |
||||
|
var trigger = e.delegateTarget || e.currentTarget; |
||||
|
|
||||
|
if (this.clipboardAction) { |
||||
|
this.clipboardAction = null; |
||||
|
} |
||||
|
|
||||
|
this.clipboardAction = new _clipboardAction2.default({ |
||||
|
action: this.action(trigger), |
||||
|
target: this.target(trigger), |
||||
|
text: this.text(trigger), |
||||
|
container: this.container, |
||||
|
trigger: trigger, |
||||
|
emitter: this |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Default `action` lookup function. |
||||
|
* @param {Element} trigger |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'defaultAction', |
||||
|
value: function defaultAction(trigger) { |
||||
|
return getAttributeValue('action', trigger); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Default `target` lookup function. |
||||
|
* @param {Element} trigger |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'defaultTarget', |
||||
|
value: function defaultTarget(trigger) { |
||||
|
var selector = getAttributeValue('target', trigger); |
||||
|
|
||||
|
if (selector) { |
||||
|
return document.querySelector(selector); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the support of the given action, or all actions if no action is |
||||
|
* given. |
||||
|
* @param {String} [action] |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'defaultText', |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Default `text` lookup function. |
||||
|
* @param {Element} trigger |
||||
|
*/ |
||||
|
value: function defaultText(trigger) { |
||||
|
return getAttributeValue('text', trigger); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Destroy lifecycle. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'destroy', |
||||
|
value: function destroy() { |
||||
|
this.listener.destroy(); |
||||
|
|
||||
|
if (this.clipboardAction) { |
||||
|
this.clipboardAction.destroy(); |
||||
|
this.clipboardAction = null; |
||||
|
} |
||||
|
} |
||||
|
}], [{ |
||||
|
key: 'isSupported', |
||||
|
value: function isSupported() { |
||||
|
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; |
||||
|
|
||||
|
var actions = typeof action === 'string' ? [action] : action; |
||||
|
var support = !!document.queryCommandSupported; |
||||
|
|
||||
|
actions.forEach(function (action) { |
||||
|
support = support && !!document.queryCommandSupported(action); |
||||
|
}); |
||||
|
|
||||
|
return support; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return Clipboard; |
||||
|
}(_tinyEmitter2.default); |
||||
|
|
||||
|
/** |
||||
|
* Helper function to retrieve attribute value. |
||||
|
* @param {String} suffix |
||||
|
* @param {Element} element |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
function getAttributeValue(suffix, element) { |
||||
|
var attribute = 'data-clipboard-' + suffix; |
||||
|
|
||||
|
if (!element.hasAttribute(attribute)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
return element.getAttribute(attribute); |
||||
|
} |
||||
|
|
||||
|
module.exports = Clipboard; |
||||
|
|
||||
|
/***/ }), |
||||
|
/* 1 */ |
||||
|
/***/ (function(module, exports, __webpack_require__) { |
||||
|
|
||||
|
"use strict"; |
||||
|
|
||||
|
|
||||
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
||||
|
|
||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
||||
|
|
||||
|
var _select = __webpack_require__(2); |
||||
|
|
||||
|
var _select2 = _interopRequireDefault(_select); |
||||
|
|
||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
|
||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
||||
|
|
||||
|
/** |
||||
|
* Inner class which performs selection from either `text` or `target` |
||||
|
* properties and then executes copy or cut operations. |
||||
|
*/ |
||||
|
var ClipboardAction = function () { |
||||
|
/** |
||||
|
* @param {Object} options |
||||
|
*/ |
||||
|
function ClipboardAction(options) { |
||||
|
_classCallCheck(this, ClipboardAction); |
||||
|
|
||||
|
this.resolveOptions(options); |
||||
|
this.initSelection(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Defines base properties passed from constructor. |
||||
|
* @param {Object} options |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
_createClass(ClipboardAction, [{ |
||||
|
key: 'resolveOptions', |
||||
|
value: function resolveOptions() { |
||||
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
||||
|
|
||||
|
this.action = options.action; |
||||
|
this.container = options.container; |
||||
|
this.emitter = options.emitter; |
||||
|
this.target = options.target; |
||||
|
this.text = options.text; |
||||
|
this.trigger = options.trigger; |
||||
|
|
||||
|
this.selectedText = ''; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Decides which selection strategy is going to be applied based |
||||
|
* on the existence of `text` and `target` properties. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'initSelection', |
||||
|
value: function initSelection() { |
||||
|
if (this.text) { |
||||
|
this.selectFake(); |
||||
|
} else if (this.target) { |
||||
|
this.selectTarget(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Creates a fake textarea element, sets its value from `text` property, |
||||
|
* and makes a selection on it. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'selectFake', |
||||
|
value: function selectFake() { |
||||
|
var _this = this; |
||||
|
|
||||
|
var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; |
||||
|
|
||||
|
this.removeFake(); |
||||
|
|
||||
|
this.fakeHandlerCallback = function () { |
||||
|
return _this.removeFake(); |
||||
|
}; |
||||
|
this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true; |
||||
|
|
||||
|
this.fakeElem = document.createElement('textarea'); |
||||
|
// Prevent zooming on iOS
|
||||
|
this.fakeElem.style.fontSize = '12pt'; |
||||
|
// Reset box model
|
||||
|
this.fakeElem.style.border = '0'; |
||||
|
this.fakeElem.style.padding = '0'; |
||||
|
this.fakeElem.style.margin = '0'; |
||||
|
// Move element out of screen horizontally
|
||||
|
this.fakeElem.style.position = 'absolute'; |
||||
|
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; |
||||
|
// Move element to the same position vertically
|
||||
|
var yPosition = window.pageYOffset || document.documentElement.scrollTop; |
||||
|
this.fakeElem.style.top = yPosition + 'px'; |
||||
|
|
||||
|
this.fakeElem.setAttribute('readonly', ''); |
||||
|
this.fakeElem.value = this.text; |
||||
|
|
||||
|
this.container.appendChild(this.fakeElem); |
||||
|
|
||||
|
this.selectedText = (0, _select2.default)(this.fakeElem); |
||||
|
this.copyText(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Only removes the fake element after another click event, that way |
||||
|
* a user can hit `Ctrl+C` to copy because selection still exists. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'removeFake', |
||||
|
value: function removeFake() { |
||||
|
if (this.fakeHandler) { |
||||
|
this.container.removeEventListener('click', this.fakeHandlerCallback); |
||||
|
this.fakeHandler = null; |
||||
|
this.fakeHandlerCallback = null; |
||||
|
} |
||||
|
|
||||
|
if (this.fakeElem) { |
||||
|
this.container.removeChild(this.fakeElem); |
||||
|
this.fakeElem = null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Selects the content from element passed on `target` property. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'selectTarget', |
||||
|
value: function selectTarget() { |
||||
|
this.selectedText = (0, _select2.default)(this.target); |
||||
|
this.copyText(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Executes the copy operation based on the current selection. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'copyText', |
||||
|
value: function copyText() { |
||||
|
var succeeded = void 0; |
||||
|
|
||||
|
try { |
||||
|
succeeded = document.execCommand(this.action); |
||||
|
} catch (err) { |
||||
|
succeeded = false; |
||||
|
} |
||||
|
|
||||
|
this.handleResult(succeeded); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Fires an event based on the copy operation result. |
||||
|
* @param {Boolean} succeeded |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'handleResult', |
||||
|
value: function handleResult(succeeded) { |
||||
|
this.emitter.emit(succeeded ? 'success' : 'error', { |
||||
|
action: this.action, |
||||
|
text: this.selectedText, |
||||
|
trigger: this.trigger, |
||||
|
clearSelection: this.clearSelection.bind(this) |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Moves focus away from `target` and back to the trigger, removes current selection. |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'clearSelection', |
||||
|
value: function clearSelection() { |
||||
|
if (this.trigger) { |
||||
|
this.trigger.focus(); |
||||
|
} |
||||
|
|
||||
|
window.getSelection().removeAllRanges(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Sets the `action` to be performed which can be either 'copy' or 'cut'. |
||||
|
* @param {String} action |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'destroy', |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Destroy lifecycle. |
||||
|
*/ |
||||
|
value: function destroy() { |
||||
|
this.removeFake(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'action', |
||||
|
set: function set() { |
||||
|
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; |
||||
|
|
||||
|
this._action = action; |
||||
|
|
||||
|
if (this._action !== 'copy' && this._action !== 'cut') { |
||||
|
throw new Error('Invalid "action" value, use either "copy" or "cut"'); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Gets the `action` property. |
||||
|
* @return {String} |
||||
|
*/ |
||||
|
, |
||||
|
get: function get() { |
||||
|
return this._action; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Sets the `target` property using an element |
||||
|
* that will be have its content copied. |
||||
|
* @param {Element} target |
||||
|
*/ |
||||
|
|
||||
|
}, { |
||||
|
key: 'target', |
||||
|
set: function set(target) { |
||||
|
if (target !== undefined) { |
||||
|
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { |
||||
|
if (this.action === 'copy' && target.hasAttribute('disabled')) { |
||||
|
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); |
||||
|
} |
||||
|
|
||||
|
if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { |
||||
|
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); |
||||
|
} |
||||
|
|
||||
|
this._target = target; |
||||
|
} else { |
||||
|
throw new Error('Invalid "target" value, use a valid Element'); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Gets the `target` property. |
||||
|
* @return {String|HTMLElement} |
||||
|
*/ |
||||
|
, |
||||
|
get: function get() { |
||||
|
return this._target; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return ClipboardAction; |
||||
|
}(); |
||||
|
|
||||
|
module.exports = ClipboardAction; |
||||
|
|
||||
|
/***/ }), |
||||
|
/* 2 */ |
||||
|
/***/ (function(module, exports) { |
||||
|
|
||||
|
function select(element) { |
||||
|
var selectedText; |
||||
|
|
||||
|
if (element.nodeName === 'SELECT') { |
||||
|
element.focus(); |
||||
|
|
||||
|
selectedText = element.value; |
||||
|
} |
||||
|
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { |
||||
|
var isReadOnly = element.hasAttribute('readonly'); |
||||
|
|
||||
|
if (!isReadOnly) { |
||||
|
element.setAttribute('readonly', ''); |
||||
|
} |
||||
|
|
||||
|
element.select(); |
||||
|
element.setSelectionRange(0, element.value.length); |
||||
|
|
||||
|
if (!isReadOnly) { |
||||
|
element.removeAttribute('readonly'); |
||||
|
} |
||||
|
|
||||
|
selectedText = element.value; |
||||
|
} |
||||
|
else { |
||||
|
if (element.hasAttribute('contenteditable')) { |
||||
|
element.focus(); |
||||
|
} |
||||
|
|
||||
|
var selection = window.getSelection(); |
||||
|
var range = document.createRange(); |
||||
|
|
||||
|
range.selectNodeContents(element); |
||||
|
selection.removeAllRanges(); |
||||
|
selection.addRange(range); |
||||
|
|
||||
|
selectedText = selection.toString(); |
||||
|
} |
||||
|
|
||||
|
return selectedText; |
||||
|
} |
||||
|
|
||||
|
module.exports = select; |
||||
|
|
||||
|
|
||||
|
/***/ }), |
||||
|
/* 3 */ |
||||
|
/***/ (function(module, exports) { |
||||
|
|
||||
|
function E () { |
||||
|
// Keep this empty so it's easier to inherit from
|
||||
|
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
|
} |
||||
|
|
||||
|
E.prototype = { |
||||
|
on: function (name, callback, ctx) { |
||||
|
var e = this.e || (this.e = {}); |
||||
|
|
||||
|
(e[name] || (e[name] = [])).push({ |
||||
|
fn: callback, |
||||
|
ctx: ctx |
||||
|
}); |
||||
|
|
||||
|
return this; |
||||
|
}, |
||||
|
|
||||
|
once: function (name, callback, ctx) { |
||||
|
var self = this; |
||||
|
function listener () { |
||||
|
self.off(name, listener); |
||||
|
callback.apply(ctx, arguments); |
||||
|
}; |
||||
|
|
||||
|
listener._ = callback |
||||
|
return this.on(name, listener, ctx); |
||||
|
}, |
||||
|
|
||||
|
emit: function (name) { |
||||
|
var data = [].slice.call(arguments, 1); |
||||
|
var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); |
||||
|
var i = 0; |
||||
|
var len = evtArr.length; |
||||
|
|
||||
|
for (i; i < len; i++) { |
||||
|
evtArr[i].fn.apply(evtArr[i].ctx, data); |
||||
|
} |
||||
|
|
||||
|
return this; |
||||
|
}, |
||||
|
|
||||
|
off: function (name, callback) { |
||||
|
var e = this.e || (this.e = {}); |
||||
|
var evts = e[name]; |
||||
|
var liveEvents = []; |
||||
|
|
||||
|
if (evts && callback) { |
||||
|
for (var i = 0, len = evts.length; i < len; i++) { |
||||
|
if (evts[i].fn !== callback && evts[i].fn._ !== callback) |
||||
|
liveEvents.push(evts[i]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Remove event from queue to prevent memory leak
|
||||
|
// Suggested by https://github.com/lazd
|
||||
|
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
|
||||
|
(liveEvents.length) |
||||
|
? e[name] = liveEvents |
||||
|
: delete e[name]; |
||||
|
|
||||
|
return this; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
module.exports = E; |
||||
|
|
||||
|
|
||||
|
/***/ }), |
||||
|
/* 4 */ |
||||
|
/***/ (function(module, exports, __webpack_require__) { |
||||
|
|
||||
|
var is = __webpack_require__(5); |
||||
|
var delegate = __webpack_require__(6); |
||||
|
|
||||
|
/** |
||||
|
* Validates all params and calls the right |
||||
|
* listener function based on its target type. |
||||
|
* |
||||
|
* @param {String|HTMLElement|HTMLCollection|NodeList} target |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function listen(target, type, callback) { |
||||
|
if (!target && !type && !callback) { |
||||
|
throw new Error('Missing required arguments'); |
||||
|
} |
||||
|
|
||||
|
if (!is.string(type)) { |
||||
|
throw new TypeError('Second argument must be a String'); |
||||
|
} |
||||
|
|
||||
|
if (!is.fn(callback)) { |
||||
|
throw new TypeError('Third argument must be a Function'); |
||||
|
} |
||||
|
|
||||
|
if (is.node(target)) { |
||||
|
return listenNode(target, type, callback); |
||||
|
} |
||||
|
else if (is.nodeList(target)) { |
||||
|
return listenNodeList(target, type, callback); |
||||
|
} |
||||
|
else if (is.string(target)) { |
||||
|
return listenSelector(target, type, callback); |
||||
|
} |
||||
|
else { |
||||
|
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Adds an event listener to a HTML element |
||||
|
* and returns a remove listener function. |
||||
|
* |
||||
|
* @param {HTMLElement} node |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function listenNode(node, type, callback) { |
||||
|
node.addEventListener(type, callback); |
||||
|
|
||||
|
return { |
||||
|
destroy: function() { |
||||
|
node.removeEventListener(type, callback); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Add an event listener to a list of HTML elements |
||||
|
* and returns a remove listener function. |
||||
|
* |
||||
|
* @param {NodeList|HTMLCollection} nodeList |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function listenNodeList(nodeList, type, callback) { |
||||
|
Array.prototype.forEach.call(nodeList, function(node) { |
||||
|
node.addEventListener(type, callback); |
||||
|
}); |
||||
|
|
||||
|
return { |
||||
|
destroy: function() { |
||||
|
Array.prototype.forEach.call(nodeList, function(node) { |
||||
|
node.removeEventListener(type, callback); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Add an event listener to a selector |
||||
|
* and returns a remove listener function. |
||||
|
* |
||||
|
* @param {String} selector |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function listenSelector(selector, type, callback) { |
||||
|
return delegate(document.body, selector, type, callback); |
||||
|
} |
||||
|
|
||||
|
module.exports = listen; |
||||
|
|
||||
|
|
||||
|
/***/ }), |
||||
|
/* 5 */ |
||||
|
/***/ (function(module, exports) { |
||||
|
|
||||
|
/** |
||||
|
* Check if argument is a HTML element. |
||||
|
* |
||||
|
* @param {Object} value |
||||
|
* @return {Boolean} |
||||
|
*/ |
||||
|
exports.node = function(value) { |
||||
|
return value !== undefined |
||||
|
&& value instanceof HTMLElement |
||||
|
&& value.nodeType === 1; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Check if argument is a list of HTML elements. |
||||
|
* |
||||
|
* @param {Object} value |
||||
|
* @return {Boolean} |
||||
|
*/ |
||||
|
exports.nodeList = function(value) { |
||||
|
var type = Object.prototype.toString.call(value); |
||||
|
|
||||
|
return value !== undefined |
||||
|
&& (type === '[object NodeList]' || type === '[object HTMLCollection]') |
||||
|
&& ('length' in value) |
||||
|
&& (value.length === 0 || exports.node(value[0])); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Check if argument is a string. |
||||
|
* |
||||
|
* @param {Object} value |
||||
|
* @return {Boolean} |
||||
|
*/ |
||||
|
exports.string = function(value) { |
||||
|
return typeof value === 'string' |
||||
|
|| value instanceof String; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Check if argument is a function. |
||||
|
* |
||||
|
* @param {Object} value |
||||
|
* @return {Boolean} |
||||
|
*/ |
||||
|
exports.fn = function(value) { |
||||
|
var type = Object.prototype.toString.call(value); |
||||
|
|
||||
|
return type === '[object Function]'; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/***/ }), |
||||
|
/* 6 */ |
||||
|
/***/ (function(module, exports, __webpack_require__) { |
||||
|
|
||||
|
var closest = __webpack_require__(7); |
||||
|
|
||||
|
/** |
||||
|
* Delegates event to a selector. |
||||
|
* |
||||
|
* @param {Element} element |
||||
|
* @param {String} selector |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @param {Boolean} useCapture |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function _delegate(element, selector, type, callback, useCapture) { |
||||
|
var listenerFn = listener.apply(this, arguments); |
||||
|
|
||||
|
element.addEventListener(type, listenerFn, useCapture); |
||||
|
|
||||
|
return { |
||||
|
destroy: function() { |
||||
|
element.removeEventListener(type, listenerFn, useCapture); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Delegates event to a selector. |
||||
|
* |
||||
|
* @param {Element|String|Array} [elements] |
||||
|
* @param {String} selector |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @param {Boolean} useCapture |
||||
|
* @return {Object} |
||||
|
*/ |
||||
|
function delegate(elements, selector, type, callback, useCapture) { |
||||
|
// Handle the regular Element usage
|
||||
|
if (typeof elements.addEventListener === 'function') { |
||||
|
return _delegate.apply(null, arguments); |
||||
|
} |
||||
|
|
||||
|
// Handle Element-less usage, it defaults to global delegation
|
||||
|
if (typeof type === 'function') { |
||||
|
// Use `document` as the first parameter, then apply arguments
|
||||
|
// This is a short way to .unshift `arguments` without running into deoptimizations
|
||||
|
return _delegate.bind(null, document).apply(null, arguments); |
||||
|
} |
||||
|
|
||||
|
// Handle Selector-based usage
|
||||
|
if (typeof elements === 'string') { |
||||
|
elements = document.querySelectorAll(elements); |
||||
|
} |
||||
|
|
||||
|
// Handle Array-like based usage
|
||||
|
return Array.prototype.map.call(elements, function (element) { |
||||
|
return _delegate(element, selector, type, callback, useCapture); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Finds closest match and invokes callback. |
||||
|
* |
||||
|
* @param {Element} element |
||||
|
* @param {String} selector |
||||
|
* @param {String} type |
||||
|
* @param {Function} callback |
||||
|
* @return {Function} |
||||
|
*/ |
||||
|
function listener(element, selector, type, callback) { |
||||
|
return function(e) { |
||||
|
e.delegateTarget = closest(e.target, selector); |
||||
|
|
||||
|
if (e.delegateTarget) { |
||||
|
callback.call(element, e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = delegate; |
||||
|
|
||||
|
|
||||
|
/***/ }), |
||||
|
/* 7 */ |
||||
|
/***/ (function(module, exports) { |
||||
|
|
||||
|
var DOCUMENT_NODE_TYPE = 9; |
||||
|
|
||||
|
/** |
||||
|
* A polyfill for Element.matches() |
||||
|
*/ |
||||
|
if (typeof Element !== 'undefined' && !Element.prototype.matches) { |
||||
|
var proto = Element.prototype; |
||||
|
|
||||
|
proto.matches = proto.matchesSelector || |
||||
|
proto.mozMatchesSelector || |
||||
|
proto.msMatchesSelector || |
||||
|
proto.oMatchesSelector || |
||||
|
proto.webkitMatchesSelector; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Finds the closest parent that matches a selector. |
||||
|
* |
||||
|
* @param {Element} element |
||||
|
* @param {String} selector |
||||
|
* @return {Function} |
||||
|
*/ |
||||
|
function closest (element, selector) { |
||||
|
while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { |
||||
|
if (typeof element.matches === 'function' && |
||||
|
element.matches(selector)) { |
||||
|
return element; |
||||
|
} |
||||
|
element = element.parentNode; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = closest; |
||||
|
|
||||
|
|
||||
|
/***/ }) |
||||
|
/******/ ]); |
||||
|
}); |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because it is too large
|
After Width: | Height: | Size: 2.9 KiB |
@ -0,0 +1,37 @@ |
|||||
|
{ |
||||
|
"name": "malihu-custom-scrollbar-plugin", |
||||
|
"version": "3.1.5", |
||||
|
"author": "malihu (http://manos.malihu.gr)", |
||||
|
"description": "Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support user defined callbacks etc.", |
||||
|
"license": "MIT", |
||||
|
"homepage": "http://manos.malihu.gr/jquery-custom-content-scroller", |
||||
|
"main": "./jquery.mCustomScrollbar.js", |
||||
|
"repository": { |
||||
|
"type": "git", |
||||
|
"url": "https://github.com/malihu/malihu-custom-scrollbar-plugin.git" |
||||
|
}, |
||||
|
"bugs": { |
||||
|
"url": "https://github.com/malihu/malihu-custom-scrollbar-plugin/issues" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"jquery-plugin", |
||||
|
"custom-scrollbar", |
||||
|
"scrollbar" |
||||
|
], |
||||
|
"files": [ |
||||
|
"jquery.mCustomScrollbar.js", |
||||
|
"jquery.mCustomScrollbar.concat.min.js", |
||||
|
"jquery.mCustomScrollbar.css", |
||||
|
"mCSB_buttons.png", |
||||
|
"readme.md" |
||||
|
], |
||||
|
"jam": { |
||||
|
"dependencies": { |
||||
|
"jquery": ">=1.6", |
||||
|
"jquery-mousewheel": ">=3.0.6" |
||||
|
} |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"jquery-mousewheel": ">=3.0.6" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,82 @@ |
|||||
|
malihu custom scrollbar plugin |
||||
|
================================ |
||||
|
|
||||
|
Highly customizable custom scrollbar jQuery plugin ([Demo](http://manos.malihu.gr/repository/custom-scrollbar/demo/examples/complete_examples.html)). Features include: |
||||
|
|
||||
|
* Vertical and/or horizontal scrollbar(s) |
||||
|
* Adjustable scrolling momentum |
||||
|
* Mouse-wheel, keyboard and touch support |
||||
|
* Ready-to-use themes and customization via CSS |
||||
|
* RTL direction support |
||||
|
* Option parameters for full control of scrollbar functionality |
||||
|
* Methods for triggering actions like scroll-to, update, destroy etc. |
||||
|
* User-defined callbacks |
||||
|
* Selectable/searchable content |
||||
|
|
||||
|
**[Plugin homepage and documentation](http://manos.malihu.gr/jquery-custom-content-scroller/)** ([Changelog](http://manos.malihu.gr/jquery-custom-content-scroller/2/)) |
||||
|
|
||||
|
#### Installation |
||||
|
|
||||
|
npm: `npm install malihu-custom-scrollbar-plugin` |
||||
|
|
||||
|
Bower: `bower install malihu-custom-scrollbar-plugin` |
||||
|
|
||||
|
[Manual](http://manos.malihu.gr/jquery-custom-content-scroller/#get-started-section) |
||||
|
|
||||
|
#### Usage |
||||
|
|
||||
|
Manual: `$(selector).mCustomScrollbar();` |
||||
|
|
||||
|
[Browserify](http://browserify.org/): |
||||
|
|
||||
|
var $ = require('jquery'); |
||||
|
require('malihu-custom-scrollbar-plugin')($); |
||||
|
|
||||
|
[webpack](https://webpack.github.io/): |
||||
|
|
||||
|
npm install imports-loader |
||||
|
npm install jquery-mousewheel |
||||
|
npm install malihu-custom-scrollbar-plugin |
||||
|
|
||||
|
module.exports = { |
||||
|
module: { |
||||
|
loaders: [ |
||||
|
{ test: /jquery-mousewheel/, loader: "imports?define=>false&this=>window" }, |
||||
|
{ test: /malihu-custom-scrollbar-plugin/, loader: "imports?define=>false&this=>window" } |
||||
|
] |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
var $ = require('jquery'); |
||||
|
require("jquery-mousewheel")($); |
||||
|
require('malihu-custom-scrollbar-plugin')($); |
||||
|
|
||||
|
|
||||
|
Requirements |
||||
|
------------------------- |
||||
|
|
||||
|
jQuery version **1.6.0** or higher |
||||
|
|
||||
|
Browser compatibility |
||||
|
------------------------- |
||||
|
|
||||
|
* Internet Explorer 8+ |
||||
|
* Firefox |
||||
|
* Chrome |
||||
|
* Opera |
||||
|
* Safari |
||||
|
* iOS |
||||
|
* Android |
||||
|
* Windows Phone |
||||
|
|
||||
|
License |
||||
|
------------------------- |
||||
|
|
||||
|
MIT License (MIT) |
||||
|
|
||||
|
http://opensource.org/licenses/MIT |
||||
|
|
||||
|
Donate |
||||
|
------------------------- |
||||
|
|
||||
|
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28 |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
@ -0,0 +1,26 @@ |
|||||
|
# [Prism](http://prismjs.com/) |
||||
|
|
||||
|
Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from [Dabblet](http://dabblet.com/). |
||||
|
|
||||
|
You can learn more on http://prismjs.com/. |
||||
|
|
||||
|
Why another syntax highlighter?: http://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841 |
||||
|
|
||||
|
## Contribute to Prism! |
||||
|
|
||||
|
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips: |
||||
|
|
||||
|
- Read the [documentation](http://prismjs.com/extending.html). Prism was designed to be extensible. |
||||
|
- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the components/ folder. The minified files are also generated automatically. |
||||
|
- The build system uses [gulp](https://github.com/gulpjs/gulp) to minify the files and build `prism.js`. Having gulp installed, you just need to run the command `gulp`. |
||||
|
- Please follow the code conventions used in the files already. For example, I use [tabs for indentation and spaces for alignment](http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/). Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc. |
||||
|
- Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult. |
||||
|
- My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected. |
||||
|
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition. |
||||
|
- If you add a new language definition, theme or plugin, you need to add it to `components.js` as well, so that it becomes available to the download build page. |
||||
|
|
||||
|
Thank you so much for contributing!! |
||||
|
|
||||
|
## Translations |
||||
|
|
||||
|
* [](http://www.awesomes.cn/repo/PrismJS/prism) |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,867 @@ |
|||||
|
{ |
||||
|
"core": { |
||||
|
"meta": { |
||||
|
"path": "components/prism-core.js", |
||||
|
"option": "mandatory" |
||||
|
}, |
||||
|
"core": "Core" |
||||
|
}, |
||||
|
"themes": { |
||||
|
"meta": { |
||||
|
"path": "themes/{id}.css", |
||||
|
"link": "index.html?theme={id}", |
||||
|
"exclusive": true |
||||
|
}, |
||||
|
"prism": { |
||||
|
"title": "Default", |
||||
|
"option": "default" |
||||
|
}, |
||||
|
"prism-dark": "Dark", |
||||
|
"prism-funky": "Funky", |
||||
|
"prism-okaidia": { |
||||
|
"title": "Okaidia", |
||||
|
"owner": "ocodia" |
||||
|
}, |
||||
|
"prism-twilight": { |
||||
|
"title": "Twilight", |
||||
|
"owner": "remybach" |
||||
|
}, |
||||
|
"prism-coy": { |
||||
|
"title": "Coy", |
||||
|
"owner": "tshedor" |
||||
|
}, |
||||
|
"prism-solarizedlight": { |
||||
|
"title": "Solarized Light", |
||||
|
"owner": "hectormatos2011 " |
||||
|
}, |
||||
|
"prism-tomorrow": { |
||||
|
"title": "Tomorrow Night", |
||||
|
"owner": "Rosey" |
||||
|
} |
||||
|
}, |
||||
|
"languages": { |
||||
|
"meta": { |
||||
|
"path": "components/prism-{id}", |
||||
|
"noCSS": true, |
||||
|
"examplesPath": "examples/prism-{id}", |
||||
|
"addCheckAll": true |
||||
|
}, |
||||
|
"markup": { |
||||
|
"title": "Markup", |
||||
|
"alias": ["html", "xml", "svg", "mathml"], |
||||
|
"aliasTitles": { |
||||
|
"html": "HTML", |
||||
|
"xml": "XML", |
||||
|
"svg": "SVG", |
||||
|
"mathml": "MathML" |
||||
|
}, |
||||
|
"option": "default" |
||||
|
}, |
||||
|
"css": { |
||||
|
"title": "CSS", |
||||
|
"option": "default", |
||||
|
"peerDependencies": "markup" |
||||
|
}, |
||||
|
"clike": { |
||||
|
"title": "C-like", |
||||
|
"option": "default", |
||||
|
"overrideExampleHeader": true |
||||
|
}, |
||||
|
"javascript": { |
||||
|
"title": "JavaScript", |
||||
|
"require": "clike", |
||||
|
"peerDependencies": "markup", |
||||
|
"alias": "js", |
||||
|
"option": "default" |
||||
|
}, |
||||
|
"abap": { |
||||
|
"title": "ABAP", |
||||
|
"owner": "dellagustin" |
||||
|
}, |
||||
|
"actionscript": { |
||||
|
"title": "ActionScript", |
||||
|
"require": "javascript", |
||||
|
"peerDependencies": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"ada": { |
||||
|
"title": "Ada", |
||||
|
"owner": "Lucretia" |
||||
|
}, |
||||
|
"apacheconf": { |
||||
|
"title": "Apache Configuration", |
||||
|
"owner": "GuiTeK" |
||||
|
}, |
||||
|
"apl": { |
||||
|
"title": "APL", |
||||
|
"owner": "ngn" |
||||
|
}, |
||||
|
"applescript": { |
||||
|
"title": "AppleScript", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"arduino": { |
||||
|
"title": "Arduino", |
||||
|
"require": "cpp", |
||||
|
"owner": "eisbehr-" |
||||
|
}, |
||||
|
"arff": { |
||||
|
"title": "ARFF", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"asciidoc": { |
||||
|
"title": "AsciiDoc", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"asm6502": { |
||||
|
"title": "6502 Assembly", |
||||
|
"owner": "kzurawel" |
||||
|
}, |
||||
|
"aspnet": { |
||||
|
"title": "ASP.NET (C#)", |
||||
|
"require": ["markup", "csharp"], |
||||
|
"owner": "nauzilus" |
||||
|
}, |
||||
|
"autohotkey": { |
||||
|
"title": "AutoHotkey", |
||||
|
"owner": "aviaryan" |
||||
|
}, |
||||
|
"autoit": { |
||||
|
"title": "AutoIt", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"bash": { |
||||
|
"title": "Bash", |
||||
|
"owner": "zeitgeist87" |
||||
|
}, |
||||
|
"basic": { |
||||
|
"title": "BASIC", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"batch": { |
||||
|
"title": "Batch", |
||||
|
"alias": "shell", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"bison": { |
||||
|
"title": "Bison", |
||||
|
"require": "c", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"brainfuck": { |
||||
|
"title": "Brainfuck", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"bro": { |
||||
|
"title": "Bro", |
||||
|
"owner": "wayward710" |
||||
|
}, |
||||
|
"c": { |
||||
|
"title": "C", |
||||
|
"require": "clike", |
||||
|
"owner": "zeitgeist87" |
||||
|
}, |
||||
|
"csharp": { |
||||
|
"title": "C#", |
||||
|
"require": "clike", |
||||
|
"alias": "dotnet", |
||||
|
"owner": "mvalipour" |
||||
|
}, |
||||
|
"cpp": { |
||||
|
"title": "C++", |
||||
|
"require": "c", |
||||
|
"owner": "zeitgeist87" |
||||
|
}, |
||||
|
"coffeescript": { |
||||
|
"title": "CoffeeScript", |
||||
|
"require": "javascript", |
||||
|
"owner": "R-osey" |
||||
|
}, |
||||
|
"clojure": { |
||||
|
"title": "Clojure", |
||||
|
"owner": "troglotit" |
||||
|
}, |
||||
|
"crystal": { |
||||
|
"title": "Crystal", |
||||
|
"require": "ruby", |
||||
|
"owner": "MakeNowJust" |
||||
|
}, |
||||
|
"csp": { |
||||
|
"title": "Content-Security-Policy", |
||||
|
"owner": "ScottHelme" |
||||
|
}, |
||||
|
"css-extras": { |
||||
|
"title": "CSS Extras", |
||||
|
"require": "css", |
||||
|
"owner": "milesj" |
||||
|
}, |
||||
|
"d": { |
||||
|
"title": "D", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"dart": { |
||||
|
"title": "Dart", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"diff": { |
||||
|
"title": "Diff", |
||||
|
"owner": "uranusjr" |
||||
|
}, |
||||
|
"django": { |
||||
|
"title": "Django/Jinja2", |
||||
|
"require": "markup", |
||||
|
"peerDependencies": [ |
||||
|
"css", |
||||
|
"javascript" |
||||
|
], |
||||
|
"alias": "jinja2", |
||||
|
"owner": "romanvm" |
||||
|
}, |
||||
|
"docker": { |
||||
|
"title": "Docker", |
||||
|
"owner": "JustinBeckwith" |
||||
|
}, |
||||
|
"eiffel": { |
||||
|
"title": "Eiffel", |
||||
|
"owner": "Conaclos" |
||||
|
}, |
||||
|
"elixir": { |
||||
|
"title": "Elixir", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"elm": { |
||||
|
"title": "Elm", |
||||
|
"owner": "zwilias" |
||||
|
}, |
||||
|
"erb": { |
||||
|
"title": "ERB", |
||||
|
"require": ["ruby", "markup-templating"], |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"erlang": { |
||||
|
"title": "Erlang", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"fsharp": { |
||||
|
"title": "F#", |
||||
|
"require": "clike", |
||||
|
"owner": "simonreynolds7" |
||||
|
}, |
||||
|
"flow": { |
||||
|
"title": "Flow", |
||||
|
"require": "javascript", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"fortran": { |
||||
|
"title": "Fortran", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"gedcom": { |
||||
|
"title": "GEDCOM", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"gherkin": { |
||||
|
"title": "Gherkin", |
||||
|
"owner": "hason" |
||||
|
}, |
||||
|
"git": { |
||||
|
"title": "Git", |
||||
|
"owner": "lgiraudel" |
||||
|
}, |
||||
|
"glsl": { |
||||
|
"title": "GLSL", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"go": { |
||||
|
"title": "Go", |
||||
|
"require": "clike", |
||||
|
"owner": "arnehormann" |
||||
|
}, |
||||
|
"graphql": { |
||||
|
"title": "GraphQL", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"groovy": { |
||||
|
"title": "Groovy", |
||||
|
"require": "clike", |
||||
|
"owner": "robfletcher" |
||||
|
}, |
||||
|
"haml": { |
||||
|
"title": "Haml", |
||||
|
"require": "ruby", |
||||
|
"peerDependencies": [ |
||||
|
"css", |
||||
|
"coffeescript", |
||||
|
"erb", |
||||
|
"javascript", |
||||
|
"less", |
||||
|
"markdown", |
||||
|
"ruby", |
||||
|
"scss", |
||||
|
"textile" |
||||
|
], |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"handlebars": { |
||||
|
"title": "Handlebars", |
||||
|
"require": "markup-templating", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"haskell": { |
||||
|
"title": "Haskell", |
||||
|
"owner": "bholst" |
||||
|
}, |
||||
|
"haxe": { |
||||
|
"title": "Haxe", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"http": { |
||||
|
"title": "HTTP", |
||||
|
"peerDependencies": [ |
||||
|
"javascript", |
||||
|
"markup" |
||||
|
], |
||||
|
"owner": "danielgtaylor" |
||||
|
}, |
||||
|
"hpkp": { |
||||
|
"title": "HTTP Public-Key-Pins", |
||||
|
"owner": "ScottHelme" |
||||
|
}, |
||||
|
"hsts": { |
||||
|
"title": "HTTP Strict-Transport-Security", |
||||
|
"owner": "ScottHelme" |
||||
|
}, |
||||
|
"ichigojam": { |
||||
|
"title": "IchigoJam", |
||||
|
"owner": "BlueCocoa" |
||||
|
}, |
||||
|
"icon": { |
||||
|
"title": "Icon", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"inform7": { |
||||
|
"title": "Inform 7", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"ini": { |
||||
|
"title": "Ini", |
||||
|
"owner": "aviaryan" |
||||
|
}, |
||||
|
"io": { |
||||
|
"title": "Io", |
||||
|
"owner": "AlesTsurko" |
||||
|
}, |
||||
|
"j": { |
||||
|
"title": "J", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"java": { |
||||
|
"title": "Java", |
||||
|
"require": "clike", |
||||
|
"owner": "sherblot" |
||||
|
}, |
||||
|
"jolie": { |
||||
|
"title": "Jolie", |
||||
|
"require": "clike", |
||||
|
"owner": "thesave" |
||||
|
}, |
||||
|
"json": { |
||||
|
"title": "JSON", |
||||
|
"owner": "CupOfTea696" |
||||
|
}, |
||||
|
"julia": { |
||||
|
"title": "Julia", |
||||
|
"owner": "cdagnino" |
||||
|
}, |
||||
|
"keyman": { |
||||
|
"title": "Keyman", |
||||
|
"owner": "mcdurdin" |
||||
|
}, |
||||
|
"kotlin": { |
||||
|
"title": "Kotlin", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"latex": { |
||||
|
"title": "LaTeX", |
||||
|
"owner": "japborst" |
||||
|
}, |
||||
|
"less": { |
||||
|
"title": "Less", |
||||
|
"require": "css", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"liquid": { |
||||
|
"title": "Liquid", |
||||
|
"owner": "cinhtau" |
||||
|
}, |
||||
|
"lisp": { |
||||
|
"title": "Lisp", |
||||
|
"owner": "JuanCaicedo", |
||||
|
"alias": ["emacs", "elisp", "emacs-lisp"] |
||||
|
}, |
||||
|
"livescript": { |
||||
|
"title": "LiveScript", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"lolcode": { |
||||
|
"title": "LOLCODE", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"lua": { |
||||
|
"title": "Lua", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"makefile": { |
||||
|
"title": "Makefile", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"markdown": { |
||||
|
"title": "Markdown", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"markup-templating": { |
||||
|
"title": "Markup templating", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"matlab": { |
||||
|
"title": "MATLAB", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"mel": { |
||||
|
"title": "MEL", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"mizar": { |
||||
|
"title": "Mizar", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"monkey": { |
||||
|
"title": "Monkey", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"n4js": { |
||||
|
"title": "N4JS", |
||||
|
"require": "javascript", |
||||
|
"owner": "bsmith-n4" |
||||
|
}, |
||||
|
"nasm": { |
||||
|
"title": "NASM", |
||||
|
"owner": "rbmj" |
||||
|
}, |
||||
|
"nginx": { |
||||
|
"title": "nginx", |
||||
|
"owner": "westonganger", |
||||
|
"require": "clike" |
||||
|
}, |
||||
|
"nim": { |
||||
|
"title": "Nim", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"nix": { |
||||
|
"title": "Nix", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"nsis": { |
||||
|
"title": "NSIS", |
||||
|
"owner": "idleberg" |
||||
|
}, |
||||
|
"objectivec": { |
||||
|
"title": "Objective-C", |
||||
|
"require": "c", |
||||
|
"owner": "uranusjr" |
||||
|
}, |
||||
|
"ocaml": { |
||||
|
"title": "OCaml", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"opencl": { |
||||
|
"title": "OpenCL", |
||||
|
"require": "cpp", |
||||
|
"peerDependencies": [ |
||||
|
"c", |
||||
|
"cpp" |
||||
|
], |
||||
|
"overrideExampleHeader": true, |
||||
|
"owner": "Milania1" |
||||
|
}, |
||||
|
"oz": { |
||||
|
"title": "Oz", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"parigp": { |
||||
|
"title": "PARI/GP", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"parser": { |
||||
|
"title": "Parser", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"pascal": { |
||||
|
"title": "Pascal", |
||||
|
"alias": "objectpascal", |
||||
|
"aliasTitles": { |
||||
|
"objectpascal": "Object Pascal" |
||||
|
}, |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"perl": { |
||||
|
"title": "Perl", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"php": { |
||||
|
"title": "PHP", |
||||
|
"require": ["clike", "markup-templating"], |
||||
|
"owner": "milesj" |
||||
|
}, |
||||
|
"php-extras": { |
||||
|
"title": "PHP Extras", |
||||
|
"require": "php", |
||||
|
"owner": "milesj" |
||||
|
}, |
||||
|
"plsql": { |
||||
|
"title": "PL/SQL", |
||||
|
"require": "sql", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"powershell": { |
||||
|
"title": "PowerShell", |
||||
|
"owner": "nauzilus" |
||||
|
}, |
||||
|
"processing": { |
||||
|
"title": "Processing", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"prolog": { |
||||
|
"title": "Prolog", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"properties": { |
||||
|
"title": ".properties", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"protobuf": { |
||||
|
"title": "Protocol Buffers", |
||||
|
"require": "clike", |
||||
|
"owner": "just-boris" |
||||
|
}, |
||||
|
"pug": { |
||||
|
"title": "Pug", |
||||
|
"require": "javascript", |
||||
|
"peerDependencies": [ |
||||
|
"coffeescript", |
||||
|
"ejs", |
||||
|
"handlebars", |
||||
|
"hogan", |
||||
|
"less", |
||||
|
"livescript", |
||||
|
"markdown", |
||||
|
"mustache", |
||||
|
"plates", |
||||
|
"scss", |
||||
|
"stylus", |
||||
|
"swig" |
||||
|
], |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"puppet": { |
||||
|
"title": "Puppet", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"pure": { |
||||
|
"title": "Pure", |
||||
|
"peerDependencies": [ |
||||
|
"c", |
||||
|
"cpp", |
||||
|
"fortran", |
||||
|
"ats", |
||||
|
"dsp" |
||||
|
], |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"python": { |
||||
|
"title": "Python", |
||||
|
"owner": "multipetros" |
||||
|
}, |
||||
|
"q": { |
||||
|
"title": "Q (kdb+ database)", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"qore": { |
||||
|
"title": "Qore", |
||||
|
"require": "clike", |
||||
|
"owner": "temnroegg" |
||||
|
}, |
||||
|
"r": { |
||||
|
"title": "R", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"jsx": { |
||||
|
"title": "React JSX", |
||||
|
"require": ["markup", "javascript"], |
||||
|
"owner": "vkbansal" |
||||
|
}, |
||||
|
"tsx": { |
||||
|
"title": "React TSX", |
||||
|
"require": ["jsx", "typescript"] |
||||
|
}, |
||||
|
"renpy": { |
||||
|
"title": "Ren'py", |
||||
|
"owner": "HyuchiaDiego" |
||||
|
}, |
||||
|
"reason": { |
||||
|
"title": "Reason", |
||||
|
"require": "clike", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"rest": { |
||||
|
"title": "reST (reStructuredText)", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"rip": { |
||||
|
"title": "Rip", |
||||
|
"owner": "ravinggenius" |
||||
|
}, |
||||
|
"roboconf": { |
||||
|
"title": "Roboconf", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"ruby": { |
||||
|
"title": "Ruby", |
||||
|
"require": "clike", |
||||
|
"owner": "samflores" |
||||
|
}, |
||||
|
"rust": { |
||||
|
"title": "Rust", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"sas": { |
||||
|
"title": "SAS", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"sass": { |
||||
|
"title": "Sass (Sass)", |
||||
|
"require": "css", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"scss": { |
||||
|
"title": "Sass (Scss)", |
||||
|
"require": "css", |
||||
|
"owner": "MoOx" |
||||
|
}, |
||||
|
"scala": { |
||||
|
"title": "Scala", |
||||
|
"require": "java", |
||||
|
"owner": "jozic" |
||||
|
}, |
||||
|
"scheme": { |
||||
|
"title": "Scheme", |
||||
|
"owner": "bacchus123" |
||||
|
}, |
||||
|
"smalltalk": { |
||||
|
"title": "Smalltalk", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"smarty": { |
||||
|
"title": "Smarty", |
||||
|
"require": "markup-templating", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"sql": { |
||||
|
"title": "SQL", |
||||
|
"owner": "multipetros" |
||||
|
}, |
||||
|
"soy": { |
||||
|
"title": "Soy (Closure Template)", |
||||
|
"require": "markup-templating", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"stylus": { |
||||
|
"title": "Stylus", |
||||
|
"owner": "vkbansal" |
||||
|
}, |
||||
|
"swift": { |
||||
|
"title": "Swift", |
||||
|
"require": "clike", |
||||
|
"owner": "chrischares" |
||||
|
}, |
||||
|
"tap": { |
||||
|
"title": "TAP", |
||||
|
"owner": "isaacs", |
||||
|
"require": "yaml" |
||||
|
}, |
||||
|
"tcl": { |
||||
|
"title": "Tcl", |
||||
|
"owner": "PeterChaplin" |
||||
|
}, |
||||
|
"textile": { |
||||
|
"title": "Textile", |
||||
|
"require": "markup", |
||||
|
"peerDependencies": "css", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"tt2": { |
||||
|
"title": "Template Toolkit 2", |
||||
|
"require": ["clike", "markup-templating"], |
||||
|
"owner": "gflohr" |
||||
|
}, |
||||
|
"twig": { |
||||
|
"title": "Twig", |
||||
|
"require": "markup", |
||||
|
"owner": "brandonkelly" |
||||
|
}, |
||||
|
"typescript": { |
||||
|
"title": "TypeScript", |
||||
|
"require": "javascript", |
||||
|
"alias": "ts", |
||||
|
"owner": "vkbansal" |
||||
|
}, |
||||
|
"vbnet": { |
||||
|
"title": "VB.Net", |
||||
|
"require": "basic", |
||||
|
"owner": "Bigsby" |
||||
|
}, |
||||
|
"velocity": { |
||||
|
"title": "Velocity", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"verilog": { |
||||
|
"title": "Verilog", |
||||
|
"owner": "a-rey" |
||||
|
}, |
||||
|
"vhdl": { |
||||
|
"title": "VHDL", |
||||
|
"owner": "a-rey" |
||||
|
}, |
||||
|
"vim": { |
||||
|
"title": "vim", |
||||
|
"owner": "westonganger" |
||||
|
}, |
||||
|
"visual-basic": { |
||||
|
"title": "Visual Basic", |
||||
|
"owner": "Golmote", |
||||
|
"alias": "vb" |
||||
|
}, |
||||
|
"wasm": { |
||||
|
"title": "WebAssembly", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"wiki": { |
||||
|
"title": "Wiki markup", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"xeora": { |
||||
|
"title": "Xeora", |
||||
|
"require": "markup", |
||||
|
"owner": "freakmaxi" |
||||
|
}, |
||||
|
"xojo": { |
||||
|
"title": "Xojo (REALbasic)", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"xquery": { |
||||
|
"title": "XQuery", |
||||
|
"require": "markup", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"yaml": { |
||||
|
"title": "YAML", |
||||
|
"owner": "hason" |
||||
|
} |
||||
|
}, |
||||
|
"plugins": { |
||||
|
"meta": { |
||||
|
"path": "plugins/{id}/prism-{id}", |
||||
|
"link": "plugins/{id}/" |
||||
|
}, |
||||
|
"line-highlight": "Line Highlight", |
||||
|
"line-numbers": { |
||||
|
"title": "Line Numbers", |
||||
|
"owner": "kuba-kubula" |
||||
|
}, |
||||
|
"show-invisibles": "Show Invisibles", |
||||
|
"autolinker": "Autolinker", |
||||
|
"wpd": "WebPlatform Docs", |
||||
|
"custom-class": { |
||||
|
"title": "Custom Class", |
||||
|
"owner": "dvkndn", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"file-highlight": { |
||||
|
"title": "File Highlight", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"show-language": { |
||||
|
"title": "Show Language", |
||||
|
"owner": "nauzilus", |
||||
|
"noCSS": true, |
||||
|
"require": "toolbar" |
||||
|
}, |
||||
|
"jsonp-highlight": { |
||||
|
"title": "JSONP Highlight", |
||||
|
"noCSS": true, |
||||
|
"owner": "nauzilus" |
||||
|
}, |
||||
|
"highlight-keywords": { |
||||
|
"title": "Highlight Keywords", |
||||
|
"owner": "vkbansal", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"remove-initial-line-feed": { |
||||
|
"title": "Remove initial line feed", |
||||
|
"owner": "Golmote", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"previewers": { |
||||
|
"title": "Previewers", |
||||
|
"owner": "Golmote" |
||||
|
}, |
||||
|
"autoloader": { |
||||
|
"title": "Autoloader", |
||||
|
"owner": "Golmote", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"keep-markup": { |
||||
|
"title": "Keep Markup", |
||||
|
"owner": "Golmote", |
||||
|
"after": "normalize-whitespace", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"command-line": { |
||||
|
"title": "Command Line", |
||||
|
"owner": "chriswells0" |
||||
|
}, |
||||
|
"unescaped-markup": "Unescaped Markup", |
||||
|
"normalize-whitespace": { |
||||
|
"title": "Normalize Whitespace", |
||||
|
"owner": "zeitgeist87", |
||||
|
"after": "unescaped-markup", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"data-uri-highlight": { |
||||
|
"title": "Data-URI Highlight", |
||||
|
"owner": "Golmote", |
||||
|
"noCSS": true |
||||
|
}, |
||||
|
"toolbar": { |
||||
|
"title": "Toolbar", |
||||
|
"owner": "mAAdhaTTah" |
||||
|
}, |
||||
|
"copy-to-clipboard": { |
||||
|
"title": "Copy to Clipboard Button", |
||||
|
"owner": "mAAdhaTTah", |
||||
|
"require": "toolbar", |
||||
|
"noCSS": true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,82 @@ |
|||||
|
var components = require('../components.js'); |
||||
|
var peerDependentsMap = null; |
||||
|
|
||||
|
function getPeerDependentsMap() { |
||||
|
var peerDependentsMap = {}; |
||||
|
Object.keys(components.languages).forEach(function (language) { |
||||
|
if (language === 'meta') { |
||||
|
return false; |
||||
|
} |
||||
|
if (components.languages[language].peerDependencies) { |
||||
|
var peerDependencies = components.languages[language].peerDependencies; |
||||
|
if (!Array.isArray(peerDependencies)) { |
||||
|
peerDependencies = [peerDependencies]; |
||||
|
} |
||||
|
peerDependencies.forEach(function (peerDependency) { |
||||
|
if (!peerDependentsMap[peerDependency]) { |
||||
|
peerDependentsMap[peerDependency] = []; |
||||
|
} |
||||
|
peerDependentsMap[peerDependency].push(language); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
return peerDependentsMap; |
||||
|
} |
||||
|
|
||||
|
function getPeerDependents(mainLanguage) { |
||||
|
if (!peerDependentsMap) { |
||||
|
peerDependentsMap = getPeerDependentsMap(); |
||||
|
} |
||||
|
return peerDependentsMap[mainLanguage] || []; |
||||
|
} |
||||
|
|
||||
|
function loadLanguages(arr, withoutDependencies) { |
||||
|
// If no argument is passed, load all components
|
||||
|
if (!arr) { |
||||
|
arr = Object.keys(components.languages).filter(function (language) { |
||||
|
return language !== 'meta'; |
||||
|
}); |
||||
|
} |
||||
|
if (arr && !arr.length) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (!Array.isArray(arr)) { |
||||
|
arr = [arr]; |
||||
|
} |
||||
|
|
||||
|
arr.forEach(function (language) { |
||||
|
if (!components.languages[language]) { |
||||
|
console.warn('Language does not exist ' + language); |
||||
|
return; |
||||
|
} |
||||
|
// Load dependencies first
|
||||
|
if (!withoutDependencies && components.languages[language].require) { |
||||
|
loadLanguages(components.languages[language].require); |
||||
|
} |
||||
|
|
||||
|
var pathToLanguage = './prism-' + language; |
||||
|
delete require.cache[require.resolve(pathToLanguage)]; |
||||
|
delete Prism.languages[language]; |
||||
|
require(pathToLanguage); |
||||
|
|
||||
|
// Reload dependents
|
||||
|
var dependents = getPeerDependents(language).filter(function (dependent) { |
||||
|
// If dependent language was already loaded,
|
||||
|
// we want to reload it.
|
||||
|
if (Prism.languages[dependent]) { |
||||
|
delete Prism.languages[dependent]; |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
}); |
||||
|
if (dependents.length) { |
||||
|
loadLanguages(dependents, true); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
module.exports = function (arr) { |
||||
|
// Don't expose withoutDependencies
|
||||
|
loadLanguages(arr); |
||||
|
}; |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,17 @@ |
|||||
|
Prism.languages.actionscript = Prism.languages.extend('javascript', { |
||||
|
'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/, |
||||
|
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/ |
||||
|
}); |
||||
|
Prism.languages.actionscript['class-name'].alias = 'function'; |
||||
|
|
||||
|
if (Prism.languages.markup) { |
||||
|
Prism.languages.insertBefore('actionscript', 'string', { |
||||
|
'xml': { |
||||
|
pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
rest: Prism.languages.markup |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:{rest:Prism.languages.markup}}}); |
||||
@ -0,0 +1,19 @@ |
|||||
|
Prism.languages.ada = { |
||||
|
'comment': /--.*/, |
||||
|
'string': /"(?:""|[^"\r\f\n])*"/i, |
||||
|
'number': [ |
||||
|
{ |
||||
|
pattern: /\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i |
||||
|
} |
||||
|
], |
||||
|
'attr-name': /\b'\w+/i, |
||||
|
'keyword': /\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i, |
||||
|
'boolean': /\b(?:true|false)\b/i, |
||||
|
'operator': /<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/, |
||||
|
'punctuation': /\.\.?|[,;():]/, |
||||
|
'char': /'.'/, |
||||
|
'variable': /\b[a-z](?:[_a-z\d])*\b/i |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.ada={comment:/--.*/,string:/"(?:""|[^"\r\f\n])*"/i,number:[{pattern:/\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i},{pattern:/\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i}],"attr-name":/\b'\w+/i,keyword:/\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,"boolean":/\b(?:true|false)\b/i,operator:/<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/,punctuation:/\.\.?|[,;():]/,"char":/'.'/,variable:/\b[a-z](?:[_a-z\d])*\b/i}; |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,32 @@ |
|||||
|
Prism.languages.apl = { |
||||
|
'comment': /(?:⍝|#[! ]).*$/m, |
||||
|
'string': { |
||||
|
pattern: /'(?:[^'\r\n]|'')*'/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'number': /¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i, |
||||
|
'statement': /:[A-Z][a-z][A-Za-z]*\b/, |
||||
|
'system-function': { |
||||
|
pattern: /⎕[A-Z]+/i, |
||||
|
alias: 'function' |
||||
|
}, |
||||
|
'constant': /[⍬⌾#⎕⍞]/, |
||||
|
'function': /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/, |
||||
|
'monadic-operator': { |
||||
|
pattern: /[\\\/⌿⍀¨⍨⌶&∥]/, |
||||
|
alias: 'operator' |
||||
|
}, |
||||
|
'dyadic-operator': { |
||||
|
pattern: /[.⍣⍠⍤∘⌸@⌺]/, |
||||
|
alias: 'operator' |
||||
|
}, |
||||
|
'assignment': { |
||||
|
pattern: /←/, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
'punctuation': /[\[;\]()◇⋄]/, |
||||
|
'dfn': { |
||||
|
pattern: /[{}⍺⍵⍶⍹∇⍫:]/, |
||||
|
alias: 'builtin' |
||||
|
} |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.apl={comment:/(?:⍝|#[! ]).*$/m,string:{pattern:/'(?:[^'\r\n]|'')*'/,greedy:!0},number:/¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i,statement:/:[A-Z][a-z][A-Za-z]*\b/,"system-function":{pattern:/⎕[A-Z]+/i,alias:"function"},constant:/[⍬⌾#⎕⍞]/,"function":/[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,"monadic-operator":{pattern:/[\\\/⌿⍀¨⍨⌶&∥]/,alias:"operator"},"dyadic-operator":{pattern:/[.⍣⍠⍤∘⌸@⌺]/,alias:"operator"},assignment:{pattern:/←/,alias:"keyword"},punctuation:/[\[;\]()◇⋄]/,dfn:{pattern:/[{}⍺⍵⍶⍹∇⍫:]/,alias:"builtin"}}; |
||||
@ -0,0 +1,20 @@ |
|||||
|
Prism.languages.applescript = { |
||||
|
'comment': [ |
||||
|
// Allow one level of nesting
|
||||
|
/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/, |
||||
|
/--.+/, |
||||
|
/#.+/ |
||||
|
], |
||||
|
'string': /"(?:\\.|[^"\\\r\n])*"/, |
||||
|
'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:e-?\d+)?\b/i, |
||||
|
'operator': [ |
||||
|
/[&=≠≤≥*+\-\/÷^]|[<>]=?/, |
||||
|
/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/ |
||||
|
], |
||||
|
'keyword': /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/, |
||||
|
'class': { |
||||
|
pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, |
||||
|
alias: 'builtin' |
||||
|
}, |
||||
|
'punctuation': /[{}():,¬«»《》]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.applescript={comment:[/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,/--.+/,/#.+/],string:/"(?:\\.|[^"\\\r\n])*"/,number:/(?:\b\d+\.?\d*|\B\.\d+)(?:e-?\d+)?\b/i,operator:[/[&=≠≤≥*+\-\/÷^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},punctuation:/[{}():,¬«»《》]/}; |
||||
@ -0,0 +1,5 @@ |
|||||
|
Prism.languages.arduino = Prism.languages.extend('cpp', { |
||||
|
'keyword': /\b(?:setup|if|else|while|do|for|return|in|instanceof|default|function|loop|goto|switch|case|new|try|throw|catch|finally|null|break|continue|boolean|bool|void|byte|word|string|String|array|int|long|integer|double)\b/, |
||||
|
'builtin': /\b(?:KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|LiquidCrystal_I2C|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD|runShellCommandAsynchronously|analogWriteResolution|retrieveCallingNumber|printFirmwareVersion|analogReadResolution|sendDigitalPortPair|noListenOnLocalhost|readJoystickButton|setFirmwareVersion|readJoystickSwitch|scrollDisplayRight|getVoiceCallStatus|scrollDisplayLeft|writeMicroseconds|delayMicroseconds|beginTransmission|getSignalStrength|runAsynchronously|getAsynchronously|listenOnLocalhost|getCurrentCarrier|readAccelerometer|messageAvailable|sendDigitalPorts|lineFollowConfig|countryNameWrite|runShellCommand|readStringUntil|rewindDirectory|readTemperature|setClockDivider|readLightSensor|endTransmission|analogReference|detachInterrupt|countryNameRead|attachInterrupt|encryptionType|readBytesUntil|robotNameWrite|readMicrophone|robotNameRead|cityNameWrite|userNameWrite|readJoystickY|readJoystickX|mouseReleased|openNextFile|scanNetworks|noInterrupts|digitalWrite|beginSpeaker|mousePressed|isActionDone|mouseDragged|displayLogos|noAutoscroll|addParameter|remoteNumber|getModifiers|keyboardRead|userNameRead|waitContinue|processInput|parseCommand|printVersion|readNetworks|writeMessage|blinkVersion|cityNameRead|readMessage|setDataMode|parsePacket|isListening|setBitOrder|beginPacket|isDirectory|motorsWrite|drawCompass|digitalRead|clearScreen|serialEvent|rightToLeft|setTextSize|leftToRight|requestFrom|keyReleased|compassRead|analogWrite|interrupts|WiFiServer|disconnect|playMelody|parseFloat|autoscroll|getPINUsed|setPINUsed|setTimeout|sendAnalog|readSlider|analogRead|beginWrite|createChar|motorsStop|keyPressed|tempoWrite|readButton|subnetMask|debugPrint|macAddress|writeGreen|randomSeed|attachGPRS|readString|sendString|remotePort|releaseAll|mouseMoved|background|getXChange|getYChange|answerCall|getResult|voiceCall|endPacket|constrain|getSocket|writeJSON|getButton|available|connected|findUntil|readBytes|exitValue|readGreen|writeBlue|startLoop|IPAddress|isPressed|sendSysex|pauseMode|gatewayIP|setCursor|getOemKey|tuneWrite|noDisplay|loadImage|switchPIN|onRequest|onReceive|changePIN|playFile|noBuffer|parseInt|overflow|checkPIN|knobRead|beginTFT|bitClear|updateIR|bitWrite|position|writeRGB|highByte|writeRed|setSpeed|readBlue|noStroke|remoteIP|transfer|shutdown|hangCall|beginSMS|endWrite|attached|maintain|noCursor|checkReg|checkPUK|shiftOut|isValid|shiftIn|pulseIn|connect|println|localIP|pinMode|getIMEI|display|noBlink|process|getBand|running|beginSD|drawBMP|lowByte|setBand|release|bitRead|prepare|pointTo|readRed|setMode|noFill|remove|listen|stroke|detach|attach|noTone|exists|buffer|height|bitSet|circle|config|cursor|random|IRread|setDNS|endSMS|getKey|micros|millis|begin|print|write|ready|flush|width|isPIN|blink|clear|press|mkdir|rmdir|close|point|yield|image|BSSID|click|delay|read|text|move|peek|beep|rect|line|open|seek|fill|size|turn|stop|home|find|step|tone|sqrt|RSSI|SSID|end|bit|tan|cos|sin|pow|map|abs|max|min|get|run|put)\b/, |
||||
|
'constant': /\b(?:DIGITAL_MESSAGE|FIRMATA_STRING|ANALOG_MESSAGE|REPORT_DIGITAL|REPORT_ANALOG|INPUT_PULLUP|SET_PIN_MODE|INTERNAL2V56|SYSTEM_RESET|LED_BUILTIN|INTERNAL1V1|SYSEX_START|INTERNAL|EXTERNAL|DEFAULT|OUTPUT|INPUT|HIGH|LOW)\b/ |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.arduino=Prism.languages.extend("cpp",{keyword:/\b(?:setup|if|else|while|do|for|return|in|instanceof|default|function|loop|goto|switch|case|new|try|throw|catch|finally|null|break|continue|boolean|bool|void|byte|word|string|String|array|int|long|integer|double)\b/,builtin:/\b(?:KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|LiquidCrystal_I2C|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD|runShellCommandAsynchronously|analogWriteResolution|retrieveCallingNumber|printFirmwareVersion|analogReadResolution|sendDigitalPortPair|noListenOnLocalhost|readJoystickButton|setFirmwareVersion|readJoystickSwitch|scrollDisplayRight|getVoiceCallStatus|scrollDisplayLeft|writeMicroseconds|delayMicroseconds|beginTransmission|getSignalStrength|runAsynchronously|getAsynchronously|listenOnLocalhost|getCurrentCarrier|readAccelerometer|messageAvailable|sendDigitalPorts|lineFollowConfig|countryNameWrite|runShellCommand|readStringUntil|rewindDirectory|readTemperature|setClockDivider|readLightSensor|endTransmission|analogReference|detachInterrupt|countryNameRead|attachInterrupt|encryptionType|readBytesUntil|robotNameWrite|readMicrophone|robotNameRead|cityNameWrite|userNameWrite|readJoystickY|readJoystickX|mouseReleased|openNextFile|scanNetworks|noInterrupts|digitalWrite|beginSpeaker|mousePressed|isActionDone|mouseDragged|displayLogos|noAutoscroll|addParameter|remoteNumber|getModifiers|keyboardRead|userNameRead|waitContinue|processInput|parseCommand|printVersion|readNetworks|writeMessage|blinkVersion|cityNameRead|readMessage|setDataMode|parsePacket|isListening|setBitOrder|beginPacket|isDirectory|motorsWrite|drawCompass|digitalRead|clearScreen|serialEvent|rightToLeft|setTextSize|leftToRight|requestFrom|keyReleased|compassRead|analogWrite|interrupts|WiFiServer|disconnect|playMelody|parseFloat|autoscroll|getPINUsed|setPINUsed|setTimeout|sendAnalog|readSlider|analogRead|beginWrite|createChar|motorsStop|keyPressed|tempoWrite|readButton|subnetMask|debugPrint|macAddress|writeGreen|randomSeed|attachGPRS|readString|sendString|remotePort|releaseAll|mouseMoved|background|getXChange|getYChange|answerCall|getResult|voiceCall|endPacket|constrain|getSocket|writeJSON|getButton|available|connected|findUntil|readBytes|exitValue|readGreen|writeBlue|startLoop|IPAddress|isPressed|sendSysex|pauseMode|gatewayIP|setCursor|getOemKey|tuneWrite|noDisplay|loadImage|switchPIN|onRequest|onReceive|changePIN|playFile|noBuffer|parseInt|overflow|checkPIN|knobRead|beginTFT|bitClear|updateIR|bitWrite|position|writeRGB|highByte|writeRed|setSpeed|readBlue|noStroke|remoteIP|transfer|shutdown|hangCall|beginSMS|endWrite|attached|maintain|noCursor|checkReg|checkPUK|shiftOut|isValid|shiftIn|pulseIn|connect|println|localIP|pinMode|getIMEI|display|noBlink|process|getBand|running|beginSD|drawBMP|lowByte|setBand|release|bitRead|prepare|pointTo|readRed|setMode|noFill|remove|listen|stroke|detach|attach|noTone|exists|buffer|height|bitSet|circle|config|cursor|random|IRread|setDNS|endSMS|getKey|micros|millis|begin|print|write|ready|flush|width|isPIN|blink|clear|press|mkdir|rmdir|close|point|yield|image|BSSID|click|delay|read|text|move|peek|beep|rect|line|open|seek|fill|size|turn|stop|home|find|step|tone|sqrt|RSSI|SSID|end|bit|tan|cos|sin|pow|map|abs|max|min|get|run|put)\b/,constant:/\b(?:DIGITAL_MESSAGE|FIRMATA_STRING|ANALOG_MESSAGE|REPORT_DIGITAL|REPORT_ANALOG|INPUT_PULLUP|SET_PIN_MODE|INTERNAL2V56|SYSTEM_RESET|LED_BUILTIN|INTERNAL1V1|SYSEX_START|INTERNAL|EXTERNAL|DEFAULT|OUTPUT|INPUT|HIGH|LOW)\b/}); |
||||
@ -0,0 +1,10 @@ |
|||||
|
Prism.languages.arff = { |
||||
|
'comment': /%.*/, |
||||
|
'string': { |
||||
|
pattern: /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'keyword': /@(?:attribute|data|end|relation)\b/i, |
||||
|
'number': /\b\d+(?:\.\d+)?\b/, |
||||
|
'punctuation': /[{},]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.arff={comment:/%.*/,string:{pattern:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/@(?:attribute|data|end|relation)\b/i,number:/\b\d+(?:\.\d+)?\b/,punctuation:/[{},]/}; |
||||
@ -0,0 +1,271 @@ |
|||||
|
(function (Prism) { |
||||
|
|
||||
|
var attributes = { |
||||
|
pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'quoted': { |
||||
|
pattern: /([$`])(?:(?!\1)[^\\]|\\.)*\1/, |
||||
|
inside: { |
||||
|
'punctuation': /^[$`]|[$`]$/ |
||||
|
} |
||||
|
}, |
||||
|
'interpreted': { |
||||
|
pattern: /'(?:[^'\\]|\\.)*'/, |
||||
|
inside: { |
||||
|
'punctuation': /^'|'$/ |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
'string': /"(?:[^"\\]|\\.)*"/, |
||||
|
'variable': /\w+(?==)/, |
||||
|
'punctuation': /^\[|\]$|,/, |
||||
|
'operator': /=/, |
||||
|
// The negative look-ahead prevents blank matches
|
||||
|
'attr-value': /(?!^\s+$).+/ |
||||
|
} |
||||
|
}; |
||||
|
Prism.languages.asciidoc = { |
||||
|
'comment-block': { |
||||
|
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m, |
||||
|
alias: 'comment' |
||||
|
}, |
||||
|
'table': { |
||||
|
pattern: /^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m, |
||||
|
inside: { |
||||
|
'specifiers': { |
||||
|
pattern: /(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/, |
||||
|
alias: 'attr-value' |
||||
|
}, |
||||
|
'punctuation': { |
||||
|
pattern: /(^|[^\\])[|!]=*/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
'passthrough-block': { |
||||
|
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
||||
|
inside: { |
||||
|
'punctuation': /^\++|\++$/ |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
// Literal blocks and listing blocks
|
||||
|
'literal-block': { |
||||
|
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
||||
|
inside: { |
||||
|
'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/ |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
// Sidebar blocks, quote blocks, example blocks and open blocks
|
||||
|
'other-block': { |
||||
|
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
||||
|
inside: { |
||||
|
'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/ |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// list-punctuation and list-label must appear before indented-block
|
||||
|
'list-punctuation': { |
||||
|
pattern: /(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im, |
||||
|
lookbehind: true, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
'list-label': { |
||||
|
pattern: /(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im, |
||||
|
lookbehind: true, |
||||
|
alias: 'symbol' |
||||
|
}, |
||||
|
'indented-block': { |
||||
|
pattern: /((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
|
||||
|
'comment': /^\/\/.*/m, |
||||
|
'title': { |
||||
|
pattern: /^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m, |
||||
|
alias: 'important', |
||||
|
inside: { |
||||
|
'punctuation': /^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/ |
||||
|
// See rest below
|
||||
|
} |
||||
|
}, |
||||
|
'attribute-entry': { |
||||
|
pattern: /^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m, |
||||
|
alias: 'tag' |
||||
|
}, |
||||
|
'attributes': attributes, |
||||
|
'hr': { |
||||
|
pattern: /^'{3,}$/m, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
'page-break': { |
||||
|
pattern: /^<{3,}$/m, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
'admonition': { |
||||
|
pattern: /^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
'callout': [ |
||||
|
{ |
||||
|
pattern: /(^[ \t]*)<?\d*>/m, |
||||
|
lookbehind: true, |
||||
|
alias: 'symbol' |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /<\d+>/, |
||||
|
alias: 'symbol' |
||||
|
} |
||||
|
], |
||||
|
'macro': { |
||||
|
pattern: /\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, |
||||
|
inside: { |
||||
|
'function': /^[a-z\d-]+(?=:)/, |
||||
|
'punctuation': /^::?/, |
||||
|
'attributes': { |
||||
|
pattern: /(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, |
||||
|
inside: attributes.inside |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
'inline': { |
||||
|
/* |
||||
|
The initial look-behind prevents the highlighting of escaped quoted text. |
||||
|
|
||||
|
Quoted text can be multi-line but cannot span an empty line. |
||||
|
All quoted text can have attributes before [foobar, 'foobar', baz="bar"]. |
||||
|
|
||||
|
First, we handle the constrained quotes. |
||||
|
Those must be bounded by non-word chars and cannot have spaces between the delimiter and the first char. |
||||
|
They are, in order: _emphasis_, ``double quotes'', `single quotes', `monospace`, 'emphasis', *strong*, +monospace+ and #unquoted#
|
||||
|
|
||||
|
Then we handle the unconstrained quotes. |
||||
|
Those do not have the restrictions of the constrained quotes. |
||||
|
They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <<xref>>, (((indexes))) and ((indexes)) |
||||
|
*/ |
||||
|
pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'attributes': attributes, |
||||
|
'url': { |
||||
|
pattern: /^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/, |
||||
|
inside: { |
||||
|
'punctuation': /^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/ |
||||
|
} |
||||
|
}, |
||||
|
'attribute-ref': { |
||||
|
pattern: /^\{.+\}$/, |
||||
|
inside: { |
||||
|
'variable': { |
||||
|
pattern: /(^\{)[a-z\d,+_-]+/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
'operator': /^[=?!#%@$]|!(?=[:}])/, |
||||
|
'punctuation': /^\{|\}$|::?/ |
||||
|
} |
||||
|
}, |
||||
|
'italic': { |
||||
|
pattern: /^(['_])[\s\S]+\1$/, |
||||
|
inside: { |
||||
|
'punctuation': /^(?:''?|__?)|(?:''?|__?)$/ |
||||
|
} |
||||
|
}, |
||||
|
'bold': { |
||||
|
pattern: /^\*[\s\S]+\*$/, |
||||
|
inside: { |
||||
|
punctuation: /^\*\*?|\*\*?$/ |
||||
|
} |
||||
|
}, |
||||
|
'punctuation': /^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/ |
||||
|
} |
||||
|
}, |
||||
|
'replacement': { |
||||
|
pattern: /\((?:C|TM|R)\)/, |
||||
|
alias: 'builtin' |
||||
|
}, |
||||
|
'entity': /&#?[\da-z]{1,8};/i, |
||||
|
'line-continuation': { |
||||
|
pattern: /(^| )\+$/m, |
||||
|
lookbehind: true, |
||||
|
alias: 'punctuation' |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
// Allow some nesting. There is no recursion though, so cloning should not be needed.
|
||||
|
|
||||
|
attributes.inside['interpreted'].inside.rest = { |
||||
|
'macro': Prism.languages.asciidoc['macro'], |
||||
|
'inline': Prism.languages.asciidoc['inline'], |
||||
|
'replacement': Prism.languages.asciidoc['replacement'], |
||||
|
'entity': Prism.languages.asciidoc['entity'] |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.asciidoc['passthrough-block'].inside.rest = { |
||||
|
'macro': Prism.languages.asciidoc['macro'] |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.asciidoc['literal-block'].inside.rest = { |
||||
|
'callout': Prism.languages.asciidoc['callout'] |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.asciidoc['table'].inside.rest = { |
||||
|
'comment-block': Prism.languages.asciidoc['comment-block'], |
||||
|
'passthrough-block': Prism.languages.asciidoc['passthrough-block'], |
||||
|
'literal-block': Prism.languages.asciidoc['literal-block'], |
||||
|
'other-block': Prism.languages.asciidoc['other-block'], |
||||
|
'list-punctuation': Prism.languages.asciidoc['list-punctuation'], |
||||
|
'indented-block': Prism.languages.asciidoc['indented-block'], |
||||
|
'comment': Prism.languages.asciidoc['comment'], |
||||
|
'title': Prism.languages.asciidoc['title'], |
||||
|
'attribute-entry': Prism.languages.asciidoc['attribute-entry'], |
||||
|
'attributes': Prism.languages.asciidoc['attributes'], |
||||
|
'hr': Prism.languages.asciidoc['hr'], |
||||
|
'page-break': Prism.languages.asciidoc['page-break'], |
||||
|
'admonition': Prism.languages.asciidoc['admonition'], |
||||
|
'list-label': Prism.languages.asciidoc['list-label'], |
||||
|
'callout': Prism.languages.asciidoc['callout'], |
||||
|
'macro': Prism.languages.asciidoc['macro'], |
||||
|
'inline': Prism.languages.asciidoc['inline'], |
||||
|
'replacement': Prism.languages.asciidoc['replacement'], |
||||
|
'entity': Prism.languages.asciidoc['entity'], |
||||
|
'line-continuation': Prism.languages.asciidoc['line-continuation'] |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.asciidoc['other-block'].inside.rest = { |
||||
|
'table': Prism.languages.asciidoc['table'], |
||||
|
'list-punctuation': Prism.languages.asciidoc['list-punctuation'], |
||||
|
'indented-block': Prism.languages.asciidoc['indented-block'], |
||||
|
'comment': Prism.languages.asciidoc['comment'], |
||||
|
'attribute-entry': Prism.languages.asciidoc['attribute-entry'], |
||||
|
'attributes': Prism.languages.asciidoc['attributes'], |
||||
|
'hr': Prism.languages.asciidoc['hr'], |
||||
|
'page-break': Prism.languages.asciidoc['page-break'], |
||||
|
'admonition': Prism.languages.asciidoc['admonition'], |
||||
|
'list-label': Prism.languages.asciidoc['list-label'], |
||||
|
'macro': Prism.languages.asciidoc['macro'], |
||||
|
'inline': Prism.languages.asciidoc['inline'], |
||||
|
'replacement': Prism.languages.asciidoc['replacement'], |
||||
|
'entity': Prism.languages.asciidoc['entity'], |
||||
|
'line-continuation': Prism.languages.asciidoc['line-continuation'] |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.asciidoc['title'].inside.rest = { |
||||
|
'macro': Prism.languages.asciidoc['macro'], |
||||
|
'inline': Prism.languages.asciidoc['inline'], |
||||
|
'replacement': Prism.languages.asciidoc['replacement'], |
||||
|
'entity': Prism.languages.asciidoc['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)); |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,28 @@ |
|||||
|
Prism.languages.asm6502 = { |
||||
|
'comment': /;.*/, |
||||
|
'directive': { |
||||
|
pattern: /\.\w+(?= )/, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, |
||||
|
'opcode': { |
||||
|
pattern: /\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/, |
||||
|
alias: 'property' |
||||
|
}, |
||||
|
'hexnumber': { |
||||
|
pattern: /#?\$[\da-f]{2,4}/i, |
||||
|
alias: 'string' |
||||
|
}, |
||||
|
'binarynumber': { |
||||
|
pattern: /#?%[01]+/, |
||||
|
alias: 'string' |
||||
|
}, |
||||
|
'decimalnumber': { |
||||
|
pattern: /#?\d+/, |
||||
|
alias: 'string' |
||||
|
}, |
||||
|
'register': { |
||||
|
pattern: /\b[xya]\b/i, |
||||
|
alias: 'variable' |
||||
|
} |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.asm6502={comment:/;.*/,directive:{pattern:/\.\w+(?= )/,alias:"keyword"},string:/(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,opcode:{pattern:/\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/,alias:"property"},hexnumber:{pattern:/#?\$[\da-f]{2,4}/i,alias:"string"},binarynumber:{pattern:/#?%[01]+/,alias:"string"},decimalnumber:{pattern:/#?\d+/,alias:"string"},register:{pattern:/\b[xya]\b/i,alias:"variable"}}; |
||||
@ -0,0 +1,36 @@ |
|||||
|
Prism.languages.aspnet = Prism.languages.extend('markup', { |
||||
|
'page-directive tag': { |
||||
|
pattern: /<%\s*@.*%>/i, |
||||
|
inside: { |
||||
|
'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, |
||||
|
rest: Prism.languages.markup.tag.inside |
||||
|
} |
||||
|
}, |
||||
|
'directive tag': { |
||||
|
pattern: /<%.*%>/i, |
||||
|
inside: { |
||||
|
'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i, |
||||
|
rest: Prism.languages.csharp |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
// Regexp copied from prism-markup, with a negative look-ahead added
|
||||
|
Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i; |
||||
|
|
||||
|
// match directives of attribute value foo="<% Bar %>"
|
||||
|
Prism.languages.insertBefore('inside', 'punctuation', { |
||||
|
'directive tag': Prism.languages.aspnet['directive tag'] |
||||
|
}, Prism.languages.aspnet.tag.inside["attr-value"]); |
||||
|
|
||||
|
Prism.languages.insertBefore('aspnet', 'comment', { |
||||
|
'asp comment': /<%--[\s\S]*?--%>/ |
||||
|
}); |
||||
|
|
||||
|
// script runat="server" contains csharp, not javascript
|
||||
|
Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', { |
||||
|
'asp script': { |
||||
|
pattern: /(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, |
||||
|
lookbehind: true, |
||||
|
inside: Prism.languages.csharp || {} |
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.aspnet=Prism.languages.extend("markup",{"page-directive tag":{pattern:/<%\s*@.*%>/i,inside:{"page-directive tag":/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,rest:Prism.languages.markup.tag.inside}},"directive tag":{pattern:/<%.*%>/i,inside:{"directive tag":/<%\s*?[$=%#:]{0,2}|%>/i,rest:Prism.languages.csharp}}}),Prism.languages.aspnet.tag.pattern=/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,Prism.languages.insertBefore("inside","punctuation",{"directive tag":Prism.languages.aspnet["directive tag"]},Prism.languages.aspnet.tag.inside["attr-value"]),Prism.languages.insertBefore("aspnet","comment",{"asp comment":/<%--[\s\S]*?--%>/}),Prism.languages.insertBefore("aspnet",Prism.languages.javascript?"script":"tag",{"asp script":{pattern:/(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.csharp||{}}}); |
||||
@ -0,0 +1,27 @@ |
|||||
|
// NOTES - follows first-first highlight method, block is locked after highlight, different from SyntaxHl
|
||||
|
Prism.languages.autohotkey= { |
||||
|
'comment': { |
||||
|
pattern: /(^[^";\n]*("[^"\n]*?"[^"\n]*?)*)(?:;.*$|^\s*\/\*[\s\S]*\n\*\/)/m, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
'string': /"(?:[^"\n\r]|"")*"/m, |
||||
|
'function': /[^(); \t,\n+*\-=?>:\\\/<&%\[\]]+?(?=\()/m, //function - don't use .*\) in the end bcoz string locks it
|
||||
|
'tag': /^[ \t]*[^\s:]+?(?=:(?:[^:]|$))/m, //labels
|
||||
|
'variable': /%\w+%/, |
||||
|
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, |
||||
|
'operator': /\?|\/\/?=?|:=|\|[=|]?|&[=&]?|\+[=+]?|-[=-]?|\*[=*]?|<(?:<=?|>|=)?|>>?=?|[.^!=~]=?|\b(?:AND|NOT|OR)\b/, |
||||
|
'punctuation': /[{}[\]():,]/, |
||||
|
'boolean': /\b(?:true|false)\b/, |
||||
|
|
||||
|
'selector': /\b(?:AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i, |
||||
|
|
||||
|
'constant': /\b(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i, |
||||
|
|
||||
|
'builtin': /\b(?:abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i, |
||||
|
|
||||
|
'symbol': /\b(?:alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i, |
||||
|
|
||||
|
'important': /#\b(?:AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i, |
||||
|
|
||||
|
'keyword': /\b(?:Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i |
||||
|
}; |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,34 @@ |
|||||
|
Prism.languages.autoit = { |
||||
|
"comment": [ |
||||
|
/;.*/, |
||||
|
{ |
||||
|
// The multi-line comments delimiters can actually be commented out with ";"
|
||||
|
pattern: /(^\s*)#(?:comments-start|cs)[\s\S]*?^\s*#(?:comments-end|ce)/m, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
"url": { |
||||
|
pattern: /(^\s*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
"string": { |
||||
|
pattern: /(["'])(?:\1\1|(?!\1)[^\r\n])*\1/, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
"variable": /([%$@])\w+\1/ |
||||
|
} |
||||
|
}, |
||||
|
"directive": { |
||||
|
pattern: /(^\s*)#\w+/m, |
||||
|
lookbehind: true, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
"function": /\b\w+(?=\()/, |
||||
|
// Variables and macros
|
||||
|
"variable": /[$@]\w+/, |
||||
|
"keyword": /\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i, |
||||
|
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i, |
||||
|
"boolean": /\b(?:True|False)\b/i, |
||||
|
"operator": /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i, |
||||
|
"punctuation": /[\[\]().,:]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.autoit={comment:[/;.*/,{pattern:/(^\s*)#(?:comments-start|cs)[\s\S]*?^\s*#(?:comments-end|ce)/m,lookbehind:!0}],url:{pattern:/(^\s*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m,lookbehind:!0},string:{pattern:/(["'])(?:\1\1|(?!\1)[^\r\n])*\1/,greedy:!0,inside:{variable:/([%$@])\w+\1/}},directive:{pattern:/(^\s*)#\w+/m,lookbehind:!0,alias:"keyword"},"function":/\b\w+(?=\()/,variable:/[$@]\w+/,keyword:/\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,"boolean":/\b(?:True|False)\b/i,operator:/<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i,punctuation:/[\[\]().,:]/}; |
||||
@ -0,0 +1,84 @@ |
|||||
|
(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: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, |
||||
|
// 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: /\$\([^)]+\)|`[^`]+`/, |
||||
|
greedy: true, |
||||
|
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|curl|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|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/, |
||||
|
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.string = Prism.languages.bash.string; |
||||
|
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.languages.shell = Prism.languages.bash; |
||||
|
})(Prism); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(e){var t={variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[\w#?*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,lookbehind:!0,greedy:!0,inside:t},{pattern:/(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,greedy:!0,inside:t}],variable:t.variable,"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|curl|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|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/,lookbehind:!0},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:!0},"boolean":{pattern:/(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a.string=e.languages.bash.string,a["function"]=e.languages.bash["function"],a.keyword=e.languages.bash.keyword,a["boolean"]=e.languages.bash["boolean"],a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation,e.languages.shell=e.languages.bash}(Prism); |
||||
@ -0,0 +1,17 @@ |
|||||
|
Prism.languages.basic = { |
||||
|
'comment': { |
||||
|
pattern: /(?:!|REM\b).+/i, |
||||
|
inside: { |
||||
|
'keyword': /^REM/i |
||||
|
} |
||||
|
}, |
||||
|
'string': { |
||||
|
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:E[+-]?\d+)?/i, |
||||
|
'keyword': /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i, |
||||
|
'function': /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i, |
||||
|
'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i, |
||||
|
'punctuation': /[,;:()]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,greedy:!0},number:/(?:\b\d+\.?\d*|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,"function":/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}; |
||||
@ -0,0 +1,99 @@ |
|||||
|
(function (Prism) { |
||||
|
var variable = /%%?[~:\w]+%?|!\S+!/; |
||||
|
var parameter = { |
||||
|
pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im, |
||||
|
alias: 'attr-name', |
||||
|
inside: { |
||||
|
'punctuation': /:/ |
||||
|
} |
||||
|
}; |
||||
|
var string = /"[^"]*"/; |
||||
|
var number = /(?:\b|-)\d+\b/; |
||||
|
|
||||
|
Prism.languages.batch = { |
||||
|
'comment': [ |
||||
|
/^::.*/m, |
||||
|
{ |
||||
|
pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
'label': { |
||||
|
pattern: /^:.*/m, |
||||
|
alias: 'property' |
||||
|
}, |
||||
|
'command': [ |
||||
|
{ |
||||
|
// FOR command
|
||||
|
pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'keyword': /^for\b|\b(?:in|do)\b/i, |
||||
|
'string': string, |
||||
|
'parameter': parameter, |
||||
|
'variable': variable, |
||||
|
'number': number, |
||||
|
'punctuation': /[()',]/ |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// IF command
|
||||
|
pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i, |
||||
|
'string': string, |
||||
|
'parameter': parameter, |
||||
|
'variable': variable, |
||||
|
'number': number, |
||||
|
'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// ELSE command
|
||||
|
pattern: /((?:^|[&()])[ \t]*)else\b/im, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'keyword': /^else\b/i |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// SET command
|
||||
|
pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'keyword': /^set\b/i, |
||||
|
'string': string, |
||||
|
'parameter': parameter, |
||||
|
'variable': [ |
||||
|
variable, |
||||
|
/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/ |
||||
|
], |
||||
|
'number': number, |
||||
|
'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/, |
||||
|
'punctuation': /[()',]/ |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// Other commands
|
||||
|
pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'keyword': /^\w+\b/i, |
||||
|
'string': string, |
||||
|
'parameter': parameter, |
||||
|
'label': { |
||||
|
pattern: /(^\s*):\S+/m, |
||||
|
lookbehind: true, |
||||
|
alias: 'property' |
||||
|
}, |
||||
|
'variable': variable, |
||||
|
'number': number, |
||||
|
'operator': /\^/ |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
'operator': /[&@]/, |
||||
|
'punctuation': /[()']/ |
||||
|
}; |
||||
|
}(Prism)); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(e){var r=/%%?[~:\w]+%?|!\S+!/,t={pattern:/\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,alias:"attr-name",inside:{punctuation:/:/}},n=/"[^"]*"/,i=/(?:\b|-)\d+\b/;e.languages.batch={comment:[/^::.*/m,{pattern:/((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0}],label:{pattern:/^:.*/m,alias:"property"},command:[{pattern:/((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,lookbehind:!0,inside:{keyword:/^for\b|\b(?:in|do)\b/i,string:n,parameter:t,variable:r,number:i,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,lookbehind:!0,inside:{keyword:/^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,string:n,parameter:t,variable:r,number:i,operator:/\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i}},{pattern:/((?:^|[&()])[ \t]*)else\b/im,lookbehind:!0,inside:{keyword:/^else\b/i}},{pattern:/((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0,inside:{keyword:/^set\b/i,string:n,parameter:t,variable:[r,/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/],number:i,operator:/[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0,inside:{keyword:/^\w+\b/i,string:n,parameter:t,label:{pattern:/(^\s*):\S+/m,lookbehind:!0,alias:"property"},variable:r,number:i,operator:/\^/}}],operator:/[&@]/,punctuation:/[()']/}}(Prism); |
||||
@ -0,0 +1,39 @@ |
|||||
|
Prism.languages.bison = Prism.languages.extend('c', {}); |
||||
|
|
||||
|
Prism.languages.insertBefore('bison', 'comment', { |
||||
|
'bison': { |
||||
|
// This should match all the beginning of the file
|
||||
|
// including the prologue(s), the bison declarations and
|
||||
|
// the grammar rules.
|
||||
|
pattern: /^[\s\S]*?%%[\s\S]*?%%/, |
||||
|
inside: { |
||||
|
'c': { |
||||
|
// Allow for one level of nested braces
|
||||
|
pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/, |
||||
|
inside: { |
||||
|
'delimiter': { |
||||
|
pattern: /^%?\{|%?\}$/, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
'bison-variable': { |
||||
|
pattern: /[$@](?:<[^\s>]+>)?[\w$]+/, |
||||
|
alias: 'variable', |
||||
|
inside: { |
||||
|
'punctuation': /<|>/ |
||||
|
} |
||||
|
}, |
||||
|
rest: Prism.languages.c |
||||
|
} |
||||
|
}, |
||||
|
'comment': Prism.languages.c.comment, |
||||
|
'string': Prism.languages.c.string, |
||||
|
'property': /\S+(?=:)/, |
||||
|
'keyword': /%\w+/, |
||||
|
'number': { |
||||
|
pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
'punctuation': /%[%?]|[|:;\[\]<>]/ |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.bison=Prism.languages.extend("c",{}),Prism.languages.insertBefore("bison","comment",{bison:{pattern:/^[\s\S]*?%%[\s\S]*?%%/,inside:{c:{pattern:/%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,inside:{delimiter:{pattern:/^%?\{|%?\}$/,alias:"punctuation"},"bison-variable":{pattern:/[$@](?:<[^\s>]+>)?[\w$]+/,alias:"variable",inside:{punctuation:/<|>/}},rest:Prism.languages.c}},comment:Prism.languages.c.comment,string:Prism.languages.c.string,property:/\S+(?=:)/,keyword:/%\w+/,number:{pattern:/(^|[^@])\b(?:0x[\da-f]+|\d+)/i,lookbehind:!0},punctuation:/%[%?]|[|:;\[\]<>]/}}}); |
||||
@ -0,0 +1,20 @@ |
|||||
|
Prism.languages.brainfuck = { |
||||
|
'pointer': { |
||||
|
pattern: /<|>/, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
'increment': { |
||||
|
pattern: /\+/, |
||||
|
alias: 'inserted' |
||||
|
}, |
||||
|
'decrement': { |
||||
|
pattern: /-/, |
||||
|
alias: 'deleted' |
||||
|
}, |
||||
|
'branching': { |
||||
|
pattern: /\[|\]/, |
||||
|
alias: 'important' |
||||
|
}, |
||||
|
'operator': /[.,]/, |
||||
|
'comment': /\S+/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.brainfuck={pointer:{pattern:/<|>/,alias:"keyword"},increment:{pattern:/\+/,alias:"inserted"},decrement:{pattern:/-/,alias:"deleted"},branching:{pattern:/\[|\]/,alias:"important"},operator:/[.,]/,comment:/\S+/}; |
||||
@ -0,0 +1,48 @@ |
|||||
|
Prism.languages.bro = { |
||||
|
|
||||
|
'comment': { |
||||
|
pattern: /(^|[^\\$])#.*/, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
'italic': /\b(?:TODO|FIXME|XXX)\b/ |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
'string': { |
||||
|
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
|
||||
|
'boolean': /\b[TF]\b/, |
||||
|
|
||||
|
'function': { |
||||
|
pattern: /(?:function|hook|event) \w+(?:::\w+)?/, |
||||
|
inside: { |
||||
|
keyword: /^(?:function|hook|event)/ |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
'variable': { |
||||
|
pattern: /(?:global|local) \w+/i, |
||||
|
inside: { |
||||
|
keyword: /(?:global|local)/ |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
'builtin': /(?:@(?:load(?:-(?:sigs|plugin))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/, |
||||
|
|
||||
|
'constant': { |
||||
|
pattern: /const \w+/i, |
||||
|
inside: { |
||||
|
keyword: /const/ |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
'keyword': /\b(?:break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/, |
||||
|
|
||||
|
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/, |
||||
|
|
||||
|
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
||||
|
|
||||
|
'punctuation': /[{}[\];(),.:]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.bro={comment:{pattern:/(^|[^\\$])#.*/,lookbehind:!0,inside:{italic:/\b(?:TODO|FIXME|XXX)\b/}},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"boolean":/\b[TF]\b/,"function":{pattern:/(?:function|hook|event) \w+(?:::\w+)?/,inside:{keyword:/^(?:function|hook|event)/}},variable:{pattern:/(?:global|local) \w+/i,inside:{keyword:/(?:global|local)/}},builtin:/(?:@(?:load(?:-(?:sigs|plugin))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/,constant:{pattern:/const \w+/i,inside:{keyword:/const/}},keyword:/\b(?:break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,punctuation:/[{}[\];(),.:]/}; |
||||
@ -0,0 +1,33 @@ |
|||||
|
Prism.languages.c = Prism.languages.extend('clike', { |
||||
|
'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, |
||||
|
'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/, |
||||
|
'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('c', 'string', { |
||||
|
'macro': { |
||||
|
// allow for multiline macro definitions
|
||||
|
// spaces after the # character compile fine with gcc
|
||||
|
pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im, |
||||
|
lookbehind: true, |
||||
|
alias: 'property', |
||||
|
inside: { |
||||
|
// highlight the path of the include statement as a string
|
||||
|
'string': { |
||||
|
pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
// highlight macro directives as keywords
|
||||
|
'directive': { |
||||
|
pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/, |
||||
|
lookbehind: true, |
||||
|
alias: 'keyword' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// highlight predefined macros as constants
|
||||
|
'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/ |
||||
|
}); |
||||
|
|
||||
|
delete Prism.languages.c['class-name']; |
||||
|
delete Prism.languages.c['boolean']; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/,number:/(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c["class-name"],delete Prism.languages.c["boolean"]; |
||||
@ -0,0 +1,30 @@ |
|||||
|
Prism.languages.clike = { |
||||
|
'comment': [ |
||||
|
{ |
||||
|
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /(^|[^\\:])\/\/.*/, |
||||
|
lookbehind: true, |
||||
|
greedy: 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': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
||||
|
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, |
||||
|
'punctuation': /[{}[\];(),.:]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,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:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; |
||||
@ -0,0 +1,13 @@ |
|||||
|
// Copied from https://github.com/jeluard/prism-clojure
|
||||
|
Prism.languages.clojure = { |
||||
|
comment: /;+.*/, |
||||
|
string: /"(?:\\.|[^\\"\r\n])*"/, |
||||
|
operator: /(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i, //used for symbols and keywords
|
||||
|
keyword: { |
||||
|
pattern: /([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
boolean: /\b(?:true|false|nil)\b/, |
||||
|
number: /\b[0-9A-Fa-f]+\b/, |
||||
|
punctuation: /[{}\[\](),]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.clojure={comment:/;+.*/,string:/"(?:\\.|[^\\"\r\n])*"/,operator:/(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i,keyword:{pattern:/([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/,lookbehind:!0},"boolean":/\b(?:true|false|nil)\b/,number:/\b[0-9A-Fa-f]+\b/,punctuation:/[{}\[\](),]/}; |
||||
@ -0,0 +1,91 @@ |
|||||
|
(function(Prism) { |
||||
|
|
||||
|
// Ignore comments starting with { to privilege string interpolation highlighting
|
||||
|
var comment = /#(?!\{).+/, |
||||
|
interpolation = { |
||||
|
pattern: /#\{[^}]+\}/, |
||||
|
alias: 'variable' |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.coffeescript = Prism.languages.extend('javascript', { |
||||
|
'comment': comment, |
||||
|
'string': [ |
||||
|
|
||||
|
// Strings are multiline
|
||||
|
{ |
||||
|
pattern: /'(?:\\[\s\S]|[^\\'])*'/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
// Strings are multiline
|
||||
|
pattern: /"(?:\\[\s\S]|[^\\"])*"/, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
'interpolation': interpolation |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/, |
||||
|
'class-member': { |
||||
|
pattern: /@(?!\d)\w+/, |
||||
|
alias: 'variable' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('coffeescript', 'comment', { |
||||
|
'multiline-comment': { |
||||
|
pattern: /###[\s\S]+?###/, |
||||
|
alias: 'comment' |
||||
|
}, |
||||
|
|
||||
|
// Block regexp can contain comments and interpolation
|
||||
|
'block-regex': { |
||||
|
pattern: /\/{3}[\s\S]*?\/{3}/, |
||||
|
alias: 'regex', |
||||
|
inside: { |
||||
|
'comment': comment, |
||||
|
'interpolation': interpolation |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('coffeescript', 'string', { |
||||
|
'inline-javascript': { |
||||
|
pattern: /`(?:\\[\s\S]|[^\\`])*`/, |
||||
|
inside: { |
||||
|
'delimiter': { |
||||
|
pattern: /^`|`$/, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
rest: Prism.languages.javascript |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// Block strings
|
||||
|
'multiline-string': [ |
||||
|
{ |
||||
|
pattern: /'''[\s\S]*?'''/, |
||||
|
greedy: true, |
||||
|
alias: 'string' |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /"""[\s\S]*?"""/, |
||||
|
greedy: true, |
||||
|
alias: 'string', |
||||
|
inside: { |
||||
|
interpolation: interpolation |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('coffeescript', 'keyword', { |
||||
|
// Object property
|
||||
|
'property': /(?!\d)\w+(?=\s*:(?!:))/ |
||||
|
}); |
||||
|
|
||||
|
delete Prism.languages.coffeescript['template-string']; |
||||
|
|
||||
|
}(Prism)); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"]}(Prism); |
||||
@ -0,0 +1,557 @@ |
|||||
|
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, visited) { |
||||
|
var type = _.util.type(o); |
||||
|
visited = visited || {}; |
||||
|
|
||||
|
switch (type) { |
||||
|
case 'Object': |
||||
|
if (visited[_.util.objId(o)]) { |
||||
|
return visited[_.util.objId(o)]; |
||||
|
} |
||||
|
var clone = {}; |
||||
|
visited[_.util.objId(o)] = clone; |
||||
|
|
||||
|
for (var key in o) { |
||||
|
if (o.hasOwnProperty(key)) { |
||||
|
clone[key] = _.util.clone(o[key], visited); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return clone; |
||||
|
|
||||
|
case 'Array': |
||||
|
if (visited[_.util.objId(o)]) { |
||||
|
return visited[_.util.objId(o)]; |
||||
|
} |
||||
|
var clone = []; |
||||
|
visited[_.util.objId(o)] = clone; |
||||
|
|
||||
|
o.forEach(function (v, i) { |
||||
|
clone[i] = _.util.clone(v, visited); |
||||
|
}); |
||||
|
|
||||
|
return clone; |
||||
|
} |
||||
|
|
||||
|
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 env = { |
||||
|
code: text, |
||||
|
grammar: grammar, |
||||
|
language: language |
||||
|
}; |
||||
|
_.hooks.run('before-tokenize', env); |
||||
|
env.tokens = _.tokenize(env.code, env.grammar); |
||||
|
_.hooks.run('after-tokenize', env); |
||||
|
return Token.stringify(_.util.encode(env.tokens), env.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; |
||||
|
} |
||||
|
|
||||
|
if (greedy && i != strarr.length - 1) { |
||||
|
pattern.lastIndex = pos; |
||||
|
var 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[i] instanceof Token) { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
// Number of tokens to delete and replace with the new match
|
||||
|
delNum = k - i; |
||||
|
str = text.slice(pos, p); |
||||
|
match.index -= pos; |
||||
|
} else { |
||||
|
pattern.lastIndex = 0; |
||||
|
|
||||
|
var match = pattern.exec(str), |
||||
|
delNum = 1; |
||||
|
} |
||||
|
|
||||
|
if (!match) { |
||||
|
if (oneshot) { |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
if(lookbehind) { |
||||
|
lookbehindLength = match[1] ? match[1].length : 0; |
||||
|
} |
||||
|
|
||||
|
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; |
||||
|
} |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,20 @@ |
|||||
|
Prism.languages.cpp = Prism.languages.extend('c', { |
||||
|
'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, |
||||
|
'boolean': /\b(?:true|false)\b/, |
||||
|
'operator': /--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('cpp', 'keyword', { |
||||
|
'class-name': { |
||||
|
pattern: /(class\s+)\w+/i, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('cpp', 'string', { |
||||
|
'raw-string': { |
||||
|
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/, |
||||
|
alias: 'string', |
||||
|
greedy: true |
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.cpp=Prism.languages.extend("c",{keyword:/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(?:true|false)\b/,operator:/--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),Prism.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)\w+/i,lookbehind:!0}}),Prism.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}); |
||||
@ -0,0 +1,51 @@ |
|||||
|
(function(Prism) { |
||||
|
Prism.languages.crystal = Prism.languages.extend('ruby', { |
||||
|
keyword: [ |
||||
|
/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/, |
||||
|
{ |
||||
|
pattern: /(\.\s*)(?:is_a|responds_to)\?/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/ |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('crystal', 'string', { |
||||
|
attribute: { |
||||
|
pattern: /@\[.+?\]/, |
||||
|
alias: 'attr-name', |
||||
|
inside: { |
||||
|
delimiter: { |
||||
|
pattern: /^@\[|\]$/, |
||||
|
alias: 'tag' |
||||
|
}, |
||||
|
rest: Prism.languages.crystal |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
expansion: [ |
||||
|
{ |
||||
|
pattern: /\{\{.+?\}\}/, |
||||
|
inside: { |
||||
|
delimiter: { |
||||
|
pattern: /^\{\{|\}\}$/, |
||||
|
alias: 'tag' |
||||
|
}, |
||||
|
rest: Prism.languages.crystal |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /\{%.+?%\}/, |
||||
|
inside: { |
||||
|
delimiter: { |
||||
|
pattern: /^\{%|%\}$/, |
||||
|
alias: 'tag' |
||||
|
}, |
||||
|
rest: Prism.languages.crystal |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
}(Prism)); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(e){e.languages.crystal=e.languages.extend("ruby",{keyword:[/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,{pattern:/(\.\s*)(?:is_a|responds_to)\?/,lookbehind:!0}],number:/\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/}),e.languages.insertBefore("crystal","string",{attribute:{pattern:/@\[.+?\]/,alias:"attr-name",inside:{delimiter:{pattern:/^@\[|\]$/,alias:"tag"},rest:e.languages.crystal}},expansion:[{pattern:/\{\{.+?\}\}/,inside:{delimiter:{pattern:/^\{\{|\}\}$/,alias:"tag"},rest:e.languages.crystal}},{pattern:/\{%.+?%\}/,inside:{delimiter:{pattern:/^\{%|%\}$/,alias:"tag"},rest:e.languages.crystal}}]})}(Prism); |
||||
@ -0,0 +1,79 @@ |
|||||
|
Prism.languages.csharp = Prism.languages.extend('clike', { |
||||
|
'keyword': /\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/, |
||||
|
'string': [ |
||||
|
{ |
||||
|
pattern: /@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/, |
||||
|
greedy: true |
||||
|
} |
||||
|
], |
||||
|
'class-name': [ |
||||
|
{ |
||||
|
// (Foo bar, Bar baz)
|
||||
|
pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=\s+\w+)/, |
||||
|
inside: { |
||||
|
punctuation: /\./ |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// [Foo]
|
||||
|
pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
punctuation: /\./ |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// class Foo : Bar
|
||||
|
pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
punctuation: /\./ |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// class Foo
|
||||
|
pattern: /((?:\b(?:class|interface|new)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/, |
||||
|
lookbehind: true, |
||||
|
inside: { |
||||
|
punctuation: /\./ |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('csharp', 'class-name', { |
||||
|
'generic-method': { |
||||
|
pattern: /\w+\s*<[^>\r\n]+?>\s*(?=\()/, |
||||
|
inside: { |
||||
|
function: /^\w+/, |
||||
|
'class-name': { |
||||
|
pattern: /\b[A-Z]\w*(?:\.\w+)*\b/, |
||||
|
inside: { |
||||
|
punctuation: /\./ |
||||
|
} |
||||
|
}, |
||||
|
keyword: Prism.languages.csharp.keyword, |
||||
|
punctuation: /[<>(),.:]/ |
||||
|
} |
||||
|
}, |
||||
|
'preprocessor': { |
||||
|
pattern: /(^\s*)#.*/m, |
||||
|
lookbehind: true, |
||||
|
alias: 'property', |
||||
|
inside: { |
||||
|
// highlight preprocessor directives as keywords
|
||||
|
'directive': { |
||||
|
pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/, |
||||
|
lookbehind: true, |
||||
|
alias: 'keyword' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.dotnet = Prism.languages.csharp; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.csharp=Prism.languages.extend("clike",{keyword:/\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/,string:[{pattern:/@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0},{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/,greedy:!0}],"class-name":[{pattern:/\b[A-Z]\w*(?:\.\w+)*\b(?=\s+\w+)/,inside:{punctuation:/\./}},{pattern:/(\[)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/((?:\b(?:class|interface|new)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}}],number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i}),Prism.languages.insertBefore("csharp","class-name",{"generic-method":{pattern:/\w+\s*<[^>\r\n]+?>\s*(?=\()/,inside:{"function":/^\w+/,"class-name":{pattern:/\b[A-Z]\w*(?:\.\w+)*\b/,inside:{punctuation:/\./}},keyword:Prism.languages.csharp.keyword,punctuation:/[<>(),.:]/}},preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}}),Prism.languages.dotnet=Prism.languages.csharp; |
||||
@ -0,0 +1,25 @@ |
|||||
|
/** |
||||
|
* Original by Scott Helme. |
||||
|
* |
||||
|
* Reference: https://scotthelme.co.uk/csp-cheat-sheet/
|
||||
|
* |
||||
|
* Supports the following: |
||||
|
* - CSP Level 1 |
||||
|
* - CSP Level 2 |
||||
|
* - CSP Level 3 |
||||
|
*/ |
||||
|
|
||||
|
Prism.languages.csp = { |
||||
|
'directive': { |
||||
|
pattern: /\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i, |
||||
|
alias: 'keyword' |
||||
|
}, |
||||
|
'safe': { |
||||
|
pattern: /'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z\d+=/]+)'/, |
||||
|
alias: 'selector' |
||||
|
}, |
||||
|
'unsafe': { |
||||
|
pattern: /(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/, |
||||
|
alias: 'function' |
||||
|
} |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.csp={directive:{pattern:/\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i,alias:"keyword"},safe:{pattern:/'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z\d+=\/]+)'/,alias:"selector"},unsafe:{pattern:/(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/,alias:"function"}}; |
||||
@ -0,0 +1,16 @@ |
|||||
|
Prism.languages.css.selector = { |
||||
|
pattern: /[^{}\s][^{}]*(?=\s*\{)/, |
||||
|
inside: { |
||||
|
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, |
||||
|
'pseudo-class': /:[-\w]+(?:\(.*\))?/, |
||||
|
'class': /\.[-:.\w]+/, |
||||
|
'id': /#[-:.\w]+/, |
||||
|
'attribute': /\[[^\]]+\]/ |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.insertBefore('css', 'function', { |
||||
|
'hexcode': /#[\da-f]{3,8}/i, |
||||
|
'entity': /\\[\da-f]{1,8}/i, |
||||
|
'number': /[\d%.]+/ |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.css.selector={pattern:/[^{}\s][^{}]*(?=\s*\{)/,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+(?:\(.*\))?/,"class":/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:/\[[^\]]+\]/}},Prism.languages.insertBefore("css","function",{hexcode:/#[\da-f]{3,8}/i,entity:/\\[\da-f]{1,8}/i,number:/[\d%.]+/}); |
||||
@ -0,0 +1,52 @@ |
|||||
|
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.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); |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},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:!0},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.languages.css,Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css",greedy:!0}}),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)); |
||||
@ -0,0 +1,64 @@ |
|||||
|
Prism.languages.d = Prism.languages.extend('clike', { |
||||
|
'string': [ |
||||
|
// r"", x""
|
||||
|
/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/, |
||||
|
// q"[]", q"()", q"<>", q"{}"
|
||||
|
/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/, |
||||
|
// q"IDENT
|
||||
|
// ...
|
||||
|
// IDENT"
|
||||
|
/\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/, |
||||
|
// q"//", q"||", etc.
|
||||
|
/\bq"(.)[\s\S]*?\1"/, |
||||
|
// Characters
|
||||
|
/'(?:\\'|\\?[^']+)'/, |
||||
|
|
||||
|
/(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/ |
||||
|
], |
||||
|
|
||||
|
'number': [ |
||||
|
// The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
|
||||
|
// Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
|
||||
|
/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i, |
||||
|
{ |
||||
|
pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
// In order: $, keywords and special tokens, globally defined symbols
|
||||
|
'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/, |
||||
|
'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/ |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
Prism.languages.d.comment = [ |
||||
|
// Shebang
|
||||
|
/^\s*#!.+/, |
||||
|
// /+ +/
|
||||
|
{ |
||||
|
// Allow one level of nesting
|
||||
|
pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
].concat(Prism.languages.d.comment); |
||||
|
|
||||
|
Prism.languages.insertBefore('d', 'comment', { |
||||
|
'token-string': { |
||||
|
// Allow one level of nesting
|
||||
|
pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/, |
||||
|
alias: 'string' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('d', 'keyword', { |
||||
|
'property': /\B@\w*/ |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('d', 'function', { |
||||
|
'register': { |
||||
|
// Iasm registers
|
||||
|
pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/, |
||||
|
alias: 'variable' |
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.d=Prism.languages.extend("clike",{string:[/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/,/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,/\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,/\bq"(.)[\s\S]*?\1"/,/'(?:\\'|\\?[^']+)'/,/(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/],number:[/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,{pattern:/((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,lookbehind:!0}],keyword:/\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,operator:/\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/}),Prism.languages.d.comment=[/^\s*#!.+/,{pattern:/(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,lookbehind:!0}].concat(Prism.languages.d.comment),Prism.languages.insertBefore("d","comment",{"token-string":{pattern:/\bq\{(?:\{[^}]*\}|[^}])*\}/,alias:"string"}}),Prism.languages.insertBefore("d","keyword",{property:/\B@\w*/}),Prism.languages.insertBefore("d","function",{register:{pattern:/\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,alias:"variable"}}); |
||||
@ -0,0 +1,24 @@ |
|||||
|
Prism.languages.dart = Prism.languages.extend('clike', { |
||||
|
'string': [ |
||||
|
{ |
||||
|
pattern: /r?("""|''')[\s\S]*?\1/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
||||
|
greedy: true |
||||
|
} |
||||
|
], |
||||
|
'keyword': [ |
||||
|
/\b(?:async|sync|yield)\*/, |
||||
|
/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/ |
||||
|
], |
||||
|
'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ |
||||
|
}); |
||||
|
|
||||
|
Prism.languages.insertBefore('dart','function',{ |
||||
|
'metadata': { |
||||
|
pattern: /@\w+/, |
||||
|
alias: 'symbol' |
||||
|
} |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.dart=Prism.languages.extend("clike",{string:[{pattern:/r?("""|''')[\s\S]*?\1/,greedy:!0},{pattern:/r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0}],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}}); |
||||
@ -0,0 +1,20 @@ |
|||||
|
Prism.languages.diff = { |
||||
|
'coord': [ |
||||
|
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
|
||||
|
/^(?:\*{3}|-{3}|\+{3}).*$/m, |
||||
|
// Match "@@ ... @@" coord lines in unified diff.
|
||||
|
/^@@.*@@$/m, |
||||
|
// Match coord lines in normal diff (starts with a number).
|
||||
|
/^\d+.*$/m |
||||
|
], |
||||
|
|
||||
|
// Match inserted and deleted lines. Support both +/- and >/< styles.
|
||||
|
'deleted': /^[-<].*$/m, |
||||
|
'inserted': /^[+>].*$/m, |
||||
|
|
||||
|
// Match "different" lines (prefixed with "!") in context diff.
|
||||
|
'diff': { |
||||
|
'pattern': /^!(?!!).+$/m, |
||||
|
'alias': 'important' |
||||
|
} |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d+.*$/m],deleted:/^[-<].*$/m,inserted:/^[+>].*$/m,diff:{pattern:/^!(?!!).+$/m,alias:"important"}}; |
||||
@ -0,0 +1,41 @@ |
|||||
|
// Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter.
|
||||
|
// Mostly it works OK but can paint code incorrectly on complex html/template tag combinations.
|
||||
|
|
||||
|
var _django_template = { |
||||
|
'property': { |
||||
|
pattern: /(?:{{|{%)[\s\S]*?(?:%}|}})/g, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
'string': { |
||||
|
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'keyword': /\b(?:\||load|verbatim|widthratio|ssi|firstof|for|url|ifchanged|csrf_token|lorem|ifnotequal|autoescape|now|templatetag|debug|cycle|ifequal|regroup|comment|filter|endfilter|if|spaceless|with|extends|block|include|else|empty|endif|endfor|as|endblock|endautoescape|endverbatim|trans|endtrans|[Tt]rue|[Ff]alse|[Nn]one|in|is|static|macro|endmacro|call|endcall|set|endset|raw|endraw)\b/, |
||||
|
'operator' : /[-+=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/, |
||||
|
'function': /\b(?:_|abs|add|addslashes|attr|batch|callable|capfirst|capitalize|center|count|cut|d|date|default|default_if_none|defined|dictsort|dictsortreversed|divisibleby|e|equalto|escape|escaped|escapejs|even|filesizeformat|first|float|floatformat|force_escape|forceescape|format|get_digit|groupby|indent|int|iriencode|iterable|join|last|length|length_is|linebreaks|linebreaksbr|linenumbers|list|ljust|lower|make_list|map|mapping|number|odd|phone2numeric|pluralize|pprint|random|reject|rejectattr|removetags|replace|reverse|rjust|round|safe|safeseq|sameas|select|selectattr|sequence|slice|slugify|sort|string|stringformat|striptags|sum|time|timesince|timeuntil|title|trim|truncate|truncatechars|truncatechars_html|truncatewords|truncatewords_html|undefined|unordered_list|upper|urlencode|urlize|urlizetrunc|wordcount|wordwrap|xmlattr|yesno)\b/, |
||||
|
'important': /\b-?\d+(?:\.\d+)?\b/, |
||||
|
'variable': /\b\w+?\b/, |
||||
|
'punctuation' : /[[\];(),.:]/ |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.django = Prism.languages.extend('markup', {'comment': /(?:<!--|{#)[\s\S]*?(?:#}|-->)/}); |
||||
|
// Updated html tag pattern to allow template tags inside html tags
|
||||
|
Prism.languages.django.tag.pattern = /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^>=]+))?)*\s*\/?>/i; |
||||
|
Prism.languages.insertBefore('django', 'entity', _django_template); |
||||
|
Prism.languages.insertBefore('inside', 'tag', _django_template, Prism.languages.django.tag); |
||||
|
|
||||
|
if (Prism.languages.javascript) { |
||||
|
// Combine js code and template tags painting inside <script> blocks
|
||||
|
Prism.languages.insertBefore('inside', 'string', _django_template, Prism.languages.django.script); |
||||
|
Prism.languages.django.script.inside.string.inside = _django_template; |
||||
|
} |
||||
|
if (Prism.languages.css) { |
||||
|
// Combine css code and template tags painting inside <style> blocks
|
||||
|
Prism.languages.insertBefore('inside', 'atrule', {'tag': _django_template.property}, Prism.languages.django.style); |
||||
|
Prism.languages.django.style.inside.string.inside = _django_template; |
||||
|
} |
||||
|
|
||||
|
// Add an Jinja2 alias
|
||||
|
Prism.languages.jinja2 = Prism.languages.django; |
||||
@ -0,0 +1 @@ |
|||||
|
var _django_template={property:{pattern:/(?:{{|{%)[\s\S]*?(?:%}|}})/g,greedy:!0,inside:{string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/\b(?:\||load|verbatim|widthratio|ssi|firstof|for|url|ifchanged|csrf_token|lorem|ifnotequal|autoescape|now|templatetag|debug|cycle|ifequal|regroup|comment|filter|endfilter|if|spaceless|with|extends|block|include|else|empty|endif|endfor|as|endblock|endautoescape|endverbatim|trans|endtrans|[Tt]rue|[Ff]alse|[Nn]one|in|is|static|macro|endmacro|call|endcall|set|endset|raw|endraw)\b/,operator:/[-+=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,"function":/\b(?:_|abs|add|addslashes|attr|batch|callable|capfirst|capitalize|center|count|cut|d|date|default|default_if_none|defined|dictsort|dictsortreversed|divisibleby|e|equalto|escape|escaped|escapejs|even|filesizeformat|first|float|floatformat|force_escape|forceescape|format|get_digit|groupby|indent|int|iriencode|iterable|join|last|length|length_is|linebreaks|linebreaksbr|linenumbers|list|ljust|lower|make_list|map|mapping|number|odd|phone2numeric|pluralize|pprint|random|reject|rejectattr|removetags|replace|reverse|rjust|round|safe|safeseq|sameas|select|selectattr|sequence|slice|slugify|sort|string|stringformat|striptags|sum|time|timesince|timeuntil|title|trim|truncate|truncatechars|truncatechars_html|truncatewords|truncatewords_html|undefined|unordered_list|upper|urlencode|urlize|urlizetrunc|wordcount|wordwrap|xmlattr|yesno)\b/,important:/\b-?\d+(?:\.\d+)?\b/,variable:/\b\w+?\b/,punctuation:/[[\];(),.:]/}}};Prism.languages.django=Prism.languages.extend("markup",{comment:/(?:<!--|{#)[\s\S]*?(?:#}|-->)/}),Prism.languages.django.tag.pattern=/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^>=]+))?)*\s*\/?>/i,Prism.languages.insertBefore("django","entity",_django_template),Prism.languages.insertBefore("inside","tag",_django_template,Prism.languages.django.tag),Prism.languages.javascript&&(Prism.languages.insertBefore("inside","string",_django_template,Prism.languages.django.script),Prism.languages.django.script.inside.string.inside=_django_template),Prism.languages.css&&(Prism.languages.insertBefore("inside","atrule",{tag:_django_template.property},Prism.languages.django.style),Prism.languages.django.style.inside.string.inside=_django_template),Prism.languages.jinja2=Prism.languages.django; |
||||
@ -0,0 +1,11 @@ |
|||||
|
Prism.languages.docker = { |
||||
|
'keyword': { |
||||
|
pattern: /(^\s*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)/mi, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
'string': /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/, |
||||
|
'comment': /#.*/, |
||||
|
'punctuation': /---|\.\.\.|[:[\]{}\-,|>?]/ |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.dockerfile = Prism.languages.docker; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.docker={keyword:{pattern:/(^\s*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)/im,lookbehind:!0},string:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,comment:/#.*/,punctuation:/---|\.\.\.|[:[\]{}\-,|>?]/},Prism.languages.dockerfile=Prism.languages.docker; |
||||
@ -0,0 +1,37 @@ |
|||||
|
Prism.languages.eiffel = { |
||||
|
'comment': /--.*/, |
||||
|
'string': [ |
||||
|
// Aligned-verbatim-strings
|
||||
|
{ |
||||
|
pattern: /"([^[]*)\[[\s\S]*?\]\1"/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
// Non-aligned-verbatim-strings
|
||||
|
{ |
||||
|
pattern: /"([^{]*)\{[\s\S]*?\}\1"/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
// Single-line string
|
||||
|
{ |
||||
|
pattern: /"(?:%\s+%|%.|[^%"\r\n])*"/, |
||||
|
greedy: true |
||||
|
} |
||||
|
], |
||||
|
// normal char | special char | char code
|
||||
|
'char': /'(?:%.|[^%'\r\n])+'/, |
||||
|
'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/i, |
||||
|
'boolean': /\b(?:True|False)\b/i, |
||||
|
// Convention: class-names are always all upper-case characters
|
||||
|
'class-name': { |
||||
|
'pattern': /\b[A-Z][\dA-Z_]*\b/, |
||||
|
'alias': 'builtin' |
||||
|
}, |
||||
|
'number': [ |
||||
|
// hexa | octal | bin
|
||||
|
/\b0[xcb][\da-f](?:_*[\da-f])*\b/i, |
||||
|
// Decimal
|
||||
|
/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/i |
||||
|
], |
||||
|
'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/, |
||||
|
'operator': /\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.eiffel={comment:/--.*/,string:[{pattern:/"([^[]*)\[[\s\S]*?\]\1"/,greedy:!0},{pattern:/"([^{]*)\{[\s\S]*?\}\1"/,greedy:!0},{pattern:/"(?:%\s+%|%.|[^%"\r\n])*"/,greedy:!0}],"char":/'(?:%.|[^%'\r\n])+'/,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/i,"boolean":/\b(?:True|False)\b/i,"class-name":{pattern:/\b[A-Z][\dA-Z_]*\b/,alias:"builtin"},number:[/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/i],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,operator:/\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/}; |
||||
@ -0,0 +1,93 @@ |
|||||
|
Prism.languages.elixir = { |
||||
|
'comment': { |
||||
|
pattern: /#.*/m, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
// ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
|
||||
|
'regex': { |
||||
|
pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'string': [ |
||||
|
{ |
||||
|
// ~s"""foo""" (multi-line), ~s'''foo''' (multi-line), ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo} (with interpolation care), ~s<foo>
|
||||
|
pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
// See interpolation below
|
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /("""|''')[\s\S]*?\1/, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
// See interpolation below
|
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
// Multi-line strings are allowed
|
||||
|
pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
||||
|
greedy: true, |
||||
|
inside: { |
||||
|
// See interpolation below
|
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
'atom': { |
||||
|
// Look-behind prevents bad highlighting of the :: operator
|
||||
|
pattern: /(^|[^:]):\w+/, |
||||
|
lookbehind: true, |
||||
|
alias: 'symbol' |
||||
|
}, |
||||
|
// Look-ahead prevents bad highlighting of the :: operator
|
||||
|
'attr-name': /\w+:(?!:)/, |
||||
|
'capture': { |
||||
|
// Look-behind prevents bad highlighting of the && operator
|
||||
|
pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/, |
||||
|
lookbehind: true, |
||||
|
alias: 'function' |
||||
|
}, |
||||
|
'argument': { |
||||
|
// Look-behind prevents bad highlighting of the && operator
|
||||
|
pattern: /(^|[^&])&\d+/, |
||||
|
lookbehind: true, |
||||
|
alias: 'variable' |
||||
|
}, |
||||
|
'attribute': { |
||||
|
pattern: /@\w+/, |
||||
|
alias: 'variable' |
||||
|
}, |
||||
|
'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i, |
||||
|
'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/, |
||||
|
'boolean': /\b(?:true|false|nil)\b/, |
||||
|
'operator': [ |
||||
|
/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/, |
||||
|
{ |
||||
|
// We don't want to match <<
|
||||
|
pattern: /([^<])<(?!<)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
{ |
||||
|
// We don't want to match >>
|
||||
|
pattern: /([^>])>(?!>)/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
'punctuation': /<<|>>|[.,%\[\]{}()]/ |
||||
|
}; |
||||
|
|
||||
|
Prism.languages.elixir.string.forEach(function(o) { |
||||
|
o.inside = { |
||||
|
'interpolation': { |
||||
|
pattern: /#\{[^}]+\}/, |
||||
|
inside: { |
||||
|
'delimiter': { |
||||
|
pattern: /^#\{|\}$/, |
||||
|
alias: 'punctuation' |
||||
|
}, |
||||
|
rest: Prism.languages.elixir |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
|
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.elixir={comment:{pattern:/#.*/m,lookbehind:!0},regex:{pattern:/~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,greedy:!0},string:[{pattern:/~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,greedy:!0,inside:{}},{pattern:/("""|''')[\s\S]*?\1/,greedy:!0,inside:{}},{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0,inside:{}}],atom:{pattern:/(^|[^:]):\w+/,lookbehind:!0,alias:"symbol"},"attr-name":/\w+:(?!:)/,capture:{pattern:/(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,lookbehind:!0,alias:"function"},argument:{pattern:/(^|[^&])&\d+/,lookbehind:!0,alias:"variable"},attribute:{pattern:/@\w+/,alias:"variable"},number:/\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,keyword:/\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,"boolean":/\b(?:true|false|nil)\b/,operator:[/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,{pattern:/([^<])<(?!<)/,lookbehind:!0},{pattern:/([^>])>(?!>)/,lookbehind:!0}],punctuation:/<<|>>|[.,%\[\]{}()]/},Prism.languages.elixir.string.forEach(function(e){e.inside={interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:Prism.languages.elixir}}}}); |
||||
@ -0,0 +1,44 @@ |
|||||
|
Prism.languages.elm = { |
||||
|
comment: /--.*|{-[\s\S]*?-}/, |
||||
|
char: { |
||||
|
pattern: /'(?:[^\\'\r\n]|\\(?:[abfnrtv\\']|\d+|x[0-9a-fA-F]+))'/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
string: [ |
||||
|
{ |
||||
|
// Multiline strings are wrapped in triple ". Quotes may appear unescaped.
|
||||
|
pattern: /"""[\s\S]*?"""/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /"(?:[^\\"\r\n]|\\(?:[abfnrtv\\"]|\d+|x[0-9a-fA-F]+))*"/, |
||||
|
greedy: true |
||||
|
} |
||||
|
], |
||||
|
import_statement: { |
||||
|
// The imported or hidden names are not included in this import
|
||||
|
// statement. This is because we want to highlight those exactly like
|
||||
|
// we do for the names in the program.
|
||||
|
pattern: /^\s*import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+([A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m, |
||||
|
inside: { |
||||
|
keyword: /\b(?:import|as|exposing)\b/ |
||||
|
} |
||||
|
}, |
||||
|
keyword: /\b(?:alias|as|case|else|exposing|if|in|infixl|infixr|let|module|of|then|type)\b/, |
||||
|
// These are builtin variables only. Constructors are highlighted later as a constant.
|
||||
|
builtin: /\b(?:abs|acos|always|asin|atan|atan2|ceiling|clamp|compare|cos|curry|degrees|e|flip|floor|fromPolar|identity|isInfinite|isNaN|logBase|max|min|negate|never|not|pi|radians|rem|round|sin|sqrt|tan|toFloat|toPolar|toString|truncate|turns|uncurry|xor)\b/, |
||||
|
// decimal integers and floating point numbers | hexadecimal integers
|
||||
|
number: /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[0-9a-f]+)\b/i, |
||||
|
// Most of this is needed because of the meaning of a single '.'.
|
||||
|
// If it stands alone freely, it is the function composition.
|
||||
|
// It may also be a separator between a module name and an identifier => no
|
||||
|
// operator. If it comes together with other special characters it is an
|
||||
|
// operator too.
|
||||
|
// Valid operator characters in 0.18: +-/*=.$<>:&|^?%#@~!
|
||||
|
// Ref: https://groups.google.com/forum/#!msg/elm-dev/0AHSnDdkSkQ/E0SVU70JEQAJ
|
||||
|
operator: /\s\.\s|[+\-/*=.$<>:&|^?%#@~!]{2,}|[+\-/*=$<>:&|^?%#@~!]/, |
||||
|
// In Elm, nearly everything is a variable, do not highlight these.
|
||||
|
hvariable: /\b(?:[A-Z]\w*\.)*[a-z]\w*\b/, |
||||
|
constant: /\b(?:[A-Z]\w*\.)*[A-Z]\w*\b/, |
||||
|
punctuation: /[{}[\]|(),.:]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.elm={comment:/--.*|{-[\s\S]*?-}/,"char":{pattern:/'(?:[^\\'\r\n]|\\(?:[abfnrtv\\']|\d+|x[0-9a-fA-F]+))'/,greedy:!0},string:[{pattern:/"""[\s\S]*?"""/,greedy:!0},{pattern:/"(?:[^\\"\r\n]|\\(?:[abfnrtv\\"]|\d+|x[0-9a-fA-F]+))*"/,greedy:!0}],import_statement:{pattern:/^\s*import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+([A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m,inside:{keyword:/\b(?:import|as|exposing)\b/}},keyword:/\b(?:alias|as|case|else|exposing|if|in|infixl|infixr|let|module|of|then|type)\b/,builtin:/\b(?:abs|acos|always|asin|atan|atan2|ceiling|clamp|compare|cos|curry|degrees|e|flip|floor|fromPolar|identity|isInfinite|isNaN|logBase|max|min|negate|never|not|pi|radians|rem|round|sin|sqrt|tan|toFloat|toPolar|toString|truncate|turns|uncurry|xor)\b/,number:/\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[0-9a-f]+)\b/i,operator:/\s\.\s|[+\-\/*=.$<>:&|^?%#@~!]{2,}|[+\-\/*=$<>:&|^?%#@~!]/,hvariable:/\b(?:[A-Z]\w*\.)*[a-z]\w*\b/,constant:/\b(?:[A-Z]\w*\.)*[A-Z]\w*\b/,punctuation:/[{}[\]|(),.:]/}; |
||||
@ -0,0 +1,20 @@ |
|||||
|
(function (Prism) { |
||||
|
|
||||
|
Prism.languages.erb = Prism.languages.extend('ruby', {}); |
||||
|
Prism.languages.insertBefore('erb', 'comment', { |
||||
|
'delimiter': { |
||||
|
pattern: /^<%=?|%>$/, |
||||
|
alias: 'punctuation' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
Prism.hooks.add('before-tokenize', function(env) { |
||||
|
var erbPattern = /<%=?[\s\S]+?%>/g; |
||||
|
Prism.languages['markup-templating'].buildPlaceholders(env, 'erb', erbPattern); |
||||
|
}); |
||||
|
|
||||
|
Prism.hooks.add('after-tokenize', function(env) { |
||||
|
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'erb'); |
||||
|
}); |
||||
|
|
||||
|
}(Prism)); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(e){e.languages.erb=e.languages.extend("ruby",{}),e.languages.insertBefore("erb","comment",{delimiter:{pattern:/^<%=?|%>$/,alias:"punctuation"}}),e.hooks.add("before-tokenize",function(a){var n=/<%=?[\s\S]+?%>/g;e.languages["markup-templating"].buildPlaceholders(a,"erb",n)}),e.hooks.add("after-tokenize",function(a){e.languages["markup-templating"].tokenizePlaceholders(a,"erb")})}(Prism); |
||||
@ -0,0 +1,44 @@ |
|||||
|
Prism.languages.erlang = { |
||||
|
'comment': /%.+/, |
||||
|
'string': { |
||||
|
pattern: /"(?:\\.|[^\\"\r\n])*"/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'quoted-function': { |
||||
|
pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/, |
||||
|
alias: 'function' |
||||
|
}, |
||||
|
'quoted-atom': { |
||||
|
pattern: /'(?:\\.|[^\\'\r\n])+'/, |
||||
|
alias: 'atom' |
||||
|
}, |
||||
|
'boolean': /\b(?:true|false)\b/, |
||||
|
'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/, |
||||
|
'number': [ |
||||
|
/\$\\?./, |
||||
|
/\d+#[a-z0-9]+/i, |
||||
|
/(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i |
||||
|
], |
||||
|
'function': /\b[a-z][\w@]*(?=\()/, |
||||
|
'variable': { |
||||
|
// Look-behind is used to prevent wrong highlighting of atoms containing "@"
|
||||
|
pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
'operator': [ |
||||
|
/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/, |
||||
|
{ |
||||
|
// We don't want to match <<
|
||||
|
pattern: /(^|[^<])<(?!<)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
{ |
||||
|
// We don't want to match >>
|
||||
|
pattern: /(^|[^>])>(?!>)/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
'atom': /\b[a-z][\w@]*/, |
||||
|
'punctuation': /[()[\]{}:;,.#|]|<<|>>/ |
||||
|
|
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.erlang={comment:/%.+/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},"quoted-function":{pattern:/'(?:\\.|[^\\'\r\n])+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'(?:\\.|[^\\'\r\n])+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i],"function":/\b[a-z][\w@]*(?=\()/,variable:{pattern:/(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,lookbehind:!0},operator:[/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|[^<])<(?!<)/,lookbehind:!0},{pattern:/(^|[^>])>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/}; |
||||
@ -0,0 +1,34 @@ |
|||||
|
(function (Prism) { |
||||
|
Prism.languages.flow = Prism.languages.extend('javascript', {}); |
||||
|
|
||||
|
Prism.languages.insertBefore('flow', 'keyword', { |
||||
|
'type': [ |
||||
|
{ |
||||
|
pattern: /\b(?:[Nn]umber|[Ss]tring|[Bb]oolean|Function|any|mixed|null|void)\b/, |
||||
|
alias: 'tag' |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
Prism.languages.flow['function-variable'].pattern = /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i; |
||||
|
|
||||
|
Prism.languages.insertBefore('flow', 'operator', { |
||||
|
'flow-punctuation': { |
||||
|
pattern: /\{\||\|\}/, |
||||
|
alias: 'punctuation' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (Prism.util.type(Prism.languages.flow.keyword) !== 'Array') { |
||||
|
Prism.languages.flow.keyword = [Prism.languages.flow.keyword]; |
||||
|
} |
||||
|
Prism.languages.flow.keyword.unshift( |
||||
|
{ |
||||
|
pattern: /(^|[^$]\b)(?:type|opaque|declare|Class)\b(?!\$)/, |
||||
|
lookbehind: true |
||||
|
}, |
||||
|
{ |
||||
|
pattern: /(^|[^$]\B)\$(?:await|Diff|Exact|Keys|ObjMap|PropertyType|Shape|Record|Supertype|Subtype|Enum)\b(?!\$)/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
); |
||||
|
}(Prism)); |
||||
@ -0,0 +1 @@ |
|||||
|
!function(a){a.languages.flow=a.languages.extend("javascript",{}),a.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Nn]umber|[Ss]tring|[Bb]oolean|Function|any|mixed|null|void)\b/,alias:"tag"}]}),a.languages.flow["function-variable"].pattern=/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,a.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),"Array"!==a.util.type(a.languages.flow.keyword)&&(a.languages.flow.keyword=[a.languages.flow.keyword]),a.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:type|opaque|declare|Class)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:await|Diff|Exact|Keys|ObjMap|PropertyType|Shape|Record|Supertype|Subtype|Enum)\b(?!\$)/,lookbehind:!0})}(Prism); |
||||
@ -0,0 +1,40 @@ |
|||||
|
Prism.languages.fortran = { |
||||
|
'quoted-number': { |
||||
|
pattern: /[BOZ](['"])[A-F0-9]+\1/i, |
||||
|
alias: 'number' |
||||
|
}, |
||||
|
'string': { |
||||
|
pattern: /(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/, |
||||
|
inside: { |
||||
|
'comment': { |
||||
|
pattern: /(&(?:\r\n?|\n)\s*)!.*/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
'comment': { |
||||
|
pattern: /!.*/, |
||||
|
greedy: true |
||||
|
}, |
||||
|
'boolean': /\.(?:TRUE|FALSE)\.(?:_\w+)?/i, |
||||
|
'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i, |
||||
|
'keyword': [ |
||||
|
// Types
|
||||
|
/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i, |
||||
|
// END statements
|
||||
|
/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i, |
||||
|
// Statements
|
||||
|
/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i, |
||||
|
// Others
|
||||
|
/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i |
||||
|
], |
||||
|
'operator': [ |
||||
|
/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i, |
||||
|
{ |
||||
|
// Use lookbehind to prevent confusion with (/ /)
|
||||
|
pattern: /(^|(?!\().)\/(?!\))/, |
||||
|
lookbehind: true |
||||
|
} |
||||
|
], |
||||
|
'punctuation': /\(\/|\/\)|[(),;:&]/ |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,inside:{comment:{pattern:/(&(?:\r\n?|\n)\s*)!.*/,lookbehind:!0}}},comment:{pattern:/!.*/,greedy:!0},"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/}; |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue