This is an automated email from the ASF dual-hosted git repository. epugh pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/solr.git
commit 94581162b90a81e508c8d21f4d163878bb6064d1 Author: Eric Pugh <[email protected]> AuthorDate: Wed Oct 14 17:40:53 2026 +0100 Use updated highlighter code. --- solr/webapp/web/css/angular/common.css | 8 ++++-- solr/webapp/web/index.html | 2 +- solr/webapp/web/js/angular/app.js | 2 +- solr/webapp/web/libs/highlight.js | 31 ------------------------ solr/webapp/web/libs/highlight.js-11.12.0.min.js | 17 +++++++++++++ 5 files changed, 25 insertions(+), 35 deletions(-) diff --git a/solr/webapp/web/css/angular/common.css b/solr/webapp/web/css/angular/common.css index df87254a803..0d06795694f 100644 --- a/solr/webapp/web/css/angular/common.css +++ b/solr/webapp/web/css/angular/common.css @@ -465,9 +465,11 @@ pre.syntax.language-json .number color: blue; } -pre.syntax.language-json .literal +pre.syntax.language-json .literal, +pre.syntax.language-json .literal .keyword { color: firebrick; + font-weight: normal; } pre.syntax .string, @@ -515,6 +517,7 @@ pre.syntax .django .tag .keyword } pre.syntax .attribute, +pre.syntax .attr, pre.syntax .variable, pre.syntax .instancevar, pre.syntax .lisp .body @@ -522,7 +525,8 @@ pre.syntax .lisp .body color: #008080; } -pre.syntax.language-json .attribute +pre.syntax.language-json .attribute, +pre.syntax.language-json .attr { color: black; font-weight: bold; diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html index 46535d6b742..6f63331ada2 100644 --- a/solr/webapp/web/index.html +++ b/solr/webapp/web/index.html @@ -65,7 +65,7 @@ limitations under the License. <script src="libs/angular-route.min.js?_=${version}"></script> <script src="libs/angular-cookies.min.js?_=${version}"></script> <script src="libs/ngtimeago.js?_=${version}"></script> - <script src="libs/highlight.js?_=${version}"></script> + <script src="libs/highlight.js-11.12.0.min.js?_=${version}"></script> <script src="libs/d3.js?_=${version}"></script> <script src="libs/ui-grid.min.js?_=${version}"></script> <script src="libs/solr/index.js"></script> diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js index aba91049975..20bd0078fc7 100644 --- a/solr/webapp/web/js/angular/app.js +++ b/solr/webapp/web/js/angular/app.js @@ -204,7 +204,7 @@ solrAdminApp.config([ }) .filter('highlight', function($sce) { return function(input, lang) { - if (lang && input && lang!="txt" && lang!="csv") return hljs.highlight(lang, input).value; + if (lang && input && hljs.getLanguage(lang)) return hljs.highlight(input, {language: lang}).value; return input; } }) diff --git a/solr/webapp/web/libs/highlight.js b/solr/webapp/web/libs/highlight.js deleted file mode 100644 index 527c3406719..00000000000 --- a/solr/webapp/web/libs/highlight.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - -Copyright (c) 2006, Ivan Sagalaev -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * 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. - * Neither the name of highlight.js 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 REGENTS 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 REGENTS AND 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. - -*/ - -var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" " [...] diff --git a/solr/webapp/web/libs/highlight.js-11.12.0.min.js b/solr/webapp/web/libs/highlight.js-11.12.0.min.js new file mode 100644 index 00000000000..3489b5b2292 --- /dev/null +++ b/solr/webapp/web/libs/highlight.js-11.12.0.min.js @@ -0,0 +1,17 @@ +/* + * highlight.js 11.12.0 - https://github.com/highlightjs/highlight.js + * Copyright (c) 2006, Ivan Sagalaev. BSD-3-Clause license (see NOTICE.txt). + * + * Custom minimal build: core + json, xml, javascript language modules only + * -- the languages the Solr Admin UI actually passes to the 'highlight' + * Angular filter (json/xml/csv from the Query wt selector and file + * extensions in Files/ZK admin; csv/txt skip highlighting entirely). + * python/ruby/php were dropped after SOLR-17494 removed those response + * writers server-side, so the UI can no longer produce content in them. + * Built with: + * npm install [email protected] esbuild + * npx esbuild entry.js --bundle --minify --format=iife + */ +(()=>{var fn=Object.create;var Ie=Object.defineProperty;var dn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var bn=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var _n=(e,n,t,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of hn(n))!pn.call(e,h)&&h!==t&&Ie(e,h,{get:()=>n[h],enumerable:!(c=dn(n,h))||c.enumerable});return e};var Nn=(e,n,t)=>(t=e!=nul [...] +https://github.com/highlightjs/highlight.js/issues/2277`),M=s,E=l),g===void 0&&(g=!0);let O={code:E,language:M};z("before:highlight",O);let y=O.result?O.result:C(O.language,O.code,g);return y.code=O.code,z("after:highlight",y),y}function C(s,l,g,E){let M=Object.create(null);function O(r,o){return r.keywords[o]}function y(){if(!f.keywords){A.addText(N);return}let r=0;f.keywordPatternRe.lastIndex=0;let o=f.keywordPatternRe.exec(N),d="";for(;o;){d+=N.substring(r,o.index);let p=v.case_insens [...] +`),1;if(he>1e5&&he>o.index*3)throw new Error("potential infinite loop, way more iterations than matches");return N+=d,d.length}let v=T(s);if(!v)throw U(b.replace("{}",s)),new Error('Unknown language: "'+s+'"');let ln=rt(v),de="",f=E||ln,we={},A=new i.__emitter(i);on();let N="",te=0,P=0,he=0,Ee=!1;try{if(v.__emitTokens)v.__emitTokens(l,A);else{for(f.matcher.considerAll();;){he++,Ee?Ee=!1:f.matcher.considerAll(),f.matcher.lastIndex=P;let r=f.matcher.exec(l);if(!r)break;let o=l.substring(P, [...]
