mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 22:41:58 +03:00
Merge c10a13f226 into 37cfd2144b
This commit is contained in:
commit
ef6ec6c76e
1 changed files with 9 additions and 2 deletions
|
|
@ -29,6 +29,7 @@ export class Workspace {
|
||||||
private resolving: Set<string> = new Set();
|
private resolving: Set<string> = new Set();
|
||||||
private parsedRefsCache = new Map<string, { text: string; refs: string[] }>();
|
private parsedRefsCache = new Map<string, { text: string; refs: string[] }>();
|
||||||
private titleCache: Map<string, SheetSource> | null = null;
|
private titleCache: Map<string, SheetSource> | null = null;
|
||||||
|
private lowerTitleCache = new Map<string, string>();
|
||||||
|
|
||||||
constructor(private engine: SumEngine, private sheets: () => SheetSource[]) {}
|
constructor(private engine: SumEngine, private sheets: () => SheetSource[]) {}
|
||||||
|
|
||||||
|
|
@ -115,8 +116,14 @@ export class Workspace {
|
||||||
const needle = title.trim().toLowerCase();
|
const needle = title.trim().toLowerCase();
|
||||||
if (this.titleCache === null) {
|
if (this.titleCache === null) {
|
||||||
this.titleCache = new Map();
|
this.titleCache = new Map();
|
||||||
for (const s of this.sheets()) {
|
const currentSheets = this.sheets();
|
||||||
const key = s.title.trim().toLowerCase();
|
for (let i = 0, len = currentSheets.length; i < len; i++) {
|
||||||
|
const s = currentSheets[i];
|
||||||
|
let key = this.lowerTitleCache.get(s.title);
|
||||||
|
if (key === undefined) {
|
||||||
|
key = s.title.trim().toLowerCase();
|
||||||
|
this.lowerTitleCache.set(s.title, key);
|
||||||
|
}
|
||||||
if (!this.titleCache.has(key)) {
|
if (!this.titleCache.has(key)) {
|
||||||
this.titleCache.set(key, s);
|
this.titleCache.set(key, s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue