texlite 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +460 -0
- package/NPM_TESTING.md +130 -0
- package/OPERATIONS.md +246 -0
- package/README.md +78 -306
- package/README.zh-CN.md +61 -330
- package/dist/client/assets/{GitDialog-Bm5yMpQK.js → GitDialog-DdLrbz_H.js} +1 -1
- package/dist/client/assets/{HistoryDialog-Po4KHT_2.js → HistoryDialog-AlF9iozX.js} +1 -1
- package/dist/client/assets/{LatexEditor-CnKCXaHr.js → LatexEditor-DH9v1wgS.js} +22 -22
- package/dist/client/assets/{PdfPreview-Cd20VIjT.js → PdfPreview-CanYnyfJ.js} +1 -1
- package/dist/client/assets/ProjectNavigationDialogs-DiXtkTj1.js +1 -0
- package/dist/client/assets/{SystemMetricsDialog-DdOlcqqK.js → SystemMetricsDialog-DimBI7er.js} +1 -1
- package/dist/client/assets/index-CdiutUgf.css +1 -0
- package/dist/client/assets/index-vpWlpUOr.js +64 -0
- package/dist/client/assets/{minus-O6pK-6mA.js → minus-DR-ttrx3.js} +1 -1
- package/dist/client/assets/spellCheck-Wn7_eF9j.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/app.js +3 -3
- package/dist/server/compiler.js +139 -10
- package/dist/server/harper.js +210 -119
- package/dist/server/latexSpellMask.js +257 -0
- package/dist/server/projects.js +0 -12
- package/dist/server/routes/compile.js +54 -41
- package/dist/server/routes/projectFiles.js +11 -0
- package/dist/server/routes/projectShared.js +1 -1
- package/dist/server/routes/projects.js +20 -19
- package/package.json +4 -2
- package/dist/client/assets/ProjectNavigationDialogs-BDOtIoTy.js +0 -1
- package/dist/client/assets/index-MDwr9W9R.css +0 -1
- package/dist/client/assets/index-zIjCeZFK.js +0 -64
- package/dist/client/assets/spellCheck-Ce3o_xO-.js +0 -4
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as z}from"./index-zIjCeZFK.js";import"./react-BoEjKzFZ.js";const R=/([A-Za-z][A-Za-z0-9_.:/-]*(?:\s+[A-Za-z][A-Za-z0-9_.:/-]*){0,7})\s*$/,C=new Set(["tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"]),q=new Set(["math","displaymath","equation","equation*","align","align*","alignat","alignat*","gather","gather*","multline","multline*","flalign","flalign*","tikzpicture","axis","scope","pgfonlayer","pgfpicture","tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","verbatim","Verbatim","lstlisting","minted","comment","algorithmic","alignat"]),w=new Set(["documentclass","usepackage","RequirePackage","includegraphics","tikzset","pgfplotsset","hypersetup","lstset","definecolor","colorlet","setlength","setcounter","draw","path","fill","filldraw","shade","node","addplot","color","textcolor","colorbox","pagecolor"]),E=new Set(["label","hypertarget","ref","pageref","autoref","nameref","hyperref","index","gls","Gls","glspl","Glspl","cite","citep","citet","citeauthor","citeyear","citenum","parencite","textcite","autocite","footcite"]),$=5,p=new Map,Z=12;let y=!1,x=null;class b extends Error{constructor(){super("A newer writing check replaced this request."),this.name="HarperLintSupersededError"}}function D(t){return t instanceof b}function m(t,n,e){e>n&&t.push({from:n,to:e})}function g(t,n,e,o){if(t[n]!==e)return null;let i=0;for(let r=n;r<t.length;r+=1){const s=t[r-1]==="\\"&&t[r-2]!=="\\";if(!s&&t[r]===e&&(i+=1),!s&&t[r]===o&&(i-=1,i===0))return{from:n,to:r+1,end:r+1}}return null}function u(t,n){let e=n;for(;e<t.length&&/[ \t\r\n]/.test(t[e]);)e+=1;return e}function O(t,n){if(t[n]!=="%")return!1;let e=0;for(let o=n-1;o>=0&&t[o]==="\\";o-=1)e+=1;return e%2===0}function j(t){return/[=,!/]/.test(t)||/\b(?:colorbar|legend|width|height|draw|fill|style|domain|samples|anchor|at|axis)\b/.test(t)}function P(t){return E.has(t)||/^cite[A-Za-z]*/.test(t)}function I(t,n){for(let e=t.indexOf("=");e>=0;e=t.indexOf("=",e+1)){const i=Math.max(...[`
|
|
2
|
-
`,"[","{","]","}",",",";"].map(a=>t.lastIndexOf(a,e-1)+1)),s=t.slice(i,e).match(R);s?.index!==void 0&&m(n,i+s.index,e);let l=e+1;for(;l<t.length&&/\s/.test(t[l]);)l+=1;let f=l;if(t[l]==="{")f=g(t,l,"{","}")?.end??l;else for(;f<t.length&&!/[,\]\}\n]/.test(t[f]);)f+=1;m(n,l,f)}}function B(t,n,e){const o=/\\(begin|end)\s*\{\s*([^{}]+?)\s*\}/g;o.lastIndex=n;let i=1;for(let r=o.exec(t);r;r=o.exec(t))if(r[2].trim()===e){if(r[1]==="begin")i+=1;else if(--i===0)return o.lastIndex}return null}function H(t,n){for(const e of t.matchAll(/\\\((?:\\.|[^])*?\\\)|\\\[(?:\\.|[^])*?\\\]/g))e.index!==void 0&&m(n,e.index,e.index+e[0].length);for(let e=0;e<t.length;e+=1){if(t[e]!=="$"||t[e-1]==="\\")continue;const o=t[e+1]==="$"?"$$":"$",i=t.indexOf(o,e+o.length);i>=0&&(m(n,e,i+o.length),e=i+o.length-1)}}function M(t){const n=[],e=/[A-Za-z@]/;for(let i=0;i<t.length;i+=1){if(O(t,i)){const a=t.indexOf(`
|
|
3
|
-
`,i);m(n,i,a<0?t.length:a),i=a<0?t.length:a;continue}if(t[i]!=="\\")continue;const r=i;let s=i+1;if(e.test(t[s]??""))for(;s<t.length&&/[A-Za-z@0-9:_]/.test(t[s]);)s+=1;else s<t.length&&(s+=1);const l=t.slice(i+1,s);m(n,r,s);let f=u(t,s);if(l==="begin"||l==="end"){const a=g(t,f,"{","}");if(a){m(n,a.from,a.to);const d=t.slice(a.from+1,a.to-1).trim();if(f=u(t,a.end),l==="begin"){const h=g(t,f,"[","]");if(h&&(m(n,h.from,h.to),f=u(t,h.end)),C.has(d)){const c=g(t,f,"{","}");c&&m(n,c.from,c.to)}if(q.has(d)){const c=B(t,a.end,d);if(c!==null){m(n,r,c),i=c-1;continue}}}}i=s-1;continue}if(P(l))for(t[f]==="*"&&(f=u(t,f+1));;){const a=g(t,f,"[","]")??g(t,f,"{","}");if(!a)break;m(n,a.from,a.to),f=u(t,a.end)}else{const a=g(t,f,"[","]");if(a&&(w.has(l)||j(t.slice(a.from+1,a.to-1)))&&(m(n,a.from,a.to),f=u(t,a.end)),w.has(l)){const d=l==="definecolor"||l==="colorlet"?3:1;for(let h=0;h<d;h+=1){const c=g(t,f,"{","}");if(!c)break;m(n,c.from,c.to),f=u(t,c.end)}}}i=s-1}H(t,n),I(t,n);for(const i of t.matchAll(/(?:https?|ftp):\/\/[^\s]+/gi))i.index!==void 0&&m(n,i.index,i.index+i[0].length);n.sort((i,r)=>i.from-r.from||i.to-r.to);const o=[];for(const i of n){const r=o.at(-1);r&&i.from<=r.to?r.to=Math.max(r.to,i.to):o.push({...i})}return o}function k(t){const n=M(t),e=[];let o=0,i=0;for(const r of t){for(;i<n.length&&n[i].to<=o;)i+=1;const s=n[i];e.push(s&&s.from<=o&&o<s.to&&r!==`
|
|
4
|
-
`&&r!=="\r"?" ":r),o+=r.length}return e.join("")}function T(t){const n=[0];let e=0;for(const o of t)e+=o.length,n.push(e);return n}function L(t){return[...new Set(t.map(n=>n.trim()).filter(Boolean))].sort((n,e)=>n.localeCompare(e)).join("\0")}async function V(t,n,e){return(await z(`/api/projects/${t}/spellcheck`,{method:"POST",body:JSON.stringify({path:n,source:e})})).lints}function K(t,n,e,o){const i={from:e.start,to:e.end},r={from:o[e.start]??-1,to:o[e.end]??-1},s=[i,r].filter((l,f,a)=>l.from>=0&&l.to>l.from&&l.to<=t.length&&a.findIndex(d=>d.from===l.from&&d.to===l.to)===f);return s.length===0?null:s.find(l=>n.slice(l.from,l.to)===e.problem)??s.find(l=>/[A-Za-z]/.test(n.slice(l.from,l.to)))??s[0]??null}function N(t,n,e,o){const i=K(t,n,e,o);if(!i)return null;const{from:r,to:s}=i;if(!/[A-Za-z]/.test(n.slice(r,s)))return null;const l=t.slice(r,s);if(!l.trim()||/[\\%$]/.test(l))return null;const f=e.kind==="Spelling"||e.kind==="Typo"?"spelling":"grammar",a=e.suggestions.filter((d,h,c)=>h<$&&c.indexOf(d)===h);return{from:r,to:s,word:l,kind:f,message:e.message,suggestions:a}}function S(t){let n=2166136261;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`${t.length}:${n>>>0}`}function v(t,n){const e=S(t),o=p.get(e);return!o||o.source!==t||o.dictionary!==n?null:(p.delete(e),p.set(e,o),o.issues)}function _(t,n,e){const o=S(t);for(p.set(o,{source:t,dictionary:n,issues:e});p.size>Z;){const i=p.keys().next().value;if(i===void 0)break;p.delete(i)}}async function G(t,n,e){const o=L(n),i=v(t,o);if(i)return i;const r=k(t),s=T(t),l=new Set(n.map(a=>a.trim().toLocaleLowerCase("en-US")).filter(Boolean)),f=e.map(a=>N(t,r,a,s)).filter(a=>!!a).filter(a=>a.kind!=="spelling"||!l.has(a.word.trim().toLocaleLowerCase("en-US"))).sort((a,d)=>a.from-d.from||a.to-d.to);return _(t,o,f),f}async function U(t,n,e,o){const i=L(o),r=v(e,i);if(r)return r;const s=k(e),l=await V(t,n,s);return G(e,o,l)}async function A(){if(y||!x)return;const t=x;x=null,y=!0;try{t.resolve(await U(t.projectId,t.path,t.source,t.customWords))}catch(n){t.reject(n)}finally{y=!1,A()}}function F(t,n,e,o=[]){return new Promise((i,r)=>{x?.reject(new b),x={projectId:t,path:n,source:e,customWords:[...o],resolve:i,reject:r},A()})}export{b as HarperLintSupersededError,M as ignoredRanges,D as isHarperLintSupersededError,F as lintLatex,G as mapLatexLints,k as maskLatexSource};
|