- commit
- 5890316987b39e1289ef7d09c065c6a81bd47819
- parent
- 5c504dc923d8651e610897999f14f5de2ea7356f
- author
- Dami <dami.etoile@gmail.com>
| M | src/ | 7 | +++++++ |
| M | tests/ | 15 | +++++++++++++++ |
@@ -44,6 +44,13 @@ export function warningLines(pack, warnings = []) {
4444 const lines = [];4545 const loose = new Map();4646 for (const warning of warnings) {47+ // These notes describe pack or proof metadata, not loose rule words.48+ // Preserve their authored copy, including punctuation used in validation hints.49+ if (['RULES', 'TITLE', 'WORLD'].includes(String(warning?.word || '').toUpperCase()) && warning?.message) {50+ const prefix = warning.levelId ? `${warningProof(pack, warning)}: ` : '';51+ lines.push(`${prefix}${warning.message}`);52+ continue;53+ }4754 if (!warning.sentence) {4855 if (/thing in another proof|used as a thing here|declared as a property|property in another proof/i.test(String(warning.message || ''))) {4956 lines.push(`${warningProof(pack, warning)}: ${warningBody(warning)}`);@@ -24,3 +24,18 @@ test('formed cross-proof property ambiguity keeps its consequence', () => {
2424 'Proof 1, Key and door: SHUT is a rule word in one proof and a thing in another, so DOOR IS SHUT would turn every door into a SHUT.',2525 ]);2626 });27+28+test('pack and proof authoring notes keep their messages and scope', () => {29+ const pack = { levels: [{ id: 'long', title: 'A lengthy proof title' }] };30+ assert.deepEqual(warningLines(pack, [31+ { word: 'RULES', sentence: null, message: 'This pack was made for older rules; some proofs may play differently.' },32+ { word: 'TITLE', levelId: 'long', sentence: null, message: 'Proof titles should use 24 characters or fewer for easier reading.' },33+ { word: 'WORLD', sentence: null, message: "Tagline can't use ·; use a comma or a dash." },34+ { word: 'RULES', levelId: 'long', sentence: null, message: 'Rule text is too complex to analyze safely; reduce stacked rule alternatives.' },35+ ]), [36+ 'This pack was made for older rules; some proofs may play differently.',37+ 'Proof 1, A lengthy proof title: Proof titles should use 24 characters or fewer for easier reading.',38+ "Tagline can't use ·; use a comma or a dash.",39+ 'Proof 1, A lengthy proof title: Rule text is too complex to analyze safely; reduce stacked rule alternatives.',40+ ]);41+});