aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-includes/js/dist/blocks.js
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
commit5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch)
tree39a1a4629749056191c05dfd899f931701b7acf3 /srcs/wordpress/wp-includes/js/dist/blocks.js
parent5afd237bbd22028b85532b8c0b3fcead49a00764 (diff)
downloadft_server-master.tar.gz
ft_server-master.tar.bz2
ft_server-master.zip
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/wordpress/wp-includes/js/dist/blocks.js')
-rw-r--r--srcs/wordpress/wp-includes/js/dist/blocks.js13335
1 files changed, 0 insertions, 13335 deletions
diff --git a/srcs/wordpress/wp-includes/js/dist/blocks.js b/srcs/wordpress/wp-includes/js/dist/blocks.js
deleted file mode 100644
index 919db00..0000000
--- a/srcs/wordpress/wp-includes/js/dist/blocks.js
+++ /dev/null
@@ -1,13335 +0,0 @@
-this["wp"] = this["wp"] || {}; this["wp"]["blocks"] =
-/******/ (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 = 347);
-/******/ })
-/************************************************************************/
-/******/ ({
-
-/***/ 0:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["element"]; }());
-
-/***/ }),
-
-/***/ 1:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["i18n"]; }());
-
-/***/ }),
-
-/***/ 10:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
-function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
-}
-
-/***/ }),
-
-/***/ 11:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
-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);
- }
-}
-
-function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
-}
-
-/***/ }),
-
-/***/ 12:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
-function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
-}
-
-/***/ }),
-
-/***/ 144:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["shortcode"]; }());
-
-/***/ }),
-
-/***/ 17:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
-
- return arr2;
- }
-}
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
-var iterableToArray = __webpack_require__(30);
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
-}
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
-
-
-
-function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
-}
-
-/***/ }),
-
-/***/ 18:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
-function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
- return target;
- };
-
- return _extends.apply(this, arguments);
-}
-
-/***/ }),
-
-/***/ 2:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["lodash"]; }());
-
-/***/ }),
-
-/***/ 222:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["blockSerializationDefaultParser"]; }());
-
-/***/ }),
-
-/***/ 223:
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.0 - 10-11-2018 */
-(function(){
-/**
- * Created by Tivie on 13-07-2015.
- */
-
-function getDefaultOpts (simple) {
- 'use strict';
-
- var defaultOptions = {
- omitExtraWLInCodeBlocks: {
- defaultValue: false,
- describe: 'Omit the default extra whiteline added to code blocks',
- type: 'boolean'
- },
- noHeaderId: {
- defaultValue: false,
- describe: 'Turn on/off generated header id',
- type: 'boolean'
- },
- prefixHeaderId: {
- defaultValue: false,
- describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
- type: 'string'
- },
- rawPrefixHeaderId: {
- defaultValue: false,
- describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
- type: 'boolean'
- },
- ghCompatibleHeaderId: {
- defaultValue: false,
- describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
- type: 'boolean'
- },
- rawHeaderId: {
- defaultValue: false,
- describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
- type: 'boolean'
- },
- headerLevelStart: {
- defaultValue: false,
- describe: 'The header blocks level start',
- type: 'integer'
- },
- parseImgDimensions: {
- defaultValue: false,
- describe: 'Turn on/off image dimension parsing',
- type: 'boolean'
- },
- simplifiedAutoLink: {
- defaultValue: false,
- describe: 'Turn on/off GFM autolink style',
- type: 'boolean'
- },
- excludeTrailingPunctuationFromURLs: {
- defaultValue: false,
- describe: 'Excludes trailing punctuation from links generated with autoLinking',
- type: 'boolean'
- },
- literalMidWordUnderscores: {
- defaultValue: false,
- describe: 'Parse midword underscores as literal underscores',
- type: 'boolean'
- },
- literalMidWordAsterisks: {
- defaultValue: false,
- describe: 'Parse midword asterisks as literal asterisks',
- type: 'boolean'
- },
- strikethrough: {
- defaultValue: false,
- describe: 'Turn on/off strikethrough support',
- type: 'boolean'
- },
- tables: {
- defaultValue: false,
- describe: 'Turn on/off tables support',
- type: 'boolean'
- },
- tablesHeaderId: {
- defaultValue: false,
- describe: 'Add an id to table headers',
- type: 'boolean'
- },
- ghCodeBlocks: {
- defaultValue: true,
- describe: 'Turn on/off GFM fenced code blocks support',
- type: 'boolean'
- },
- tasklists: {
- defaultValue: false,
- describe: 'Turn on/off GFM tasklist support',
- type: 'boolean'
- },
- smoothLivePreview: {
- defaultValue: false,
- describe: 'Prevents weird effects in live previews due to incomplete input',
- type: 'boolean'
- },
- smartIndentationFix: {
- defaultValue: false,
- description: 'Tries to smartly fix indentation in es6 strings',
- type: 'boolean'
- },
- disableForced4SpacesIndentedSublists: {
- defaultValue: false,
- description: 'Disables the requirement of indenting nested sublists by 4 spaces',
- type: 'boolean'
- },
- simpleLineBreaks: {
- defaultValue: false,
- description: 'Parses simple line breaks as <br> (GFM Style)',
- type: 'boolean'
- },
- requireSpaceBeforeHeadingText: {
- defaultValue: false,
- description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
- type: 'boolean'
- },
- ghMentions: {
- defaultValue: false,
- description: 'Enables github @mentions',
- type: 'boolean'
- },
- ghMentionsLink: {
- defaultValue: 'https://github.com/{u}',
- description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
- type: 'string'
- },
- encodeEmails: {
- defaultValue: true,
- description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
- type: 'boolean'
- },
- openLinksInNewWindow: {
- defaultValue: false,
- description: 'Open all links in new windows',
- type: 'boolean'
- },
- backslashEscapesHTMLTags: {
- defaultValue: false,
- description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
- type: 'boolean'
- },
- emoji: {
- defaultValue: false,
- description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
- type: 'boolean'
- },
- underline: {
- defaultValue: false,
- description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
- type: 'boolean'
- },
- completeHTMLDocument: {
- defaultValue: false,
- description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
- type: 'boolean'
- },
- metadata: {
- defaultValue: false,
- description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
- type: 'boolean'
- },
- splitAdjacentBlockquotes: {
- defaultValue: false,
- description: 'Split adjacent blockquote blocks',
- type: 'boolean'
- }
- };
- if (simple === false) {
- return JSON.parse(JSON.stringify(defaultOptions));
- }
- var ret = {};
- for (var opt in defaultOptions) {
- if (defaultOptions.hasOwnProperty(opt)) {
- ret[opt] = defaultOptions[opt].defaultValue;
- }
- }
- return ret;
-}
-
-function allOptionsOn () {
- 'use strict';
- var options = getDefaultOpts(true),
- ret = {};
- for (var opt in options) {
- if (options.hasOwnProperty(opt)) {
- ret[opt] = true;
- }
- }
- return ret;
-}
-
-/**
- * Created by Tivie on 06-01-2015.
- */
-
-// Private properties
-var showdown = {},
- parsers = {},
- extensions = {},
- globalOptions = getDefaultOpts(true),
- setFlavor = 'vanilla',
- flavor = {
- github: {
- omitExtraWLInCodeBlocks: true,
- simplifiedAutoLink: true,
- excludeTrailingPunctuationFromURLs: true,
- literalMidWordUnderscores: true,
- strikethrough: true,
- tables: true,
- tablesHeaderId: true,
- ghCodeBlocks: true,
- tasklists: true,
- disableForced4SpacesIndentedSublists: true,
- simpleLineBreaks: true,
- requireSpaceBeforeHeadingText: true,
- ghCompatibleHeaderId: true,
- ghMentions: true,
- backslashEscapesHTMLTags: true,
- emoji: true,
- splitAdjacentBlockquotes: true
- },
- original: {
- noHeaderId: true,
- ghCodeBlocks: false
- },
- ghost: {
- omitExtraWLInCodeBlocks: true,
- parseImgDimensions: true,
- simplifiedAutoLink: true,
- excludeTrailingPunctuationFromURLs: true,
- literalMidWordUnderscores: true,
- strikethrough: true,
- tables: true,
- tablesHeaderId: true,
- ghCodeBlocks: true,
- tasklists: true,
- smoothLivePreview: true,
- simpleLineBreaks: true,
- requireSpaceBeforeHeadingText: true,
- ghMentions: false,
- encodeEmails: true
- },
- vanilla: getDefaultOpts(true),
- allOn: allOptionsOn()
- };
-
-/**
- * helper namespace
- * @type {{}}
- */
-showdown.helper = {};
-
-/**
- * TODO LEGACY SUPPORT CODE
- * @type {{}}
- */
-showdown.extensions = {};
-
-/**
- * Set a global option
- * @static
- * @param {string} key
- * @param {*} value
- * @returns {showdown}
- */
-showdown.setOption = function (key, value) {
- 'use strict';
- globalOptions[key] = value;
- return this;
-};
-
-/**
- * Get a global option
- * @static
- * @param {string} key
- * @returns {*}
- */
-showdown.getOption = function (key) {
- 'use strict';
- return globalOptions[key];
-};
-
-/**
- * Get the global options
- * @static
- * @returns {{}}
- */
-showdown.getOptions = function () {
- 'use strict';
- return globalOptions;
-};
-
-/**
- * Reset global options to the default values
- * @static
- */
-showdown.resetOptions = function () {
- 'use strict';
- globalOptions = getDefaultOpts(true);
-};
-
-/**
- * Set the flavor showdown should use as default
- * @param {string} name
- */
-showdown.setFlavor = function (name) {
- 'use strict';
- if (!flavor.hasOwnProperty(name)) {
- throw Error(name + ' flavor was not found');
- }
- showdown.resetOptions();
- var preset = flavor[name];
- setFlavor = name;
- for (var option in preset) {
- if (preset.hasOwnProperty(option)) {
- globalOptions[option] = preset[option];
- }
- }
-};
-
-/**
- * Get the currently set flavor
- * @returns {string}
- */
-showdown.getFlavor = function () {
- 'use strict';
- return setFlavor;
-};
-
-/**
- * Get the options of a specified flavor. Returns undefined if the flavor was not found
- * @param {string} name Name of the flavor
- * @returns {{}|undefined}
- */
-showdown.getFlavorOptions = function (name) {
- 'use strict';
- if (flavor.hasOwnProperty(name)) {
- return flavor[name];
- }
-};
-
-/**
- * Get the default options
- * @static
- * @param {boolean} [simple=true]
- * @returns {{}}
- */
-showdown.getDefaultOptions = function (simple) {
- 'use strict';
- return getDefaultOpts(simple);
-};
-
-/**
- * Get or set a subParser
- *
- * subParser(name) - Get a registered subParser
- * subParser(name, func) - Register a subParser
- * @static
- * @param {string} name
- * @param {function} [func]
- * @returns {*}
- */
-showdown.subParser = function (name, func) {
- 'use strict';
- if (showdown.helper.isString(name)) {
- if (typeof func !== 'undefined') {
- parsers[name] = func;
- } else {
- if (parsers.hasOwnProperty(name)) {
- return parsers[name];
- } else {
- throw Error('SubParser named ' + name + ' not registered!');
- }
- }
- }
-};
-
-/**
- * Gets or registers an extension
- * @static
- * @param {string} name
- * @param {object|function=} ext
- * @returns {*}
- */
-showdown.extension = function (name, ext) {
- 'use strict';
-
- if (!showdown.helper.isString(name)) {
- throw Error('Extension \'name\' must be a string');
- }
-
- name = showdown.helper.stdExtName(name);
-
- // Getter
- if (showdown.helper.isUndefined(ext)) {
- if (!extensions.hasOwnProperty(name)) {
- throw Error('Extension named ' + name + ' is not registered!');
- }
- return extensions[name];
-
- // Setter
- } else {
- // Expand extension if it's wrapped in a function
- if (typeof ext === 'function') {
- ext = ext();
- }
-
- // Ensure extension is an array
- if (!showdown.helper.isArray(ext)) {
- ext = [ext];
- }
-
- var validExtension = validate(ext, name);
-
- if (validExtension.valid) {
- extensions[name] = ext;
- } else {
- throw Error(validExtension.error);
- }
- }
-};
-
-/**
- * Gets all extensions registered
- * @returns {{}}
- */
-showdown.getAllExtensions = function () {
- 'use strict';
- return extensions;
-};
-
-/**
- * Remove an extension
- * @param {string} name
- */
-showdown.removeExtension = function (name) {
- 'use strict';
- delete extensions[name];
-};
-
-/**
- * Removes all extensions
- */
-showdown.resetExtensions = function () {
- 'use strict';
- extensions = {};
-};
-
-/**
- * Validate extension
- * @param {array} extension
- * @param {string} name
- * @returns {{valid: boolean, error: string}}
- */
-function validate (extension, name) {
- 'use strict';
-
- var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
- ret = {
- valid: true,
- error: ''
- };
-
- if (!showdown.helper.isArray(extension)) {
- extension = [extension];
- }
-
- for (var i = 0; i < extension.length; ++i) {
- var baseMsg = errMsg + ' sub-extension ' + i + ': ',
- ext = extension[i];
- if (typeof ext !== 'object') {
- ret.valid = false;
- ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
- return ret;
- }
-
- if (!showdown.helper.isString(ext.type)) {
- ret.valid = false;
- ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
- return ret;
- }
-
- var type = ext.type = ext.type.toLowerCase();
-
- // normalize extension type
- if (type === 'language') {
- type = ext.type = 'lang';
- }
-
- if (type === 'html') {
- type = ext.type = 'output';
- }
-
- if (type !== 'lang' && type !== 'output' && type !== 'listener') {
- ret.valid = false;
- ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
- return ret;
- }
-
- if (type === 'listener') {
- if (showdown.helper.isUndefined(ext.listeners)) {
- ret.valid = false;
- ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
- return ret;
- }
- } else {
- if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
- ret.valid = false;
- ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
- return ret;
- }
- }
-
- if (ext.listeners) {
- if (typeof ext.listeners !== 'object') {
- ret.valid = false;
- ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
- return ret;
- }
- for (var ln in ext.listeners) {
- if (ext.listeners.hasOwnProperty(ln)) {
- if (typeof ext.listeners[ln] !== 'function') {
- ret.valid = false;
- ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
- ' must be a function but ' + typeof ext.listeners[ln] + ' given';
- return ret;
- }
- }
- }
- }
-
- if (ext.filter) {
- if (typeof ext.filter !== 'function') {
- ret.valid = false;
- ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
- return ret;
- }
- } else if (ext.regex) {
- if (showdown.helper.isString(ext.regex)) {
- ext.regex = new RegExp(ext.regex, 'g');
- }
- if (!(ext.regex instanceof RegExp)) {
- ret.valid = false;
- ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
- return ret;
- }
- if (showdown.helper.isUndefined(ext.replace)) {
- ret.valid = false;
- ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
- return ret;
- }
- }
- }
- return ret;
-}
-
-/**
- * Validate extension
- * @param {object} ext
- * @returns {boolean}
- */
-showdown.validateExtension = function (ext) {
- 'use strict';
-
- var validateExtension = validate(ext, null);
- if (!validateExtension.valid) {
- console.warn(validateExtension.error);
- return false;
- }
- return true;
-};
-
-/**
- * showdownjs helper functions
- */
-
-if (!showdown.hasOwnProperty('helper')) {
- showdown.helper = {};
-}
-
-/**
- * Check if var is string
- * @static
- * @param {string} a
- * @returns {boolean}
- */
-showdown.helper.isString = function (a) {
- 'use strict';
- return (typeof a === 'string' || a instanceof String);
-};
-
-/**
- * Check if var is a function
- * @static
- * @param {*} a
- * @returns {boolean}
- */
-showdown.helper.isFunction = function (a) {
- 'use strict';
- var getType = {};
- return a && getType.toString.call(a) === '[object Function]';
-};
-
-/**
- * isArray helper function
- * @static
- * @param {*} a
- * @returns {boolean}
- */
-showdown.helper.isArray = function (a) {
- 'use strict';
- return Array.isArray(a);
-};
-
-/**
- * Check if value is undefined
- * @static
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
- */
-showdown.helper.isUndefined = function (value) {
- 'use strict';
- return typeof value === 'undefined';
-};
-
-/**
- * ForEach helper function
- * Iterates over Arrays and Objects (own properties only)
- * @static
- * @param {*} obj
- * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
- */
-showdown.helper.forEach = function (obj, callback) {
- 'use strict';
- // check if obj is defined
- if (showdown.helper.isUndefined(obj)) {
- throw new Error('obj param is required');
- }
-
- if (showdown.helper.isUndefined(callback)) {
- throw new Error('callback param is required');
- }
-
- if (!showdown.helper.isFunction(callback)) {
- throw new Error('callback param must be a function/closure');
- }
-
- if (typeof obj.forEach === 'function') {
- obj.forEach(callback);
- } else if (showdown.helper.isArray(obj)) {
- for (var i = 0; i < obj.length; i++) {
- callback(obj[i], i, obj);
- }
- } else if (typeof (obj) === 'object') {
- for (var prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- callback(obj[prop], prop, obj);
- }
- }
- } else {
- throw new Error('obj does not seem to be an array or an iterable object');
- }
-};
-
-/**
- * Standardidize extension name
- * @static
- * @param {string} s extension name
- * @returns {string}
- */
-showdown.helper.stdExtName = function (s) {
- 'use strict';
- return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
-};
-
-function escapeCharactersCallback (wholeMatch, m1) {
- 'use strict';
- var charCodeToEscape = m1.charCodeAt(0);
- return '¨E' + charCodeToEscape + 'E';
-}
-
-/**
- * Callback used to escape characters when passing through String.replace
- * @static
- * @param {string} wholeMatch
- * @param {string} m1
- * @returns {string}
- */
-showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
-
-/**
- * Escape characters in a string
- * @static
- * @param {string} text
- * @param {string} charsToEscape
- * @param {boolean} afterBackslash
- * @returns {XML|string|void|*}
- */
-showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
- 'use strict';
- // First we have to escape the escape characters so that
- // we can build a character class out of them
- var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
-
- if (afterBackslash) {
- regexString = '\\\\' + regexString;
- }
-
- var regex = new RegExp(regexString, 'g');
- text = text.replace(regex, escapeCharactersCallback);
-
- return text;
-};
-
-/**
- * Unescape HTML entities
- * @param txt
- * @returns {string}
- */
-showdown.helper.unescapeHTMLEntities = function (txt) {
- 'use strict';
-
- return txt
- .replace(/&quot;/g, '"')
- .replace(/&lt;/g, '<')
- .replace(/&gt;/g, '>')
- .replace(/&amp;/g, '&');
-};
-
-var rgxFindMatchPos = function (str, left, right, flags) {
- 'use strict';
- var f = flags || '',
- g = f.indexOf('g') > -1,
- x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
- l = new RegExp(left, f.replace(/g/g, '')),
- pos = [],
- t, s, m, start, end;
-
- do {
- t = 0;
- while ((m = x.exec(str))) {
- if (l.test(m[0])) {
- if (!(t++)) {
- s = x.lastIndex;
- start = s - m[0].length;
- }
- } else if (t) {
- if (!--t) {
- end = m.index + m[0].length;
- var obj = {
- left: {start: start, end: s},
- match: {start: s, end: m.index},
- right: {start: m.index, end: end},
- wholeMatch: {start: start, end: end}
- };
- pos.push(obj);
- if (!g) {
- return pos;
- }
- }
- }
- }
- } while (t && (x.lastIndex = s));
-
- return pos;
-};
-
-/**
- * matchRecursiveRegExp
- *
- * (c) 2007 Steven Levithan <stevenlevithan.com>
- * MIT License
- *
- * Accepts a string to search, a left and right format delimiter
- * as regex patterns, and optional regex flags. Returns an array
- * of matches, allowing nested instances of left/right delimiters.
- * Use the "g" flag to return all matches, otherwise only the
- * first is returned. Be careful to ensure that the left and
- * right format delimiters produce mutually exclusive matches.
- * Backreferences are not supported within the right delimiter
- * due to how it is internally combined with the left delimiter.
- * When matching strings whose format delimiters are unbalanced
- * to the left or right, the output is intentionally as a
- * conventional regex library with recursion support would
- * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
- * "<" and ">" as the delimiters (both strings contain a single,
- * balanced instance of "<x>").
- *
- * examples:
- * matchRecursiveRegExp("test", "\\(", "\\)")
- * returns: []
- * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
- * returns: ["t<<e>><s>", ""]
- * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
- * returns: ["test"]
- */
-showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
- 'use strict';
-
- var matchPos = rgxFindMatchPos (str, left, right, flags),
- results = [];
-
- for (var i = 0; i < matchPos.length; ++i) {
- results.push([
- str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
- str.slice(matchPos[i].match.start, matchPos[i].match.end),
- str.slice(matchPos[i].left.start, matchPos[i].left.end),
- str.slice(matchPos[i].right.start, matchPos[i].right.end)
- ]);
- }
- return results;
-};
-
-/**
- *
- * @param {string} str
- * @param {string|function} replacement
- * @param {string} left
- * @param {string} right
- * @param {string} flags
- * @returns {string}
- */
-showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
- 'use strict';
-
- if (!showdown.helper.isFunction(replacement)) {
- var repStr = replacement;
- replacement = function () {
- return repStr;
- };
- }
-
- var matchPos = rgxFindMatchPos(str, left, right, flags),
- finalStr = str,
- lng = matchPos.length;
-
- if (lng > 0) {
- var bits = [];
- if (matchPos[0].wholeMatch.start !== 0) {
- bits.push(str.slice(0, matchPos[0].wholeMatch.start));
- }
- for (var i = 0; i < lng; ++i) {
- bits.push(
- replacement(
- str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
- str.slice(matchPos[i].match.start, matchPos[i].match.end),
- str.slice(matchPos[i].left.start, matchPos[i].left.end),
- str.slice(matchPos[i].right.start, matchPos[i].right.end)
- )
- );
- if (i < lng - 1) {
- bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
- }
- }
- if (matchPos[lng - 1].wholeMatch.end < str.length) {
- bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
- }
- finalStr = bits.join('');
- }
- return finalStr;
-};
-
-/**
- * Returns the index within the passed String object of the first occurrence of the specified regex,
- * starting the search at fromIndex. Returns -1 if the value is not found.
- *
- * @param {string} str string to search
- * @param {RegExp} regex Regular expression to search
- * @param {int} [fromIndex = 0] Index to start the search
- * @returns {Number}
- * @throws InvalidArgumentError
- */
-showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
- 'use strict';
- if (!showdown.helper.isString(str)) {
- throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
- }
- if (regex instanceof RegExp === false) {
- throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
- }
- var indexOf = str.substring