Skip to content

Add support for reading the .txt format useful for authoring crosswords. #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

viresh-ratnakar
Copy link

The .txt format (http://www.litsoft.com/across/docs/AcrossTextFormat.pdf) offers a convenient
way to author a crossword puzzle using any text editor. With this commit, we can author a .txt
file and convert it to the .puz format easily, like this:
import puz
p = puz.read('puzzle.txt')
p.save('puzzle.puz')

The .txt format (http://www.litsoft.com/across/docs/AcrossTextFormat.pdf) offers a convenient
way to author a crossword puzzle using any text editor. With this commit, we can author a .txt
file and convert it to the .puz format easily, like this:
  import puz
  p = puz.read('puzzle.txt')
  p.save('puzzle.puz')
@louispotok
Copy link

@viresh-ratnakar thank you for implementing this! @alexdej any objectio n to merging it?

If anyone else is interested, it looks like there is also a new "Across Puzzle V2" format. I used this commit on a file in that format, and it worked after the following changes:

  • the <ACROSS PUZZLE> tag is now `'
  • there is a new "rebus" section between GRID and ACROSS, I deleted it in the puzzle I was converting since it was unused, but I don't know how I would handle a non-empty one.
  • tobytes failed because the first element in self.data was an empty string (rather than a bytes object). I just changed the call to return b''.join(self.data[1:])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants