puzzmo-com / xd-crossword-tools

A single dependency for using the xd file format for crosswords: convertors (puz -> xd, xd -> json, json -> xd, json -> puz) and editor tooling for xd
MIT License
33 stars 2 forks source link

Support splits #2

Closed samanpwbb closed 2 years ago

samanpwbb commented 2 years ago

This PR introduces the concept of splits to the xd parser.

@orta for review.

orta commented 2 years ago

Cool, let's take this as is - there's a low possibility that an xd could be written like this:

 ## Grid

 OKGO
 H..B
 O..J
 H..E
 O..C
 H..T

 ## Clues

 A1. Band with two words. ~ OK|GO

 D1. Reverse santa. ~ OH|OHO|H
 D2. A thing. ~ OBJECT

## Metadata

 title: Square
 author: Orta
 date: 2021-03-16
 editor: Orta Therox
 splitcharacter: |

which might not work out, because I think this is the first time the order in the parser matters. However, I'm happy to deal with that edge case if/when we hit it.

samanpwbb commented 2 years ago

@orta The sort order issue handled should be handled here! we don’t run parseSplitsFromAnswer until after the first pass, so we're certian to have our SplitCharacter if it exists. I can add a test case if that's helpful.

orta commented 2 years ago

Ace, this is great then