Skip to main content

Create Static HTML/Js Crosswords

Project description

htmlxword

htmlxword is

A python library that can create a interactive crossword, from an input text file, on a static page using html and javascript.

Demo

See a demo of a created crossword on github. https://trisdav.github.io/htmlxword-pages/

htmlxword usage

  • Basic usage:
htmlxword inputfile.txt -o myCrossword.html -t "Crossword Title"
  • Example input file:
Noun Person, place, or thing.
adverb A word or phrase that modifies or qualifies an adjective.
adjective A word or phrase describing an attribute.
paragraph A section of a piece of writing.
chapter A section marker in a book.
  • Arguments
short long description
-o --output What the output file should be named.
-t --title Add a title to the crossword page.
-y --config-yaml Path to a custom yaml config file.
-c --css-template Path to a custom css file.
-j --javascript Path to a custom javascript file.
-m --html-tempalte Path to a custom html template file.
-s --json input format is json
--print-config Print the contents of the default config.yaml.
--print-css Print the contents of the default csstemplate.css.
--print-javascript Print the contents of the default jstemplate.js.
--print-html Print the contnets of the default html_xword_template.html.

htmlxword depends on

The python library genxword, which creates crosswords and various formats. This uses genxword to create a layout for the crossword, and then builds a crossword in html and javascript. Genxword has several dependenices, I would refer to that project to determine the dependencies.

JSON input

The crossword clues can also be input as a JSON file. This JSON file supports hints and "with" clues. For example, the answer to the clue "Verb ending with -ing" is "present participle" which is two words. To get around this, clues will be something like "With 2 Across, Verb ending with -ing." To use this input format with the cli use the -s flag.

  • json input file
[
    {
        "word":"Noun",
        "clue":"Person, place, or thing.",
        "hintTitle":"Hint",
        "hint":"English 101"
    },
    {
        "word":"adverb",
        "clue":"A word or phrase that modifies or qualifies an adjective."
    },
    {
        "word":"present",
        "clue":"Verb ending with -ing",
        "with":4
    },
    {
        "word":"participle",
        "clue":"Verb ending with -ing",
        "with":3
    },
    {
        "word":"adjective",
        "clue":"A word or phrase describing an attribute."
    },
    {
        "word":"paragraph",
        "clue":"A section of a piece of writing."
    },
    {
        "word":"chapter",
        "clue":"A section marker in a book."
    }
]

Configurability

The heart of configurability of this project is in html_xword_template.html. Inside that file there are strings like {JS}, {CLUE} which define where to insert generated code segments. Other things can be configred in config.yaml I strongly advise viewing the template files for figuring out how to configure the outputs.

  • jstemplate.js, {JS}
  • csstemplate.css, {CSS}

config.yaml

  • superScript - Defines the html of the superscript in the first block signifying the start of a word.
  • letterBlock - Defines html of the crossword blocks that accepts inputs.
  • blankBlock - Defines html of the crossword blocks that is an empty cell.
  • crossWordRowHtml - Defines html of a crow in the crossword.
  • clueHtml - Defines html of the clue text.
  • clueListDown - Defines the list which holds the Down clues.
  • clueListAcross - Defines the list whcih holds the Across clues.
  • clueListItem - Defines an item in the clue list.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

htmlxword-0.0.9.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

htmlxword-0.0.9-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file htmlxword-0.0.9.tar.gz.

File metadata

  • Download URL: htmlxword-0.0.9.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for htmlxword-0.0.9.tar.gz
Algorithm Hash digest
SHA256 4c1df59f195550680af22337afcde57e87f57af05e93d12833d67661f1935815
MD5 83450dfa6cb14bdff96c8a22ca37b3b6
BLAKE2b-256 5f898b1d297e5a47eb055f5052ad8d9c82e58cdabfda4f2a4cb39db6a9b0195b

See more details on using hashes here.

File details

Details for the file htmlxword-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: htmlxword-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for htmlxword-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a12e67943ed8ff56819151092a2e87fd4f5edb5c26293b9e87fa52e615ae60c5
MD5 cabcd6b4f51cd5d22a09e40200ef9860
BLAKE2b-256 63f287e1c272f564b45b6fcbf8d51f5a37f342d0505cd3d3ccaf5b680c3dc852

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page