# 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
```python
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:
```json
{'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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/arlarse/htmlwhat",
"name": "htmlwhat",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "htmlwhat,html,feedback,html validation,testing,html testing",
"author": "SHRAY SALVI",
"author_email": "shraysalvi@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/5a/7f/d20f63b59b8d8d718b31b0bb6a0c618e640a8ea64666947de501018957a1/htmlwhat-1.0.1.tar.gz",
"platform": null,
"description": "# htmlwhat\r\n\r\n`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.\r\n\r\n## Installation\r\n\r\n```\r\n# latest stable version from PyPi\r\npip install htmlwhat\r\n\r\n# latest development version from GitHub\r\npip install git+https://github.com/arlarse/htmlwhat\r\n```\r\n\r\n## Quick Start\r\n```python\r\nfrom htmlwhat.test_exercise import test_exercise\r\n\r\nuserhtml = \"\"\"\r\n<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <title>Title</title>\r\n </head>\r\n <body class=\"hello\">\r\n <h1>My First Heading</h1>\r\n </body>\r\n</html>\r\n\"\"\"\r\n\r\nsolutionhtml = \"\"\"\r\n<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <title>Title</title>\r\n </head>\r\n <body class=\"example\">\r\n <h1>My First Heading</h1>\r\n </body>\r\n</html>\r\n\"\"\"\r\n\r\ntest = \"Ex().check_body().has_equal_attr()\"\r\n\r\nprint(test_exercise(\r\n test,\r\n userhtml,\r\n solutionhtml,\r\n))\r\n```\r\nOutput:\r\n```json\r\n{'correct': False, 'message': 'Inspect the <code><body></code> tag. Expected attribute <code>class</code> to be <code>\"example\"</code>, but found <code>\"hello\"</code>.'}\r\n```\r\n\r\n## Problems after installation\r\n\r\nhtmlwhat built over ``protowhat`` which uses ``jinja2==2.11.3``, and jinja uses ``MarkupSafe==2.0.1``.\r\nHence you will face this error\r\n\r\n```\r\nImportError: cannot import name 'soft_unicode' from 'markupsafe'\r\n```\r\n\r\nso install the latest version of jinja2 using the following command:\r\n\r\n```\r\npip install --upgrade jinja2\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Verify HTML code submissions and auto-generate meaningful feedback messages.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/arlarse/htmlwhat"
},
"split_keywords": [
"htmlwhat",
"html",
"feedback",
"html validation",
"testing",
"html testing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9c2675c5f066c51b6870a3a90322649207b973b560ce1a36c817aa4a996d4579",
"md5": "61c92621708235e1dc180488ca9313d5",
"sha256": "73a54ef3bd45e6313db304d30b7ab74f3c433f200512fdf3484931619133cd91"
},
"downloads": -1,
"filename": "htmlwhat-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "61c92621708235e1dc180488ca9313d5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12076,
"upload_time": "2024-02-13T23:53:09",
"upload_time_iso_8601": "2024-02-13T23:53:09.442362Z",
"url": "https://files.pythonhosted.org/packages/9c/26/75c5f066c51b6870a3a90322649207b973b560ce1a36c817aa4a996d4579/htmlwhat-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a7fd20f63b59b8d8d718b31b0bb6a0c618e640a8ea64666947de501018957a1",
"md5": "24b58bc1baf9c655f3bb4e4e3e3aa89d",
"sha256": "a25d68a82a12cf77e749c98513611869338f6ad221503b6544b024b3aa4de5d9"
},
"downloads": -1,
"filename": "htmlwhat-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "24b58bc1baf9c655f3bb4e4e3e3aa89d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9502,
"upload_time": "2024-02-13T23:53:11",
"upload_time_iso_8601": "2024-02-13T23:53:11.449705Z",
"url": "https://files.pythonhosted.org/packages/5a/7f/d20f63b59b8d8d718b31b0bb6a0c618e640a8ea64666947de501018957a1/htmlwhat-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-13 23:53:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arlarse",
"github_project": "htmlwhat",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "htmlwhat"
}