{crossword}

A crossword made from a list of words: a numbered SVG grid with the Across and Down clues.

Games Tag pairs

Syntax

{crossword} WORD: clue ... {/crossword}
{crossword solution, title='Name'} WORD: clue ... {/crossword}

Options

solution
Bare option: write the letters in the grid and the answers behind the clues.
title
The grid's accessible name, Crossword when not given.

Description

{crossword} builds a crossword from a list of words. The content is a line per word, WORD: clue; it is taken as it stands, before the level walks it, so a clue may hold braces. Spaces, hyphens and apostrophes in a word are dropped - a word is letters only.

The words are laid out on the server across and down so they cross. The layout is greedy and the same every time: the longest word first, across; then each next word, longest first, where it crosses the most letters already placed on the smallest grid, never side by side with another word. A word that fits nowhere is left out and named under the clues. The squares are numbered row by row where a word starts, and each clue carries the length of its word.

The grid is an SVG drawn empty, ready to print, beside the Across and Down clues. With solution the letters are written in the grid and the answers behind the clues; title= names the grid.

Under the strict check the tag written alone, a line without a :, a word that is not letters, a word without a clue and a word written twice are errors. The colours are --pad-crossword-square, -line, -number, -letter and -answer on .pad-crossword.

Examples

Words and clues

Five words about PAD laid out as an empty grid with the clues beside it.

Templateexamples/crossword/1-words.pad
{crossword title='PAD crossword'}
  TEMPLATE: The file that drives a PAD page
  PIPE: The bar that hands a value to a function
  ECHO: Writes a value
  LEVEL: The scope a tag opens
  IGNORE: Keeps braces from being read as tags
{/crossword}
Resultopen alone
PAD crossword 5 words on a grid of 10 by 6 squares 4 3 2 1 5

Across

  1. Writes a value (4)
  2. The file that drives a PAD page (8)

Down

  1. Keeps braces from being read as tags (6)
  2. The scope a tag opens (5)
  3. The bar that hands a value to a function (4)

With the solution

The same words with solution - the letters in the grid and the answers behind the clues.

Templateexamples/crossword/2-solution.pad
{crossword solution, title='PAD crossword, solved'}
  TEMPLATE: The file that drives a PAD page
  PIPE: The bar that hands a value to a function
  ECHO: Writes a value
  LEVEL: The scope a tag opens
  IGNORE: Keeps braces from being read as tags
{/crossword}
Resultopen alone
PAD crossword, solved 5 words on a grid of 10 by 6 squares, filled in: 4 across ECHO, 5 across TEMPLATE, 1 down IGNORE, 2 down LEVEL, 3 down PIPE R E P C 4 E H O V I N E 3 P G 2 L 1 I 5 T E M P L A T E

Across

  1. Writes a value (4) ECHO
  2. The file that drives a PAD page (8) TEMPLATE

Down

  1. Keeps braces from being read as tags (6) IGNORE
  2. The scope a tag opens (5) LEVEL
  3. The bar that hands a value to a function (4) PIPE

See also

  • {sudoku} A sudoku as a table, the givens bold - and with solve, solved on the server.
  • {chess} A chess position from FEN as an SVG board, with marked squares and arrows.