diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/data/checks.js | 9 | ||||
| -rw-r--r-- | src/data/thing.js | 21 | ||||
| -rw-r--r-- | src/find-reverse.js | 4 | ||||
| -rw-r--r-- | src/static/css/page.css | 4 |
4 files changed, 31 insertions, 7 deletions
diff --git a/src/data/checks.js b/src/data/checks.js index 88dfbc6d..fcafbaca 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -568,7 +568,16 @@ export function filterReferenceErrors(wikiData, { break; default: + if (findFnKey.startsWith('_')) { + throw new Error(`Unknown specially handled find function "${findFnKey}"`); + } + findFn = boundFind[findFnKey]; + + if (!findFn) { + throw new Error(`Unknown find function "${findFnKey}"`); + } + break; } diff --git a/src/data/thing.js b/src/data/thing.js index f5afe076..621dff5a 100644 --- a/src/data/thing.js +++ b/src/data/thing.js @@ -67,7 +67,11 @@ export default class Thing extends CacheableObject { name = colors.yellow(`couldn't get name`); } - let reference = Thing.inspectReference(this, {showConstructor: false}); + let reference = + Thing.inspectReference(this, { + showConstructor: false, + showName: false, + }); return ( (name ? `${constructorName} ${name}` : `${constructorName}`) + @@ -120,7 +124,10 @@ export default class Thing extends CacheableObject { return `${thing.constructor[Thing.referenceType]}:${thing.directory}`; } - static inspectReference(thing, {showConstructor = true} = {}) { + static inspectReference(thing, { + showConstructor = true, + showName = true, + } = {}) { const referenceType = thing.constructor[Thing.referenceType] ?? null; @@ -145,12 +152,12 @@ export default class Thing extends CacheableObject { if (directoryPart && referenceType) { return colors.blue(`${referenceType}:${directoryPart}`); - } else if (directoryPart) { - return constructorPart + `(${colors.blue(directoryPart)})`; - } else if (tryToGet('name')) { - return constructorPart + `(named ${inspect(thing.name)}`; + } if (directoryPart) { + return constructorPart + `${colors.blue(directoryPart)}`; + } else if (showName && tryToGet('name')) { + return constructorPart + `named ${inspect(thing.name)}`; } else if (errored && directoryErrored) { - return constructorPart + `(${colors.yellow(`couldn't compute reference`)})`; + return constructorPart + `${colors.yellow(`couldn't compute reference`)}`; } else { return constructorPart; } diff --git a/src/find-reverse.js b/src/find-reverse.js index c99a4a71..770ac7f3 100644 --- a/src/find-reverse.js +++ b/src/find-reverse.js @@ -121,6 +121,10 @@ export function bind(wikiData, opts1, { ? wikiData : wikiData[spec.bindTo]); + if (!data) { + throw new Error(`Couldn't find data for ${key}, bindTo: ${spec.bindTo}`); + } + bound[key] = (opts1 ? (ref, opts2) => diff --git a/src/static/css/page.css b/src/static/css/page.css index 2ce4c02b..982a3021 100644 --- a/src/static/css/page.css +++ b/src/static/css/page.css @@ -550,6 +550,10 @@ font-size: 1.25em; } + .sidebar h1 a { + word-break: break-word; + } + .sidebar h2 { font-size: 1.1em; margin: 0; |