Verify HTML code submissions and auto-generate meaningful feedback messages.
Project description
htmlwhat
htmlwhat is a Python module that provides feedback on incorrect HTML code submissions. It's often used in educational platforms where students submit HTML code as part of their assignments or exercises.
Installation
# latest stable version from PyPi
pip install htmlwhat
# latest development version from GitHub
pip install git+https://github.com/arlarse/htmlwhat
Quick Start
from htmlwhat.test_exercise import test_exercise
userhtml = """
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body class="hello">
<h1>My First Heading</h1>
</body>
</html>
"""
solutionhtml = """
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body class="example">
<h1>My First Heading</h1>
</body>
</html>
"""
test = "Ex().check_body().has_equal_attr()"
print(test_exercise(
test,
userhtml,
solutionhtml,
))
Output:
{'correct': False, 'message': 'Inspect the <code><body></code> tag. Expected attribute <code>class</code> to be <code>"example"</code>, but found <code>"hello"</code>.'}
Problems after installation
htmlwhat built over protowhat which uses jinja2==2.11.3, and jinja uses MarkupSafe==2.0.1.
Hence you will face this error
ImportError: cannot import name 'soft_unicode' from 'markupsafe'
so install the latest version of jinja2 using the following command:
pip install --upgrade jinja2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htmlwhat-1.0.2.tar.gz.
File metadata
- Download URL: htmlwhat-1.0.2.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
008c32a37c5cdc44b997bfc95bca5477c3e5559dbc375cadb0c97f7b6734d2cf
|
|
| MD5 |
7e14a8a96319af69ce7c8452fcddcbda
|
|
| BLAKE2b-256 |
1cd54d9a770e352729d064d2d9eb1e903264587ece8bd2e99459ec9459e40612
|
File details
Details for the file htmlwhat-1.0.2-py3-none-any.whl.
File metadata
- Download URL: htmlwhat-1.0.2-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d2044cf13b208945764974d406dbb62a8ada5ebbe84990a67b4ab12136db000
|
|
| MD5 |
68e1993f2047b7f0a9da16b71b124fc2
|
|
| BLAKE2b-256 |
3c85920fa14ba378fdd2d272eb3655c54548c13beeb0f159faa146e6afebb6cc
|