Helpfeel記法を勝手に展開してリンクにしてくれるUserScript
code:script.js
var St=Reflect.get,Gt=Reflect.set;var j=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,u)=>(typeof require!="undefined"?require:s)u}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ut=Object.create,R=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyNames,ft=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,gt=e=>R(e,"__esModule",{value:!0}),mt=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),yt=(e,s,u,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of lt(s))!dt.call(e,o)&&(u||o!=="default")&&R(e,o,{get:()=>so,enumerable:!(l=ct(s,o))||l.enumerable});return e},tt=(e,s)=>yt(gt(R(e!=null?ut(ft(e)):{},"default",!s&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),et=mt((e,s)=>{(function(){var u;u=function(){var l,o,f;l=2147483648,f=256,o=l,0,0,0,h.prototype.isupper=function(r){return r>=65&&r<=90},h.prototype.islower=function(r){return r>=97&&r<=122},h.prototype.tolower=function(r){return this.isupper(r)?r+32:r},h.prototype.toupper=function(r){return this.islower(r)?r-32:r};function h(r){var n,i,t,a,p,c;for(this.source=r,this.shiftpat=[],this.epsilon=0,this.acceptpat=0,i=l,n=t=0;0<=f?t<f:t>f;n=0<=f?++t:--t)this.shiftpatn=0;for(c=this.unpack(this.source),a=0,p=c.length;a<p;a++)n=ca,n===32?this.epsilon|=i:(this.shiftpatn|=i,this.shiftpatthis.toupper(n)|=i,this.shiftpatthis.tolower(n)|=i,i>>>=1);return this.acceptpat=i,this}return h.prototype.state=function(r,n){var i,t,a,p,c,d,y,g,m;for(r==null&&(r=o),n==null&&(n=""),t=r0,a=r1,p=r2,c=r3,m=this.unpack(n),y=0,g=m.length;y<g;y++)i=my,d=this.shiftpati,c=c&this.epsilon|(c&d)>>>1|p>>>1|p,p=p&this.epsilon|(p&d)>>>1|a>>>1|a,a=a&this.epsilon|(a&d)>>>1|t>>>1|t,t=t&this.epsilon|(t&d)>>>1,a|=t>>>1,p|=a>>>1,c|=p>>>1;returnt,a,p,c},h.prototype.match=function(r,n){var i;return n==null&&(n=0),i=this.state(o,r),n<o.length||(n=o.length-1),(in&this.acceptpat)!=0},h.prototype.unpack=function(r){var n,i,t,a,p,c;for(n=[],c=r.split(""),a=0,p=c.length;a<p;a++)i=ca,t=i.charCodeAt(0),t>255&&n.push((t&65280)>>>8),n.push(t&255);return n},h}(),typeof s<"u"&&s!==null&&s.exports!=null?s.exports=u:typeof window<"u"&&window!==null&&(window.Asearch=u)}).call(e)}),vt=tt(et()),xt=tt(et()),{default:wt,...bt}=xt,rt=vt.default??wt??bt;var jt=Object.create,U=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,Ot=Object.getOwnPropertyNames,_t=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty,$t=e=>U(e,"__esModule",{value:!0}),Ht=(e=>typeof j!="undefined"?j:typeof Proxy!="undefined"?new Proxy(e,{get:(s,u)=>(typeof j!="undefined"?j:s)u}):e)(function(e){if(typeof j!="undefined")return j.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),G=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),Pt=(e,s,u,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of Ot(s))!Tt.call(e,o)&&(u||o!=="default")&&U(e,o,{get:()=>so,enumerable:!(l=kt(s,o))||l.enumerable});return e},st=(e,s)=>Pt($t(U(e!=null?jt(_t(e)):{},"default",!s&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),nt=G((e,s)=>{var u;u=function(){function l(o){this.s=o,this.a=o.split(""),this.p=0,this.t="",this.u=""}return l.prototype.gettoken=function(){if(this.u!=="")return this.t=this.u,this.u="",this.t;if(this.p>=this.a.length)return this.t="","";if(this.t=this.athis.p,this.t.match(/^[\(\|\)\*\+\?\\]$/))return this.p+=1,this.t;if(this.t==="\\")return this.t=this.a++this.p,this.t==="n"&&(this.t=` ),this.t==="t"&&(this.t=" "),this.p+=1,this.t;for(this.p+=1;this.p<this.a.length&&!this.a[this.p].match(/^[\(\|\)\*\+\?\[\]\\]$/);)this.t+=this.a[this.p++];return this.t},l.prototype.ungettoken=function(){return this.u===""?this.u=this.t:console.log("Can't ungettoken()")},l.prototype.nexttoken=function(){return this.t},l}(),s.exports=u}),it=G((e,s)=>{var u,l;l=function(){function o(f,h){this.pat=f,this.dest=h}return o.prototype.str=function(){return this.pat.split(/\t/)[0]},o.prototype.arg=function(){var f;return f=this.pat.match(/^(.*)\t(.*)$/),f?f[2]:this.pat},o}(),u=function(){o.id=1,o.nodes={};function o(){this.id=o.id,this.accept=null,this.trans=[],o.nodes[o.id++]=this,this.pars=[]}return o.prototype.addTrans=function(f,h){var r;return r=new l(f,h),this.trans.push(r)},o.node=function(f){return o.nodes[f]},o}(),s.exports=u}),qt=G((e,s)=>{var u,l,o;u=it(),o=nt(),l=function(){function f(){}return f.prototype.regexp=function(h,r){var n,i,t,a,p,c;for(r==null&&(r=!1),c=new u,n=new u,r&&(this.pars=[],this.parno=0,this.ruleid=0),c.pars=this.pars,n.pars=this.pars,a=this.regcat(h),i=a[0],t=a[1],c.addTrans("",i),r&&(t.accept=this.ruleid),t.addTrans("",n);h.gettoken()==="|"&&h.nexttoken()!=="";)r&&(this.pars=[],this.parno=0,this.ruleid+=1),p=this.regcat(h),i=p[0],t=p[1],c.addTrans("",i),r&&(t.accept=this.ruleid),t.addTrans("",n);return h.ungettoken(),[c,n]},f.prototype.regcat=function(h){var r,n,i,t,a,p;for(t=this.regfactor(h),p=t[0],r=t[1];!h.gettoken().match(/^[\)\]\|]$/)&&h.nexttoken()!=="";)h.ungettoken(),a=this.regfactor(h),n=a[0],i=a[1],r.addTrans("",n),r=i;return h.ungettoken(),[p,r]},f.prototype.regfactor=function(h){var r,n,i,t,a;return i=this.regterm(h),t=i[0],r=i[1],a=h.gettoken(),a.match(/^[\?]$/)?t.addTrans("",r):a.match(/^[\+]$/)?r.addTrans("",t):a.match(/^[\*]$/)?(n=new u,t.addTrans("",r),r.addTrans("",n),n.addTrans("",t)):h.ungettoken(),[t,r]},f.prototype.regterm=function(h){var r,n,i,t,a,p;return p=h.gettoken(),p==="("?(this.parno+=1,this.pars.push(this.parno),t=this.regexp(h),n=t[0],i=t[1],n.pars=this.pars.slice(0),p=h.gettoken(),p===")"?(this.pars.pop(),i.pars=this.pars.slice(0),[n,i]):(console.log("missing )"),null)):(a=new u,a.pars=this.pars.slice(0),r=new u,r.pars=this.pars.slice(0),a.addTrans(p,r),[a,r])},f}(),s.exports=l}),at=G((e,s)=>{var u,l,o,f,h,r;r=nt(),h=qt(),f=it(),u=rt,l=function(){function n(i,t,a,p,c){this.id=i,this.state=t??[],this.s=a??"",this.substrings=p??[],this.accept=c??!1}return n}(),o=function(){function n(i,t){i==null&&(i=""),t==null&&(t=""),this.s=[i],this.commands=[t],this.par=0}return n.prototype.add=function(i,t){return this.s[0]===""?this.s=[i]:this.s.push(i),this.commands[0]===""?this.commands=[t]:this.commands.push(t)},n.prototype.delete=function(){return this.s.pop,this.commands.pop},n.prototype.filter=function(i,t,a){var p,c,d,y,g,m,w,L,M,C,W,Y,Z,B,b,F,N,A,H,D,E,I,_,T,pt,$,z,J,K,P,q,k,x,S,v,Q,X,O;for(t==null&&(t=null),this.maxambig=a??2,k=[[],[],[]],pt=i.split("").map(function(ht){return ht.toLowerCase()}),this.asearch=new u(i),this.regexp=new h,this.scanner=new r(this.s.join("|")),z=this.regexp.regexp(this.scanner,!0),X=z[0],y=z[1],N=[],F=[{},{},{}],m={},b=[],b[0]=new l(X.id,this.asearch.state()),N[0]=b,B=L=0;L<=1e4;B=++L){for(b=N[B],E=[],M=0,W=b.length;M<W;M++)if(g=b[M],S=f.node(g.id),b.length*S.trans.length<1e5)for(J=S.trans,C=0,Y=J.length;C<Y;C++){for(O=J[C],v=g.substrings.slice(0),K=S.pars,D=0,Z=K.length;D<Z;D++)w=K[D],typeof v[w-1]>"u"&&(v[w-1]=""),v[w-1]=v[w-1]+O.arg();if(I=this.asearch.state(g.state,O.str()),x=g.s+O.str(),p=O.dest.accept,E.push(new l(O.dest.id,I,x,v,p)),p!==null){for(c=_=0,P=this.maxambig;0<=P?_<=P:_>=P;c=0<=P?++_:--_)if((t&&!m[x]||!t&&!F[c][x])&&(I[c]&this.asearch.acceptpat)!=0){if(F[c][x]=!0,m[x]=!0,Q=v.length,H=[],Q>0){for(T=[],w=$=0,q=Q;0<=q?$<q:$>q;w=0<=q?++$:--$)T.push("(.*)");T=T.join(" "),H=v.join(" ").match(T)}for(d=this.commands[p],d||(d="");A=d.match(/^(.*)(\$(\d+))(.*)$/);)d=""+A[1]+H[A[3]]+A[4];t?t([x].concat(v),d):k[c].push([x,d])}}}if(E.length===0||(N.push(E),k[0].length>100))break}return[k[0],k[1],k[2]]},n}(),String.prototype.expand=function(n,i,t){var a,p,c,d,y,g,m;if(n==null&&(n=" "),i==null&&(i=null),t==null&&(t=0),a=new o,a.add(this,""),m=[],i)return a.filter(n,i);for(d=a.filter(n),y=d[0].length>0?d[0]:d[1].length>0?d[1]:d[2],p=0,c=y.length;p<c;p++)g=y[p],m.push(g[0]);return m},s.exports=o}),Mt=st(at()),Ct=st(at()),{default:Nt,...At}=Ct,V=Mt.default??Nt??At;var Dt=e=>{let s=new V(e);try{return[...new Set(s.filter(" ").flatMap(u=>u.map(([l])=>l)))]}catch(u){if(u instanceof TypeError)return[];throw u}},ot=/^\s*\[(^\n+)\]/,Et=e=>{let s=e.match(ot);return s===null?e:\[${s[1]}]\` ${Dt(s[1].replace(/[\[\]]/g,"")).flatMap(u=>u!==""?[(${u})]:[]).join(" ")}};scrapbox.PopupMenu.addButton({title:e=>e.split(` ).some(s=>ot.test(s.trim()))?"正規表現を展開":"",onClick:e=>e.split(
).map(Et).join(
`)});