From 333ed2f1a07ffc24e246ab71585df31ab69559a0 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 11 Aug 2018 14:41:02 -0700 Subject: [PATCH 1/9] Fix warning regarding lack of "key" prop --- code-syntax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code-syntax.js b/code-syntax.js index 5503c97..2f458b5 100644 --- a/code-syntax.js +++ b/code-syntax.js @@ -58,7 +58,7 @@ const addSyntaxToCodeBlock = settings => { }; return [ - + { onChange={ updateLanguage } /> , -
+
setAttributes( { content } ) } From 8542dace07f13b7cb06831ad5766ae3ad13aa7f4 Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 14:43:33 -0700 Subject: [PATCH 2/9] Improve translatability and missing code-syntax-block text domain --- code-syntax.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/code-syntax.js b/code-syntax.js index 2f458b5..bdd8447 100644 --- a/code-syntax.js +++ b/code-syntax.js @@ -18,19 +18,19 @@ import './editor.scss'; import './style.scss'; const langs = { - bash: 'Bash (shell)', - clike: 'C-like', - css: 'CSS', - git: 'Git', - go: 'Go (golang)', - markup: 'HTML/Markup', - javascript: 'JavaScript', - json: 'JSON', - markdown: 'Markdown', - php: 'PHP', - python: 'Python', - jsx: 'React JSX', - sql: 'SQL', + bash: __( 'Bash (shell)', 'code-syntax-block' ), + clike: __( 'C-like', 'code-syntax-block' ), + css: __( 'CSS', 'code-syntax-block' ), + git: __( 'Git', 'code-syntax-block' ), + go: __( 'Go (golang)', 'code-syntax-block' ), + markup: __( 'HTML/Markup', 'code-syntax-block' ), + javascript: __( 'JavaScript', 'code-syntax-block' ), + json: __( 'JSON', 'code-syntax-block' ), + markdown: __( 'Markdown', 'code-syntax-block' ), + php: __( 'PHP', 'code-syntax-block' ), + python: __( 'Python', 'code-syntax-block' ), + jsx: __( 'React JSX', 'code-syntax-block' ), + sql: __( 'SQL', 'code-syntax-block' ), }; const addSyntaxToCodeBlock = settings => { @@ -63,7 +63,7 @@ const addSyntaxToCodeBlock = settings => { label="Language" value={ attributes.language } options={ - [ { label: __( 'Select code language' ), value: '' } ].concat ( + [ { label: __( 'Select code language', 'code-syntax-block' ), value: '' } ].concat ( Object.keys( langs ).map( ( lang ) => ( { label: langs[lang], value: lang } ) ) ) @@ -75,8 +75,8 @@ const addSyntaxToCodeBlock = settings => { <PlainText value={ attributes.content } onChange={ ( content ) => setAttributes( { content } ) } - placeholder={ __( 'Write code…' ) } - aria-label={ __( 'Code' ) } + placeholder={ __( 'Write code…', 'code-syntax-block' ) } + aria-label={ __( 'Code', 'code-syntax-block' ) } /> <div className="language-selected">{ langs[ attributes.language ] }</div> </div> From 3542c9fdfd2df3ad721088dfe5b69f7c8006f252 Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 15:27:52 -0700 Subject: [PATCH 3/9] Add eslint config for WordPress and fix issues --- .eslintrc.js | 22 ++++++++++++++++++++++ code-syntax.js | 48 ++++++++++++++++++++++++------------------------ package.json | 2 ++ 3 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..535a2fb --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,22 @@ +module.exports = { + root: true, + extends: [ + 'wordpress' + ], + env: { + browser: false, + node: true + }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + ecmaFeatures: { + jsx: true + } + }, + settings: { + react: { + pragma: 'wp' + } + } +}; diff --git a/code-syntax.js b/code-syntax.js index bdd8447..6fb4a62 100644 --- a/code-syntax.js +++ b/code-syntax.js @@ -3,7 +3,7 @@ * A gutenberg block that allows inserting code with syntax highlighting. */ - /** +/** * WordPress dependencies */ const { __ } = wp.i18n; @@ -18,23 +18,23 @@ import './editor.scss'; import './style.scss'; const langs = { - bash: __( 'Bash (shell)', 'code-syntax-block' ), - clike: __( 'C-like', 'code-syntax-block' ), - css: __( 'CSS', 'code-syntax-block' ), - git: __( 'Git', 'code-syntax-block' ), - go: __( 'Go (golang)', 'code-syntax-block' ), - markup: __( 'HTML/Markup', 'code-syntax-block' ), + bash: __( 'Bash (shell)', 'code-syntax-block' ), + clike: __( 'C-like', 'code-syntax-block' ), + css: __( 'CSS', 'code-syntax-block' ), + git: __( 'Git', 'code-syntax-block' ), + go: __( 'Go (golang)', 'code-syntax-block' ), + markup: __( 'HTML/Markup', 'code-syntax-block' ), javascript: __( 'JavaScript', 'code-syntax-block' ), - json: __( 'JSON', 'code-syntax-block' ), - markdown: __( 'Markdown', 'code-syntax-block' ), - php: __( 'PHP', 'code-syntax-block' ), - python: __( 'Python', 'code-syntax-block' ), - jsx: __( 'React JSX', 'code-syntax-block' ), - sql: __( 'SQL', 'code-syntax-block' ), + json: __( 'JSON', 'code-syntax-block' ), + markdown: __( 'Markdown', 'code-syntax-block' ), + php: __( 'PHP', 'code-syntax-block' ), + python: __( 'Python', 'code-syntax-block' ), + jsx: __( 'React JSX', 'code-syntax-block' ), + sql: __( 'SQL', 'code-syntax-block' ) }; const addSyntaxToCodeBlock = settings => { - if ( settings.name !== "core/code" ) { + if ( 'core/code' !== settings.name ) { return settings; } @@ -48,13 +48,13 @@ const addSyntaxToCodeBlock = settings => { selector: 'code', source: 'attribute', attribute: 'lang' - }, + } }, - edit( { attributes, setAttributes, isSelected, className } ) { + edit({ attributes, setAttributes, isSelected, className }) { const updateLanguage = language => { - setAttributes( { language } ); + setAttributes({ language }); }; return [ @@ -74,7 +74,7 @@ const addSyntaxToCodeBlock = settings => { <div key="editor-wrapper" className={ className }> <PlainText value={ attributes.content } - onChange={ ( content ) => setAttributes( { content } ) } + onChange={ ( content ) => setAttributes({ content }) } placeholder={ __( 'Write code…', 'code-syntax-block' ) } aria-label={ __( 'Code', 'code-syntax-block' ) } /> @@ -83,10 +83,10 @@ const addSyntaxToCodeBlock = settings => { ]; }, - save( { attributes } ) { - const cls = ( attributes.language ) ? "language-" + attributes.language : ""; + save({ attributes }) { + const cls = ( attributes.language ) ? 'language-' + attributes.language : ''; return <pre><code lang={ attributes.language } className={ cls }>{ attributes.content }</code></pre>; - }, + } }; return newCodeBlockSettings; @@ -94,7 +94,7 @@ const addSyntaxToCodeBlock = settings => { // Register Filter addFilter( - "blocks.registerBlockType", - "mkaz/code-syntax-block", + 'blocks.registerBlockType', + 'mkaz/code-syntax-block', addSyntaxToCodeBlock -) +); diff --git a/package.json b/package.json index 1ae9f61..6803895 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "babel-preset-env": "^1.6.0", "cross-env": "^5.1.4", "css-loader": "^0.28.11", + "eslint": "^5.3.0", + "eslint-config-wordpress": "^2.0.0", "extract-text-webpack-plugin": "^3.0.2", "node-sass": "^4.8.3", "postcss-loader": "^2.1.3", From ded6aca4910561abf0216e508bac77ad8a9da65a Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 15:27:58 -0700 Subject: [PATCH 4/9] Fix phpcs issues --- index.php | 81 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/index.php b/index.php index 097e59b..e268d3a 100644 --- a/index.php +++ b/index.php @@ -1,38 +1,39 @@ <?php -/* -Plugin Name: Code Syntax Block -Plugin URI: https://github.com/mkaz/code-syntax-block -Description: A plugin to extend Gutenberg code block with syntax highlighting -Version: 0.4.0 -Author: Marcus Kazmierczak -Author URI: https://mkaz.blog/ -License: GPL2 -License URI: https://www.gnu.org/licenses/gpl-2.0.html -*/ - +/** + * Plugin Name: Code Syntax Block + * Plugin URI: https://github.com/mkaz/code-syntax-block + * Description: A plugin to extend Gutenberg code block with syntax highlighting + * Version: 0.4.0 + * Author: Marcus Kazmierczak + * Author URI: https://mkaz.blog/ + * License: GPL2 + * License URI: https://www.gnu.org/licenses/gpl-2.0.html + * + * @package Code_Syntax_Block + */ /** * Enqueue assets for editor portion of Gutenberg */ function mkaz_code_syntax_editor_assets() { - // files - $blockPath = 'build/block.built.js'; - $editorStylePath = 'assets/blocks.editor.css'; + // Files. + $block_path = 'build/block.built.js'; + $editor_style_path = 'assets/blocks.editor.css'; - // block + // Block. wp_enqueue_script( 'mkaz-code-syntax', - plugins_url( $blockPath, __FILE__ ), - [ 'wp-blocks', 'wp-element' ], - filemtime( plugin_dir_path(__FILE__) . $blockPath ) + plugins_url( $block_path, __FILE__ ), + array( 'wp-blocks', 'wp-element' ), + filemtime( plugin_dir_path( __FILE__ ) . $block_path ) ); - // enqueue editor style + // Enqueue editor style. wp_enqueue_style( 'mkaz-code-syntax-editor-css', - plugins_url( $editorStylePath, __FILE__), - [ 'wp-blocks' ], - filemtime( plugin_dir_path( __FILE__ ) . $editorStylePath ) + plugins_url( $editor_style_path, __FILE__ ), + array( 'wp-blocks' ), + filemtime( plugin_dir_path( __FILE__ ) . $editor_style_path ) ); } @@ -42,34 +43,34 @@ function mkaz_code_syntax_editor_assets() { * Enqueue assets for viewing posts */ function mkaz_code_syntax_view_assets() { - // files - $viewStylePath = 'assets/blocks.style.css'; - $prismJsPath = 'assets/prism.js'; - $prismCssPath = 'assets/prism.css'; + // Files. + $view_style_path = 'assets/blocks.style.css'; + $prism_js_path = 'assets/prism.js'; + $prism_css_path = 'assets/prism.css'; - // enqueue view style + // Enqueue view style. wp_enqueue_style( 'mkaz-code-syntax-css', - plugins_url( $viewStylePath, __FILE__ ), - [], - filemtime( plugin_dir_path(__FILE__) . $viewStylePath ) + plugins_url( $view_style_path, __FILE__ ), + array(), + filemtime( plugin_dir_path( __FILE__ ) . $view_style_path ) ); - // enqueue prism style + // Enqueue prism style. wp_enqueue_style( 'mkaz-code-syntax-prism-css', - plugins_url( $prismCssPath, __FILE__ ), - [], - filemtime( plugin_dir_path(__FILE__) . $prismCssPath ) + plugins_url( $prism_css_path, __FILE__ ), + array(), + filemtime( plugin_dir_path( __FILE__ ) . $prism_css_path ) ); - // enqueue prism script + // Enqueue prism script. wp_enqueue_script( 'mkaz-code-syntax-prism-css', - plugins_url( $prismJsPath, __FILE__ ), - [], // no dependencies - filemtime( plugin_dir_path(__FILE__) . $prismJsPath ), - true // in footer + plugins_url( $prism_js_path, __FILE__ ), + array(), // No dependencies. + filemtime( plugin_dir_path( __FILE__ ) . $prism_js_path ), + true // In footer. ); } -add_action('wp_enqueue_scripts', 'mkaz_code_syntax_view_assets'); +add_action( 'wp_enqueue_scripts', 'mkaz_code_syntax_view_assets' ); From 379370a16a53eb9ba4d3efc53d1a2c15cea11a7b Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 15:53:39 -0700 Subject: [PATCH 5/9] Add POT file and load for plugin translation strings --- index.php | 18 +++++- languages/code-syntax-block.pot | 99 +++++++++++++++++++++++++++++++++ package.json | 5 +- 3 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 languages/code-syntax-block.pot diff --git a/index.php b/index.php index e268d3a..9d5ba2d 100644 --- a/index.php +++ b/index.php @@ -8,10 +8,19 @@ * Author URI: https://mkaz.blog/ * License: GPL2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html + * Text Domain: code-syntax-block * * @package Code_Syntax_Block */ +/** + * Load text domain. + */ +function mkaz_load_plugin_textdomain() { + load_plugin_textdomain( 'code-syntax-block', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); +} +add_action( 'plugins_loaded', 'mkaz_load_plugin_textdomain' ); + /** * Enqueue assets for editor portion of Gutenberg */ @@ -24,7 +33,7 @@ function mkaz_code_syntax_editor_assets() { wp_enqueue_script( 'mkaz-code-syntax', plugins_url( $block_path, __FILE__ ), - array( 'wp-blocks', 'wp-element' ), + array( 'wp-blocks', 'wp-element', 'wp-i18n' ), filemtime( plugin_dir_path( __FILE__ ) . $block_path ) ); @@ -36,6 +45,13 @@ function mkaz_code_syntax_editor_assets() { filemtime( plugin_dir_path( __FILE__ ) . $editor_style_path ) ); + // Prepare Jed locale data. + $locale_data = gutenberg_get_jed_locale_data( 'code-syntax-block' ); + wp_add_inline_script( + 'wp-i18n', + sprintf( 'wp.i18n.setLocaleData( %s, "code-syntax-block" );', wp_json_encode( $locale_data ) ) + ); + } add_action( 'enqueue_block_editor_assets', 'mkaz_code_syntax_editor_assets' ); diff --git a/languages/code-syntax-block.pot b/languages/code-syntax-block.pot new file mode 100644 index 0000000..9766a6c --- /dev/null +++ b/languages/code-syntax-block.pot @@ -0,0 +1,99 @@ +# Copyright (C) 2018 Marcus Kazmierczak +# This file is distributed under the same license as the Code Syntax Block plugin. +msgid "" +msgstr "" +"Project-Id-Version: Code Syntax Block 0.4.0\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/code-syntax-block\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2018-08-11T22:51:33+00:00\n" +"PO-Revision-Date: 2018-08-11T22:51:33+00:00\n" +"X-Generator: WP-CLI 2.0.0\n" +"X-Domain: code-syntax-block\n" + +#. Plugin Name of the plugin +msgid "Code Syntax Block" +msgstr "" + +#. Plugin URI of the plugin +msgid "https://github.com/mkaz/code-syntax-block" +msgstr "" + +#. Description of the plugin +msgid "A plugin to extend Gutenberg code block with syntax highlighting" +msgstr "" + +#. Author of the plugin +msgid "Marcus Kazmierczak" +msgstr "" + +#. Author URI of the plugin +msgid "https://mkaz.blog/" +msgstr "" + +#: code-syntax.js:21 +msgid "Bash (shell)" +msgstr "" + +#: code-syntax.js:22 +msgid "C-like" +msgstr "" + +#: code-syntax.js:23 +msgid "CSS" +msgstr "" + +#: code-syntax.js:24 +msgid "Git" +msgstr "" + +#: code-syntax.js:25 +msgid "Go (golang)" +msgstr "" + +#: code-syntax.js:26 +msgid "HTML/Markup" +msgstr "" + +#: code-syntax.js:27 +msgid "JavaScript" +msgstr "" + +#: code-syntax.js:28 +msgid "JSON" +msgstr "" + +#: code-syntax.js:29 +msgid "Markdown" +msgstr "" + +#: code-syntax.js:30 +msgid "PHP" +msgstr "" + +#: code-syntax.js:31 +msgid "Python" +msgstr "" + +#: code-syntax.js:32 +msgid "React JSX" +msgstr "" + +#: code-syntax.js:33 +msgid "SQL" +msgstr "" + +#: code-syntax.js:66 +msgid "Select code language" +msgstr "" + +#: code-syntax.js:78 +msgid "Write code…" +msgstr "" + +#: code-syntax.js:79 +msgid "Code" +msgstr "" diff --git a/package.json b/package.json index 6803895..08b173c 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,9 @@ "webpack": "^3.1.0" }, "scripts": { - "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack", + "make-pot": "wp i18n make-pot . languages/code-syntax-block.pot --include=code-syntax.js", + "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack; npm run make-pot", "dev": "cross-env BABEL_ENV=default webpack --watch", - "zip": "zip -r code-syntax-block.zip index.php readme.md assets build" + "zip": "zip -r code-syntax-block.zip index.php readme.md assets build languages" } } From ff5e498396bbda8ec21072ba07c9e489321c2634 Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 15:54:09 -0700 Subject: [PATCH 6/9] Re-build plugin JS at 379370a16 --- build/block.built.js | 149 +++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/build/block.built.js b/build/block.built.js index 18de6b4..e6e0bb4 100644 --- a/build/block.built.js +++ b/build/block.built.js @@ -67,7 +67,7 @@ /* 0 */ /***/ (function(module, exports) { -var core = module.exports = { version: '2.5.4' }; +var core = module.exports = { version: '2.5.7' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef @@ -143,7 +143,7 @@ module.exports = function (it) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(17); -var enumBugKeys = __webpack_require__(25); +var enumBugKeys = __webpack_require__(26); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); @@ -202,8 +202,8 @@ module.exports = function (it) { var global = __webpack_require__(2); var core = __webpack_require__(0); -var ctx = __webpack_require__(27); -var hide = __webpack_require__(29); +var ctx = __webpack_require__(28); +var hide = __webpack_require__(30); var has = __webpack_require__(8); var PROTOTYPE = 'prototype'; @@ -272,11 +272,11 @@ module.exports = $export; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__ = __webpack_require__(14); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__ = __webpack_require__(36); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__ = __webpack_require__(37); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss__ = __webpack_require__(43); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss__ = __webpack_require__(44); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__editor_scss__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss__ = __webpack_require__(44); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__style_scss__); @@ -286,8 +286,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); */ /** -* WordPress dependencies -*/ + * WordPress dependencies + */ var __ = wp.i18n.__; var addFilter = wp.hooks.addFilter; var _wp$editor = wp.editor, @@ -303,23 +303,23 @@ var SelectControl = wp.components.SelectControl; var langs = { - bash: 'Bash (shell)', - clike: 'C-like', - css: 'CSS', - git: 'Git', - go: 'Go (golang)', - markup: 'HTML/Markup', - javascript: 'JavaScript', - json: 'JSON', - markdown: 'Markdown', - php: 'PHP', - python: 'Python', - jsx: 'React JSX', - sql: 'SQL' + bash: __('Bash (shell)', 'code-syntax-block'), + clike: __('C-like', 'code-syntax-block'), + css: __('CSS', 'code-syntax-block'), + git: __('Git', 'code-syntax-block'), + go: __('Go (golang)', 'code-syntax-block'), + markup: __('HTML/Markup', 'code-syntax-block'), + javascript: __('JavaScript', 'code-syntax-block'), + json: __('JSON', 'code-syntax-block'), + markdown: __('Markdown', 'code-syntax-block'), + php: __('PHP', 'code-syntax-block'), + python: __('Python', 'code-syntax-block'), + jsx: __('React JSX', 'code-syntax-block'), + sql: __('SQL', 'code-syntax-block') }; var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { - if (settings.name !== "core/code") { + if ('core/code' !== settings.name) { return settings; } @@ -347,25 +347,25 @@ var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { return [React.createElement( InspectorControls, - null, + { key: 'controls' }, React.createElement(SelectControl, { label: 'Language', value: attributes.language, - options: [{ label: __('Select code language'), value: '' }].concat(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(langs).map(function (lang) { + options: [{ label: __('Select code language', 'code-syntax-block'), value: '' }].concat(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(langs).map(function (lang) { return { label: langs[lang], value: lang }; })), onChange: updateLanguage }) ), React.createElement( 'div', - { className: className }, + { key: 'editor-wrapper', className: className }, React.createElement(PlainText, { value: attributes.content, onChange: function onChange(content) { return setAttributes({ content: content }); }, - placeholder: __('Write code…'), - 'aria-label': __('Code') + placeholder: __('Write code…', 'code-syntax-block'), + 'aria-label': __('Code', 'code-syntax-block') }), React.createElement( 'div', @@ -377,7 +377,7 @@ var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { save: function save(_ref2) { var attributes = _ref2.attributes; - var cls = attributes.language ? "language-" + attributes.language : ""; + var cls = attributes.language ? 'language-' + attributes.language : ''; return React.createElement( 'pre', null, @@ -394,7 +394,7 @@ var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { }; // Register Filter -addFilter("blocks.registerBlockType", "mkaz/code-syntax-block", addSyntaxToCodeBlock); +addFilter('blocks.registerBlockType', 'mkaz/code-syntax-block', addSyntaxToCodeBlock); /***/ }), /* 14 */ @@ -418,7 +418,7 @@ module.exports = __webpack_require__(0).Object.keys; var toObject = __webpack_require__(5); var $keys = __webpack_require__(7); -__webpack_require__(26)('keys', function () { +__webpack_require__(27)('keys', function () { return function keys(it) { return $keys(toObject(it)); }; @@ -518,7 +518,7 @@ module.exports = function (index, length) { /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(23)('keys'); -var uid = __webpack_require__(24); +var uid = __webpack_require__(25); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; @@ -528,18 +528,31 @@ module.exports = function (key) { /* 23 */ /***/ (function(module, exports, __webpack_require__) { +var core = __webpack_require__(0); var global = __webpack_require__(2); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); -module.exports = function (key) { - return store[key] || (store[key] = {}); -}; + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __webpack_require__(24) ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); /***/ }), /* 24 */ /***/ (function(module, exports) { +module.exports = true; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + var id = 0; var px = Math.random(); module.exports = function (key) { @@ -548,7 +561,7 @@ module.exports = function (key) { /***/ }), -/* 25 */ +/* 26 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys @@ -558,7 +571,7 @@ module.exports = ( /***/ }), -/* 26 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives @@ -574,11 +587,11 @@ module.exports = function (KEY, exec) { /***/ }), -/* 27 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding -var aFunction = __webpack_require__(28); +var aFunction = __webpack_require__(29); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; @@ -600,7 +613,7 @@ module.exports = function (fn, that, length) { /***/ }), -/* 28 */ +/* 29 */ /***/ (function(module, exports) { module.exports = function (it) { @@ -610,11 +623,11 @@ module.exports = function (it) { /***/ }), -/* 29 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(30); -var createDesc = __webpack_require__(35); +var dP = __webpack_require__(31); +var createDesc = __webpack_require__(36); module.exports = __webpack_require__(4) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { @@ -624,12 +637,12 @@ module.exports = __webpack_require__(4) ? function (object, key, value) { /***/ }), -/* 30 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { -var anObject = __webpack_require__(31); -var IE8_DOM_DEFINE = __webpack_require__(32); -var toPrimitive = __webpack_require__(34); +var anObject = __webpack_require__(32); +var IE8_DOM_DEFINE = __webpack_require__(33); +var toPrimitive = __webpack_require__(35); var dP = Object.defineProperty; exports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes) { @@ -646,7 +659,7 @@ exports.f = __webpack_require__(4) ? Object.defineProperty : function defineProp /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(3); @@ -657,16 +670,16 @@ module.exports = function (it) { /***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(4) && !__webpack_require__(1)(function () { - return Object.defineProperty(__webpack_require__(33)('div'), 'a', { get: function () { return 7; } }).a != 7; + return Object.defineProperty(__webpack_require__(34)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(3); @@ -679,7 +692,7 @@ module.exports = function (it) { /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) @@ -697,7 +710,7 @@ module.exports = function (it, S) { /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { @@ -711,7 +724,7 @@ module.exports = function (bitmap, value) { /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -719,7 +732,7 @@ module.exports = function (bitmap, value) { exports.__esModule = true; -var _assign = __webpack_require__(37); +var _assign = __webpack_require__(38); var _assign2 = _interopRequireDefault(_assign); @@ -740,39 +753,39 @@ exports.default = _assign2.default || function (target) { }; /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(38), __esModule: true }; +module.exports = { "default": __webpack_require__(39), __esModule: true }; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(39); +__webpack_require__(40); module.exports = __webpack_require__(0).Object.assign; /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(12); -$export($export.S + $export.F, 'Object', { assign: __webpack_require__(40) }); +$export($export.S + $export.F, 'Object', { assign: __webpack_require__(41) }); /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(7); -var gOPS = __webpack_require__(41); -var pIE = __webpack_require__(42); +var gOPS = __webpack_require__(42); +var pIE = __webpack_require__(43); var toObject = __webpack_require__(5); var IObject = __webpack_require__(10); var $assign = Object.assign; @@ -805,27 +818,27 @@ module.exports = !$assign || __webpack_require__(1)(function () { /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin From 1b0cde026c4330e2dcd12878ef78cbae3a39c5f6 Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 16:07:14 -0700 Subject: [PATCH 7/9] Remove prism --- assets/prism.css | 119 ----------------------------------------------- assets/prism.js | 17 ------- index.php | 19 -------- readme.md | 15 ------ 4 files changed, 170 deletions(-) delete mode 100644 assets/prism.css delete mode 100644 assets/prism.js diff --git a/assets/prism.css b/assets/prism.css deleted file mode 100644 index f2e81b7..0000000 --- a/assets/prism.css +++ /dev/null @@ -1,119 +0,0 @@ -/** - * GHColors theme by Avi Aryan (http://aviaryan.in) - * Inspired by Github syntax coloring - */ - -code[class*="language-"], -pre[class*="language-"] { - color: #393A34; - font-family: Menlo, Consolas, "Liberation Mono", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - font-size: 14px; - line-height: 1.6em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, -code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { - background: #b3d4fc; -} - -pre[class*="language-"]::selection, pre[class*="language-"] ::selection, -code[class*="language-"]::selection, code[class*="language-"] ::selection { - background: #b3d4fc; -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; - border: 1px solid #dddddd; - background-color: white; -} - -:not(pre) > code[class*="language-"], -pre[class*="language-"] { -} - -/* Inline code */ -:not(pre) > code[class*="language-"] { - padding: .2em; - padding-top: 1px; padding-bottom: 1px; - background: #f8f8f8; - border: 1px solid #dddddd; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: #999988; font-style: italic; -} - -.token.namespace { - opacity: .7; -} - -.token.string, -.token.attr-value { - color: #e3116c; -} -.token.punctuation, -.token.operator { - color: #393A34; /* no highlight */ -} - -.token.entity, -.token.url, -.token.symbol, -.token.number, -.token.boolean, -.token.variable, -.token.constant, -.token.property, -.token.regex, -.token.inserted { - color: #36acaa; -} - -.token.atrule, -.token.keyword, -.token.attr-name, -.language-autohotkey .token.selector { - color: #00a4db; -} - -.token.function, -.token.deleted, -.language-autohotkey .token.tag { - color: #9a050f; -} - -.token.tag, -.token.selector, -.language-autohotkey .token.keyword { - color: #00009f; -} - -.token.important, -.token.function, -.token.bold { - font-weight: bold; -} - -.token.italic { - font-style: italic; -} \ No newline at end of file diff --git a/assets/prism.js b/assets/prism.js deleted file mode 100644 index 2973356..0000000 --- a/assets/prism.js +++ /dev/null @@ -1,17 +0,0 @@ -/* PrismJS 1.14.0 -http://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+markup-templating+git+go+json+markdown+php+sql+python+jsx */ -var _self = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : {}, Prism = function () { var e = /\blang(?:uage)?-([\w-]+)\b/i, t = 0, n = _self.Prism = { manual: _self.Prism && _self.Prism.manual, disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, util: { encode: function (e) { return e instanceof r ? new r(e.type, n.util.encode(e.content), e.alias) : "Array" === n.util.type(e) ? e.map(n.util.encode) : e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ") }, type: function (e) { return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1] }, objId: function (e) { return e.__id || Object.defineProperty(e, "__id", { value: ++t }), e.__id }, clone: function (e, t) { var r = n.util.type(e); switch (t = t || {}, r) { case "Object": if (t[n.util.objId(e)]) return t[n.util.objId(e)]; var a = {}; t[n.util.objId(e)] = a; for (var l in e) e.hasOwnProperty(l) && (a[l] = n.util.clone(e[l], t)); return a; case "Array": if (t[n.util.objId(e)]) return t[n.util.objId(e)]; var a = []; return t[n.util.objId(e)] = a, e.forEach(function (e, r) { a[r] = n.util.clone(e, t) }), a }return e } }, languages: { extend: function (e, t) { var r = n.util.clone(n.languages[e]); for (var a in t) r[a] = t[a]; return r }, insertBefore: function (e, t, r, a) { a = a || n.languages; var l = a[e]; if (2 == arguments.length) { r = arguments[1]; for (var i in r) r.hasOwnProperty(i) && (l[i] = r[i]); return l } var o = {}; for (var s in l) if (l.hasOwnProperty(s)) { if (s == t) for (var i in r) r.hasOwnProperty(i) && (o[i] = r[i]); o[s] = l[s] } return n.languages.DFS(n.languages, function (t, n) { n === a[e] && t != e && (this[t] = o) }), a[e] = o }, DFS: function (e, t, r, a) { a = a || {}; for (var l in e) e.hasOwnProperty(l) && (t.call(e, l, e[l], r || l), "Object" !== n.util.type(e[l]) || a[n.util.objId(e[l])] ? "Array" !== n.util.type(e[l]) || a[n.util.objId(e[l])] || (a[n.util.objId(e[l])] = !0, n.languages.DFS(e[l], t, l, a)) : (a[n.util.objId(e[l])] = !0, n.languages.DFS(e[l], t, null, a))) } }, plugins: {}, highlightAll: function (e, t) { n.highlightAllUnder(document, e, t) }, highlightAllUnder: function (e, t, r) { var a = { callback: r, selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code' }; n.hooks.run("before-highlightall", a); for (var l, i = a.elements || e.querySelectorAll(a.selector), o = 0; l = i[o++];)n.highlightElement(l, t === !0, a.callback) }, highlightElement: function (t, r, a) { for (var l, i, o = t; o && !e.test(o.className);)o = o.parentNode; o && (l = (o.className.match(e) || [, ""])[1].toLowerCase(), i = n.languages[l]), t.className = t.className.replace(e, "").replace(/\s+/g, " ") + " language-" + l, t.parentNode && (o = t.parentNode, /pre/i.test(o.nodeName) && (o.className = o.className.replace(e, "").replace(/\s+/g, " ") + " language-" + l)); var s = t.textContent, u = { element: t, language: l, grammar: i, code: s }; if (n.hooks.run("before-sanity-check", u), !u.code || !u.grammar) return u.code && (n.hooks.run("before-highlight", u), u.element.textContent = u.code, n.hooks.run("after-highlight", u)), n.hooks.run("complete", u), void 0; if (n.hooks.run("before-highlight", u), r && _self.Worker) { var g = new Worker(n.filename); g.onmessage = function (e) { u.highlightedCode = e.data, n.hooks.run("before-insert", u), u.element.innerHTML = u.highlightedCode, a && a.call(u.element), n.hooks.run("after-highlight", u), n.hooks.run("complete", u) }, g.postMessage(JSON.stringify({ language: u.language, code: u.code, immediateClose: !0 })) } else u.highlightedCode = n.highlight(u.code, u.grammar, u.language), n.hooks.run("before-insert", u), u.element.innerHTML = u.highlightedCode, a && a.call(t), n.hooks.run("after-highlight", u), n.hooks.run("complete", u) }, highlight: function (e, t, a) { var l = { code: e, grammar: t, language: a }; return n.hooks.run("before-tokenize", l), l.tokens = n.tokenize(l.code, l.grammar), n.hooks.run("after-tokenize", l), r.stringify(n.util.encode(l.tokens), l.language) }, matchGrammar: function (e, t, r, a, l, i, o) { var s = n.Token; for (var u in r) if (r.hasOwnProperty(u) && r[u]) { if (u == o) return; var g = r[u]; g = "Array" === n.util.type(g) ? g : [g]; for (var c = 0; c < g.length; ++c) { var h = g[c], f = h.inside, d = !!h.lookbehind, m = !!h.greedy, p = 0, y = h.alias; if (m && !h.pattern.global) { var v = h.pattern.toString().match(/[imuy]*$/)[0]; h.pattern = RegExp(h.pattern.source, v + "g") } h = h.pattern || h; for (var b = a, k = l; b < t.length; k += t[b].length, ++b) { var w = t[b]; if (t.length > e.length) return; if (!(w instanceof s)) { if (m && b != t.length - 1) { h.lastIndex = k; var _ = h.exec(e); if (!_) break; for (var j = _.index + (d ? _[1].length : 0), P = _.index + _[0].length, A = b, x = k, O = t.length; O > A && (P > x || !t[A].type && !t[A - 1].greedy); ++A)x += t[A].length, j >= x && (++b, k = x); if (t[b] instanceof s) continue; I = A - b, w = e.slice(k, x), _.index -= k } else { h.lastIndex = 0; var _ = h.exec(w), I = 1 } if (_) { d && (p = _[1] ? _[1].length : 0); var j = _.index + p, _ = _[0].slice(p), P = j + _.length, N = w.slice(0, j), S = w.slice(P), C = [b, I]; N && (++b, k += N.length, C.push(N)); var E = new s(u, f ? n.tokenize(_, f) : _, y, _, m); if (C.push(E), S && C.push(S), Array.prototype.splice.apply(t, C), 1 != I && n.matchGrammar(e, t, r, b, k, !0, u), i) break } else if (i) break } } } } }, tokenize: function (e, t) { var r = [e], a = t.rest; if (a) { for (var l in a) t[l] = a[l]; delete t.rest } return n.matchGrammar(e, r, t, 0, 0, !1), r }, hooks: { all: {}, add: function (e, t) { var r = n.hooks.all; r[e] = r[e] || [], r[e].push(t) }, run: function (e, t) { var r = n.hooks.all[e]; if (r && r.length) for (var a, l = 0; a = r[l++];)a(t) } } }, r = n.Token = function (e, t, n, r, a) { this.type = e, this.content = t, this.alias = n, this.length = 0 | (r || "").length, this.greedy = !!a }; if (r.stringify = function (e, t, a) { if ("string" == typeof e) return e; if ("Array" === n.util.type(e)) return e.map(function (n) { return r.stringify(n, t, e) }).join(""); var l = { type: e.type, content: r.stringify(e.content, t, a), tag: "span", classes: ["token", e.type], attributes: {}, language: t, parent: a }; if (e.alias) { var i = "Array" === n.util.type(e.alias) ? e.alias : [e.alias]; Array.prototype.push.apply(l.classes, i) } n.hooks.run("wrap", l); var o = Object.keys(l.attributes).map(function (e) { return e + '="' + (l.attributes[e] || "").replace(/"/g, "&quot;") + '"' }).join(" "); return "<" + l.tag + ' class="' + l.classes.join(" ") + '"' + (o ? " " + o : "") + ">" + l.content + "</" + l.tag + ">" }, !_self.document) return _self.addEventListener ? (n.disableWorkerMessageHandler || _self.addEventListener("message", function (e) { var t = JSON.parse(e.data), r = t.language, a = t.code, l = t.immediateClose; _self.postMessage(n.highlight(a, n.languages[r], r)), l && _self.close() }, !1), _self.Prism) : _self.Prism; var a = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); return a && (n.filename = a.src, n.manual || a.hasAttribute("data-manual") || ("loading" !== document.readyState ? window.requestAnimationFrame ? window.requestAnimationFrame(n.highlightAll) : window.setTimeout(n.highlightAll, 16) : document.addEventListener("DOMContentLoaded", n.highlightAll))), _self.Prism }(); "undefined" != typeof module && module.exports && (module.exports = Prism), "undefined" != typeof global && (global.Prism = Prism); -Prism.languages.markup = { comment: /<!--[\s\S]*?-->/, prolog: /<\?[\s\S]+?\?>/, doctype: /<!DOCTYPE[\s\S]+?>/i, cdata: /<!\[CDATA\[[\s\S]*?]]>/i, tag: { pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, greedy: !0, inside: { tag: { pattern: /^<\/?[^\s>\/]+/i, inside: { punctuation: /^<\/?/, namespace: /^[^\s>\/:]+:/ } }, "attr-value": { pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, inside: { punctuation: [/^=/, { pattern: /(^|[^\\])["']/, lookbehind: !0 }] } }, punctuation: /\/?>/, "attr-name": { pattern: /[^\s>\/]+/, inside: { namespace: /^[^\s>\/:]+:/ } } } }, entity: /&#?[\da-z]{1,8};/i }, Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity, Prism.hooks.add("wrap", function (a) { "entity" === a.type && (a.attributes.title = a.content.replace(/&amp;/, "&")) }), Prism.languages.xml = Prism.languages.markup, Prism.languages.html = Prism.languages.markup, Prism.languages.mathml = Prism.languages.markup, Prism.languages.svg = Prism.languages.markup; -Prism.languages.css = { comment: /\/\*[\s\S]*?\*\//, atrule: { pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i, inside: { rule: /@[\w-]+/ } }, 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)); -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: /[{}[\];(),.:]/ }; -Prism.languages.javascript = Prism.languages.extend("clike", { keyword: /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, number: /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, "function": /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, operator: /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ }), Prism.languages.insertBefore("javascript", "keyword", { regex: { pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, lookbehind: !0, greedy: !0 }, "function-variable": { pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, alias: "function" }, constant: /\b[A-Z][A-Z\d_]*\b/ }), Prism.languages.insertBefore("javascript", "string", { "template-string": { pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, greedy: !0, inside: { interpolation: { pattern: /\${[^}]+}/, inside: { "interpolation-punctuation": { pattern: /^\${|}$/, alias: "punctuation" }, rest: null } }, string: /[\s\S]+/ } } }), Prism.languages.javascript["template-string"].inside.interpolation.inside.rest = Prism.languages.javascript, Prism.languages.markup && Prism.languages.insertBefore("markup", "tag", { script: { pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, lookbehind: !0, inside: Prism.languages.javascript, alias: "language-javascript", greedy: !0 } }), Prism.languages.js = Prism.languages.javascript; -!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); -Prism.languages["markup-templating"] = {}, Object.defineProperties(Prism.languages["markup-templating"], { buildPlaceholders: { value: function (e, t, n, a) { e.language === t && (e.tokenStack = [], e.code = e.code.replace(n, function (n) { if ("function" == typeof a && !a(n)) return n; for (var r = e.tokenStack.length; -1 !== e.code.indexOf("___" + t.toUpperCase() + r + "___");)++r; return e.tokenStack[r] = n, "___" + t.toUpperCase() + r + "___" }), e.grammar = Prism.languages.markup) } }, tokenizePlaceholders: { value: function (e, t) { if (e.language === t && e.tokenStack) { e.grammar = Prism.languages[t]; var n = 0, a = Object.keys(e.tokenStack), r = function (o) { if (!(n >= a.length)) for (var i = 0; i < o.length; i++) { var g = o[i]; if ("string" == typeof g || g.content && "string" == typeof g.content) { var c = a[n], s = e.tokenStack[c], l = "string" == typeof g ? g : g.content, p = l.indexOf("___" + t.toUpperCase() + c + "___"); if (p > -1) { ++n; var f, u = l.substring(0, p), _ = new Prism.Token(t, Prism.tokenize(s, e.grammar, t), "language-" + t, s), k = l.substring(p + ("___" + t.toUpperCase() + c + "___").length); if (u || k ? (f = [u, _, k].filter(function (e) { return !!e }), r(f)) : f = _, "string" == typeof g ? Array.prototype.splice.apply(o, [i, 1].concat(f)) : g.content = f, n >= a.length) break } } else g.content && "string" != typeof g.content && r(g.content) } }; r(e.tokens) } } } }); -Prism.languages.git = { comment: /^#.*/m, deleted: /^[-–].*/m, inserted: /^\+.*/m, string: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m, command: { pattern: /^.*\$ git .*$/m, inside: { parameter: /\s--?\w+/m } }, coord: /^@@.*@@$/m, commit_sha1: /^commit \w{40}$/m }; -Prism.languages.go = Prism.languages.extend("clike", { keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/, builtin: /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/, "boolean": /\b(?:_|iota|nil|true|false)\b/, operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, number: /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i, string: { pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/, greedy: !0 } }), delete Prism.languages.go["class-name"]; -Prism.languages.json = { property: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i, string: { pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, greedy: !0 }, number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, punctuation: /[{}[\]);,]/, operator: /:/g, "boolean": /\b(?:true|false)\b/i, "null": /\bnull\b/i }, Prism.languages.jsonp = Prism.languages.json; -Prism.languages.markdown = Prism.languages.extend("markup", {}), Prism.languages.insertBefore("markdown", "prolog", { blockquote: { pattern: /^>(?:[\t ]*>)*/m, alias: "punctuation" }, code: [{ pattern: /^(?: {4}|\t).+/m, alias: "keyword" }, { pattern: /``.+?``|`[^`\n]+`/, alias: "keyword" }], title: [{ pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/, alias: "important", inside: { punctuation: /==+$|--+$/ } }, { pattern: /(^\s*)#+.+/m, lookbehind: !0, alias: "important", inside: { punctuation: /^#+|#+$/ } }], hr: { pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m, lookbehind: !0, alias: "punctuation" }, list: { pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m, lookbehind: !0, alias: "punctuation" }, "url-reference": { pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/, inside: { variable: { pattern: /^(!?\[)[^\]]+/, lookbehind: !0 }, string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/, punctuation: /^[\[\]!:]|[<>]/ }, alias: "url" }, bold: { pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, lookbehind: !0, inside: { punctuation: /^\*\*|^__|\*\*$|__$/ } }, italic: { pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, lookbehind: !0, inside: { punctuation: /^[*_]|[*_]$/ } }, url: { pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/, inside: { variable: { pattern: /(!?\[)[^\]]+(?=\]$)/, lookbehind: !0 }, string: { pattern: /"(?:\\.|[^"\\])*"(?=\)$)/ } } } }), Prism.languages.markdown.bold.inside.url = Prism.languages.markdown.url, Prism.languages.markdown.italic.inside.url = Prism.languages.markdown.url, Prism.languages.markdown.bold.inside.italic = Prism.languages.markdown.italic, Prism.languages.markdown.italic.inside.bold = Prism.languages.markdown.bold; -!function (e) { e.languages.php = e.languages.extend("clike", { keyword: /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, constant: /\b[A-Z0-9_]{2,}\b/, comment: { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, lookbehind: !0 } }), e.languages.insertBefore("php", "string", { "shell-comment": { pattern: /(^|[^\\])#.*/, lookbehind: !0, alias: "comment" } }), e.languages.insertBefore("php", "keyword", { delimiter: { pattern: /\?>|<\?(?:php|=)?/i, alias: "important" }, variable: /\$+(?:\w+\b|(?={))/i, "package": { pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, lookbehind: !0, inside: { punctuation: /\\/ } } }), e.languages.insertBefore("php", "operator", { property: { pattern: /(->)[\w]+/, lookbehind: !0 } }), e.languages.insertBefore("php", "string", { "nowdoc-string": { pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/, greedy: !0, alias: "string", inside: { delimiter: { pattern: /^<<<'[^']+'|[a-z_]\w*;$/i, alias: "symbol", inside: { punctuation: /^<<<'?|[';]$/ } } } }, "heredoc-string": { pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i, greedy: !0, alias: "string", inside: { delimiter: { pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i, alias: "symbol", inside: { punctuation: /^<<<"?|[";]$/ } }, interpolation: null } }, "single-quoted-string": { pattern: /'(?:\\[\s\S]|[^\\'])*'/, greedy: !0, alias: "string" }, "double-quoted-string": { pattern: /"(?:\\[\s\S]|[^\\"])*"/, greedy: !0, alias: "string", inside: { interpolation: null } } }), delete e.languages.php.string; var n = { pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/, lookbehind: !0, inside: { rest: e.languages.php } }; e.languages.php["heredoc-string"].inside.interpolation = n, e.languages.php["double-quoted-string"].inside.interpolation = n, e.hooks.add("before-tokenize", function (n) { if (/(?:<\?php|<\?)/gi.test(n.code)) { var i = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/gi; e.languages["markup-templating"].buildPlaceholders(n, "php", i) } }), e.hooks.add("after-tokenize", function (n) { e.languages["markup-templating"].tokenizePlaceholders(n, "php") }) }(Prism); -Prism.languages.sql = { comment: { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, lookbehind: !0 }, string: { pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/, greedy: !0, lookbehind: !0 }, variable: /@[\w.$]+|@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, "function": /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i, "boolean": /\b(?:TRUE|FALSE|NULL)\b/i, number: /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i, operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, punctuation: /[;[\]()`,.]/ }; -Prism.languages.python = { comment: { pattern: /(^|[^\\])#.*/, lookbehind: !0 }, "triple-quoted-string": { pattern: /("""|''')[\s\S]+?\1/, greedy: !0, alias: "string" }, string: { pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, greedy: !0 }, "function": { pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g, lookbehind: !0 }, "class-name": { pattern: /(\bclass\s+)\w+/i, lookbehind: !0 }, keyword: /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/, builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/, "boolean": /\b(?:True|False|None)\b/, number: /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, operator: /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/, punctuation: /[{}[\];(),.:]/ }; -!function (t) { var n = t.util.clone(t.languages.javascript); t.languages.jsx = t.languages.extend("markup", n), t.languages.jsx.tag.pattern = /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i, t.languages.jsx.tag.inside.tag.pattern = /^<\/?[^\s>\/]*/i, t.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i, t.languages.insertBefore("inside", "attr-name", { spread: { pattern: /\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/, inside: { punctuation: /\.{3}|[{}.]/, "attr-value": /\w+/ } } }, t.languages.jsx.tag), t.languages.insertBefore("inside", "attr-value", { script: { pattern: /=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i, inside: { "script-punctuation": { pattern: /^=(?={)/, alias: "punctuation" }, rest: t.languages.jsx }, alias: "language-javascript" } }, t.languages.jsx.tag); var e = function (t) { return t ? "string" == typeof t ? t : "string" == typeof t.content ? t.content : t.content.map(e).join("") : "" }, a = function (n) { for (var s = [], g = 0; g < n.length; g++) { var o = n[g], i = !1; if ("string" != typeof o && ("tag" === o.type && o.content[0] && "tag" === o.content[0].type ? "</" === o.content[0].content[0].content ? s.length > 0 && s[s.length - 1].tagName === e(o.content[0].content[1]) && s.pop() : "/>" === o.content[o.content.length - 1].content || s.push({ tagName: e(o.content[0].content[1]), openedBraces: 0 }) : s.length > 0 && "punctuation" === o.type && "{" === o.content ? s[s.length - 1].openedBraces++ : s.length > 0 && s[s.length - 1].openedBraces > 0 && "punctuation" === o.type && "}" === o.content ? s[s.length - 1].openedBraces-- : i = !0), (i || "string" == typeof o) && s.length > 0 && 0 === s[s.length - 1].openedBraces) { var p = e(o); g < n.length - 1 && ("string" == typeof n[g + 1] || "plain-text" === n[g + 1].type) && (p += e(n[g + 1]), n.splice(g + 1, 1)), g > 0 && ("string" == typeof n[g - 1] || "plain-text" === n[g - 1].type) && (p = e(n[g - 1]) + p, n.splice(g - 1, 1), g--), n[g] = new t.Token("plain-text", p, null, p) } o.content && "string" != typeof o.content && a(o.content) } }; t.hooks.add("after-tokenize", function (t) { ("jsx" === t.language || "tsx" === t.language) && a(t.tokens) }) }(Prism); diff --git a/index.php b/index.php index 9d5ba2d..7a1dd00 100644 --- a/index.php +++ b/index.php @@ -61,8 +61,6 @@ function mkaz_code_syntax_editor_assets() { function mkaz_code_syntax_view_assets() { // Files. $view_style_path = 'assets/blocks.style.css'; - $prism_js_path = 'assets/prism.js'; - $prism_css_path = 'assets/prism.css'; // Enqueue view style. wp_enqueue_style( @@ -71,22 +69,5 @@ function mkaz_code_syntax_view_assets() { array(), filemtime( plugin_dir_path( __FILE__ ) . $view_style_path ) ); - - // Enqueue prism style. - wp_enqueue_style( - 'mkaz-code-syntax-prism-css', - plugins_url( $prism_css_path, __FILE__ ), - array(), - filemtime( plugin_dir_path( __FILE__ ) . $prism_css_path ) - ); - - // Enqueue prism script. - wp_enqueue_script( - 'mkaz-code-syntax-prism-css', - plugins_url( $prism_js_path, __FILE__ ), - array(), // No dependencies. - filemtime( plugin_dir_path( __FILE__ ) . $prism_js_path ), - true // In footer. - ); } add_action( 'wp_enqueue_scripts', 'mkaz_code_syntax_view_assets' ); diff --git a/readme.md b/readme.md index 5f819c3..025a06b 100644 --- a/readme.md +++ b/readme.md @@ -17,25 +17,10 @@ When creating a new code block, select `Code` block, and then in the Inspector ( On the front-end when the post is being viewed, the code will be color syntax highlighted. -### Customize - -The default install uses a limited set of languages from Prism (bash, css, clike, html/markup git, go, javascript, json, php, python, react jsx, sql). If your language is not included, you can build and download a new prism.js <a href="http://prismjs.com/download.html#languages=markup+css+clike+javascript+bash+markup-templating+git+go+php+python+jsx">using this form</a>. Just replace `assets/prism.js` with the new file. You will also need to edit the langs array in code-syntax.js and rebuild. - -Changing color theme, the default color theme is based off [GHColors](https://github.com/PrismJS/prism-themes/blob/master/themes/prism-ghcolors.css). You can download a new theme from the link above, or from the [Prism themes repo](https://github.com/PrismJS/prism-themes). The easiest way would be to download and customize the new css and replace `assets/prism.css`. - - ### Contribute See Github issues for list of current issues with the plugin. Please feel free to file any additional issues or requests that you may come across. Pull requests are welcome to help extend. - -### Colophon - -- Uses PrismJS syntax highlighter, http://prismjs.com/ - -- Uses customized GH Colors theme, https://github.com/PrismJS/prism-themes - - ### License Copyright (c) 2018 Marcus Kazmierczak. From 7a8d2133533fd9ad7f91af448e48cbd01354dd89 Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 22:05:28 -0700 Subject: [PATCH 8/9] Add highlight.php and use server-side rendering --- .gitignore | 24 +- code-syntax.js | 107 +++- composer.json | 10 + composer.lock | 73 +++ index.php | 115 +++- package.json | 2 +- readme.md | 12 +- style.scss | 11 +- .../highlight.php/Highlight/Autoloader.php | 73 +++ .../highlight.php/Highlight/Highlighter.php | 606 ++++++++++++++++++ .../highlight.php/Highlight/JsonRef.php | 132 ++++ .../highlight.php/Highlight/Language.php | 277 ++++++++ .../Highlight/languages/bash.json | 1 + .../Highlight/languages/cpp.json | 1 + .../Highlight/languages/css.json | 1 + .../Highlight/languages/diff.json | 1 + .../highlight.php/Highlight/languages/go.json | 1 + .../Highlight/languages/json.json | 1 + .../Highlight/languages/markdown.json | 1 + .../Highlight/languages/php.json | 1 + .../Highlight/languages/python.json | 1 + .../Highlight/languages/sql.json | 1 + .../scrivo/highlight.php/styles/default.css | 99 +++ 23 files changed, 1514 insertions(+), 37 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 vendor/scrivo/highlight.php/Highlight/Autoloader.php create mode 100644 vendor/scrivo/highlight.php/Highlight/Highlighter.php create mode 100644 vendor/scrivo/highlight.php/Highlight/JsonRef.php create mode 100644 vendor/scrivo/highlight.php/Highlight/Language.php create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/bash.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/cpp.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/css.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/diff.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/go.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/json.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/markdown.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/php.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/python.json create mode 100644 vendor/scrivo/highlight.php/Highlight/languages/sql.json create mode 100644 vendor/scrivo/highlight.php/styles/default.css diff --git a/.gitignore b/.gitignore index 21f1646..61cb2f2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,26 @@ node_modules npm-debug.log yarn-error.log yarn.lock -pacakge-lock.json +package-lock.json +/vendor/* +!/vendor/scrivo +/vendor/scrivo/highlight.php/* + +!/vendor/scrivo/highlight.php/Highlight/ +/vendor/scrivo/highlight.php/Highlight/languages/*.json +!/vendor/scrivo/highlight.php/Highlight/languages/bash.json +!/vendor/scrivo/highlight.php/Highlight/languages/cpp.json # Like clike. +!/vendor/scrivo/highlight.php/Highlight/languages/css.json +!/vendor/scrivo/highlight.php/Highlight/languages/diff.json # Can be used instead of 'git' in Prism. +!/vendor/scrivo/highlight.php/Highlight/languages/go.json +!/vendor/scrivo/highlight.php/Highlight/languages/javascript.json # Also jsx. +!/vendor/scrivo/highlight.php/Highlight/languages/json.json +!/vendor/scrivo/highlight.php/Highlight/languages/markdown.json +!/vendor/scrivo/highlight.php/Highlight/languages/php.json +!/vendor/scrivo/highlight.php/Highlight/languages/python.json +!/vendor/scrivo/highlight.php/Highlight/languages/sql.json +!/vendor/scrivo/highlight.php/Highlight/languages/xml.json # Also markup/HTML. + +!/vendor/scrivo/highlight.php/styles/ +/vendor/scrivo/highlight.php/styles/* +!/vendor/scrivo/highlight.php/styles/default.css diff --git a/code-syntax.js b/code-syntax.js index 6fb4a62..cf0572e 100644 --- a/code-syntax.js +++ b/code-syntax.js @@ -17,37 +17,70 @@ const { SelectControl } = wp.components; import './editor.scss'; import './style.scss'; -const langs = { - bash: __( 'Bash (shell)', 'code-syntax-block' ), - clike: __( 'C-like', 'code-syntax-block' ), - css: __( 'CSS', 'code-syntax-block' ), - git: __( 'Git', 'code-syntax-block' ), - go: __( 'Go (golang)', 'code-syntax-block' ), - markup: __( 'HTML/Markup', 'code-syntax-block' ), - javascript: __( 'JavaScript', 'code-syntax-block' ), - json: __( 'JSON', 'code-syntax-block' ), - markdown: __( 'Markdown', 'code-syntax-block' ), - php: __( 'PHP', 'code-syntax-block' ), - python: __( 'Python', 'code-syntax-block' ), - jsx: __( 'React JSX', 'code-syntax-block' ), - sql: __( 'SQL', 'code-syntax-block' ) -}; +// An array is used as opposed to an object because objects in JS do not preserve order like associative arrays in PHP. +const languageOptions = [ + { + value: 'bash', + label: __( 'Bash (shell)', 'code-syntax-block' ) + }, + { + value: 'cpp', + label: __( 'C-like', 'code-syntax-block' ) + }, + { + value: 'css', + label: __( 'CSS', 'code-syntax-block' ) + }, + { + value: 'diff', + label: __( 'Diff', 'code-syntax-block' ) + }, + { + value: 'go', + label: __( 'Go (golang)', 'code-syntax-block' ) + }, + { + value: 'xml', + label: __( 'HTML/Markup', 'code-syntax-block' ) + }, + { + value: 'javascript', + label: __( 'JavaScript (JSX)', 'code-syntax-block' ) + }, + { + value: 'json', + label: __( 'JSON', 'code-syntax-block' ) + }, + { + value: 'markdown', + label: __( 'Markdown', 'code-syntax-block' ) + }, + { + value: 'php', + label: __( 'PHP', 'code-syntax-block' ) + }, + { + value: 'python', + label: __( 'Python', 'code-syntax-block' ) + }, + { + value: 'sql', + label: __( 'SQL', 'code-syntax-block' ) + } +]; const addSyntaxToCodeBlock = settings => { if ( 'core/code' !== settings.name ) { return settings; } - const newCodeBlockSettings = { + return { ...settings, attributes: { ...settings.attributes, language: { - type: 'string', - selector: 'code', - source: 'attribute', - attribute: 'lang' + type: 'string' } }, @@ -63,10 +96,10 @@ const addSyntaxToCodeBlock = settings => { label="Language" value={ attributes.language } options={ - [ { label: __( 'Select code language', 'code-syntax-block' ), value: '' } ].concat ( - Object.keys( langs ).map( ( lang ) => ( - { label: langs[lang], value: lang } - ) ) ) + [ + { label: __( 'Auto-detect', 'code-syntax-block' ), value: '' }, + ...languageOptions + ] } onChange={ updateLanguage } /> @@ -78,18 +111,32 @@ const addSyntaxToCodeBlock = settings => { placeholder={ __( 'Write code…', 'code-syntax-block' ) } aria-label={ __( 'Code', 'code-syntax-block' ) } /> - <div className="language-selected">{ langs[ attributes.language ] }</div> + <div className="language-selected">{ languageOptions[ attributes.language ] }</div> </div> ]; }, save({ attributes }) { - const cls = ( attributes.language ) ? 'language-' + attributes.language : ''; - return <pre><code lang={ attributes.language } className={ cls }>{ attributes.content }</code></pre>; - } - }; + return <pre><code>{ attributes.content }</code></pre>; + }, - return newCodeBlockSettings; + deprecated: [ + ...( settings.deprecated || []), + { + attributes: { + ...settings.attributes, + language: { + type: 'string' + } + }, + + save: function({ attributes }) { + const cls = ( attributes.language ) ? 'language-' + attributes.language : ''; + return <pre><code lang={ attributes.language } className={ cls }>{ attributes.content }</code></pre>; + } + } + ] + }; }; // Register Filter diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..d9ed313 --- /dev/null +++ b/composer.json @@ -0,0 +1,10 @@ +{ + "name": "mkaz/code-syntax-block", + "description": "A WordPress plugin which extends Gutenberg adding color syntax highlighting to the code block.", + "type": "wordpress-plugin", + "license": "GPL-2.0-or-later", + "version": "0.5.0", + "require": { + "scrivo/highlight.php": "v9.12.0.4" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..d457984 --- /dev/null +++ b/composer.lock @@ -0,0 +1,73 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "4f39f0948bfbcbab6f86ee69203cba21", + "packages": [ + { + "name": "scrivo/highlight.php", + "version": "v9.12.0.4", + "source": { + "type": "git", + "url": "https://github.com/scrivo/highlight.php.git", + "reference": "d5b40c678b79ac9faffb32df601dc69e5d11da50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/d5b40c678b79ac9faffb32df601dc69e5d11da50", + "reference": "d5b40c678b79ac9faffb32df601dc69e5d11da50", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "symfony/finder": "^2.8" + }, + "type": "library", + "autoload": { + "psr-0": { + "Highlight\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Geert Bergman", + "homepage": "http://www.scrivo.org/", + "role": "Project Author" + }, + { + "name": "Vladimir Jimenez", + "homepage": "https://allejo.io", + "role": "Contributor" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Contributor" + } + ], + "description": "Server side syntax highlighter that supports 176 languages. It's a PHP port of highlight.js", + "keywords": [ + "code", + "highlight", + "highlight.js", + "highlight.php", + "syntax" + ], + "time": "2018-08-05T06:14:48+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/index.php b/index.php index 7a1dd00..e841106 100644 --- a/index.php +++ b/index.php @@ -9,6 +9,7 @@ * License: GPL2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: code-syntax-block + * Requires PHP: 5.4 * * @package Code_Syntax_Block */ @@ -17,7 +18,15 @@ * Load text domain. */ function mkaz_load_plugin_textdomain() { + if ( ! function_exists( 'register_block_type' ) ) { + return; + } + load_plugin_textdomain( 'code-syntax-block', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); + + register_block_type( 'core/code', array( + 'render_callback' => 'mkaz_code_syntax_render_block', + ) ); } add_action( 'plugins_loaded', 'mkaz_load_plugin_textdomain' ); @@ -60,7 +69,8 @@ function mkaz_code_syntax_editor_assets() { */ function mkaz_code_syntax_view_assets() { // Files. - $view_style_path = 'assets/blocks.style.css'; + $view_style_path = 'assets/blocks.style.css'; + $default_style_path = 'vendor/scrivo/highlight.php/styles/default.css'; // Enqueue view style. wp_enqueue_style( @@ -69,5 +79,108 @@ function mkaz_code_syntax_view_assets() { array(), filemtime( plugin_dir_path( __FILE__ ) . $view_style_path ) ); + + // Enqueue prism style. + wp_enqueue_style( + 'mkaz-code-syntax-hljs-default', + plugins_url( $default_style_path, __FILE__ ), + array(), + filemtime( plugin_dir_path( __FILE__ ) . $default_style_path ) + ); } add_action( 'wp_enqueue_scripts', 'mkaz_code_syntax_view_assets' ); + +/** + * Render code block. + * + * @param array $attributes Attributes. + * @param string $content Content. + * @return string Highlighted content. + */ +function mkaz_code_syntax_render_block( $attributes, $content ) { + $pattern = '(?P<before><pre.*?><code.*?>)'; + $pattern .= '(?P<code>.*)'; + $after = '</code></pre>'; + $pattern .= $after; + + if ( ! preg_match( '#^\s*' . $pattern . '\s*$#s', $content, $matches ) ) { + return $content; + } + + if ( ! isset( $attributes['language'] ) ) { + $attributes['language'] = ''; + } + + $inject_language_class = function( $start_tags, $language ) { + $start_tags = preg_replace( + '/(<code[^>]*class=")/', + '$1' . esc_attr( $language . ' ' ), + $start_tags, + 1, + $count + ); + if ( 0 === $count ) { + $start_tags = preg_replace( + '/(?<=<code)(?=>)/', + sprintf( ' class="%s"', esc_attr( "language-$language" ) ), + $start_tags, + 1 + ); + } + return $start_tags; + }; + + $transient_key = 'code-syntax-block-' . md5( $attributes['language'] . $matches['code'] ) . '-v1'; + $highlighted = get_transient( $transient_key ); + + if ( $highlighted && isset( $highlighted['code'] ) ) { + if ( isset( $highlighted['language'] ) ) { + $matches['before'] = $inject_language_class( $matches['before'], $highlighted['language'] ); + } + return $matches['before'] . $highlighted['code'] . $after; + } + + try { + if ( ! class_exists( '\Highlight\Autoloader' ) ) { + require_once __DIR__ . '/vendor/scrivo/highlight.php/Highlight/Autoloader.php'; + spl_autoload_register( 'Highlight\Autoloader::load' ); + } + + $highlighter = new \Highlight\Highlighter(); + $language = $attributes['language']; + $code = html_entity_decode( $matches['code'], ENT_QUOTES ); + + // Convert from Prism.js languages names. + if ( 'clike' === $language ) { + $language = 'cpp'; + } elseif ( 'git' === $language ) { + $language = 'diff'; // Best match. + } elseif ( 'markup' === $language ) { + $language = 'xml'; + } + + if ( $language ) { + $r = $highlighter->highlight( $language, $code ); + } else { + $r = $highlighter->highlightAuto( $code ); + } + + $code = $r->value; + $language = $r->language; + $highlighted = compact( 'code', 'language' ); + + set_transient( $transient_key, compact( 'code', 'language' ) ); + + $matches['before'] = $inject_language_class( $matches['before'], $highlighted['language'] ); + + return $matches['before'] . $code . $after; + } catch ( \Exception $e ) { + return sprintf( + '<!-- %s(%s): %s -->%s', + get_class( $e ), + $e->getCode(), + str_replace( '--', '', $e->getMessage() ), + $content + ); + } +} diff --git a/package.json b/package.json index 08b173c..197b175 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "make-pot": "wp i18n make-pot . languages/code-syntax-block.pot --include=code-syntax.js", "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack; npm run make-pot", "dev": "cross-env BABEL_ENV=default webpack --watch", - "zip": "zip -r code-syntax-block.zip index.php readme.md assets build languages" + "zip": "zip -r code-syntax-block.zip index.php readme.md assets build languages $( git ls-files vendor )" } } diff --git a/readme.md b/readme.md index 025a06b..fc07b83 100644 --- a/readme.md +++ b/readme.md @@ -17,9 +17,19 @@ When creating a new code block, select `Code` block, and then in the Inspector ( On the front-end when the post is being viewed, the code will be color syntax highlighted. +### Customize + +The default install uses a limited set of languages from highlight.php (bash, cpp, css, diff, go, javascript, json, markdown, php, python, sql, xml). If your language is not included, you can modify the [`.gitignore`] to skip ignoring them you will also need to edit the `langs` array in [`code-syntax.js`](code-syntax.js) and rebuild. + +Changing color theme, the [default color theme](https://github.com/scrivo/highlight.php/blob/master/styles/default.css) is used from highlight.php. To use a different color scheme, just download one of the [other styles](https://github.com/scrivo/highlight.php/tree/master/styles) and then dequeue the default CSS to replace with your own. + +### Colophon + +- Uses [highlight.php syntax highlighter](https://github.com/scrivo/highlight.php) + ### Contribute -See Github issues for list of current issues with the plugin. Please feel free to file any additional issues or requests that you may come across. Pull requests are welcome to help extend. +See [list of current issues](https://github.com/mkaz/code-syntax-block/issues) with the plugin. Please feel free to file any additional issues or requests that you may come across. [Pull requests](https://github.com/mkaz/code-syntax-block/pulls) are welcome to help extend. ### License diff --git a/style.scss b/style.scss index a01609c..32fa7f6 100644 --- a/style.scss +++ b/style.scss @@ -1,14 +1,19 @@ -.code-syntax, -.code-syntax code { +.wp-block-code, +.wp-block-code > code { font-family: Menlo, Consolas, 'Liberation Mono', monospace; font-size: 14px; color: #009; } -.code-syntax { +.wp-block-code { padding: .8em 1.6em; overflow-x: auto !important; border: 1px solid #CCC; border-radius: 4px; } + +/* Override styles like https://github.com/WordPress/wordpress-develop/blob/4.9.8/src/wp-content/themes/twentysixteen/style.css#L422-L423 */ +.wp-block-code > code { + background-color: inherit; +} diff --git a/vendor/scrivo/highlight.php/Highlight/Autoloader.php b/vendor/scrivo/highlight.php/Highlight/Autoloader.php new file mode 100644 index 0000000..458759f --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/Autoloader.php @@ -0,0 +1,73 @@ +<?php +/* Copyright (c) + * - 2013-2104, Geert Bergman (geert@scrivo.nl), highlight.php + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of "highlight.js", "highlight.php", nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * Implementation of the \Scrivo\Autoloader class. + */ + +namespace Highlight; + +/** + * The autoloader class for Highlight classes. + * + * Typical usage: + * + * <?php + * + * require_once("Highlight/Autoloader.php"); + * spl_autoload_register("\\Highlight\\Autoloader::load"); + * + * // Now use Highlight classes: + * $hl = new Highlighter(...); + * ... + * ?> + */ +class Autoloader +{ + /** + * The method to include the source file for a given class to use in + * the PHP spl_autoload_register function. + * + * @param string a name of a Scrivo class + * + * @return bool true if the source file was successfully included + */ + public static function load($class) + { + if (substr($class, 0, 10) !== "Highlight\\") { + return false; + } + + $c = str_replace("\\", "/", substr($class, 10)) . ".php"; + $res = include __DIR__ . "/$c"; + + return $res == 1 ? true : false; + } +} diff --git a/vendor/scrivo/highlight.php/Highlight/Highlighter.php b/vendor/scrivo/highlight.php/Highlight/Highlighter.php new file mode 100644 index 0000000..02bd0a5 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/Highlighter.php @@ -0,0 +1,606 @@ +<?php +/* Copyright (c) + * - 2006-2013, Ivan Sagalaev (maniac@softwaremaniacs.org), highlight.js + * (original author) + * - 2013-2015, Geert Bergman (geert@scrivo.nl), highlight.php + * - 2014, Daniel Lynge, highlight.php (contributor) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of "highlight.js", "highlight.php", nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Highlight; + +class Highlighter +{ + const SPAN_END_TAG = "</span>"; + + private $options; + + private $modeBuffer = ""; + private $result = ""; + private $top = null; + private $language = null; + private $keywordCount = 0; + private $relevance = 0; + private $ignoreIllegals = false; + + private static $classMap = array(); + private static $languages = null; + private static $aliases = null; + + private $autodetectSet = array( + "xml", "json", "javascript", "css", "php", "http", + ); + + public function __construct() + { + $this->options = array( + 'classPrefix' => 'hljs-', + 'tabReplace' => null, + 'useBR' => false, + 'languages' => null, + ); + + $this->registerLanguages(); + } + + private function registerLanguages() + { + // Languages that take precedence in the classMap array. + foreach (array("xml", "django", "javascript", "matlab", "cpp") as $l) { + $this->createLanguage($l); + } + + $d = dir(__DIR__ . DIRECTORY_SEPARATOR . "languages"); + while (($entry = $d->read()) !== false) { + if ($entry[0] !== ".") { + $lng = substr($entry, 0, -5); + $this->createLanguage($lng); + } + } + $d->close(); + + self::$languages = array_keys(self::$classMap); + } + + private function createLanguage($languageId) + { + if (!isset(self::$classMap[$languageId])) { + self::registerLanguage( + $languageId, + __DIR__ . DIRECTORY_SEPARATOR . "languages" . DIRECTORY_SEPARATOR . "$languageId.json" + ); + } + + return self::$classMap[$languageId]; + } + + /** + * Register a language definition with the Highlighter's internal language + * storage. + * + * - If a language with the same $languageID already exists, it will be + * overwritten. + * - Languages are stored in a static variable, so they'll be available + * across all instances. You only need to register a language once. + * + * @param string $languageId The unique name of a language + * @param string $absoluteFilePath The file path to the language definition + * + * @return Language The object containing the definition for a language's markup + */ + public static function registerLanguage($languageId, $absoluteFilePath) + { + $lang = new Language($languageId, $absoluteFilePath); + self::$classMap[$languageId] = $lang; + + if (isset($lang->mode->aliases)) { + foreach ($lang->mode->aliases as $alias) { + self::$aliases[$alias] = $languageId; + } + } + + return self::$classMap[$languageId]; + } + + private function testRe($re, $lexeme) + { + if (!$re) { + return false; + } + $test = preg_match($re, $lexeme, $match, PREG_OFFSET_CAPTURE); + if ($test === false) { + throw new \Exception("Invalid regexp: " . var_export($re, true)); + } + + return count($match) && ($match[0][1] == 0); + } + + private function subMode($lexeme, $mode) + { + for ($i = 0; $i < count($mode->contains); ++$i) { + if ($this->testRe($mode->contains[$i]->beginRe, $lexeme)) { + return $mode->contains[$i]; + } + } + } + + private function endOfMode($mode, $lexeme) + { + if ($this->testRe($mode->endRe, $lexeme)) { + while ($mode->endsParent && $mode->parent) { + $mode = $mode->parent; + } + + return $mode; + } + if ($mode->endsWithParent) { + return $this->endOfMode($mode->parent, $lexeme); + } + } + + private function isIllegal($lexeme, $mode) + { + return !$this->ignoreIllegals && $this->testRe($mode->illegalRe, $lexeme); + } + + private function keywordMatch($mode, $match) + { + $kwd = $this->language->caseInsensitive ? mb_strtolower($match[0], "UTF-8") : $match[0]; + + return isset($mode->keywords[$kwd]) ? $mode->keywords[$kwd] : null; + } + + private function buildSpan($classname, $insideSpan, $leaveOpen = false, $noPrefix = false) + { + $classPrefix = $noPrefix ? "" : $this->options['classPrefix']; + $openSpan = "<span class=\"" . $classPrefix; + $closeSpan = $leaveOpen ? "" : self::SPAN_END_TAG; + + $openSpan .= $classname . "\">"; + + return $openSpan . $insideSpan . $closeSpan; + } + + private function escape($value) + { + return htmlspecialchars($value, ENT_NOQUOTES); + } + + private function processKeywords() + { + if (empty($this->top->keywords)) { + return $this->escape($this->modeBuffer); + } + + $result = ""; + $lastIndex = 0; + + /* TODO: when using the crystal language file on django and twigs code + * the values of $this->top->lexemesRe can become "" (empty). Check + * if this behaviour is consistent with highlight.js. + */ + if ($this->top->lexemesRe) { + while (preg_match($this->top->lexemesRe, $this->modeBuffer, $match, PREG_OFFSET_CAPTURE, $lastIndex)) { + $result .= $this->escape(substr($this->modeBuffer, $lastIndex, $match[0][1] - $lastIndex)); + $keyword_match = $this->keywordMatch($this->top, $match[0]); + + if ($keyword_match) { + $this->relevance += $keyword_match[1]; + $result .= $this->buildSpan($keyword_match[0], $this->escape($match[0][0])); + } else { + $result .= $this->escape($match[0][0]); + } + + $lastIndex = strlen($match[0][0]) + $match[0][1]; + } + } + + return $result . $this->escape(substr($this->modeBuffer, $lastIndex)); + } + + private function processSubLanguage() + { + try { + $hl = new Highlighter(); + $hl->setAutodetectLanguages($this->autodetectSet); + + $explicit = is_string($this->top->subLanguage); + if ($explicit && !in_array($this->top->subLanguage, self::$languages)) { + return $this->escape($this->modeBuffer); + } + + if ($explicit) { + $res = $hl->highlight( + $this->top->subLanguage, + $this->modeBuffer, + true, + isset($this->continuations[$this->top->subLanguage]) ? $this->continuations[$this->top->subLanguage] : null + ); + } else { + $res = $hl->highlightAuto( + $this->modeBuffer, + count($this->top->subLanguage) ? $this->top->subLanguage : null + ); + } + // Counting embedded language score towards the host language may + // be disabled with zeroing the containing mode relevance. Usecase + // in point is Markdown that allows XML everywhere and makes every + // XML snippet to have a much larger Markdown score. + if ($this->top->relevance > 0) { + $this->relevance += $res->relevance; + } + if ($explicit) { + $this->continuations[$this->top->subLanguage] = $res->top; + } + + return $this->buildSpan($res->language, $res->value, false, true); + } catch (\Exception $e) { + error_log("TODO, is this a relevant catch?"); + error_log($e); + + return $this->escape($this->modeBuffer); + } + } + + private function processBuffer() + { + $this->result .= $this->top->subLanguage ? $this->processSubLanguage() : $this->processKeywords(); + $this->modeBuffer = ''; + } + + private function startNewMode($mode) + { + $this->result .= $mode->className ? $this->buildSpan($mode->className, "", true) : ""; + + $t = clone $mode; + $t->parent = $this->top; + $this->top = $t; + } + + private function processLexeme($buffer, $lexeme = null) + { + $this->modeBuffer .= $buffer; + + if ($lexeme === null) { + $this->processBuffer(); + + return 0; + } + + $new_mode = $this->subMode($lexeme, $this->top); + if ($new_mode) { + if ($new_mode->skip) { + $this->modeBuffer .= $lexeme; + } else { + if ($new_mode->excludeBegin) { + $this->modeBuffer .= $lexeme; + } + $this->processBuffer(); + if (!$new_mode->returnBegin && !$new_mode->excludeBegin) { + $this->modeBuffer = $lexeme; + } + } + $this->startNewMode($new_mode, $lexeme); + + return $new_mode->returnBegin ? 0 : strlen($lexeme); + } + + $end_mode = $this->endOfMode($this->top, $lexeme); + if ($end_mode) { + $origin = $this->top; + if ($origin->skip) { + $this->modeBuffer .= $lexeme; + } else { + if (!($origin->returnEnd || $origin->excludeEnd)) { + $this->modeBuffer .= $lexeme; + } + $this->processBuffer(); + if ($origin->excludeEnd) { + $this->modeBuffer = $lexeme; + } + } + do { + if ($this->top->className) { + $this->result .= self::SPAN_END_TAG; + } + if (!$this->top->skip) { + $this->relevance += $this->top->relevance; + } + $this->top = $this->top->parent; + } while ($this->top != $end_mode->parent); + if ($end_mode->starts) { + $this->startNewMode($end_mode->starts, ""); + } + + return $origin->returnEnd ? 0 : strlen($lexeme); + } + + if ($this->isIllegal($lexeme, $this->top)) { + $className = $this->top->className ? $this->top->className : "unnamed"; + $err = "Illegal lexeme \"{$lexeme}\" for mode \"{$className}\""; + + throw new \Exception($err); + } + + // Parser should not reach this point as all types of lexemes should + // be caught earlier, but if it does due to some bug make sure it + // advances at least one character forward to prevent infinite looping. + + $this->modeBuffer .= $lexeme; + $l = strlen($lexeme); + + return $l ? $l : 1; + } + + /** + * Replace tabs for something more usable. + */ + private function replaceTabs($code) + { + if ($this->options['tabReplace'] !== null) { + return str_replace("\t", $this->options['tabReplace'], $code); + } + + return $code; + } + + /** + * Set the set of languages used for autodetection. When using + * autodetection the code to highlight will be probed for every language + * in this set. Limiting this set to only the languages you want to use + * will greatly improve highlighting speed. + * + * @param array $set An array of language games to use for autodetection. This defaults + * to a typical set Web development languages. + */ + public function setAutodetectLanguages(array $set) + { + $this->autodetectSet = array_unique($set); + $this->registerLanguages(); + } + + /** + * Get the tab replacement string. + * + * @return string The tab replacement string + */ + public function getTabReplace() + { + return $this->options['tabReplace']; + } + + /** + * Set the tab replacement string. This defaults to NULL: no tabs + * will be replaced. + * + * @param string $tabReplace The tab replacement string + */ + public function setTabReplace($tabReplace) + { + $this->options['tabReplace'] = $tabReplace; + } + + /** + * Get the class prefix string. + * + * @return string + * The class prefix string + */ + public function getClassPrefix() + { + return $this->options['classPrefix']; + } + + /** + * Set the class prefix string. + * + * @param string $classPrefix The class prefix string + */ + public function setClassPrefix($classPrefix) + { + $this->options['classPrefix'] = $classPrefix; + } + + /** + * @throws \DomainException if the requested language was not in this + * Highlighter's language set + */ + private function getLanguage($name) + { + if (isset(self::$classMap[$name])) { + return self::$classMap[$name]; + } elseif (isset(self::$aliases[$name]) && isset(self::$classMap[self::$aliases[$name]])) { + return self::$classMap[self::$aliases[$name]]; + } + + throw new \DomainException("Unknown language: $name"); + } + + /** + * Core highlighting function. Accepts a language name, or an alias, and a + * string with the code to highlight. Returns an object with the following + * properties: + * - relevance (int) + * - value (an HTML string with highlighting markup). + * + * @throws \DomainException if the requested language was not in this + * Highlighter's language set + * @throws \Exception if an invalid regex was given in a language file + */ + public function highlight($language, $code, $ignoreIllegals = true, $continuation = null) + { + $this->language = $this->getLanguage($language); + $this->language->compile(); + $this->top = $continuation ? $continuation : $this->language->mode; + $this->continuations = array(); + $this->result = ""; + + for ($current = $this->top; $current != $this->language->mode; $current = $current->parent) { + if ($current->className) { + $this->result = $this->buildSpan($current->className, '', true) . $this->result; + } + } + + $this->modeBuffer = ""; + $this->relevance = 0; + $this->ignoreIllegals = $ignoreIllegals; + + $res = new \stdClass(); + $res->relevance = 0; + $res->value = ""; + $res->language = ""; + + try { + $match = null; + $count = 0; + $index = 0; + + while ($this->top && $this->top->terminators) { + $test = preg_match($this->top->terminators, $code, $match, PREG_OFFSET_CAPTURE, $index); + if ($test === false) { + throw new \Exception("Invalid regExp " . var_export($this->top->terminators, true)); + } elseif ($test === 0) { + break; + } + $count = $this->processLexeme(substr($code, $index, $match[0][1] - $index), $match[0][0]); + $index = $match[0][1] + $count; + } + $this->processLexeme(substr($code, $index)); + + for ($current = $this->top; isset($current->parent); $current = $current->parent) { + if ($current->className) { + $this->result .= self::SPAN_END_TAG; + } + } + + $res->relevance = $this->relevance; + $res->value = $this->replaceTabs($this->result); + $res->language = $this->language->name; + $res->top = $this->top; + + return $res; + } catch (\Exception $e) { + if (strpos($e->getMessage(), "Illegal") !== false) { + $res->value = $this->escape($code); + + return $res; + } + throw $e; + } + } + + /** + * Highlight the given code by highlighting the given code with each + * registered language and then finding the match with highest accuracy. + * + * @param string $code + * @param string[]|null $languageSubset When set to null, this method will + * attempt to highlight $code with each language (170+). Set this to + * an array of languages of your choice to limit the amount of languages + * to try. + * + * @throws \DomainException if the attempted language to check does not exist + * @throws \Exception if an invalid regex was given in a language file + * + * @return \stdClass + */ + public function highlightAuto($code, $languageSubset = null) + { + $res = new \stdClass(); + $res->relevance = 0; + $res->value = $this->escape($code); + $res->language = ""; + $scnd = clone $res; + + $tmp = $languageSubset ? $languageSubset : $this->autodetectSet; + + foreach ($tmp as $l) { + // don't fail if we run into a non-existent language + try { + $current = $this->highlight($l, $code, false); + } catch (\DomainException $e) { + continue; + } + + if ($current->relevance > $scnd->relevance) { + $scnd = $current; + } + if ($current->relevance > $res->relevance) { + $scnd = $res; + $res = $current; + } + } + + if ($scnd->language) { + $res->secondBest = $scnd; + } + + return $res; + } + + /** + * Return a list of all supported languages. Using this list in + * setAutodetectLanguages will turn on autodetection for all supported + * languages. + * + * @param bool $include_aliases specify whether language aliases + * should be included as well + * + * @return string[] An array of language names + */ + public function listLanguages($include_aliases = false) + { + if ($include_aliases === true) { + return array_merge(self::$languages, array_keys(self::$aliases)); + } + + return self::$languages; + } + + /** + * Returns list of all available aliases for given language name. + * + * @param string $language name or alias of language to look-up + * + * @throws \DomainException if the requested language was not in this + * Highlighter's language set + * + * @return string[] An array of all aliases associated with the requested + * language name language. Passed-in name is included as + * well. + */ + public function getAliasesForLanguage($language) + { + $language = self::getLanguage($language); + + if ($language->aliases === null) { + return array($language->name); + } + + return array_merge(array($language->name), $language->aliases); + } +} diff --git a/vendor/scrivo/highlight.php/Highlight/JsonRef.php b/vendor/scrivo/highlight.php/Highlight/JsonRef.php new file mode 100644 index 0000000..1a023f1 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/JsonRef.php @@ -0,0 +1,132 @@ +<?php +/* Copyright (c) + * - 2014, Geert Bergman (geert@scrivo.nl), highlight.php + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of "highlight.js", "highlight.php", nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * Implementation of the \Highlight\JsonRef class. + */ + +namespace Highlight; + +/** + * Class to decode JSON data that contains path-based references. + * + * The language data file for highlight.js are written as JavaScript classes + * and therefore may contain variables. This allows for inner references in + * the language data. This kind of data can be converterd to JSON using the + * path based references. This class can be used to decode such JSON + * structures. It follows the conventions for path based referencing as + * used in dojox.json.ref form the Dojo toolkit (Javascript). A typical + * example of such a structure is as follows: + * + * { + * "name":"Kris Zyp", + * "children":[{"name":"Jennika Zyp"},{"name":"Korban Zyp"}], + * "spouse":{ + * "name":"Nicole Zyp", + * "spouse":{"$ref":"#"}, + * "children":{"$ref":"#children"} + * }, + * "oldestChild":{"$ref":"#children.0"} + * } + * + * Usage example: + * + * $jr = new JsonRef(); + * $data = $jr->decode(file_get_contents("data.json")); + * echo $data->spouse->spouse->name; // echos 'Kris Zyp' + * echo $data->oldestChild->name; // echos 'Jennika Zyp' + */ +class JsonRef +{ + /** + * Array to hold all data paths in the given JSON data. + * + * @var array + */ + private $paths = null; + + /** + * Recurse through the data tree and fill an array of paths that reference + * the nodes in the decoded JSON data structure. + * + * @param mixed $s Decoded JSON data (decoded with json_decode) + * @param string $r The current path key (for example: '#children.0'). + */ + private function getPaths(&$s, $r = "#") + { + $this->paths[$r] = &$s; + if (is_array($s) || is_object($s)) { + foreach ($s as $k => &$v) { + if ($k !== "\$ref") { + $this->getPaths($v, $r == "#" ? "#{$k}" : "{$r}.{$k}"); + } + } + } + } + + /** + * Recurse through the data tree and resolve all path references. + * + * @param mixed $s Decoded JSON data (decoded with json_decode) + */ + private function resolvePathReferences(&$s) + { + if (is_array($s) || is_object($s)) { + foreach ($s as $k => &$v) { + if ($k === "\$ref") { + $s = $this->paths[$v]; + } else { + $this->resolvePathReferences($v); + } + } + } + } + + /** + * Decode JSON data that may contain path based references. + * + * @param string|object $json JSON data string or JSON data object + * + * @return mixed The decoded JSON data + */ + public function decode($json) + { + // Clear the path array. + $this->paths = array(); + // Decode the given JSON data if necessary. + $x = is_string($json) ? json_decode($json) : $json; + // Get all data paths. + $this->getPaths($x); + // Resolve all path references. + $this->resolvePathReferences($x); + // Return the data. + return $x; + } +} diff --git a/vendor/scrivo/highlight.php/Highlight/Language.php b/vendor/scrivo/highlight.php/Highlight/Language.php new file mode 100644 index 0000000..828ae8e --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/Language.php @@ -0,0 +1,277 @@ +<?php +/* Copyright (c) + * - 2006-2013, Ivan Sagalaev (maniacsoftwaremaniacs.org), highlight.js + * (original author) + * - 2013-2015, Geert Bergman (geertscrivo.nl), highlight.php + * - 2014, Daniel Lynge, highlight.php (contributor) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of "highlight.js", "highlight.php", nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Highlight; + +class Language +{ + public $caseInsensitive = false; + public $aliases = null; + + public function complete(&$e) + { + if (!isset($e)) { + $e = new \stdClass(); + } + + $patch = array( + "begin" => true, + "end" => true, + "lexemes" => true, + "illegal" => true, + ); + + $def = array( + "begin" => "", + "beginRe" => "", + "beginKeywords" => "", + "excludeBegin" => "", + "returnBegin" => "", + "end" => "", + "endRe" => "", + "endsParent" => "", + "endsWithParent" => "", + "excludeEnd" => "", + "returnEnd" => "", + "starts" => "", + "terminators" => "", + "terminatorEnd" => "", + "lexemes" => "", + "lexemesRe" => "", + "illegal" => "", + "illegalRe" => "", + "className" => "", + "contains" => array(), + "keywords" => null, + "subLanguage" => null, + "subLanguageMode" => "", + "compiled" => false, + "relevance" => 1, + "skip" => false, + ); + + foreach ($patch as $k => $v) { + if (isset($e->$k)) { + $e->$k = str_replace("\\/", "/", $e->$k); + $e->$k = str_replace("/", "\\/", $e->$k); + } + } + + foreach ($def as $k => $v) { + if (!isset($e->$k)) { + @$e->$k = $v; + } + } + } + + public function __construct($lang, $filePath) + { + $json = file_get_contents($filePath); + $this->mode = json_decode($json); + + $this->name = $lang; + $this->aliases = isset($this->mode->aliases) ? $this->mode->aliases : null; + + $this->caseInsensitive = isset($this->mode->case_insensitive) ? $this->mode->case_insensitive : false; + } + + private function langRe($value, $global = false) + { + // PCRE allows us to change the definition of "new line." The + // `(*ANYCRLF)` matches `\r`, `\n`, and `\r\n` for `$` + // + // https://www.pcre.org/original/doc/html/pcrepattern.html + + return "/(*ANYCRLF){$value}/um" . ($this->caseInsensitive ? "i" : ""); + } + + private function processKeyWords($kw) + { + if (is_string($kw)) { + if ($this->caseInsensitive) { + $kw = mb_strtolower($kw, "UTF-8"); + } + $kw = array("keyword" => explode(" ", $kw)); + } else { + foreach ($kw as $cls => $vl) { + if (!is_array($vl)) { + if ($this->caseInsensitive) { + $vl = mb_strtolower($vl, "UTF-8"); + } + $kw->$cls = explode(" ", $vl); + } + } + } + + return $kw; + } + + private function inherit() + { + $result = new \stdClass(); + $objects = func_get_args(); + $parent = array_shift($objects); + + foreach ($parent as $key => $value) { + $result->{$key} = $value; + } + + foreach ($objects as $object) { + foreach ($object as $key => $value) { + $result->{$key} = $value; + } + } + + return $result; + } + + private function expandMode($mode) + { + if (isset($mode->variants) && !isset($mode->cachedVariants)) { + $mode->cachedVariants = array(); + + foreach ($mode->variants as $variant) { + $mode->cachedVariants[] = $this->inherit($mode, array('variants' => null), $variant); + } + } + + if (isset($mode->cachedVariants)) { + return $mode->cachedVariants; + } + + if (isset($mode->endsWithParent) && $mode->endsWithParent) { + return array($this->inherit($mode)); + } + + return array($mode); + } + + private function compileMode($mode, $parent = null) + { + if (isset($mode->compiled)) { + return; + } + $this->complete($mode); + $mode->compiled = true; + + $mode->keywords = $mode->keywords ? $mode->keywords : $mode->beginKeywords; + + /* Note: JsonRef method creates different references as those in the + * original source files. Two modes may refer to the same keywors + * set, so only testing if the mode has keywords is not enough: the + * mode's keywords might be compiled already, so it is necessary + * to do an 'is_array' check. + */ + if ($mode->keywords && !is_array($mode->keywords)) { + $compiledKeywords = array(); + + $mode->lexemesRe = $this->langRe($mode->lexemes ? $mode->lexemes : "\w+", true); + + foreach ($this->processKeyWords($mode->keywords) as $clsNm => $dat) { + if (!is_array($dat)) { + $dat = array($dat); + } + foreach ($dat as $kw) { + $pair = explode("|", $kw); + $compiledKeywords[$pair[0]] = array($clsNm, isset($pair[1]) ? intval($pair[1]) : 1); + } + } + $mode->keywords = $compiledKeywords; + } + + if ($parent) { + if ($mode->beginKeywords) { + $mode->begin = "\\b(" . implode("|", explode(" ", $mode->beginKeywords)) . ")\\b"; + } + if (!$mode->begin) { + $mode->begin = "\B|\b"; + } + $mode->beginRe = $this->langRe($mode->begin); + if (!$mode->end && !$mode->endsWithParent) { + $mode->end = "\B|\b"; + } + if ($mode->end) { + $mode->endRe = $this->langRe($mode->end); + } + $mode->terminatorEnd = $mode->end; + if ($mode->endsWithParent && $parent->terminatorEnd) { + $mode->terminatorEnd .= ($mode->end ? "|" : "") . $parent->terminatorEnd; + } + } + + if ($mode->illegal) { + $mode->illegalRe = $this->langRe($mode->illegal); + } + + $expandedContains = array(); + foreach ($mode->contains as $c) { + $expandedContains = array_merge($expandedContains, $this->expandMode( + $c === 'self' ? $mode : $c + )); + } + + $mode->contains = $expandedContains; + + for ($i = 0; $i < count($mode->contains); ++$i) { + $this->compileMode($mode->contains[$i], $mode); + } + + if ($mode->starts) { + $this->compileMode($mode->starts, $parent); + } + + $terminators = array(); + + for ($i = 0; $i < count($mode->contains); ++$i) { + $terminators[] = $mode->contains[$i]->beginKeywords + ? "\.?(" . $mode->contains[$i]->begin . ")\.?" + : $mode->contains[$i]->begin; + } + if ($mode->terminatorEnd) { + $terminators[] = $mode->terminatorEnd; + } + if ($mode->illegal) { + $terminators[] = $mode->illegal; + } + $mode->terminators = count($terminators) ? $this->langRe(implode("|", $terminators), true) : null; + } + + public function compile() + { + if (!isset($this->mode->compiled)) { + $jr = new JsonRef(); + $this->mode = $jr->decode($this->mode); + $this->compileMode($this->mode); + } + } +} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/bash.json b/vendor/scrivo/highlight.php/Highlight/languages/bash.json new file mode 100644 index 0000000..b033cf2 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/bash.json @@ -0,0 +1 @@ +{"aliases":["sh","zsh"],"lexemes":"\\b-?[a-z\\._]+\\b","keywords":{"keyword":"if then else elif fi for while in do done case esac function","literal":"true false","built_in":"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp","_":"-ne -eq -lt -gt -f -d -e -s -l -a"},"contains":[{"className":"meta","begin":"^#![^\\n]+sh\\s*$","relevance":10},{"className":"function","begin":"\\w[\\w\\d_]*\\s*\\(\\s*\\)\\s*\\{","returnBegin":true,"contains":[{"className":"title","begin":"\\w[\\w\\d_]*","relevance":0}],"relevance":0},{"className":"comment","begin":"#","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"string","begin":"\"","end":"\"","contains":[{"begin":"\\\\[\\s\\S]","relevance":0},{"className":"variable","variants":[{"begin":"\\$[\\w\\d#@][\\w\\d_]*"},{"begin":"\\$\\{(.*?)}"}]},{"className":"variable","begin":"\\$\\(","end":"\\)","contains":[{"$ref":"#contains.3.contains.0"}]}]},{"className":"string","begin":"'","end":"'"},{"$ref":"#contains.3.contains.1"}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/cpp.json b/vendor/scrivo/highlight.php/Highlight/languages/cpp.json new file mode 100644 index 0000000..658a325 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/cpp.json @@ -0,0 +1 @@ +{"aliases":["c","cc","h","c++","h++","hpp"],"keywords":{"keyword":"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and or not","built_in":"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr","literal":"true false nullptr NULL"},"illegal":"</","contains":[{"className":"keyword","begin":"\\b[a-z\\d_]*_t\\b"},{"className":"comment","begin":"//","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"$ref":"#contains.1.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"number","variants":[{"begin":"\\b(0b[01']+)"},{"begin":"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{"begin":"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],"relevance":0},{"className":"string","variants":[{"begin":"(u8?|U)?L?\"","end":"\"","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"begin":"(u8?|U)?R\"","end":"\"","contains":[{"$ref":"#contains.4.variants.0.contains.0"}]},{"begin":"'\\\\?.","end":"'","illegal":"."}]},{"className":"meta","begin":"#\\s*[a-z]+\\b","end":"$","keywords":{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},"contains":[{"begin":"\\\\\\n","relevance":0},{"className":"meta-string","variants":{"$ref":"#contains.4.variants"}},{"className":"meta-string","begin":"<[^\\n>]*>","end":"$","illegal":"\\n"},{"$ref":"#contains.1"},{"$ref":"#contains.2"}]},{"begin":"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<","end":">","keywords":{"$ref":"#keywords"},"contains":["self",{"$ref":"#contains.0"}]},{"begin":"[a-zA-Z]\\w*::","keywords":{"$ref":"#keywords"}},{"variants":[{"begin":"=","end":";"},{"begin":"\\(","end":"\\)"},{"beginKeywords":"new throw return else","end":";"}],"keywords":{"$ref":"#keywords"},"contains":[{"$ref":"#contains.0"},{"$ref":"#contains.1"},{"$ref":"#contains.2"},{"$ref":"#contains.3"},{"$ref":"#contains.4"},{"begin":"\\(","end":"\\)","keywords":{"$ref":"#keywords"},"contains":[{"$ref":"#contains.0"},{"$ref":"#contains.1"},{"$ref":"#contains.2"},{"$ref":"#contains.3"},{"$ref":"#contains.4"},"self"],"relevance":0}],"relevance":0},{"className":"function","begin":"([a-zA-Z]\\w*[\\*&\\s]+)+[a-zA-Z]\\w*\\s*\\(","returnBegin":true,"end":"[{;=]","excludeEnd":true,"keywords":{"$ref":"#keywords"},"illegal":"[^\\w\\s\\*&]","contains":[{"begin":"[a-zA-Z]\\w*\\s*\\(","returnBegin":true,"contains":[{"className":"title","begin":"[a-zA-Z]\\w*","relevance":0}],"relevance":0},{"className":"params","begin":"\\(","end":"\\)","keywords":{"$ref":"#keywords"},"relevance":0,"contains":[{"$ref":"#contains.1"},{"$ref":"#contains.2"},{"$ref":"#contains.4"},{"$ref":"#contains.3"},{"$ref":"#contains.0"}]},{"$ref":"#contains.1"},{"$ref":"#contains.2"},{"$ref":"#contains.5"}]},{"className":"class","beginKeywords":"class struct","end":"[{;:]","contains":[{"begin":"<","end":">","contains":["self"]},{"$ref":"#contains.9.contains.0.contains.0"}]}],"exports":{"preprocessor":{"$ref":"#contains.5"},"strings":{"$ref":"#contains.4"},"keywords":{"$ref":"#keywords"}}} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/css.json b/vendor/scrivo/highlight.php/Highlight/languages/css.json new file mode 100644 index 0000000..0d2771f --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/css.json @@ -0,0 +1 @@ +{"case_insensitive":true,"illegal":"[=\\/|'\\$]","contains":[{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"selector-id","begin":"#[A-Za-z0-9_-]+"},{"className":"selector-class","begin":"\\.[A-Za-z0-9_-]+"},{"className":"selector-attr","begin":"\\[","end":"\\]","illegal":"$"},{"className":"selector-pseudo","begin":":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\"'.]+"},{"begin":"@(font-face|page)","lexemes":"[a-z-]+","keywords":"font-face page"},{"begin":"@","end":"[{;]","illegal":":","contains":[{"className":"keyword","begin":"\\w+"},{"begin":"\\s","endsWithParent":true,"excludeEnd":true,"relevance":0,"contains":[{"className":"string","begin":"'","end":"'","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.6.contains.1.contains.0.contains.0"}]},{"className":"number","begin":"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?","relevance":0}]}]},{"className":"selector-tag","begin":"[a-zA-Z-][a-zA-Z0-9_-]*","relevance":0},{"begin":"{","end":"}","illegal":"\\S","contains":[{"$ref":"#contains.0"},{"begin":"[A-Z\\_\\.\\-]+\\s*:","returnBegin":true,"end":";","endsWithParent":true,"contains":[{"className":"attribute","begin":"\\S","end":":","excludeEnd":true,"starts":{"endsWithParent":true,"excludeEnd":true,"contains":[{"begin":"[\\w-]+\\(","returnBegin":true,"contains":[{"className":"built_in","begin":"[\\w-]+"},{"begin":"\\(","end":"\\)","contains":[{"$ref":"#contains.6.contains.1.contains.0"},{"$ref":"#contains.6.contains.1.contains.1"}]}]},{"$ref":"#contains.6.contains.1.contains.2"},{"$ref":"#contains.6.contains.1.contains.1"},{"$ref":"#contains.6.contains.1.contains.0"},{"$ref":"#contains.0"},{"className":"number","begin":"#[0-9A-Fa-f]+"},{"className":"meta","begin":"!important"}]}}]}]}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/diff.json b/vendor/scrivo/highlight.php/Highlight/languages/diff.json new file mode 100644 index 0000000..e54052e --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/diff.json @@ -0,0 +1 @@ +{"aliases":["patch"],"contains":[{"className":"meta","relevance":10,"variants":[{"begin":"^@@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +@@$"},{"begin":"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$"},{"begin":"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$"}]},{"className":"comment","variants":[{"begin":"Index: ","end":"$"},{"begin":"={3,}","end":"$"},{"begin":"^\\-{3}","end":"$"},{"begin":"^\\*{3} ","end":"$"},{"begin":"^\\+{3}","end":"$"},{"begin":"\\*{5}","end":"\\*{5}$"}]},{"className":"addition","begin":"^\\+","end":"$"},{"className":"deletion","begin":"^\\-","end":"$"},{"className":"addition","begin":"^\\!","end":"$"}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/go.json b/vendor/scrivo/highlight.php/Highlight/languages/go.json new file mode 100644 index 0000000..54e82fe --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/go.json @@ -0,0 +1 @@ +{"aliases":["golang"],"keywords":{"keyword":"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune","literal":"true false iota nil","built_in":"append cap close complex copy imag len make new panic print println real recover delete"},"illegal":"</","contains":[{"className":"comment","begin":"//","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"string","variants":[{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"begin":"'","end":"[^\\\\]'"},{"begin":"`","end":"`"}]},{"className":"number","variants":[{"begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)[dflsi]","relevance":1},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0}]},{"begin":":="},{"className":"function","beginKeywords":"func","end":"\\s*\\{","excludeEnd":true,"contains":[{"className":"title","begin":"[a-zA-Z]\\w*","relevance":0},{"className":"params","begin":"\\(","end":"\\)","keywords":{"$ref":"#keywords"},"illegal":"[\"']"}]}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/json.json b/vendor/scrivo/highlight.php/Highlight/languages/json.json new file mode 100644 index 0000000..625ea05 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/json.json @@ -0,0 +1 @@ +{"contains":[{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}]},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0},{"begin":"{","end":"}","contains":[{"className":"attr","begin":"\"","end":"\"","contains":[{"$ref":"#contains.0.contains.0"}],"illegal":"\\n"},{"end":",","endsWithParent":true,"excludeEnd":true,"contains":{"$ref":"#contains"},"keywords":{"literal":"true false null"},"begin":":"}],"illegal":"\\S"},{"begin":"\\[","end":"\\]","contains":[{"end":",","endsWithParent":true,"excludeEnd":true,"contains":{"$ref":"#contains"},"keywords":{"$ref":"#contains.2.contains.1.keywords"}}],"illegal":"\\S"}],"keywords":{"$ref":"#contains.2.contains.1.keywords"},"illegal":"\\S"} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/markdown.json b/vendor/scrivo/highlight.php/Highlight/languages/markdown.json new file mode 100644 index 0000000..739d990 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/markdown.json @@ -0,0 +1 @@ +{"aliases":["md","mkdown","mkd"],"contains":[{"className":"section","variants":[{"begin":"^#{1,6}","end":"$"},{"begin":"^.+?\\n[=-]{2,}$"}]},{"begin":"<","end":">","subLanguage":"xml","relevance":0},{"className":"bullet","begin":"^([*+-]|(\\d+\\.))\\s+"},{"className":"strong","begin":"[*_]{2}.+?[*_]{2}"},{"className":"emphasis","variants":[{"begin":"\\*.+?\\*"},{"begin":"_.+?_","relevance":0}]},{"className":"quote","begin":"^>\\s+","end":"$"},{"className":"code","variants":[{"begin":"^```w*s*$","end":"^```s*$"},{"begin":"`.+?`"},{"begin":"^( {4}|\t)","end":"$","relevance":0}]},{"begin":"^[-\\*]{3,}","end":"$"},{"begin":"\\[.+?\\][\\(\\[].*?[\\)\\]]","returnBegin":true,"contains":[{"className":"string","begin":"\\[","end":"\\]","excludeBegin":true,"returnEnd":true,"relevance":0},{"className":"link","begin":"\\]\\(","end":"\\)","excludeBegin":true,"excludeEnd":true},{"className":"symbol","begin":"\\]\\[","end":"\\]","excludeBegin":true,"excludeEnd":true}],"relevance":10},{"begin":"^\\[[^\\n]+\\]:","returnBegin":true,"contains":[{"className":"symbol","begin":"\\[","end":"\\]","excludeBegin":true,"excludeEnd":true},{"className":"link","begin":":\\s*","end":"$","excludeBegin":true}]}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/php.json b/vendor/scrivo/highlight.php/Highlight/languages/php.json new file mode 100644 index 0000000..e585253 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/php.json @@ -0,0 +1 @@ +{"aliases":["php3","php4","php5","php6"],"case_insensitive":true,"keywords":"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally","contains":[{"className":"comment","begin":"#","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"//","end":"$","contains":[{"className":"meta","begin":"<\\?(php)?|\\?>"},{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"className":"doctag","begin":"@[A-Za-z]+"},{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"__halt_compiler.+?;","end":false,"contains":[{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}],"endsWithParent":true,"keywords":"__halt_compiler","lexemes":"[a-zA-Z_]\\w*"},{"className":"string","begin":"<<<['\"]?\\w+['\"]?$","end":"^\\w+;?$","contains":[{"begin":"\\\\[\\s\\S]","relevance":0},{"className":"subst","variants":[{"begin":"\\$\\w+"},{"begin":"\\{\\$","end":"\\}"}]}]},{"$ref":"#contains.1.contains.0"},{"className":"keyword","begin":"\\$this\\b"},{"begin":"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},{"begin":"(::|->)+[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*"},{"className":"function","beginKeywords":"function","end":"[;{]","excludeEnd":true,"illegal":"\\$|\\[|%","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*","relevance":0},{"className":"params","begin":"\\(","end":"\\)","contains":["self",{"$ref":"#contains.7"},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"$ref":"#contains.0.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"string","contains":[{"$ref":"#contains.4.contains.0"},{"$ref":"#contains.1.contains.0"}],"variants":[{"begin":"b\"","end":"\""},{"begin":"b'","end":"'"},{"className":"string","begin":"'","end":"'","illegal":null,"contains":[{"$ref":"#contains.4.contains.0"}]},{"className":"string","begin":"\"","end":"\"","illegal":null,"contains":[{"$ref":"#contains.4.contains.0"},{"className":"subst","begin":"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]","relevance":0},{"className":"subst","begin":"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]","relevance":0}]}]},{"variants":[{"className":"number","begin":"\\b(0b[01]+)","relevance":0},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0}]}]}]},{"className":"class","beginKeywords":"class interface","end":"{","excludeEnd":true,"illegal":"[:\\(\\$\"]","contains":[{"beginKeywords":"extends implements"},{"$ref":"#contains.9.contains.0"}]},{"beginKeywords":"namespace","end":";","illegal":"[\\.']","contains":[{"$ref":"#contains.9.contains.0"}]},{"beginKeywords":"use","end":";","contains":[{"$ref":"#contains.9.contains.0"}]},{"begin":"=>"},{"$ref":"#contains.9.contains.1.contains.3"},{"$ref":"#contains.9.contains.1.contains.4"}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/python.json b/vendor/scrivo/highlight.php/Highlight/languages/python.json new file mode 100644 index 0000000..30fdffe --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/python.json @@ -0,0 +1 @@ +{"aliases":["py","gyp"],"keywords":{"keyword":"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False","built_in":"Ellipsis NotImplemented"},"illegal":"(<\\/|->|\\?)|=>","contains":[{"className":"meta","begin":"^(>>>|\\.\\.\\.) "},{"className":"number","relevance":0,"variants":[{"begin":"\\b(0b[01]+)[lLjJ]?"},{"begin":"\\b(0o[0-7]+)[lLjJ]?"},{"begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)[lLjJ]?"}]},{"className":"string","contains":[{"begin":"\\\\[\\s\\S]","relevance":0}],"variants":[{"begin":"(u|b)?r?'''","end":"'''","contains":[{"$ref":"#contains.0"}],"relevance":10},{"begin":"(u|b)?r?\"\"\"","end":"\"\"\"","contains":[{"$ref":"#contains.0"}],"relevance":10},{"begin":"(fr|rf|f)'''","end":"'''","contains":[{"$ref":"#contains.0"},{"className":"subst","begin":"\\{","end":"\\}","keywords":{"$ref":"#keywords"},"illegal":"#","contains":[{"$ref":"#contains.2"},{"$ref":"#contains.1"},{"$ref":"#contains.0"}]}]},{"begin":"(fr|rf|f)\"\"\"","end":"\"\"\"","contains":[{"$ref":"#contains.0"},{"$ref":"#contains.2.variants.2.contains.1"}]},{"begin":"(u|r|ur)'","end":"'","relevance":10},{"begin":"(u|r|ur)\"","end":"\"","relevance":10},{"begin":"(b|br)'","end":"'"},{"begin":"(b|br)\"","end":"\""},{"begin":"(fr|rf|f)'","end":"'","contains":[{"$ref":"#contains.2.variants.2.contains.1"}]},{"begin":"(fr|rf|f)\"","end":"\"","contains":[{"$ref":"#contains.2.variants.2.contains.1"}]},{"className":"string","begin":"'","end":"'","illegal":"\\n","contains":[{"$ref":"#contains.2.contains.0"}]},{"className":"string","begin":"\"","end":"\"","illegal":"\\n","contains":[{"$ref":"#contains.2.contains.0"},{"className":"subst","begin":"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]","relevance":0},{"className":"subst","begin":"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]","relevance":0}]}]},{"className":"comment","begin":"#","end":"$","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"variants":[{"className":"function","beginKeywords":"def"},{"className":"class","beginKeywords":"class"}],"end":":","illegal":"[${=;\\n,]","contains":[{"className":"title","begin":"[a-zA-Z_]\\w*","relevance":0},{"className":"params","begin":"\\(","end":"\\)","contains":["self",{"$ref":"#contains.0"},{"$ref":"#contains.1"},{"$ref":"#contains.2"}]},{"begin":"->","endsWithParent":true,"keywords":"None"}]},{"className":"meta","begin":"^[\\t ]*@","end":"$"},{"begin":"\\b(print|exec)\\("}]} diff --git a/vendor/scrivo/highlight.php/Highlight/languages/sql.json b/vendor/scrivo/highlight.php/Highlight/languages/sql.json new file mode 100644 index 0000000..fce98f2 --- /dev/null +++ b/vendor/scrivo/highlight.php/Highlight/languages/sql.json @@ -0,0 +1 @@ +{"case_insensitive":true,"illegal":"[<>{}*#]","contains":[{"beginKeywords":"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment","end":";","endsWithParent":true,"lexemes":"[\\w\\.]+","keywords":{"keyword":"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek","literal":"true false null","built_in":"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},"contains":[{"className":"string","begin":"'","end":"'","contains":[{"begin":"\\\\[\\s\\S]","relevance":0},{"begin":"''"}]},{"className":"string","begin":"\"","end":"\"","contains":[{"$ref":"#contains.0.contains.0.contains.0"},{"begin":"\"\""}]},{"className":"string","begin":"`","end":"`","contains":[{"$ref":"#contains.0.contains.0.contains.0"}]},{"className":"number","begin":"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)","relevance":0},{"className":"comment","begin":"/\\*","end":"\\*/","contains":[{"begin":"\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]},{"className":"comment","begin":"--","end":"$","contains":[{"$ref":"#contains.0.contains.4.contains.0"},{"className":"doctag","begin":"(?:TODO|FIXME|NOTE|BUG|XXX):","relevance":0}]}]},{"$ref":"#contains.0.contains.4"},{"$ref":"#contains.0.contains.5"}]} diff --git a/vendor/scrivo/highlight.php/styles/default.css b/vendor/scrivo/highlight.php/styles/default.css new file mode 100644 index 0000000..f1bfade --- /dev/null +++ b/vendor/scrivo/highlight.php/styles/default.css @@ -0,0 +1,99 @@ +/* + +Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org> + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #F0F0F0; +} + + +/* Base color: saturation 0; */ + +.hljs, +.hljs-subst { + color: #444; +} + +.hljs-comment { + color: #888888; +} + +.hljs-keyword, +.hljs-attribute, +.hljs-selector-tag, +.hljs-meta-keyword, +.hljs-doctag, +.hljs-name { + font-weight: bold; +} + + +/* User color: hue: 0 */ + +.hljs-type, +.hljs-string, +.hljs-number, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #880000; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #BC6060; +} + + +/* Language color: hue: 90; */ + +.hljs-literal { + color: #78A960; +} + +.hljs-built_in, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #397300; +} + + +/* Meta color: hue: 200 */ + +.hljs-meta { + color: #1f7199; +} + +.hljs-meta-string { + color: #4d99bf; +} + + +/* Misc effects */ + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} From f3aefe51ad25be702497b3644d02bb5dc7a8092c Mon Sep 17 00:00:00 2001 From: Weston Ruter <weston@xwp.co> Date: Sat, 11 Aug 2018 22:10:27 -0700 Subject: [PATCH 9/9] Re-build at 7a8d213353 --- assets/blocks.style.css | 2 +- build/block.built.js | 1236 +++++++++++++++++++++---------- languages/code-syntax-block.pot | 44 +- 3 files changed, 878 insertions(+), 404 deletions(-) diff --git a/assets/blocks.style.css b/assets/blocks.style.css index ba6e649..4c01b94 100644 --- a/assets/blocks.style.css +++ b/assets/blocks.style.css @@ -1 +1 @@ -.code-syntax,.code-syntax code{font-family:Menlo, Consolas, 'Liberation Mono', monospace;font-size:14px;color:#009}.code-syntax{padding:.8em 1.6em;overflow-x:auto !important;border:1px solid #CCC;border-radius:4px} +.wp-block-code,.wp-block-code>code{font-family:Menlo, Consolas, 'Liberation Mono', monospace;font-size:14px;color:#009}.wp-block-code{padding:.8em 1.6em;overflow-x:auto !important;border:1px solid #CCC;border-radius:4px}.wp-block-code>code{background-color:inherit} diff --git a/build/block.built.js b/build/block.built.js index e6e0bb4..bef6373 100644 --- a/build/block.built.js +++ b/build/block.built.js @@ -60,32 +60,28 @@ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 13); +/******/ return __webpack_require__(__webpack_require__.s = 29); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ -/***/ (function(module, exports) { - -var core = module.exports = { version: '2.5.7' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +/***/ (function(module, exports, __webpack_require__) { +var store = __webpack_require__(25)('wks'); +var uid = __webpack_require__(26); +var Symbol = __webpack_require__(1).Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; +$exports.store = store; + /***/ }), -/* 2 */ +/* 1 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 @@ -97,61 +93,72 @@ if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), -/* 3 */ +/* 2 */ /***/ (function(module, exports) { -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), -/* 4 */ +/* 3 */ /***/ (function(module, exports, __webpack_require__) { -// Thank's IE8 for his funny defineProperty -module.exports = !__webpack_require__(1)(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; -}); +var dP = __webpack_require__(4); +var createDesc = __webpack_require__(13); +module.exports = __webpack_require__(6) ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { -// 7.1.13 ToObject(argument) -var defined = __webpack_require__(6); -module.exports = function (it) { - return Object(defined(it)); +var anObject = __webpack_require__(5); +var IE8_DOM_DEFINE = __webpack_require__(37); +var toPrimitive = __webpack_require__(38); +var dP = Object.defineProperty; + +exports.f = __webpack_require__(6) ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; }; /***/ }), -/* 6 */ -/***/ (function(module, exports) { +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { -// 7.2.1 RequireObjectCoercible(argument) +var isObject = __webpack_require__(11); module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); + if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), -/* 7 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { -// 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(17); -var enumBugKeys = __webpack_require__(26); - -module.exports = Object.keys || function keys(O) { - return $keys(O, enumBugKeys); -}; +// Thank's IE8 for his funny defineProperty +module.exports = !__webpack_require__(12)(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); /***/ }), -/* 8 */ +/* 7 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; @@ -161,50 +168,37 @@ module.exports = function (it, key) { /***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { +/* 8 */ +/***/ (function(module, exports) { -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = __webpack_require__(10); -var defined = __webpack_require__(6); +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; module.exports = function (it) { - return IObject(defined(it)); -}; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = __webpack_require__(18); -// eslint-disable-next-line no-prototype-builtins -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return cof(it) == 'String' ? it.split('') : Object(it); + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), -/* 11 */ +/* 9 */ /***/ (function(module, exports) { -// 7.1.4 ToInteger -var ceil = Math.ceil; -var floor = Math.floor; +// 7.2.1 RequireObjectCoercible(argument) module.exports = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; }; /***/ }), -/* 12 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(2); -var core = __webpack_require__(0); -var ctx = __webpack_require__(28); -var hide = __webpack_require__(30); -var has = __webpack_require__(8); +var global = __webpack_require__(1); +var core = __webpack_require__(2); +var ctx = __webpack_require__(18); +var hide = __webpack_require__(3); +var has = __webpack_require__(7); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { @@ -264,19 +258,242 @@ $export.R = 128; // real proto method for `library` module.exports = $export; +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + + /***/ }), /* 13 */ +/***/ (function(module, exports) { + +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +module.exports = {}; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +var shared = __webpack_require__(25)('keys'); +var uid = __webpack_require__(26); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(9); +module.exports = function (it) { + return Object(defined(it)); +}; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +module.exports = true; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +// optional / simple context binding +var aFunction = __webpack_require__(36); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(11); +var document = __webpack_require__(1).document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(43); +var enumBugKeys = __webpack_require__(27); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(22); +var defined = __webpack_require__(9); +module.exports = function (it) { + return IObject(defined(it)); +}; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = __webpack_require__(23); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.15 ToLength +var toInteger = __webpack_require__(8); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +var core = __webpack_require__(2); +var global = __webpack_require__(1); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __webpack_require__(17) ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); + + +/***/ }), +/* 26 */ +/***/ (function(module, exports) { + +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +var def = __webpack_require__(4).f; +var has = __webpack_require__(7); +var TAG = __webpack_require__(0)('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + + +/***/ }), +/* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__ = __webpack_require__(37); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_toConsumableArray__ = __webpack_require__(30); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_toConsumableArray___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_toConsumableArray__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__ = __webpack_require__(55); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss__ = __webpack_require__(44); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__editor_scss__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss__ = __webpack_require__(45); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss__ = __webpack_require__(63); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__style_scss__); @@ -302,137 +519,442 @@ var SelectControl = wp.components.SelectControl; -var langs = { - bash: __('Bash (shell)', 'code-syntax-block'), - clike: __('C-like', 'code-syntax-block'), - css: __('CSS', 'code-syntax-block'), - git: __('Git', 'code-syntax-block'), - go: __('Go (golang)', 'code-syntax-block'), - markup: __('HTML/Markup', 'code-syntax-block'), - javascript: __('JavaScript', 'code-syntax-block'), - json: __('JSON', 'code-syntax-block'), - markdown: __('Markdown', 'code-syntax-block'), - php: __('PHP', 'code-syntax-block'), - python: __('Python', 'code-syntax-block'), - jsx: __('React JSX', 'code-syntax-block'), - sql: __('SQL', 'code-syntax-block') +// An array is used as opposed to an object because objects in JS do not preserve order like associative arrays in PHP. +var languageOptions = [{ + value: 'bash', + label: __('Bash (shell)', 'code-syntax-block') +}, { + value: 'cpp', + label: __('C-like', 'code-syntax-block') +}, { + value: 'css', + label: __('CSS', 'code-syntax-block') +}, { + value: 'diff', + label: __('Diff', 'code-syntax-block') +}, { + value: 'go', + label: __('Go (golang)', 'code-syntax-block') +}, { + value: 'xml', + label: __('HTML/Markup', 'code-syntax-block') +}, { + value: 'javascript', + label: __('JavaScript (JSX)', 'code-syntax-block') +}, { + value: 'json', + label: __('JSON', 'code-syntax-block') +}, { + value: 'markdown', + label: __('Markdown', 'code-syntax-block') +}, { + value: 'php', + label: __('PHP', 'code-syntax-block') +}, { + value: 'python', + label: __('Python', 'code-syntax-block') +}, { + value: 'sql', + label: __('SQL', 'code-syntax-block') +}]; + +var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { + if ('core/code' !== settings.name) { + return settings; + } + + return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({}, settings, { + + attributes: __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({}, settings.attributes, { + language: { + type: 'string' + } + }), + + edit: function edit(_ref) { + var attributes = _ref.attributes, + setAttributes = _ref.setAttributes, + isSelected = _ref.isSelected, + className = _ref.className; + + + var updateLanguage = function updateLanguage(language) { + setAttributes({ language: language }); + }; + + return [React.createElement( + InspectorControls, + { key: 'controls' }, + React.createElement(SelectControl, { + label: 'Language', + value: attributes.language, + options: [{ label: __('Auto-detect', 'code-syntax-block'), value: '' }].concat(languageOptions), + onChange: updateLanguage + }) + ), React.createElement( + 'div', + { key: 'editor-wrapper', className: className }, + React.createElement(PlainText, { + value: attributes.content, + onChange: function onChange(content) { + return setAttributes({ content: content }); + }, + placeholder: __('Write code…', 'code-syntax-block'), + 'aria-label': __('Code', 'code-syntax-block') + }), + React.createElement( + 'div', + { className: 'language-selected' }, + languageOptions[attributes.language] + ) + )]; + }, + save: function save(_ref2) { + var attributes = _ref2.attributes; + + return React.createElement( + 'pre', + null, + React.createElement( + 'code', + null, + attributes.content + ) + ); + }, + + + deprecated: [].concat(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_toConsumableArray___default()(settings.deprecated || []), [{ + attributes: __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({}, settings.attributes, { + language: { + type: 'string' + } + }), + + save: function save(_ref3) { + var attributes = _ref3.attributes; + + var cls = attributes.language ? 'language-' + attributes.language : ''; + return React.createElement( + 'pre', + null, + React.createElement( + 'code', + { lang: attributes.language, className: cls }, + attributes.content + ) + ); + } + }]) + }); +}; + +// Register Filter +addFilter('blocks.registerBlockType', 'mkaz/code-syntax-block', addSyntaxToCodeBlock); + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _from = __webpack_require__(31); + +var _from2 = _interopRequireDefault(_from); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } else { + return (0, _from2.default)(arr); + } +}; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = { "default": __webpack_require__(32), __esModule: true }; + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(33); +__webpack_require__(48); +module.exports = __webpack_require__(2).Array.from; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var $at = __webpack_require__(34)(true); + +// 21.1.3.27 String.prototype[@@iterator]() +__webpack_require__(35)(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +var toInteger = __webpack_require__(8); +var defined = __webpack_require__(9); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var LIBRARY = __webpack_require__(17); +var $export = __webpack_require__(10); +var redefine = __webpack_require__(39); +var hide = __webpack_require__(3); +var Iterators = __webpack_require__(14); +var $iterCreate = __webpack_require__(40); +var setToStringTag = __webpack_require__(28); +var getPrototypeOf = __webpack_require__(47); +var ITERATOR = __webpack_require__(0)('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + + +/***/ }), +/* 36 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = !__webpack_require__(6) && !__webpack_require__(12)(function () { + return Object.defineProperty(__webpack_require__(19)('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(11); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); }; -var addSyntaxToCodeBlock = function addSyntaxToCodeBlock(settings) { - if ('core/code' !== settings.name) { - return settings; - } - var newCodeBlockSettings = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({}, settings, { +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { - attributes: __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({}, settings.attributes, { - language: { - type: 'string', - selector: 'code', - source: 'attribute', - attribute: 'lang' - } - }), +module.exports = __webpack_require__(3); - edit: function edit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes, - isSelected = _ref.isSelected, - className = _ref.className; +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { - var updateLanguage = function updateLanguage(language) { - setAttributes({ language: language }); - }; +"use strict"; - return [React.createElement( - InspectorControls, - { key: 'controls' }, - React.createElement(SelectControl, { - label: 'Language', - value: attributes.language, - options: [{ label: __('Select code language', 'code-syntax-block'), value: '' }].concat(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(langs).map(function (lang) { - return { label: langs[lang], value: lang }; - })), - onChange: updateLanguage - }) - ), React.createElement( - 'div', - { key: 'editor-wrapper', className: className }, - React.createElement(PlainText, { - value: attributes.content, - onChange: function onChange(content) { - return setAttributes({ content: content }); - }, - placeholder: __('Write code…', 'code-syntax-block'), - 'aria-label': __('Code', 'code-syntax-block') - }), - React.createElement( - 'div', - { className: 'language-selected' }, - langs[attributes.language] - ) - )]; - }, - save: function save(_ref2) { - var attributes = _ref2.attributes; +var create = __webpack_require__(41); +var descriptor = __webpack_require__(13); +var setToStringTag = __webpack_require__(28); +var IteratorPrototype = {}; - var cls = attributes.language ? 'language-' + attributes.language : ''; - return React.createElement( - 'pre', - null, - React.createElement( - 'code', - { lang: attributes.language, className: cls }, - attributes.content - ) - ); - } - }); +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +__webpack_require__(3)(IteratorPrototype, __webpack_require__(0)('iterator'), function () { return this; }); - return newCodeBlockSettings; +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); }; -// Register Filter -addFilter('blocks.registerBlockType', 'mkaz/code-syntax-block', addSyntaxToCodeBlock); /***/ }), -/* 14 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(15), __esModule: true }; +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(5); +var dPs = __webpack_require__(42); +var enumBugKeys = __webpack_require__(27); +var IE_PROTO = __webpack_require__(15)('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(19)('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(46).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; -__webpack_require__(16); -module.exports = __webpack_require__(0).Object.keys; +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; /***/ }), -/* 16 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { -// 19.1.2.14 Object.keys(O) -var toObject = __webpack_require__(5); -var $keys = __webpack_require__(7); +var dP = __webpack_require__(4); +var anObject = __webpack_require__(5); +var getKeys = __webpack_require__(20); -__webpack_require__(27)('keys', function () { - return function keys(it) { - return $keys(toObject(it)); - }; -}); +module.exports = __webpack_require__(6) ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; /***/ }), -/* 17 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { -var has = __webpack_require__(8); -var toIObject = __webpack_require__(9); -var arrayIndexOf = __webpack_require__(19)(false); -var IE_PROTO = __webpack_require__(22)('IE_PROTO'); +var has = __webpack_require__(7); +var toIObject = __webpack_require__(21); +var arrayIndexOf = __webpack_require__(44)(false); +var IE_PROTO = __webpack_require__(15)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); @@ -449,25 +971,14 @@ module.exports = function (object, names) { /***/ }), -/* 18 */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = function (it) { - return toString.call(it).slice(8, -1); -}; - - -/***/ }), -/* 19 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes -var toIObject = __webpack_require__(9); -var toLength = __webpack_require__(20); -var toAbsoluteIndex = __webpack_require__(21); +var toIObject = __webpack_require__(21); +var toLength = __webpack_require__(24); +var toAbsoluteIndex = __webpack_require__(45); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); @@ -489,22 +1000,10 @@ module.exports = function (IS_INCLUDES) { /***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -// 7.1.15 ToLength -var toInteger = __webpack_require__(11); -var min = Math.min; -module.exports = function (it) { - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 -}; - - -/***/ }), -/* 21 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(11); +var toInteger = __webpack_require__(8); var max = Math.max; var min = Math.min; module.exports = function (index, length) { @@ -514,217 +1013,196 @@ module.exports = function (index, length) { /***/ }), -/* 22 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { -var shared = __webpack_require__(23)('keys'); -var uid = __webpack_require__(25); -module.exports = function (key) { - return shared[key] || (shared[key] = uid(key)); -}; +var document = __webpack_require__(1).document; +module.exports = document && document.documentElement; /***/ }), -/* 23 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { -var core = __webpack_require__(0); -var global = __webpack_require__(2); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: __webpack_require__(24) ? 'pure' : 'global', - copyright: '© 2018 Denis Pushkarev (zloirock.ru)' -}); - - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - -module.exports = true; - - -/***/ }), -/* 25 */ -/***/ (function(module, exports) { - -var id = 0; -var px = Math.random(); -module.exports = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = __webpack_require__(7); +var toObject = __webpack_require__(16); +var IE_PROTO = __webpack_require__(15)('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; }; /***/ }), -/* 26 */ -/***/ (function(module, exports) { - -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); - - -/***/ }), -/* 27 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { -// most Object methods by ES6 should accept primitives -var $export = __webpack_require__(12); -var core = __webpack_require__(0); -var fails = __webpack_require__(1); -module.exports = function (KEY, exec) { - var fn = (core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); -}; +"use strict"; + +var ctx = __webpack_require__(18); +var $export = __webpack_require__(10); +var toObject = __webpack_require__(16); +var call = __webpack_require__(49); +var isArrayIter = __webpack_require__(50); +var toLength = __webpack_require__(24); +var createProperty = __webpack_require__(51); +var getIterFn = __webpack_require__(52); + +$export($export.S + $export.F * !__webpack_require__(54)(function (iter) { Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); /***/ }), -/* 28 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { -// optional / simple context binding -var aFunction = __webpack_require__(29); -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; +// call something on iterator step with safe closing on error +var anObject = __webpack_require__(5); +module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; }; /***/ }), -/* 29 */ -/***/ (function(module, exports) { +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + +// check on default Array iterator +var Iterators = __webpack_require__(14); +var ITERATOR = __webpack_require__(0)('iterator'); +var ArrayProto = Array.prototype; module.exports = function (it) { - if (typeof it != 'function') throw TypeError(it + ' is not a function!'); - return it; + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }), -/* 30 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(31); -var createDesc = __webpack_require__(36); -module.exports = __webpack_require__(4) ? function (object, key, value) { - return dP.f(object, key, createDesc(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; - - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { +"use strict"; -var anObject = __webpack_require__(32); -var IE8_DOM_DEFINE = __webpack_require__(33); -var toPrimitive = __webpack_require__(35); -var dP = Object.defineProperty; +var $defineProperty = __webpack_require__(4); +var createDesc = __webpack_require__(13); -exports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return dP(O, P, Attributes); - } catch (e) { /* empty */ } - if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; }; /***/ }), -/* 32 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { -var isObject = __webpack_require__(3); -module.exports = function (it) { - if (!isObject(it)) throw TypeError(it + ' is not an object!'); - return it; +var classof = __webpack_require__(53); +var ITERATOR = __webpack_require__(0)('iterator'); +var Iterators = __webpack_require__(14); +module.exports = __webpack_require__(2).getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; }; /***/ }), -/* 33 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = !__webpack_require__(4) && !__webpack_require__(1)(function () { - return Object.defineProperty(__webpack_require__(34)('div'), 'a', { get: function () { return 7; } }).a != 7; -}); - +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = __webpack_require__(23); +var TAG = __webpack_require__(0)('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; -var isObject = __webpack_require__(3); -var document = __webpack_require__(2).document; -// typeof document.createElement is 'object' in old IE -var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { - return is ? document.createElement(it) : {}; + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), -/* 35 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = __webpack_require__(3); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function (it, S) { - if (!isObject(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - throw TypeError("Can't convert object to primitive value"); -}; - +var ITERATOR = __webpack_require__(0)('iterator'); +var SAFE_CLOSING = false; -/***/ }), -/* 36 */ -/***/ (function(module, exports) { +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; }; /***/ }), -/* 37 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -732,7 +1210,7 @@ module.exports = function (bitmap, value) { exports.__esModule = true; -var _assign = __webpack_require__(38); +var _assign = __webpack_require__(56); var _assign2 = _interopRequireDefault(_assign); @@ -753,45 +1231,45 @@ exports.default = _assign2.default || function (target) { }; /***/ }), -/* 38 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(39), __esModule: true }; +module.exports = { "default": __webpack_require__(57), __esModule: true }; /***/ }), -/* 39 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(40); -module.exports = __webpack_require__(0).Object.assign; +__webpack_require__(58); +module.exports = __webpack_require__(2).Object.assign; /***/ }), -/* 40 */ +/* 58 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) -var $export = __webpack_require__(12); +var $export = __webpack_require__(10); -$export($export.S + $export.F, 'Object', { assign: __webpack_require__(41) }); +$export($export.S + $export.F, 'Object', { assign: __webpack_require__(59) }); /***/ }), -/* 41 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) -var getKeys = __webpack_require__(7); -var gOPS = __webpack_require__(42); -var pIE = __webpack_require__(43); -var toObject = __webpack_require__(5); -var IObject = __webpack_require__(10); +var getKeys = __webpack_require__(20); +var gOPS = __webpack_require__(60); +var pIE = __webpack_require__(61); +var toObject = __webpack_require__(16); +var IObject = __webpack_require__(22); var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) -module.exports = !$assign || __webpack_require__(1)(function () { +module.exports = !$assign || __webpack_require__(12)(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef @@ -818,27 +1296,27 @@ module.exports = !$assign || __webpack_require__(1)(function () { /***/ }), -/* 42 */ +/* 60 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 43 */ +/* 61 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), -/* 44 */ +/* 62 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 45 */ +/* 63 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin diff --git a/languages/code-syntax-block.pot b/languages/code-syntax-block.pot index 9766a6c..58235a3 100644 --- a/languages/code-syntax-block.pot +++ b/languages/code-syntax-block.pot @@ -9,8 +9,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2018-08-11T22:51:33+00:00\n" -"PO-Revision-Date: 2018-08-11T22:51:33+00:00\n" +"POT-Creation-Date: 2018-08-12T05:06:40+00:00\n" +"PO-Revision-Date: 2018-08-12T05:06:40+00:00\n" "X-Generator: WP-CLI 2.0.0\n" "X-Domain: code-syntax-block\n" @@ -34,66 +34,62 @@ msgstr "" msgid "https://mkaz.blog/" msgstr "" -#: code-syntax.js:21 +#: code-syntax.js:24 msgid "Bash (shell)" msgstr "" -#: code-syntax.js:22 +#: code-syntax.js:28 msgid "C-like" msgstr "" -#: code-syntax.js:23 +#: code-syntax.js:32 msgid "CSS" msgstr "" -#: code-syntax.js:24 -msgid "Git" +#: code-syntax.js:36 +msgid "Diff" msgstr "" -#: code-syntax.js:25 +#: code-syntax.js:40 msgid "Go (golang)" msgstr "" -#: code-syntax.js:26 +#: code-syntax.js:44 msgid "HTML/Markup" msgstr "" -#: code-syntax.js:27 -msgid "JavaScript" +#: code-syntax.js:48 +msgid "JavaScript (JSX)" msgstr "" -#: code-syntax.js:28 +#: code-syntax.js:52 msgid "JSON" msgstr "" -#: code-syntax.js:29 +#: code-syntax.js:56 msgid "Markdown" msgstr "" -#: code-syntax.js:30 +#: code-syntax.js:60 msgid "PHP" msgstr "" -#: code-syntax.js:31 +#: code-syntax.js:64 msgid "Python" msgstr "" -#: code-syntax.js:32 -msgid "React JSX" -msgstr "" - -#: code-syntax.js:33 +#: code-syntax.js:68 msgid "SQL" msgstr "" -#: code-syntax.js:66 -msgid "Select code language" +#: code-syntax.js:100 +msgid "Auto-detect" msgstr "" -#: code-syntax.js:78 +#: code-syntax.js:111 msgid "Write code…" msgstr "" -#: code-syntax.js:79 +#: code-syntax.js:112 msgid "Code" msgstr ""