Version Description
Download this release
Release Info
Developer | merkushin |
Plugin | SyntaxHighlighter Evolved |
Version | 3.6.1 |
Comparing to | |
See all releases |
Code changes from version 3.6.0 to 3.6.1
- dist/blocks.build.js +1 -1
- readme.txt +12 -3
- syntaxhighlighter.php +167 -130
- syntaxhighlighter3/scripts/shBrushGo.js +60 -0
- syntaxhighlighter3/scripts/shBrushHaskell.js +38 -0
- syntaxhighlighter3/scripts/shBrushXml.js +1 -1
- syntaxhighlighter3/styles/shCore.css +14 -4
dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=wp.editor},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.element},function(e,t,n){"use strict";function r(e){return e.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi,"&")}function o(e){return e.replace(/</g,"<")}function a(e){return o(r(e))}function l(e){return o(e.replace(/&/g,"&"))}t.b=a,t.a=l;n(16)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=(n.n(r),n(7));Object(r.registerBlockType)("syntaxhighlighter/code",o.a)},function(e,t,n){"use strict";var r=n(0),o=(n.n(r),n(8)),a=n(13),l=n(17),i=n(20),c=(n.n(i),n(21)),u=(n.n(c),window.syntaxHighlighterData.settings);t.a={title:Object(r.__)("SyntaxHighlighter Code","syntaxhighlighter"),description:Object(r.__)("Adds syntax highlighting to source code (front end only).","syntaxhighlighter"),icon:"editor-code",category:"formatting",keywords:[Object(r.__)("Source","syntaxhighlighter"),Object(r.__)("Program","syntaxhighlighter"),Object(r.__)("Develop","syntaxhighlighter")],attributes:{content:{type:"string",source:"text",selector:"pre"},language:{type:"string",default:u.language.default},lineNumbers:{type:"boolean",default:u.lineNumbers.default},firstLineNumber:{type:"string",default:u.firstLineNumber.default},highlightLines:{type:"string"},wrapLines:{type:"boolean",default:u.wrapLines.default},makeURLsClickable:{type:"boolean",default:u.makeURLsClickable.default},quickCode:{type:"boolean",default:u.quickCode.default}},supports:{html:!1,align:!0},transforms:l.a,edit:o.a,save:a.a}},function(e,t,n){"use strict";function r(e){var t=e.attributes,n=e.setAttributes,r=e.className,c=t.content,u=window.syntaxHighlighterData.settings.tabSize,s=wp.element.createElement("div",{className:r+" wp-block-code"},wp.element.createElement(o.PlainText,{className:"wp-block-syntaxhighlighter__textarea",style:{tabSize:u,MozTabSize:""+u},value:c,onChange:function(e){return n({content:e})},placeholder:Object(a.__)("Tip: you can choose a code language from the block settings.","syntaxhighlighter"),"aria-label":Object(a.__)("SyntaxHighlighter Code","syntaxhighlighter")}));return wp.element.createElement(i.Fragment,null,Object(l.a)({attributes:t,setAttributes:n}),s)}t.a=r;var o=n(2),a=(n.n(o),n(0)),l=(n.n(a),n(9)),i=n(4);n.n(i)},function(e,t,n){"use strict";var r=n(3),o=(n.n(r),n(4)),a=(n.n(o),n(2)),l=(n.n(a),n(0)),i=(n.n(l),n(10));t.a=function(e){var t=e.attributes,n=e.setAttributes,c=[],u=[],s=t.language,p=t.lineNumbers,h=t.firstLineNumber,g=t.highlightLines,f=t.wrapLines,b=t.makeURLsClickable,m=t.quickCode,d=window.syntaxHighlighterData,y=d.settings,w=d.brushes;if(y.language.supported){var v=[];for(var x in w)v.push({label:w[x],value:x});c.push(wp.element.createElement(r.PanelRow,{key:"code-language"},wp.element.createElement(r.SelectControl,{label:Object(l.__)("Code Language","syntaxhighlighter"),value:s,options:v,onChange:function(e){return n({language:e})}}))),u.push(Object(i.a)({attributes:t,setAttributes:n,options:v}))}return y.lineNumbers.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"show-line-numbers"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Show Line Numbers","syntaxhighlighter"),checked:p,onChange:function(e){return n({lineNumbers:e})}}))),p&&y.firstLineNumber.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"first-line-number"},wp.element.createElement(r.TextControl,{label:Object(l.__)("First Line Number","syntaxhighlighter"),type:"number",value:h,onChange:function(e){return n({firstLineNumber:e})},min:"1",max:"100000"}))),y.highlightLines.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"highlight-lines"},wp.element.createElement(r.TextControl,{label:Object(l.__)("Highlight Lines","syntaxhighlighter"),value:g,help:Object(l.__)("A comma-separated list of line numbers to highlight. Can also be a range. Example: 1,5,10-20","syntaxhighlighter"),onChange:function(e){return n({highlightLines:e})}}))),y.wrapLines.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"wrap-long-lines"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Wrap Long Lines","syntaxhighlighter"),checked:f,onChange:function(e){return n({wrapLines:e})}}))),y.makeURLsClickable.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"make-urls-clickable"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Make URLs Clickable","syntaxhighlighter"),checked:b,onChange:function(e){return n({makeURLsClickable:e})}}))),y.quickCode.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"edit-mode"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Enable edit mode on double click","syntaxhighlighter"),checked:m,onChange:function(e){return n({quickCode:e})}}))),wp.element.createElement(o.Fragment,null,wp.element.createElement(a.BlockControls,null,wp.element.createElement(r.ToolbarGroup,null,u)),wp.element.createElement(a.InspectorControls,{key:"syntaxHighlighterInspectorControls"},wp.element.createElement(r.PanelBody,{title:Object(l.__)("Settings","syntaxhighlighter")},c)))}},function(e,t,n){"use strict";var r=n(0),o=(n.n(r),n(11));t.a=function(e){var t=e.attributes,n=e.setAttributes,a=e.options,l=t.language;return wp.element.createElement(o.a,{key:"code-language",options:a,optionsLabel:Object(r.__)("Code Language","syntaxhighlighter"),value:l,onChange:function(e){return n({language:e})}})}},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var o=n(12),a=n.n(o),l=n(3),i=(n.n(l),Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),c=function(e){var t=e.options,n=e.optionsLabel,o=e.icon,c=e.value,u=e.onChange,s=r(e,["options","optionsLabel","icon","value","onChange"]),p=t.find(function(e){return c===e.value});return wp.element.createElement(l.Dropdown,i({className:"syntaxhighlighter-toolbar-dropdown",popoverProps:{isAlternate:!0,position:"bottom right left",focusOnMount:!0,className:a()("syntaxhighlighter-toolbar-dropdown__popover")},renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return wp.element.createElement(l.Button,{onClick:n,icon:o,"aria-expanded":t,"aria-haspopup":"true",children:p?p.label:""})},renderContent:function(e){var r=e.onClose;return wp.element.createElement(l.NavigableMenu,{role:"menu",stopNavigationEvents:!0},wp.element.createElement(l.MenuGroup,{label:n},t.map(function(e){var t=e.value===p.value;return wp.element.createElement(l.MenuItem,{key:e.value,role:"menuitemradio",isSelected:t,className:a()("syntaxhighlighter-toolbar-dropdown__option",{"is-selected":t}),onClick:function(){u(e.value),r()},children:e.label})})))}},s))};t.a=c},function(e,t,n){var r,o;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===o)for(var i in r)a.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(o=function(){return n}.apply(t,r))&&(e.exports=o))}()},function(e,t,n){"use strict";function r(e){var t=e.attributes;return wp.element.createElement("pre",null,Object(o.a)(t.content))}t.a=r;var o=n(14)},function(e,t,n){"use strict";function r(e){return Object(a.flow)(l.a,o)(e||"")}function o(e){return e.replace(/^(\s*https?:)\/\/([^\s<>"]+\s*)$/m,"$1//$2")}t.a=r;var a=n(15),l=(n.n(a),n(5))},function(e,t){e.exports=lodash},function(e,t,n){"use strict";function r(e){return e.replace(/>/g,">")}t.a=r},function(e,t,n){"use strict";var r=n(1),o=(n.n(r),n(5)),a=n(18),l=n.n(a),i=function(){function e(e,t){var n=[],_n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(_n=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{!_n&&l.return&&l.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.a={from:[{type:"enter",regExp:/^```\w*$/,transform:function(e){var t=e.content,n=void 0===t?"":t,o=n.match(/^```(\w+)/)||[null,null],a=i(o,2),l=a[1],c=l?{language:l}:void 0;return Object(r.createBlock)("syntaxhighlighter/code",c)}},{type:"raw",isMatch:function(e){return"PRE"===e.nodeName&&1===e.children.length&&"CODE"===e.firstChild.nodeName},schema:{pre:{children:{code:{children:{"#text":{}}}}}}},{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(r.createBlock)("syntaxhighlighter/code",{content:l()(t)})}}],to:[{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(r.createBlock)("core/code",{content:Object(o.b)(t)})}}]}},function(e,t,n){(function(t){function n(e){if("string"==typeof e)return e;if(o(e))return v?v.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function r(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||r(e)&&d.call(e)==c}function a(e){return null==e?"":n(e)}function l(e){return e=a(e),e&&s.test(e)?e.replace(u,b):e}var i=1/0,c="[object Symbol]",u=/&(?:amp|lt|gt|quot|#39|#96);/g,s=RegExp(u.source),p={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},h="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,f=h||g||Function("return this")(),b=function(e){return function(t){return null==e?void 0:e[t]}}(p),m=Object.prototype,d=m.toString,y=f.Symbol,w=y?y.prototype:void 0,v=w?w.toString:void 0;e.exports=l}).call(t,n(19))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(n=window)}e.exports=n},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=wp.editor},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.element},function(e,t,n){"use strict";function r(e){return e.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi,"&")}function o(e){return e.replace(/</g,"<")}function a(e){return o(r(e))}function l(e){return o(e.replace(/&/g,"&"))}t.b=a,t.a=l;n(16)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=(n.n(r),n(7));Object(r.registerBlockType)("syntaxhighlighter/code",o.a)},function(e,t,n){"use strict";var r=n(0),o=(n.n(r),n(8)),a=n(13),l=n(17),i=n(20),c=(n.n(i),n(21)),u=(n.n(c),window.syntaxHighlighterData.settings);t.a={title:Object(r.__)("SyntaxHighlighter Code","syntaxhighlighter"),description:Object(r.__)("Adds syntax highlighting to source code (front end only).","syntaxhighlighter"),icon:"editor-code",category:"formatting",keywords:[Object(r.__)("Source","syntaxhighlighter"),Object(r.__)("Program","syntaxhighlighter"),Object(r.__)("Develop","syntaxhighlighter")],attributes:{content:{type:"string",source:"text",selector:"pre"},language:{type:"string",default:u.language.default},lineNumbers:{type:"boolean",default:u.lineNumbers.default},firstLineNumber:{type:"string",default:u.firstLineNumber.default},highlightLines:{type:"string"},wrapLines:{type:"boolean",default:u.wrapLines.default},makeURLsClickable:{type:"boolean",default:u.makeURLsClickable.default},quickCode:{type:"boolean",default:u.quickCode.default}},supports:{html:!1,align:!0},transforms:l.a,edit:o.a,save:a.a}},function(e,t,n){"use strict";function r(e){var t=e.attributes,n=e.setAttributes,r=e.className,c=t.content,u=window.syntaxHighlighterData.settings.tabSize,s=wp.element.createElement("div",{className:r+" wp-block-code"},wp.element.createElement(o.PlainText,{className:"wp-block-syntaxhighlighter__textarea",style:{tabSize:u,MozTabSize:""+u},value:c,onChange:function(e){return n({content:e})},placeholder:Object(a.__)("Tip: you can choose a code language from the block settings.","syntaxhighlighter"),"aria-label":Object(a.__)("SyntaxHighlighter Code","syntaxhighlighter")}));return wp.element.createElement(i.Fragment,null,Object(l.a)({attributes:t,setAttributes:n}),s)}t.a=r;var o=n(2),a=(n.n(o),n(0)),l=(n.n(a),n(9)),i=n(4);n.n(i)},function(e,t,n){"use strict";var r=n(3),o=(n.n(r),n(4)),a=(n.n(o),n(2)),l=(n.n(a),n(0)),i=(n.n(l),n(10));t.a=function(e){var t=e.attributes,n=e.setAttributes,c=[],u=[],s=t.language,p=t.lineNumbers,h=t.firstLineNumber,g=t.highlightLines,f=t.wrapLines,m=t.makeURLsClickable,b=t.quickCode,d=window.syntaxHighlighterData,y=d.settings,w=d.brushes;if(y.language.supported){var v=[];for(var x in w)v.push({label:w[x],value:x});c.push(wp.element.createElement(r.PanelRow,{key:"code-language"},wp.element.createElement(r.SelectControl,{label:Object(l.__)("Code Language","syntaxhighlighter"),value:s,options:v,onChange:function(e){return n({language:e})}}))),u.push(Object(i.a)({attributes:t,setAttributes:n,options:v}))}return y.lineNumbers.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"show-line-numbers"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Show Line Numbers","syntaxhighlighter"),checked:p,onChange:function(e){return n({lineNumbers:e})}}))),p&&y.firstLineNumber.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"first-line-number"},wp.element.createElement(r.TextControl,{label:Object(l.__)("First Line Number","syntaxhighlighter"),type:"number",value:h,onChange:function(e){return n({firstLineNumber:e})},min:"1",max:"100000"}))),y.highlightLines.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"highlight-lines"},wp.element.createElement(r.TextControl,{label:Object(l.__)("Highlight Lines","syntaxhighlighter"),value:g,help:Object(l.__)("A comma-separated list of line numbers to highlight. Can also be a range. Example: 1,5,10-20","syntaxhighlighter"),onChange:function(e){return n({highlightLines:e})}}))),y.wrapLines.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"wrap-long-lines"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Wrap Long Lines","syntaxhighlighter"),checked:f,onChange:function(e){return n({wrapLines:e})}}))),y.makeURLsClickable.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"make-urls-clickable"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Make URLs Clickable","syntaxhighlighter"),checked:m,onChange:function(e){return n({makeURLsClickable:e})}}))),y.quickCode.supported&&c.push(wp.element.createElement(r.PanelRow,{key:"edit-mode"},wp.element.createElement(r.ToggleControl,{label:Object(l.__)("Enable edit mode on double click","syntaxhighlighter"),checked:b,onChange:function(e){return n({quickCode:e})}}))),wp.element.createElement(o.Fragment,null,wp.element.createElement(a.BlockControls,null,wp.element.createElement(r.ToolbarGroup,null,u)),wp.element.createElement(a.InspectorControls,{key:"syntaxHighlighterInspectorControls"},wp.element.createElement(r.PanelBody,{title:Object(l.__)("Settings","syntaxhighlighter")},c)))}},function(e,t,n){"use strict";var r=n(0),o=(n.n(r),n(11));t.a=function(e){var t=e.attributes,n=e.setAttributes,a=e.options,l=t.language;return wp.element.createElement(o.a,{key:"code-language",options:a,optionsLabel:Object(r.__)("Code Language","syntaxhighlighter"),value:l,onChange:function(e){return n({language:e})}})}},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var o=n(12),a=n.n(o),l=n(3),i=(n.n(l),Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),c=function(e){var t=e.options,n=e.optionsLabel,o=e.icon,c=e.value,u=e.onChange,s=r(e,["options","optionsLabel","icon","value","onChange"]),p=t.find(function(e){return c===e.value});return wp.element.createElement(l.Dropdown,i({className:"syntaxhighlighter-toolbar-dropdown",popoverProps:{isAlternate:!0,position:"bottom right left",focusOnMount:!0,className:a()("syntaxhighlighter-toolbar-dropdown__popover")},renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return wp.element.createElement(l.Button,{onClick:n,icon:o,"aria-expanded":t,"aria-haspopup":"true",children:p?p.label:""})},renderContent:function(e){var r=e.onClose;return wp.element.createElement(l.NavigableMenu,{role:"menu",stopNavigationEvents:!0},wp.element.createElement(l.MenuGroup,{label:n},t.map(function(e){var t=e.value===p.value;return wp.element.createElement(l.MenuItem,{key:e.value,role:"menuitemradio",isSelected:t,className:a()("syntaxhighlighter-toolbar-dropdown__option",{"is-selected":t}),onClick:function(){u(e.value),r()},children:e.label})})))}},s))};t.a=c},function(e,t,n){var r,o;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===o)for(var i in r)a.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(o=function(){return n}.apply(t,r))&&(e.exports=o))}()},function(e,t,n){"use strict";function r(e){var t=e.attributes;return wp.element.createElement("pre",null,Object(o.a)(t.content))}t.a=r;var o=n(14)},function(e,t,n){"use strict";function r(e){return Object(a.flow)(l.a,o)(e||"")}function o(e){return e.replace(/^(\s*https?:)\/\/([^\s<>"]+\s*)$/m,"$1//$2")}t.a=r;var a=n(15),l=(n.n(a),n(5))},function(e,t){e.exports=lodash},function(e,t,n){"use strict";function r(e){return e.replace(/>/g,">")}t.a=r},function(e,t,n){"use strict";var r=n(1),o=(n.n(r),n(5)),a=n(18),l=n.n(a),i=function(){function e(e,t){var n=[],_n=!0,r=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(_n=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{!_n&&l.return&&l.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.a={from:[{type:"enter",regExp:/^```\w*$/,transform:function(e){var t=e.content,n=void 0===t?"":t,o=n.match(/^```(\w+)/)||[null,null],a=i(o,2),l=a[1],c=l?{language:l}:void 0;return Object(r.createBlock)("syntaxhighlighter/code",c)}},{type:"raw",isMatch:function(e){return"PRE"===e.nodeName&&1===e.children.length&&"CODE"===e.firstChild.nodeName},transform:function(e){var t=e.firstChild.textContent,n=t.match(/^```(\w+)?\n/)||[null,null],o=i(n,2),a=o[0],l=o[1],c=l?{language:l}:{};return c.content=a?t.replace(a,"").replace(/```\s*$/,""):t,Object(r.createBlock)("syntaxhighlighter/code",c)},schema:{pre:{children:{code:{children:{"#text":{}}}}}}},{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(r.createBlock)("syntaxhighlighter/code",{content:l()(t)})}}],to:[{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(r.createBlock)("core/code",{content:Object(o.b)(t)})}}]}},function(e,t,n){(function(t){function n(e){if("string"==typeof e)return e;if(o(e))return v?v.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function r(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||r(e)&&d.call(e)==c}function a(e){return null==e?"":n(e)}function l(e){return e=a(e),e&&s.test(e)?e.replace(u,m):e}var i=1/0,c="[object Symbol]",u=/&(?:amp|lt|gt|quot|#39|#96);/g,s=RegExp(u.source),p={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},h="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,f=h||g||Function("return this")(),m=function(e){return function(t){return null==e?void 0:e[t]}}(p),b=Object.prototype,d=b.toString,y=f.Symbol,w=y?y.prototype:void 0,v=w?w.toString:void 0;e.exports=l}).call(t,n(19))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(n=window)}e.exports=n},function(e,t){},function(e,t){}]);
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: Viper007Bond, automattic, donncha
|
3 |
Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update/
|
4 |
Tags: code, source, sourcecode, php, syntax highlighting, syntax, highlight, highlighting, highlighter, WordPress.com
|
5 |
-
Requires at least: 5.
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 3.6.
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
@@ -40,6 +40,15 @@ Try excluding this plugin's Javascript from any performance optimizations your s
|
|
40 |
|
41 |
== ChangeLog ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
= Version 3.6.0 =
|
44 |
|
45 |
* New: Add ```language shortcut. #180
|
2 |
Contributors: Viper007Bond, automattic, donncha
|
3 |
Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update/
|
4 |
Tags: code, source, sourcecode, php, syntax highlighting, syntax, highlight, highlighting, highlighter, WordPress.com
|
5 |
+
Requires at least: 5.6
|
6 |
+
Tested up to: 5.8
|
7 |
+
Stable tag: 3.6.1
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
40 |
|
41 |
== ChangeLog ==
|
42 |
|
43 |
+
= Version 3.6.1 =
|
44 |
+
|
45 |
+
* New: Set code block language when pasting into editor. #215
|
46 |
+
* New: Add syntax highlight for Haskell. #210
|
47 |
+
* New: Display the list of available brushes. #221
|
48 |
+
* Fix: Line alignment for bootstrap themes. #222
|
49 |
+
* Fix: Add space around code. #223
|
50 |
+
* Fix: XML brush - use the last occurrence of the tag. #225
|
51 |
+
|
52 |
= Version 3.6.0 =
|
53 |
|
54 |
* New: Add ```language shortcut. #180
|
syntaxhighlighter.php
CHANGED
@@ -4,33 +4,33 @@
|
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
|
7 |
-
Version: 3.6.
|
8 |
Description: Easily post syntax-highlighted code to your site without having to modify the code at all. Uses Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a>. Includes a new editor block.
|
9 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: https://alex.blog/
|
11 |
Text Domain: syntaxhighlighter
|
12 |
License: GPL2
|
13 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
14 |
-
Requires at least: 5.
|
15 |
-
Tested up to: 5.
|
16 |
Requires PHP: 7.0
|
17 |
|
18 |
**************************************************************************/
|
19 |
|
20 |
class SyntaxHighlighter {
|
21 |
// All of these variables are private. Filters are provided for things that can be modified.
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
// Initalize the plugin by registering the hooks
|
36 |
function __construct() {
|
@@ -123,52 +123,55 @@ class SyntaxHighlighter {
|
|
123 |
$this->agshver = '3.0.9b';
|
124 |
}
|
125 |
|
|
|
126 |
// Register brush scripts
|
127 |
-
wp_register_script( 'syntaxhighlighter-core', plugins_url( $this->shfolder . '/scripts/shCore.js', __FILE__ ), array(),
|
128 |
-
wp_register_script( 'syntaxhighlighter-brush-as3', plugins_url( $this->shfolder . '/scripts/shBrushAS3.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
129 |
-
wp_register_script( 'syntaxhighlighter-brush-arduino', plugins_url( $this->shfolder . '/scripts/shBrushArduino.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
130 |
-
wp_register_script( 'syntaxhighlighter-brush-bash', plugins_url( $this->shfolder . '/scripts/shBrushBash.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
131 |
-
wp_register_script( 'syntaxhighlighter-brush-coldfusion', plugins_url( $this->shfolder . '/scripts/shBrushColdFusion.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
132 |
-
wp_register_script( 'syntaxhighlighter-brush-cpp', plugins_url( $this->shfolder . '/scripts/shBrushCpp.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
133 |
-
wp_register_script( 'syntaxhighlighter-brush-csharp', plugins_url( $this->shfolder . '/scripts/shBrushCSharp.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
134 |
-
wp_register_script( 'syntaxhighlighter-brush-css', plugins_url( $this->shfolder . '/scripts/shBrushCss.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
135 |
-
wp_register_script( 'syntaxhighlighter-brush-delphi', plugins_url( $this->shfolder . '/scripts/shBrushDelphi.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
136 |
-
wp_register_script( 'syntaxhighlighter-brush-diff', plugins_url( $this->shfolder . '/scripts/shBrushDiff.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
137 |
-
wp_register_script( 'syntaxhighlighter-brush-erlang', plugins_url( $this->shfolder . '/scripts/shBrushErlang.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
138 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
139 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
140 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
141 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
142 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
143 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
144 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
145 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
146 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
147 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
148 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
149 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
150 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
151 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
152 |
-
wp_register_script( 'syntaxhighlighter-brush-
|
|
|
|
|
153 |
|
154 |
// Register some popular third-party brushes
|
155 |
-
wp_register_script( 'syntaxhighlighter-brush-clojure', plugins_url( 'third-party-brushes/shBrushClojure.js', __FILE__ ), array('syntaxhighlighter-core'), '20090602' );
|
156 |
-
wp_register_script( 'syntaxhighlighter-brush-fsharp', plugins_url( 'third-party-brushes/shBrushFSharp.js', __FILE__ ), array('syntaxhighlighter-core'), '20091003' );
|
157 |
-
wp_register_script( 'syntaxhighlighter-brush-latex', plugins_url( 'third-party-brushes/shBrushLatex.js', __FILE__ ), array('syntaxhighlighter-core'), '20090613' );
|
158 |
-
wp_register_script( 'syntaxhighlighter-brush-matlabkey', plugins_url( 'third-party-brushes/shBrushMatlabKey.js', __FILE__ ), array('syntaxhighlighter-core'), '20091209' );
|
159 |
-
wp_register_script( 'syntaxhighlighter-brush-objc', plugins_url( 'third-party-brushes/shBrushObjC.js', __FILE__ ), array('syntaxhighlighter-core'), '20091207' );
|
160 |
-
wp_register_script( 'syntaxhighlighter-brush-r', plugins_url( 'third-party-brushes/shBrushR.js', __FILE__ ), array('syntaxhighlighter-core'), '20100919' );
|
161 |
|
162 |
// Register theme stylesheets
|
163 |
-
wp_register_style(
|
164 |
-
wp_register_style(
|
165 |
-
wp_register_style(
|
166 |
-
wp_register_style(
|
167 |
-
wp_register_style(
|
168 |
-
wp_register_style(
|
169 |
-
wp_register_style(
|
170 |
-
wp_register_style(
|
171 |
-
|
172 |
|
173 |
// Create list of brush aliases and map them to their real brushes
|
174 |
// The key is the language alias
|
@@ -196,7 +199,10 @@ class SyntaxHighlighter {
|
|
196 |
'erl' => 'erlang',
|
197 |
'erlang' => 'erlang',
|
198 |
'fsharp' => 'fsharp',
|
|
|
|
|
199 |
'groovy' => 'groovy',
|
|
|
200 |
'java' => 'java',
|
201 |
'jfx' => 'javafx',
|
202 |
'javafx' => 'javafx',
|
@@ -236,6 +242,7 @@ class SyntaxHighlighter {
|
|
236 |
'yml' => 'yaml',
|
237 |
) );
|
238 |
|
|
|
239 |
$this->brush_names = (array) apply_filters( 'syntaxhighlighter_brush_names', array(
|
240 |
'as3' => __( 'ActionScript', 'syntaxhighlighter' ),
|
241 |
'arduino' => __( 'Arduino', 'syntaxhighlighter' ),
|
@@ -249,7 +256,9 @@ class SyntaxHighlighter {
|
|
249 |
'diff' => __( 'diff / patch', 'syntaxhighlighter' ),
|
250 |
'erlang' => __( 'Erlang', 'syntaxhighlighter' ),
|
251 |
'fsharp' => __( 'F#', 'syntaxhighlighter' ),
|
|
|
252 |
'groovy' => __( 'Groovy', 'syntaxhighlighter' ),
|
|
|
253 |
'java' => __( 'Java', 'syntaxhighlighter' ),
|
254 |
'javafx' => __( 'JavaFX', 'syntaxhighlighter' ),
|
255 |
'jscript' => __( 'JavaScript', 'syntaxhighlighter' ),
|
@@ -269,6 +278,7 @@ class SyntaxHighlighter {
|
|
269 |
'xml' => __( 'HTML / XHTML / XML / XSLT', 'syntaxhighlighter' ),
|
270 |
'yaml' => __( 'YAML', 'syntaxhighlighter' ),
|
271 |
) );
|
|
|
272 |
|
273 |
// Add any custom brushes that aren't making use of the newer "syntaxhighlighter_brush_names" filter.
|
274 |
foreach ( $this->brushes as $slug => $language ) {
|
@@ -524,9 +534,9 @@ class SyntaxHighlighter {
|
|
524 |
'makeURLsClickable' => 'autolinks',
|
525 |
'quickCode' => 'quickcode',
|
526 |
);
|
527 |
-
$
|
528 |
-
if( ! empty( $attributes['align'] ) ) {
|
529 |
-
$
|
530 |
}
|
531 |
|
532 |
foreach ( $remaps as $from => $to ) {
|
@@ -545,11 +555,11 @@ class SyntaxHighlighter {
|
|
545 |
|
546 |
// Undo escaping done by WordPress
|
547 |
$code = htmlspecialchars_decode( $code );
|
548 |
-
$code = preg_replace(
|
549 |
|
550 |
$code = $this->shortcode_callback( $attributes, $code, 'code' );
|
551 |
|
552 |
-
return '<div class="wp-block-syntaxhighlighter-code ' . esc_attr( join(' ', $
|
553 |
}
|
554 |
|
555 |
// Add the custom TinyMCE plugin which wraps plugin shortcodes in <pre> in TinyMCE
|
@@ -579,11 +589,13 @@ class SyntaxHighlighter {
|
|
579 |
function settings_link( $links, $file ) {
|
580 |
static $this_plugin;
|
581 |
|
582 |
-
if( empty($this_plugin) )
|
583 |
$this_plugin = plugin_basename(__FILE__);
|
|
|
584 |
|
585 |
-
if ( $file == $this_plugin )
|
586 |
$links[] = '<a href="' . admin_url( 'options-general.php?page=syntaxhighlighter' ) . '">' . __( 'Settings', 'syntaxhighlighter' ) . '</a>';
|
|
|
587 |
|
588 |
return $links;
|
589 |
}
|
@@ -783,7 +795,7 @@ class SyntaxHighlighter {
|
|
783 |
// The callback function for SyntaxHighlighter::encode_shortcode_contents()
|
784 |
function encode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
|
785 |
$this->encoded = true;
|
786 |
-
$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars), htmlspecialchars( $code ) );
|
787 |
return '[' . $tag . $this->atts2string( $atts ) . "]{$code}[/$tag]";
|
788 |
}
|
789 |
|
@@ -792,7 +804,7 @@ class SyntaxHighlighter {
|
|
792 |
// Shortcode attribute values need to not be quoted with TinyMCE disabled for some reason (weird bug)
|
793 |
function decode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
|
794 |
$quotes = ( user_can_richedit() ) ? true : false;
|
795 |
-
$code = str_replace(
|
796 |
return '[' . $tag . $this->atts2string( $atts, $quotes ) . "]{$code}[/$tag]";
|
797 |
}
|
798 |
|
@@ -836,7 +848,7 @@ class SyntaxHighlighter {
|
|
836 |
|
837 |
// Run SyntaxHighlighter::decode_shortcode_contents_callback() on the contents of the text widget form
|
838 |
function widget_text_form( $instance, $widgetclass ) {
|
839 |
-
if ( 'text' == $widgetclass->id_base && !empty($instance['syntaxhighlighter_encoded']) ) {
|
840 |
$instance['text'] = $this->shortcode_hack( $instance['text'], array( $this, 'decode_shortcode_contents_callback' ) );
|
841 |
}
|
842 |
|
@@ -846,7 +858,7 @@ class SyntaxHighlighter {
|
|
846 |
|
847 |
// Run SyntaxHighlighter::parse_shortcodes() on the contents of a text widget
|
848 |
function widget_text_output( $content, $instance = false ) {
|
849 |
-
$this->codeformat = ( false === $instance || empty($instance['syntaxhighlighter_encoded']) ) ? 1 : 2;
|
850 |
$content = $this->parse_shortcodes( $content );
|
851 |
$this->codeformat = false;
|
852 |
|
@@ -867,16 +879,18 @@ class SyntaxHighlighter {
|
|
867 |
// This function determines what version of SyntaxHighlighter was used when the post was written
|
868 |
// This is because the code was stored differently for different versions of SyntaxHighlighter
|
869 |
function get_code_format( $post ) {
|
870 |
-
if ( false !== $this->codeformat )
|
871 |
return $this->codeformat;
|
|
|
872 |
|
873 |
-
if ( empty($post) )
|
874 |
$post = new stdClass();
|
|
|
875 |
|
876 |
if ( null !== $version = apply_filters( 'syntaxhighlighter_pre_getcodeformat', null, $post ) )
|
877 |
return $version;
|
878 |
|
879 |
-
$version = ( empty($post->ID) || get_post_meta( $post->ID, '_syntaxhighlighter_encoded', true ) || get_post_meta( $post->ID, 'syntaxhighlighter_encoded', true ) ) ? 2 : 1;
|
880 |
|
881 |
return apply_filters( 'syntaxhighlighter_getcodeformat', $version, $post );
|
882 |
}
|
@@ -894,17 +908,19 @@ class SyntaxHighlighter {
|
|
894 |
|
895 |
// Transforms an attributes array into a 'key="value"' format (i.e. reverses the process)
|
896 |
function atts2string( $atts, $quotes = true ) {
|
897 |
-
if ( empty($atts) )
|
898 |
return '';
|
|
|
899 |
|
900 |
$atts = $this->attributefix( $atts );
|
901 |
|
902 |
// Re-map [code="php"] style tags
|
903 |
-
if ( isset($atts[0]) ) {
|
904 |
-
if ( empty($atts['language']) )
|
905 |
$atts['language'] = $atts[0];
|
|
|
906 |
|
907 |
-
unset($atts[0]);
|
908 |
}
|
909 |
|
910 |
$strings = array();
|
@@ -925,11 +941,13 @@ class SyntaxHighlighter {
|
|
925 |
function maybe_output_scripts() {
|
926 |
global $wp_styles;
|
927 |
|
928 |
-
if ( 1 == $this->settings['loadallbrushes'] )
|
929 |
$this->usedbrushes = array_flip( array_values( $this->brushes ) );
|
|
|
930 |
|
931 |
-
if ( empty($this->usedbrushes) )
|
932 |
return;
|
|
|
933 |
|
934 |
$scripts = array();
|
935 |
foreach ( $this->usedbrushes as $brush => $unused )
|
@@ -943,22 +961,24 @@ class SyntaxHighlighter {
|
|
943 |
echo " var corecss = document.createElement('link');\n";
|
944 |
echo " var themecss = document.createElement('link');\n";
|
945 |
|
946 |
-
if ( !is_a($wp_styles, 'WP_Styles') )
|
947 |
$wp_styles = new WP_Styles();
|
|
|
948 |
|
949 |
$needcore = false;
|
950 |
if ( 'none' == $this->settings['theme'] ) {
|
951 |
$needcore = true;
|
952 |
} else {
|
953 |
-
$theme = ( !empty($this->themes[$this->settings['theme']]) ) ? strtolower($this->settings['theme']) : $this->defaultsettings['theme'];
|
954 |
$theme = 'syntaxhighlighter-theme-' . $theme;
|
955 |
|
956 |
// See if the requested theme has been registered
|
957 |
-
if ( !empty($wp_styles) && !empty($wp_styles->registered) && !empty($wp_styles->registered[$theme]) && !empty($wp_styles->registered[$theme]->src) ) {
|
958 |
|
959 |
// Users can register their own stylesheet and may opt to not load the core stylesheet if they wish for some reason
|
960 |
-
if ( is_array($wp_styles->registered[$theme]->deps) && in_array( 'syntaxhighlighter-core', $wp_styles->registered[$theme]->deps ) )
|
961 |
$needcore = true;
|
|
|
962 |
}
|
963 |
|
964 |
// Otherwise use the default theme
|
@@ -968,7 +988,7 @@ class SyntaxHighlighter {
|
|
968 |
}
|
969 |
}
|
970 |
|
971 |
-
if ( $needcore && !empty($wp_styles) && !empty($wp_styles->registered) && !empty($wp_styles->registered['syntaxhighlighter-core']) && !empty($wp_styles->registered['syntaxhighlighter-core']->src) ) :
|
972 |
$corecssurl = add_query_arg( 'ver', $this->agshver, $wp_styles->registered['syntaxhighlighter-core']->src );
|
973 |
$corecssurl = apply_filters( 'syntaxhighlighter_csscoreurl', $corecssurl );
|
974 |
?>
|
@@ -986,7 +1006,7 @@ class SyntaxHighlighter {
|
|
986 |
endif; // Endif $needcore
|
987 |
|
988 |
if ( 'none' != $this->settings['theme'] ) : ?>
|
989 |
-
var themecssurl = "<?php echo esc_js( apply_filters( 'syntaxhighlighter_cssthemeurl', add_query_arg( 'ver', $this->agshver, $wp_styles->registered[$theme]->src ) ) ); ?>";
|
990 |
if ( themecss.setAttribute ) {
|
991 |
themecss.setAttribute( "rel", "stylesheet" );
|
992 |
themecss.setAttribute( "type", "text/css" );
|
@@ -1023,28 +1043,35 @@ class SyntaxHighlighter {
|
|
1023 |
break;
|
1024 |
}
|
1025 |
|
1026 |
-
if ( 1 != $this->settings['autolinks'] )
|
1027 |
echo " SyntaxHighlighter.defaults['auto-links'] = false;\n";
|
|
|
1028 |
|
1029 |
-
if ( !empty($this->settings['classname']) )
|
1030 |
echo " SyntaxHighlighter.defaults['class-name'] = '" . $this->js_escape_singlequotes( $this->settings['classname'] ) . "';\n";
|
|
|
1031 |
|
1032 |
-
if ( 1 == $this->settings['collapse'] )
|
1033 |
echo " SyntaxHighlighter.defaults['collapse'] = true;\n";
|
|
|
1034 |
|
1035 |
-
if ( 1 != $this->settings['firstline'] )
|
1036 |
echo " SyntaxHighlighter.defaults['first-line'] = " . $this->settings['firstline'] . ";\n";
|
|
|
1037 |
|
1038 |
-
if ( 1 != $this->settings['gutter'] )
|
1039 |
echo " SyntaxHighlighter.defaults['gutter'] = false;\n";
|
|
|
1040 |
|
1041 |
/*
|
1042 |
-
if ( 1 == $this->settings['htmlscript'] )
|
1043 |
echo " SyntaxHighlighter.defaults['html-script'] = true;\n";
|
|
|
1044 |
*/
|
1045 |
|
1046 |
-
if ( 1 == $this->settings['light'] )
|
1047 |
echo " SyntaxHighlighter.defaults['light'] = true;\n";
|
|
|
1048 |
|
1049 |
echo " SyntaxHighlighter.defaults['pad-line-numbers'] = ";
|
1050 |
switch ( $this->settings['padlinenumbers'] ) {
|
@@ -1069,11 +1096,13 @@ class SyntaxHighlighter {
|
|
1069 |
echo " SyntaxHighlighter.defaults['toolbar'] = false;\n";
|
1070 |
|
1071 |
// 2.x only for now
|
1072 |
-
if ( 1 != $this->settings['wraplines'] )
|
1073 |
echo " SyntaxHighlighter.defaults['wrap-lines'] = false;\n";
|
|
|
1074 |
|
1075 |
-
if ( 1 != $this->settings['quickcode'] )
|
1076 |
echo " SyntaxHighlighter.defaults['quick-code'] = false;\n";
|
|
|
1077 |
|
1078 |
?> SyntaxHighlighter.all();
|
1079 |
|
@@ -1095,16 +1124,18 @@ class SyntaxHighlighter {
|
|
1095 |
|
1096 |
// No-name attribute fixing
|
1097 |
function attributefix( $atts = array() ) {
|
1098 |
-
if ( empty($atts[0]) )
|
1099 |
return $atts;
|
|
|
1100 |
|
1101 |
-
|
1102 |
-
|
1103 |
$atts[0] = $match[2];
|
1104 |
|
1105 |
-
|
1106 |
-
|
1107 |
$atts[0] = substr( $atts[0], 1 );
|
|
|
1108 |
|
1109 |
return $atts;
|
1110 |
}
|
@@ -1114,20 +1145,22 @@ class SyntaxHighlighter {
|
|
1114 |
function shortcode_callback( $atts, $code = '', $tag = false ) {
|
1115 |
global $post;
|
1116 |
|
1117 |
-
if ( false === $tag || empty($code) )
|
1118 |
return $code;
|
|
|
1119 |
|
1120 |
// Avoid PHP notices
|
1121 |
-
if ( !isset($post) )
|
1122 |
$post = null;
|
|
|
1123 |
|
1124 |
$code = apply_filters( 'syntaxhighlighter_precode', $code, $atts, $tag );
|
1125 |
|
1126 |
// Error fixing for [tag="language"]
|
1127 |
-
if ( isset($atts[0]) ) {
|
1128 |
$atts = $this->attributefix( $atts );
|
1129 |
$atts['language'] = $atts[0];
|
1130 |
-
unset($atts[0]);
|
1131 |
}
|
1132 |
|
1133 |
// Default out all of the available parameters to "false" (easy way to check if they're set or not)
|
@@ -1155,7 +1188,7 @@ class SyntaxHighlighter {
|
|
1155 |
), $atts ) );
|
1156 |
|
1157 |
// Check for language shortcode tag such as [php]code[/php]
|
1158 |
-
if ( isset($this->brushes[$tag]) ) {
|
1159 |
$lang = $tag;
|
1160 |
}
|
1161 |
|
@@ -1179,15 +1212,16 @@ class SyntaxHighlighter {
|
|
1179 |
$lang = strtolower( $lang );
|
1180 |
|
1181 |
// Validate passed attribute
|
1182 |
-
if ( !isset($this->brushes[$lang]) )
|
1183 |
return $code;
|
|
|
1184 |
}
|
1185 |
|
1186 |
// Switch from the alias to the real brush name (so custom aliases can be used)
|
1187 |
-
$lang = $this->brushes[$lang];
|
1188 |
|
1189 |
// Register this brush as used so it's script will be outputted
|
1190 |
-
$this->usedbrushes[$lang] = true;
|
1191 |
|
1192 |
$params = array();
|
1193 |
$params[] = "brush: $lang;";
|
@@ -1240,15 +1274,17 @@ class SyntaxHighlighter {
|
|
1240 |
$key = strtolower( $key );
|
1241 |
|
1242 |
// Put back parameter names that have been renamed for shortcode use
|
1243 |
-
if ( !empty($rename_map[$key]) )
|
1244 |
-
$key = $rename_map[$key];
|
|
|
1245 |
|
1246 |
// This this parameter if it's unknown, not set, or the language which was already handled
|
1247 |
-
if ( empty($allowed_atts[$key]) || false === $value || in_array( $key, array( 'language', 'lang' ) ) )
|
1248 |
continue;
|
|
|
1249 |
|
1250 |
// Sanitize values
|
1251 |
-
switch ( $allowed_atts[$key] ) {
|
1252 |
case 'boolean':
|
1253 |
$value = strtolower( $value );
|
1254 |
if ( 'true' === $value || '1' === $value || 'on' == $value )
|
@@ -1335,7 +1371,7 @@ class SyntaxHighlighter {
|
|
1335 |
$title = ' title="' . esc_attr( $value ) . '"';
|
1336 |
}
|
1337 |
|
1338 |
-
$code = ( false === strpos( $code, '<' ) && false === strpos( $code, '>' ) && 2 == $this->get_code_format($post) ) ? strip_tags( $code ) : htmlspecialchars( $code );
|
1339 |
|
1340 |
// Escape shortcodes
|
1341 |
$code = preg_replace( '/\[/', '[', $code );
|
@@ -1353,15 +1389,15 @@ class SyntaxHighlighter {
|
|
1353 |
|
1354 |
<script type="text/javascript">
|
1355 |
// <![CDATA[
|
1356 |
-
jQuery(document).ready(function($) {
|
1357 |
// Confirm pressing of the "Reset to Defaults" button
|
1358 |
$("#syntaxhighlighter-defaults").click(function(){
|
1359 |
var areyousure = confirm("<?php echo esc_js( __( 'Are you sure you want to reset your settings to the defaults?', 'syntaxhighlighter' ) ); ?>");
|
1360 |
if ( true != areyousure ) return false;
|
1361 |
});
|
1362 |
-
<?php if ( !empty( $_GET['defaults'] ) ) : ?>
|
1363 |
$("#message p strong").text("<?php echo esc_js( __( 'Settings reset to defaults.', 'syntaxhighlighter' ) ); ?>");
|
1364 |
-
<?php endif; ?>
|
1365 |
});
|
1366 |
// ]]>
|
1367 |
</script>
|
@@ -1556,15 +1592,15 @@ class SyntaxHighlighter {
|
|
1556 |
<?php
|
1557 |
echo wp_kses(
|
1558 |
sprintf(
|
1559 |
-
// translators: %1$s Lang parameter; %2$s Language parameter; %3$s
|
1560 |
_x(
|
1561 |
-
'%1$s or %2$s — The language syntax to highlight with. You can alternately just use that as the tag, such as <code>[php]code[/php]</code>.
|
1562 |
'language parameter',
|
1563 |
'syntaxhighlighter'
|
1564 |
),
|
1565 |
'<code>lang</code>',
|
1566 |
'<code>language</code>',
|
1567 |
-
'
|
1568 |
),
|
1569 |
array(
|
1570 |
'a' => array(
|
@@ -1767,23 +1803,24 @@ class SyntaxHighlighter {
|
|
1767 |
|
1768 |
// Validate the settings sent from the settings page
|
1769 |
function validate_settings( $settings ) {
|
1770 |
-
|
|
|
1771 |
$settings = $this->defaultsettings;
|
1772 |
$_REQUEST['_wp_http_referer'] = add_query_arg( 'defaults', 'true', $_REQUEST['_wp_http_referer'] );
|
1773 |
} else {
|
1774 |
-
$settings['shversion'] = ( ! empty($settings['shversion']) && 2 == $settings['shversion'] ) ? 2 : 3;
|
1775 |
|
1776 |
-
$settings['theme'] = ( ! empty($settings['theme']) && isset($this->themes[$settings['theme']]) ) ? strtolower($settings['theme']) : $this->defaultsettings['theme'];
|
1777 |
|
1778 |
-
$settings['loadallbrushes'] = ( ! empty($settings['loadallbrushes']) ) ? 1 : 0;
|
1779 |
-
$settings['autolinks'] = ( ! empty($settings['autolinks']) )
|
1780 |
-
$settings['collapse'] = ( ! empty($settings['collapse']) )
|
1781 |
-
$settings['gutter'] = ( ! empty($settings['gutter']) )
|
1782 |
-
$settings['light'] = ( ! empty($settings['light']) )
|
1783 |
-
$settings['smarttabs'] = ( ! empty($settings['smarttabs']) )
|
1784 |
-
$settings['toolbar'] = ( ! empty($settings['toolbar']) )
|
1785 |
-
$settings['wraplines'] = ( ! empty($settings['wraplines']) )
|
1786 |
-
$settings['quickcode'] = ( ! empty($settings['quickcode']) )
|
1787 |
|
1788 |
// If the version changed, then force change the toolbar version setting
|
1789 |
if ( $settings['shversion'] != $this->settings['shversion'] ) {
|
@@ -1793,9 +1830,9 @@ class SyntaxHighlighter {
|
|
1793 |
if ( 'true' != $settings['padlinenumbers'] && 'false' != $settings['padlinenumbers'] )
|
1794 |
$settings['padlinenumbers'] = (int) $settings['padlinenumbers'];
|
1795 |
|
1796 |
-
$settings['classname'] = ( !empty($settings['classname']) )
|
1797 |
-
$settings['firstline'] = (int) ( ( !empty($settings['firstline']) ) ? $settings['firstline'] : $this->defaultsettings['firstline'] );
|
1798 |
-
$settings['tabsize'] = (int) ( ( !empty($settings['tabsize']) )
|
1799 |
}
|
1800 |
|
1801 |
return $settings;
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
|
7 |
+
Version: 3.6.1
|
8 |
Description: Easily post syntax-highlighted code to your site without having to modify the code at all. Uses Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a>. Includes a new editor block.
|
9 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: https://alex.blog/
|
11 |
Text Domain: syntaxhighlighter
|
12 |
License: GPL2
|
13 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
14 |
+
Requires at least: 5.6
|
15 |
+
Tested up to: 5.8
|
16 |
Requires PHP: 7.0
|
17 |
|
18 |
**************************************************************************/
|
19 |
|
20 |
class SyntaxHighlighter {
|
21 |
// All of these variables are private. Filters are provided for things that can be modified.
|
22 |
+
public $pluginver = '3.6.1'; // Plugin version
|
23 |
+
public $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
|
24 |
+
public $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
|
25 |
+
public $settings = array(); // Contains the user's settings
|
26 |
+
public $defaultsettings = array(); // Contains the default settings
|
27 |
+
public $brushes = array(); // Array of aliases => brushes
|
28 |
+
public $shortcodes = array(); // Array of shortcodes to use
|
29 |
+
public $themes = array(); // Array of themes
|
30 |
+
public $usedbrushes = array(); // Stores used brushes so we know what to output
|
31 |
+
public $encoded = false; // Used to mark that a character encode took place
|
32 |
+
public $codeformat = false; // If set, SyntaxHighlighter::get_code_format() will return this value
|
33 |
+
public $content_save_pre_ran = false; // It's possible for the "content_save_pre" filter to run multiple times, so keep track
|
34 |
|
35 |
// Initalize the plugin by registering the hooks
|
36 |
function __construct() {
|
123 |
$this->agshver = '3.0.9b';
|
124 |
}
|
125 |
|
126 |
+
// phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma, PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket
|
127 |
// Register brush scripts
|
128 |
+
wp_register_script( 'syntaxhighlighter-core', plugins_url( $this->shfolder . '/scripts/shCore.js', __FILE__ ), array(), $this->agshver );
|
129 |
+
wp_register_script( 'syntaxhighlighter-brush-as3', plugins_url( $this->shfolder . '/scripts/shBrushAS3.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
130 |
+
wp_register_script( 'syntaxhighlighter-brush-arduino', plugins_url( $this->shfolder . '/scripts/shBrushArduino.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
131 |
+
wp_register_script( 'syntaxhighlighter-brush-bash', plugins_url( $this->shfolder . '/scripts/shBrushBash.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
132 |
+
wp_register_script( 'syntaxhighlighter-brush-coldfusion', plugins_url( $this->shfolder . '/scripts/shBrushColdFusion.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
133 |
+
wp_register_script( 'syntaxhighlighter-brush-cpp', plugins_url( $this->shfolder . '/scripts/shBrushCpp.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
134 |
+
wp_register_script( 'syntaxhighlighter-brush-csharp', plugins_url( $this->shfolder . '/scripts/shBrushCSharp.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
135 |
+
wp_register_script( 'syntaxhighlighter-brush-css', plugins_url( $this->shfolder . '/scripts/shBrushCss.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
136 |
+
wp_register_script( 'syntaxhighlighter-brush-delphi', plugins_url( $this->shfolder . '/scripts/shBrushDelphi.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
137 |
+
wp_register_script( 'syntaxhighlighter-brush-diff', plugins_url( $this->shfolder . '/scripts/shBrushDiff.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
138 |
+
wp_register_script( 'syntaxhighlighter-brush-erlang', plugins_url( $this->shfolder . '/scripts/shBrushErlang.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
139 |
+
wp_register_script( 'syntaxhighlighter-brush-go', plugins_url( $this->shfolder . '/scripts/shBrushGo.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
140 |
+
wp_register_script( 'syntaxhighlighter-brush-groovy', plugins_url( $this->shfolder . '/scripts/shBrushGroovy.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
141 |
+
wp_register_script( 'syntaxhighlighter-brush-haskell', plugins_url( $this->shfolder . '/scripts/shBrushHaskell.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
142 |
+
wp_register_script( 'syntaxhighlighter-brush-java', plugins_url( $this->shfolder . '/scripts/shBrushJava.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
143 |
+
wp_register_script( 'syntaxhighlighter-brush-javafx', plugins_url( $this->shfolder . '/scripts/shBrushJavaFX.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
144 |
+
wp_register_script( 'syntaxhighlighter-brush-jscript', plugins_url( $this->shfolder . '/scripts/shBrushJScript.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
145 |
+
wp_register_script( 'syntaxhighlighter-brush-perl', plugins_url( $this->shfolder . '/scripts/shBrushPerl.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
146 |
+
wp_register_script( 'syntaxhighlighter-brush-php', plugins_url( $this->shfolder . '/scripts/shBrushPhp.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
147 |
+
wp_register_script( 'syntaxhighlighter-brush-plain', plugins_url( $this->shfolder . '/scripts/shBrushPlain.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
148 |
+
wp_register_script( 'syntaxhighlighter-brush-powershell', plugins_url( $this->shfolder . '/scripts/shBrushPowerShell.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
149 |
+
wp_register_script( 'syntaxhighlighter-brush-python', plugins_url( $this->shfolder . '/scripts/shBrushPython.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
150 |
+
wp_register_script( 'syntaxhighlighter-brush-ruby', plugins_url( $this->shfolder . '/scripts/shBrushRuby.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
151 |
+
wp_register_script( 'syntaxhighlighter-brush-scala', plugins_url( $this->shfolder . '/scripts/shBrushScala.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
152 |
+
wp_register_script( 'syntaxhighlighter-brush-sql', plugins_url( $this->shfolder . '/scripts/shBrushSql.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
153 |
+
wp_register_script( 'syntaxhighlighter-brush-vb', plugins_url( $this->shfolder . '/scripts/shBrushVb.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
154 |
+
wp_register_script( 'syntaxhighlighter-brush-xml', plugins_url( $this->shfolder . '/scripts/shBrushXml.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
155 |
+
wp_register_script( 'syntaxhighlighter-brush-yaml', plugins_url( $this->shfolder . '/scripts/shBrushYaml.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
156 |
|
157 |
// Register some popular third-party brushes
|
158 |
+
wp_register_script( 'syntaxhighlighter-brush-clojure', plugins_url( 'third-party-brushes/shBrushClojure.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20090602' );
|
159 |
+
wp_register_script( 'syntaxhighlighter-brush-fsharp', plugins_url( 'third-party-brushes/shBrushFSharp.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20091003' );
|
160 |
+
wp_register_script( 'syntaxhighlighter-brush-latex', plugins_url( 'third-party-brushes/shBrushLatex.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20090613' );
|
161 |
+
wp_register_script( 'syntaxhighlighter-brush-matlabkey', plugins_url( 'third-party-brushes/shBrushMatlabKey.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20091209' );
|
162 |
+
wp_register_script( 'syntaxhighlighter-brush-objc', plugins_url( 'third-party-brushes/shBrushObjC.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20091207' );
|
163 |
+
wp_register_script( 'syntaxhighlighter-brush-r', plugins_url( 'third-party-brushes/shBrushR.js', __FILE__ ), array( 'syntaxhighlighter-core' ), '20100919' );
|
164 |
|
165 |
// Register theme stylesheets
|
166 |
+
wp_register_style( 'syntaxhighlighter-core', plugins_url( $this->shfolder . '/styles/shCore.css', __FILE__ ), array(), $this->agshver );
|
167 |
+
wp_register_style( 'syntaxhighlighter-theme-default', plugins_url( $this->shfolder . '/styles/shThemeDefault.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
168 |
+
wp_register_style( 'syntaxhighlighter-theme-django', plugins_url( $this->shfolder . '/styles/shThemeDjango.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
169 |
+
wp_register_style( 'syntaxhighlighter-theme-eclipse', plugins_url( $this->shfolder . '/styles/shThemeEclipse.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
170 |
+
wp_register_style( 'syntaxhighlighter-theme-emacs', plugins_url( $this->shfolder . '/styles/shThemeEmacs.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
171 |
+
wp_register_style( 'syntaxhighlighter-theme-fadetogrey', plugins_url( $this->shfolder . '/styles/shThemeFadeToGrey.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
172 |
+
wp_register_style( 'syntaxhighlighter-theme-midnight', plugins_url( $this->shfolder . '/styles/shThemeMidnight.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
173 |
+
wp_register_style( 'syntaxhighlighter-theme-rdark', plugins_url( $this->shfolder . '/styles/shThemeRDark.css', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver );
|
174 |
+
// phpcs:enable
|
175 |
|
176 |
// Create list of brush aliases and map them to their real brushes
|
177 |
// The key is the language alias
|
199 |
'erl' => 'erlang',
|
200 |
'erlang' => 'erlang',
|
201 |
'fsharp' => 'fsharp',
|
202 |
+
'go' => 'go',
|
203 |
+
'golang' => 'go',
|
204 |
'groovy' => 'groovy',
|
205 |
+
'haskell' => 'haskell',
|
206 |
'java' => 'java',
|
207 |
'jfx' => 'javafx',
|
208 |
'javafx' => 'javafx',
|
242 |
'yml' => 'yaml',
|
243 |
) );
|
244 |
|
245 |
+
// phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma
|
246 |
$this->brush_names = (array) apply_filters( 'syntaxhighlighter_brush_names', array(
|
247 |
'as3' => __( 'ActionScript', 'syntaxhighlighter' ),
|
248 |
'arduino' => __( 'Arduino', 'syntaxhighlighter' ),
|
256 |
'diff' => __( 'diff / patch', 'syntaxhighlighter' ),
|
257 |
'erlang' => __( 'Erlang', 'syntaxhighlighter' ),
|
258 |
'fsharp' => __( 'F#', 'syntaxhighlighter' ),
|
259 |
+
'go' => __( 'Go', 'syntaxhighlighter' ),
|
260 |
'groovy' => __( 'Groovy', 'syntaxhighlighter' ),
|
261 |
+
'haskell' => __( 'Haskell', 'syntaxhighlighter' ),
|
262 |
'java' => __( 'Java', 'syntaxhighlighter' ),
|
263 |
'javafx' => __( 'JavaFX', 'syntaxhighlighter' ),
|
264 |
'jscript' => __( 'JavaScript', 'syntaxhighlighter' ),
|
278 |
'xml' => __( 'HTML / XHTML / XML / XSLT', 'syntaxhighlighter' ),
|
279 |
'yaml' => __( 'YAML', 'syntaxhighlighter' ),
|
280 |
) );
|
281 |
+
// phpcs:enable
|
282 |
|
283 |
// Add any custom brushes that aren't making use of the newer "syntaxhighlighter_brush_names" filter.
|
284 |
foreach ( $this->brushes as $slug => $language ) {
|
534 |
'makeURLsClickable' => 'autolinks',
|
535 |
'quickCode' => 'quickcode',
|
536 |
);
|
537 |
+
$classnames = ! empty( $attributes['className'] ) ? [ esc_attr( $attributes['className'] ) ] : [];
|
538 |
+
if ( ! empty( $attributes['align'] ) ) {
|
539 |
+
$classnames[] = 'align' . esc_attr( $attributes['align'] );
|
540 |
}
|
541 |
|
542 |
foreach ( $remaps as $from => $to ) {
|
555 |
|
556 |
// Undo escaping done by WordPress
|
557 |
$code = htmlspecialchars_decode( $code );
|
558 |
+
$code = preg_replace( '/^(\s*https?:)�?47;�?47;([^\s<>"]+\s*)$/m', '$1//$2', $code );
|
559 |
|
560 |
$code = $this->shortcode_callback( $attributes, $code, 'code' );
|
561 |
|
562 |
+
return '<div class="wp-block-syntaxhighlighter-code ' . esc_attr( join( ' ', $classnames ) ) . '">' . $code . '</div>';
|
563 |
}
|
564 |
|
565 |
// Add the custom TinyMCE plugin which wraps plugin shortcodes in <pre> in TinyMCE
|
589 |
function settings_link( $links, $file ) {
|
590 |
static $this_plugin;
|
591 |
|
592 |
+
if ( empty( $this_plugin ) ) {
|
593 |
$this_plugin = plugin_basename(__FILE__);
|
594 |
+
}
|
595 |
|
596 |
+
if ( $file == $this_plugin ) {
|
597 |
$links[] = '<a href="' . admin_url( 'options-general.php?page=syntaxhighlighter' ) . '">' . __( 'Settings', 'syntaxhighlighter' ) . '</a>';
|
598 |
+
}
|
599 |
|
600 |
return $links;
|
601 |
}
|
795 |
// The callback function for SyntaxHighlighter::encode_shortcode_contents()
|
796 |
function encode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
|
797 |
$this->encoded = true;
|
798 |
+
$code = str_replace( array_keys( $this->specialchars ), array_values( $this->specialchars ), htmlspecialchars( $code ) );
|
799 |
return '[' . $tag . $this->atts2string( $atts ) . "]{$code}[/$tag]";
|
800 |
}
|
801 |
|
804 |
// Shortcode attribute values need to not be quoted with TinyMCE disabled for some reason (weird bug)
|
805 |
function decode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
|
806 |
$quotes = ( user_can_richedit() ) ? true : false;
|
807 |
+
$code = str_replace( array_values( $this->specialchars ), array_keys( $this->specialchars ), htmlspecialchars_decode( $code ) );
|
808 |
return '[' . $tag . $this->atts2string( $atts, $quotes ) . "]{$code}[/$tag]";
|
809 |
}
|
810 |
|
848 |
|
849 |
// Run SyntaxHighlighter::decode_shortcode_contents_callback() on the contents of the text widget form
|
850 |
function widget_text_form( $instance, $widgetclass ) {
|
851 |
+
if ( 'text' == $widgetclass->id_base && ! empty( $instance['syntaxhighlighter_encoded'] ) ) {
|
852 |
$instance['text'] = $this->shortcode_hack( $instance['text'], array( $this, 'decode_shortcode_contents_callback' ) );
|
853 |
}
|
854 |
|
858 |
|
859 |
// Run SyntaxHighlighter::parse_shortcodes() on the contents of a text widget
|
860 |
function widget_text_output( $content, $instance = false ) {
|
861 |
+
$this->codeformat = ( false === $instance || empty( $instance['syntaxhighlighter_encoded'] ) ) ? 1 : 2;
|
862 |
$content = $this->parse_shortcodes( $content );
|
863 |
$this->codeformat = false;
|
864 |
|
879 |
// This function determines what version of SyntaxHighlighter was used when the post was written
|
880 |
// This is because the code was stored differently for different versions of SyntaxHighlighter
|
881 |
function get_code_format( $post ) {
|
882 |
+
if ( false !== $this->codeformat ) {
|
883 |
return $this->codeformat;
|
884 |
+
}
|
885 |
|
886 |
+
if ( empty( $post ) ) {
|
887 |
$post = new stdClass();
|
888 |
+
}
|
889 |
|
890 |
if ( null !== $version = apply_filters( 'syntaxhighlighter_pre_getcodeformat', null, $post ) )
|
891 |
return $version;
|
892 |
|
893 |
+
$version = ( empty( $post->ID ) || get_post_meta( $post->ID, '_syntaxhighlighter_encoded', true ) || get_post_meta( $post->ID, 'syntaxhighlighter_encoded', true ) ) ? 2 : 1;
|
894 |
|
895 |
return apply_filters( 'syntaxhighlighter_getcodeformat', $version, $post );
|
896 |
}
|
908 |
|
909 |
// Transforms an attributes array into a 'key="value"' format (i.e. reverses the process)
|
910 |
function atts2string( $atts, $quotes = true ) {
|
911 |
+
if ( empty( $atts ) ) {
|
912 |
return '';
|
913 |
+
}
|
914 |
|
915 |
$atts = $this->attributefix( $atts );
|
916 |
|
917 |
// Re-map [code="php"] style tags
|
918 |
+
if ( isset( $atts[0] ) ) {
|
919 |
+
if ( empty( $atts['language'] ) ) {
|
920 |
$atts['language'] = $atts[0];
|
921 |
+
}
|
922 |
|
923 |
+
unset( $atts[0] );
|
924 |
}
|
925 |
|
926 |
$strings = array();
|
941 |
function maybe_output_scripts() {
|
942 |
global $wp_styles;
|
943 |
|
944 |
+
if ( 1 == $this->settings['loadallbrushes'] ) {
|
945 |
$this->usedbrushes = array_flip( array_values( $this->brushes ) );
|
946 |
+
}
|
947 |
|
948 |
+
if ( empty( $this->usedbrushes ) ) {
|
949 |
return;
|
950 |
+
}
|
951 |
|
952 |
$scripts = array();
|
953 |
foreach ( $this->usedbrushes as $brush => $unused )
|
961 |
echo " var corecss = document.createElement('link');\n";
|
962 |
echo " var themecss = document.createElement('link');\n";
|
963 |
|
964 |
+
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
|
965 |
$wp_styles = new WP_Styles();
|
966 |
+
}
|
967 |
|
968 |
$needcore = false;
|
969 |
if ( 'none' == $this->settings['theme'] ) {
|
970 |
$needcore = true;
|
971 |
} else {
|
972 |
+
$theme = ( ! empty( $this->themes[ $this->settings['theme'] ] ) ) ? strtolower( $this->settings['theme'] ) : $this->defaultsettings['theme'];
|
973 |
$theme = 'syntaxhighlighter-theme-' . $theme;
|
974 |
|
975 |
// See if the requested theme has been registered
|
976 |
+
if ( ! empty( $wp_styles ) && ! empty( $wp_styles->registered ) && ! empty( $wp_styles->registered[ $theme ] ) && ! empty( $wp_styles->registered[ $theme ]->src ) ) {
|
977 |
|
978 |
// Users can register their own stylesheet and may opt to not load the core stylesheet if they wish for some reason
|
979 |
+
if ( is_array( $wp_styles->registered[ $theme ]->deps ) && in_array( 'syntaxhighlighter-core', $wp_styles->registered[ $theme ]->deps ) ) {
|
980 |
$needcore = true;
|
981 |
+
}
|
982 |
}
|
983 |
|
984 |
// Otherwise use the default theme
|
988 |
}
|
989 |
}
|
990 |
|
991 |
+
if ( $needcore && ! empty( $wp_styles ) && ! empty( $wp_styles->registered ) && ! empty( $wp_styles->registered['syntaxhighlighter-core'] ) && ! empty( $wp_styles->registered['syntaxhighlighter-core']->src ) ) :
|
992 |
$corecssurl = add_query_arg( 'ver', $this->agshver, $wp_styles->registered['syntaxhighlighter-core']->src );
|
993 |
$corecssurl = apply_filters( 'syntaxhighlighter_csscoreurl', $corecssurl );
|
994 |
?>
|
1006 |
endif; // Endif $needcore
|
1007 |
|
1008 |
if ( 'none' != $this->settings['theme'] ) : ?>
|
1009 |
+
var themecssurl = "<?php echo esc_js( apply_filters( 'syntaxhighlighter_cssthemeurl', add_query_arg( 'ver', $this->agshver, $wp_styles->registered[ $theme ]->src ) ) ); ?>";
|
1010 |
if ( themecss.setAttribute ) {
|
1011 |
themecss.setAttribute( "rel", "stylesheet" );
|
1012 |
themecss.setAttribute( "type", "text/css" );
|
1043 |
break;
|
1044 |
}
|
1045 |
|
1046 |
+
if ( 1 != $this->settings['autolinks'] ) {
|
1047 |
echo " SyntaxHighlighter.defaults['auto-links'] = false;\n";
|
1048 |
+
}
|
1049 |
|
1050 |
+
if ( ! empty( $this->settings['classname'] ) ) {
|
1051 |
echo " SyntaxHighlighter.defaults['class-name'] = '" . $this->js_escape_singlequotes( $this->settings['classname'] ) . "';\n";
|
1052 |
+
}
|
1053 |
|
1054 |
+
if ( 1 == $this->settings['collapse'] ) {
|
1055 |
echo " SyntaxHighlighter.defaults['collapse'] = true;\n";
|
1056 |
+
}
|
1057 |
|
1058 |
+
if ( 1 != $this->settings['firstline'] ) {
|
1059 |
echo " SyntaxHighlighter.defaults['first-line'] = " . $this->settings['firstline'] . ";\n";
|
1060 |
+
}
|
1061 |
|
1062 |
+
if ( 1 != $this->settings['gutter'] ) {
|
1063 |
echo " SyntaxHighlighter.defaults['gutter'] = false;\n";
|
1064 |
+
}
|
1065 |
|
1066 |
/*
|
1067 |
+
if ( 1 == $this->settings['htmlscript'] ) {
|
1068 |
echo " SyntaxHighlighter.defaults['html-script'] = true;\n";
|
1069 |
+
}
|
1070 |
*/
|
1071 |
|
1072 |
+
if ( 1 == $this->settings['light'] ) {
|
1073 |
echo " SyntaxHighlighter.defaults['light'] = true;\n";
|
1074 |
+
}
|
1075 |
|
1076 |
echo " SyntaxHighlighter.defaults['pad-line-numbers'] = ";
|
1077 |
switch ( $this->settings['padlinenumbers'] ) {
|
1096 |
echo " SyntaxHighlighter.defaults['toolbar'] = false;\n";
|
1097 |
|
1098 |
// 2.x only for now
|
1099 |
+
if ( 1 != $this->settings['wraplines'] ) {
|
1100 |
echo " SyntaxHighlighter.defaults['wrap-lines'] = false;\n";
|
1101 |
+
}
|
1102 |
|
1103 |
+
if ( 1 != $this->settings['quickcode'] ) {
|
1104 |
echo " SyntaxHighlighter.defaults['quick-code'] = false;\n";
|
1105 |
+
}
|
1106 |
|
1107 |
?> SyntaxHighlighter.all();
|
1108 |
|
1124 |
|
1125 |
// No-name attribute fixing
|
1126 |
function attributefix( $atts = array() ) {
|
1127 |
+
if ( empty( $atts[0] ) ) {
|
1128 |
return $atts;
|
1129 |
+
}
|
1130 |
|
1131 |
+
if ( 0 !== preg_match( '#=("|\')(.*?)\1#', $atts[0], $match ) ) {
|
1132 |
+
// Quoted value
|
1133 |
$atts[0] = $match[2];
|
1134 |
|
1135 |
+
} elseif ( '=' == substr( $atts[0], 0, 1 ) ) {
|
1136 |
+
// Unquoted value
|
1137 |
$atts[0] = substr( $atts[0], 1 );
|
1138 |
+
}
|
1139 |
|
1140 |
return $atts;
|
1141 |
}
|
1145 |
function shortcode_callback( $atts, $code = '', $tag = false ) {
|
1146 |
global $post;
|
1147 |
|
1148 |
+
if ( false === $tag || empty( $code ) ) {
|
1149 |
return $code;
|
1150 |
+
}
|
1151 |
|
1152 |
// Avoid PHP notices
|
1153 |
+
if ( ! isset( $post ) ) {
|
1154 |
$post = null;
|
1155 |
+
}
|
1156 |
|
1157 |
$code = apply_filters( 'syntaxhighlighter_precode', $code, $atts, $tag );
|
1158 |
|
1159 |
// Error fixing for [tag="language"]
|
1160 |
+
if ( isset( $atts[0] ) ) {
|
1161 |
$atts = $this->attributefix( $atts );
|
1162 |
$atts['language'] = $atts[0];
|
1163 |
+
unset( $atts[0] );
|
1164 |
}
|
1165 |
|
1166 |
// Default out all of the available parameters to "false" (easy way to check if they're set or not)
|
1188 |
), $atts ) );
|
1189 |
|
1190 |
// Check for language shortcode tag such as [php]code[/php]
|
1191 |
+
if ( isset( $this->brushes[ $tag ] ) ) {
|
1192 |
$lang = $tag;
|
1193 |
}
|
1194 |
|
1212 |
$lang = strtolower( $lang );
|
1213 |
|
1214 |
// Validate passed attribute
|
1215 |
+
if ( ! isset( $this->brushes[ $lang ] ) ) {
|
1216 |
return $code;
|
1217 |
+
}
|
1218 |
}
|
1219 |
|
1220 |
// Switch from the alias to the real brush name (so custom aliases can be used)
|
1221 |
+
$lang = $this->brushes[ $lang ];
|
1222 |
|
1223 |
// Register this brush as used so it's script will be outputted
|
1224 |
+
$this->usedbrushes[ $lang ] = true;
|
1225 |
|
1226 |
$params = array();
|
1227 |
$params[] = "brush: $lang;";
|
1274 |
$key = strtolower( $key );
|
1275 |
|
1276 |
// Put back parameter names that have been renamed for shortcode use
|
1277 |
+
if ( ! empty( $rename_map[ $key ] ) ) {
|
1278 |
+
$key = $rename_map[ $key ];
|
1279 |
+
}
|
1280 |
|
1281 |
// This this parameter if it's unknown, not set, or the language which was already handled
|
1282 |
+
if ( empty( $allowed_atts[ $key ] ) || false === $value || in_array( $key, array( 'language', 'lang' ) ) ) {
|
1283 |
continue;
|
1284 |
+
}
|
1285 |
|
1286 |
// Sanitize values
|
1287 |
+
switch ( $allowed_atts[ $key ] ) {
|
1288 |
case 'boolean':
|
1289 |
$value = strtolower( $value );
|
1290 |
if ( 'true' === $value || '1' === $value || 'on' == $value )
|
1371 |
$title = ' title="' . esc_attr( $value ) . '"';
|
1372 |
}
|
1373 |
|
1374 |
+
$code = ( false === strpos( $code, '<' ) && false === strpos( $code, '>' ) && 2 == $this->get_code_format( $post ) ) ? strip_tags( $code ) : htmlspecialchars( $code );
|
1375 |
|
1376 |
// Escape shortcodes
|
1377 |
$code = preg_replace( '/\[/', '[', $code );
|
1389 |
|
1390 |
<script type="text/javascript">
|
1391 |
// <![CDATA[
|
1392 |
+
jQuery(document).ready(function( $ ) {
|
1393 |
// Confirm pressing of the "Reset to Defaults" button
|
1394 |
$("#syntaxhighlighter-defaults").click(function(){
|
1395 |
var areyousure = confirm("<?php echo esc_js( __( 'Are you sure you want to reset your settings to the defaults?', 'syntaxhighlighter' ) ); ?>");
|
1396 |
if ( true != areyousure ) return false;
|
1397 |
});
|
1398 |
+
<?php if ( ! empty( $_GET['defaults'] ) ) : ?>
|
1399 |
$("#message p strong").text("<?php echo esc_js( __( 'Settings reset to defaults.', 'syntaxhighlighter' ) ); ?>");
|
1400 |
+
<?php endif; ?>
|
1401 |
});
|
1402 |
// ]]>
|
1403 |
</script>
|
1592 |
<?php
|
1593 |
echo wp_kses(
|
1594 |
sprintf(
|
1595 |
+
// translators: %1$s Lang parameter; %2$s Language parameter; %3$s List of brush names.
|
1596 |
_x(
|
1597 |
+
'%1$s or %2$s — The language syntax to highlight with. You can alternately just use that as the tag, such as <code>[php]code[/php]</code>. Available tags: %3$s.',
|
1598 |
'language parameter',
|
1599 |
'syntaxhighlighter'
|
1600 |
),
|
1601 |
'<code>lang</code>',
|
1602 |
'<code>language</code>',
|
1603 |
+
implode( ', ', array_keys( $this->brushes ) )
|
1604 |
),
|
1605 |
array(
|
1606 |
'a' => array(
|
1803 |
|
1804 |
// Validate the settings sent from the settings page
|
1805 |
function validate_settings( $settings ) {
|
1806 |
+
// phpcs:ignore WordPress.Security.NonceVerification -- Used only for check.
|
1807 |
+
if ( ! empty( $_POST['syntaxhighlighter-defaults'] ) ) {
|
1808 |
$settings = $this->defaultsettings;
|
1809 |
$_REQUEST['_wp_http_referer'] = add_query_arg( 'defaults', 'true', $_REQUEST['_wp_http_referer'] );
|
1810 |
} else {
|
1811 |
+
$settings['shversion'] = ( ! empty( $settings['shversion'] ) && 2 == $settings['shversion'] ) ? 2 : 3;
|
1812 |
|
1813 |
+
$settings['theme'] = ( ! empty( $settings['theme'] ) && isset( $this->themes[ $settings['theme'] ] ) ) ? strtolower( $settings['theme'] ) : $this->defaultsettings['theme'];
|
1814 |
|
1815 |
+
$settings['loadallbrushes'] = ( ! empty( $settings['loadallbrushes'] ) ) ? 1 : 0;
|
1816 |
+
$settings['autolinks'] = ( ! empty( $settings['autolinks'] ) ) ? 1 : 0;
|
1817 |
+
$settings['collapse'] = ( ! empty( $settings['collapse'] ) ) ? 1 : 0;
|
1818 |
+
$settings['gutter'] = ( ! empty( $settings['gutter'] ) ) ? 1 : 0;
|
1819 |
+
$settings['light'] = ( ! empty( $settings['light'] ) ) ? 1 : 0;
|
1820 |
+
$settings['smarttabs'] = ( ! empty( $settings['smarttabs'] ) ) ? 1 : 0;
|
1821 |
+
$settings['toolbar'] = ( ! empty( $settings['toolbar'] ) ) ? 1 : 0; // May be overridden below
|
1822 |
+
$settings['wraplines'] = ( ! empty( $settings['wraplines'] ) ) ? 1 : 0; // 2.x only for now
|
1823 |
+
$settings['quickcode'] = ( ! empty( $settings['quickcode'] ) ) ? 1 : 0; // 3.x only for now
|
1824 |
|
1825 |
// If the version changed, then force change the toolbar version setting
|
1826 |
if ( $settings['shversion'] != $this->settings['shversion'] ) {
|
1830 |
if ( 'true' != $settings['padlinenumbers'] && 'false' != $settings['padlinenumbers'] )
|
1831 |
$settings['padlinenumbers'] = (int) $settings['padlinenumbers'];
|
1832 |
|
1833 |
+
$settings['classname'] = ( ! empty( $settings['classname'] ) ) ? preg_replace( '/[^ A-Za-z0-9_-]*/', '', $settings['classname'] ) : '';
|
1834 |
+
$settings['firstline'] = (int) ( ( ! empty( $settings['firstline'] ) ) ? $settings['firstline'] : $this->defaultsettings['firstline'] );
|
1835 |
+
$settings['tabsize'] = (int) ( ( ! empty( $settings['tabsize'] ) ) ? $settings['tabsize'] : $this->defaultsettings['tabsize'] );
|
1836 |
}
|
1837 |
|
1838 |
return $settings;
|
syntaxhighlighter3/scripts/shBrushGo.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* SyntaxHighlighter
|
3 |
+
* http://alexgorbatchev.com/SyntaxHighlighter
|
4 |
+
*
|
5 |
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6 |
+
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
7 |
+
*
|
8 |
+
* @version
|
9 |
+
* 3.0.83 (Wed, 16 Apr 2014 03:56:09 GMT)
|
10 |
+
*
|
11 |
+
* @copyright
|
12 |
+
* Copyright (C) 2004-2013 Alex Gorbatchev.
|
13 |
+
*
|
14 |
+
* @license
|
15 |
+
* Dual licensed under the MIT and GPL licenses.
|
16 |
+
*/
|
17 |
+
(function () {
|
18 |
+
// CommonJS
|
19 |
+
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
|
20 |
+
|
21 |
+
function Brush() {
|
22 |
+
var keywords =
|
23 |
+
'bool break byte case chan complex128 complex64 const continue default defer else ' +
|
24 |
+
'fallthrough float32 float64 for func go goto if import int int16 int32 int64 int8 ' +
|
25 |
+
'interface map package range return rune select string struct switch type uint ' +
|
26 |
+
'uint16 uint32 uint64 uint8 uintptr var';
|
27 |
+
var funcs =
|
28 |
+
'append cap close complex copy imag len make new panic print println real recover delete';
|
29 |
+
var special = 'true false iota nil';
|
30 |
+
|
31 |
+
this.regexList = [
|
32 |
+
{
|
33 |
+
regex: SyntaxHighlighter.regexLib.singleLineCComments,
|
34 |
+
css: 'comments',
|
35 |
+
}, // one line comments
|
36 |
+
{ regex: /\/\*([^\*][\s\S]*?)?\*\//gm, css: 'comments' }, // multiline comments
|
37 |
+
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
|
38 |
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
39 |
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
40 |
+
{ regex: XRegExp('`([^\\\\`]|\\\\.)*`', 'gs'), css: 'string' }, // strings
|
41 |
+
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
42 |
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
43 |
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // built-in functions
|
44 |
+
{ regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }, // literals
|
45 |
+
];
|
46 |
+
|
47 |
+
this.forHtmlScript({
|
48 |
+
left: /(<|<)%[@!=]?/g,
|
49 |
+
right: /%(>|>)/g,
|
50 |
+
});
|
51 |
+
}
|
52 |
+
|
53 |
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
54 |
+
Brush.aliases = ['go', 'golang'];
|
55 |
+
|
56 |
+
SyntaxHighlighter.brushes.Go = Brush;
|
57 |
+
|
58 |
+
// CommonJS
|
59 |
+
typeof exports != 'undefined' ? (exports.Brush = Brush) : null;
|
60 |
+
})();
|
syntaxhighlighter3/scripts/shBrushHaskell.js
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Haskell Brushes for SyntaxHighlighter 3.0
|
3 |
+
*/
|
4 |
+
(function () {
|
5 |
+
// CommonJS
|
6 |
+
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
|
7 |
+
|
8 |
+
function Brush() {
|
9 |
+
var keywords = 'as case of class data default deriving do forall foreign hiding ' +
|
10 |
+
'if then else import instance let in mdo module newtype qualified type where';
|
11 |
+
|
12 |
+
this.regexList = [
|
13 |
+
{ regex: /{-#[\s\S]*?#-}/g, css: 'preprocessor' },
|
14 |
+
{ regex: /--.*/g, css: 'comments' }, // one line comments
|
15 |
+
{ regex: /{-(?!\$)[\s\S]*?-}/gm, css: 'comments' }, // multiline comments
|
16 |
+
{ regex: /'.'/g, css: 'string' }, // chars
|
17 |
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
18 |
+
{ regex: /(-|!|#|\$|%|&|\*|\+|\/|<|=|>|\?|@|\^|\||~|:|\.|\\)+/g, css: 'keyword bold' },
|
19 |
+
{ regex: /`[a-z][a-z0-9_']*`/g, css: 'keyword bold' }, // infix operators
|
20 |
+
{ regex: /\b(\d+|0x[0-9a-f]+)\b/gi, css: 'value' }, // integer
|
21 |
+
{ regex: /\b\d+(\.\d*)?([eE][+-]?\d+)?\b/gi, css: 'value' }, // floating number
|
22 |
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }
|
23 |
+
];
|
24 |
+
|
25 |
+
this.forHtmlScript({
|
26 |
+
left : /(<|<)%[@!=]?/g,
|
27 |
+
right : /%(>|>)/g
|
28 |
+
});
|
29 |
+
}
|
30 |
+
|
31 |
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
32 |
+
Brush.aliases = ['haskell'];
|
33 |
+
|
34 |
+
SyntaxHighlighter.brushes.Haskell = Brush;
|
35 |
+
|
36 |
+
// CommonJS
|
37 |
+
typeof exports != 'undefined' ? (exports.Brush = Brush) : null;
|
38 |
+
})();
|
syntaxhighlighter3/scripts/shBrushXml.js
CHANGED
@@ -48,7 +48,7 @@
|
|
48 |
|
49 |
if (tag != null)
|
50 |
result.push(
|
51 |
-
new constructor(tag.name, match.index + tag[0].
|
52 |
);
|
53 |
|
54 |
return result;
|
48 |
|
49 |
if (tag != null)
|
50 |
result.push(
|
51 |
+
new constructor(tag.name, match.index + tag[0].lastIndexOf(tag.name), 'keyword')
|
52 |
);
|
53 |
|
54 |
return result;
|
syntaxhighlighter3/styles/shCore.css
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*
|
8 |
* @version
|
9 |
* 3.0.83 (July 02 2010)
|
10 |
-
*
|
11 |
* @copyright
|
12 |
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
13 |
*
|
@@ -65,6 +65,7 @@
|
|
65 |
overflow: auto !important;
|
66 |
overflow-y: hidden !important;
|
67 |
font-size: 1em !important;
|
|
|
68 |
}
|
69 |
.syntaxhighlighter code {
|
70 |
display: inline !important;
|
@@ -87,7 +88,7 @@
|
|
87 |
}
|
88 |
.syntaxhighlighter table caption {
|
89 |
text-align: left !important;
|
90 |
-
padding:
|
91 |
}
|
92 |
.syntaxhighlighter table td.code {
|
93 |
width: 100% !important;
|
@@ -95,6 +96,14 @@
|
|
95 |
.syntaxhighlighter table td.code .container {
|
96 |
position: relative !important;
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
.syntaxhighlighter table td.code .container textarea {
|
99 |
box-sizing: border-box !important;
|
100 |
position: absolute !important;
|
@@ -110,10 +119,11 @@
|
|
110 |
}
|
111 |
.syntaxhighlighter table td.gutter .line {
|
112 |
text-align: right !important;
|
113 |
-
padding: 0 0.5em 0
|
|
|
114 |
}
|
115 |
.syntaxhighlighter table td.code .line {
|
116 |
-
padding: 0
|
117 |
}
|
118 |
.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {
|
119 |
padding-left: 0em !important;
|
7 |
*
|
8 |
* @version
|
9 |
* 3.0.83 (July 02 2010)
|
10 |
+
*
|
11 |
* @copyright
|
12 |
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
13 |
*
|
65 |
overflow: auto !important;
|
66 |
overflow-y: hidden !important;
|
67 |
font-size: 1em !important;
|
68 |
+
padding: 0.5em 1em !important;
|
69 |
}
|
70 |
.syntaxhighlighter code {
|
71 |
display: inline !important;
|
88 |
}
|
89 |
.syntaxhighlighter table caption {
|
90 |
text-align: left !important;
|
91 |
+
padding: 0 0 0.5em 0 !important;
|
92 |
}
|
93 |
.syntaxhighlighter table td.code {
|
94 |
width: 100% !important;
|
96 |
.syntaxhighlighter table td.code .container {
|
97 |
position: relative !important;
|
98 |
}
|
99 |
+
/**
|
100 |
+
* Resolve conflict with Bootstrap CSS-based themes.
|
101 |
+
*/
|
102 |
+
.syntaxhighlighter table td.code .container:after,
|
103 |
+
.syntaxhighlighter table td.code .container:before {
|
104 |
+
display: block !important;
|
105 |
+
content: "";
|
106 |
+
}
|
107 |
.syntaxhighlighter table td.code .container textarea {
|
108 |
box-sizing: border-box !important;
|
109 |
position: absolute !important;
|
119 |
}
|
120 |
.syntaxhighlighter table td.gutter .line {
|
121 |
text-align: right !important;
|
122 |
+
padding: 0 0.5em 0 0 !important;
|
123 |
+
margin-right: 1em !important;
|
124 |
}
|
125 |
.syntaxhighlighter table td.code .line {
|
126 |
+
padding: 0 !important;
|
127 |
}
|
128 |
.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {
|
129 |
padding-left: 0em !important;
|