Skip to content

Commit 08ee045

Browse files
authored
Merge pull request #63 from puzzmo-com/site-update
Adds a polish pass on the site, a puz downloader and a bit more info on the cursor
2 parents 302d989 + 7110ebe commit 08ee045

File tree

14 files changed

+1453
-1065
lines changed

14 files changed

+1453
-1065
lines changed

.yarn/install-state.gz

-2.87 KB
Binary file not shown.

packages/xd-crossword-tools/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
"postpublish": "rm ./README.md"
1313
},
1414
"dependencies": {
15-
"@confuzzle/readpuz": "^1.2.3",
16-
"@confuzzle/writepuz": "^1.2.3",
1715
"xd-crossword-tools-parser": "workspace:*",
1816
"xml-parser": "1.2.1"
1917
},

packages/xd-crossword-tools/src/editorInfoAtCursor.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Clue, CrosswordJSON, CursorDirection, Position } from "xd-crossword-too
44
export type PositionInfo =
55
| { type: "noop" }
66
| { type: "grid"; position: Position; clues: { across: Clue | undefined; down: Clue | undefined } }
7-
| { type: "clue"; direction: CursorDirection; number: number }
7+
| { type: "clue"; direction: CursorDirection; number: number; lineMeta?: { type: string; value: string } }
88
| { type: "metadata"; key: string; value: string }
99

1010
export const editorInfoAtCursor =
@@ -44,15 +44,24 @@ export const editorInfoAtCursor =
4444

4545
case "clues": {
4646
const content = data.editorInfo.lines[line]
47-
const trimmed = content.toLowerCase().trim()
47+
const trimmed = content.trim()
48+
const trimmedLower = trimmed.toLowerCase()
4849

49-
if (!trimmed.startsWith("a") && !trimmed.startsWith("d")) return noop
50+
if (!trimmedLower.startsWith("a") && !trimmedLower.startsWith("d")) return noop
5051
if (!trimmed.includes(".") && !trimmed.includes("^")) return noop
5152
if (trimmed === "") return noop
5253

53-
const direction = trimmed.startsWith("a") ? "across" : "down"
54-
const numStr = trimmed.slice(1).split(" ")[0].replace(".", "")
54+
const direction = trimmedLower.startsWith("a") ? "across" : "down"
55+
const numStr = trimmedLower.slice(1).split(" ")[0].replace(".", "").replace("^", "")
5556
const number = parseInt(numStr)
57+
58+
// Check for clue metadata line (e.g., "A5 ^hint: Cell phone company...")
59+
const metaMatch = trimmed.match(/^[AD]\d+\s+\^(\w+):\s*(.*)$/i)
60+
if (metaMatch) {
61+
const lineMeta = { type: metaMatch[1].toLowerCase(), value: metaMatch[2] }
62+
return { type: "clue", direction, number, lineMeta }
63+
}
64+
5665
return { type: "clue", direction, number }
5766
}
5867

0 commit comments

Comments
 (0)