SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Crossword Formatter version 0.3

(c) 2004 Alon Altman <cwd@alon.wox.org>

Distributed under the GNU General Public Licence. See the file COPYING for details.

In this package, you will find a perl script to easily format crossword puzzles for use as static web pages, or for print. The script allows for full localization and customization of formatting via CSS.

With no arguments, the cwd.pl script reads a crossword definition file from standard input and writes an HTML version of the puzzle to standard output.

The name of the crossword definition file may be given on the command line. In addition, the following mutually exclusive options are supported:

-f Fix a paritally built crossword puzzle. cwd.pl will output a fixed

       crossword definition file. This file will include definition
       placeholders for all words that need to be defined, and exclamation
       marks added to the beginning of lines containing errors.

-s Output HTML for the solution of the crossword puzzle.

STRUCTURE OF DEFINITION FILES

A crossword definition file starts with a line defining the puzzle language and title. The includes comma seperated fields as follows:

CSS,Across,Down,See,Title

The first field is the name of an additional css file to be used, for example "heb.css" for a Hebrew crossword puzzle. The next three fields are the localization strings for "Across", "Down", and "See". Use the appropriate strings for your language. The last field is the title of the puzzle to be displayed in the heading and HTML title.

After this line, one may add optional lines describing the structure of the crossword puzzle. These lines start with the letter "L" and include one character for each crossword cell. Blanks are marked with an asterisk ("*").

After the structure description, comes the definition lines, which are comma-seperated fields as follows:

row,col,dir,SOLUTION,Definition

The first field is the (zero-based) row in which the defined word starts. The next field is the (zero-based) column in which the defined word starts. TIP: These values are displayed as tooltips in the output solution HTML. The third field is the direction of the definition, 0 for down and 1 for accross. The fourth field is the actual solution text (capitalized). The fifth field is the definition text.

See an example of an input file in the file "example.cwd" in this distribution.

AUTOMATIC LETTER COUNT

Letters in the word are counted automatically. If you have multi-word solutions, simply put a pipe character ("|") between the words in the solution, for example:

3,4,1,BILL|GATES,The chairperson of Microsoft

SPLIT DEFINITIONS

The script supports automatically generated split definitions, that is definitions where the solution continues in different parts of the crossword puzzle. To generate split definitions do as follows:

  1. Write definition lines for each part of the split definition as if they were seperate definitions.
  2. For all parts of the split definition but the first, type "n" as the definition, where n is a unique number. For example, "1".
  3. In the first part of the split definition type "+n+m" and then a space before the actual definition where n and m are the unique numbers assigned to the 2nd and 3rd parts of the definition in order. This can be used of course with any number of extra definition parts.

USING THE OUTPUT HTML

To use the output HTML copy the output HTML, along with cwd.js, cwd.css and cwd-below.css to a web-accessible directory. If you have used a custom CSS file xxx copy the cwd-xxx.css to the web directory as well.

The puzzle could be solved online by clicking on the empty cells and typing, the direction is automatically selected when unambigous. In any case, double click changes direction.

PROBLEMS

If you have any problems using this script, please e-mail me at <cwd@alon.wox.org>.

Alon Altman


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.