<commit_before>webalin
=======

**Web** **A**\ ccessibility **Lin**\ ter

:Author: `<NAME>`_
:License: MIT

Dependencies
------------

* `lxml`_
* `requests`_
* JSON library (`json`_, `simplejson`_, or `django.utils.simplejson`_)

Install
-------

*Forthcoming...*

Usage
-----

**Library**


``webalin.analyze`` can accept a URL or a full HTML document and returns errors
as a list::

    >>> import webalin
    >>> webalin.analyze('https://www.djangoproject.com/')
    [ ... ]
    >>> webalin.analyze(open('document.html', 'r').read())
    [ ... ]

**Command Line**

The command line utility accepts arguments from ``sys.stdin`` or ``sys.argv``
and prints errors to stdout::

    $ webalin http://www.python.org
    ...
    $ cat document.html | webalin
    ...

**Output Sample**

Format: ``[type]: [lineno]: [message]``

::

    E: -: <!DOCTYPE> is missing
    E: -: <title> is missing
    E: 7: <img:/satic/images/logo.png> is missing [alt]
    E: 17: <table> is missing [summary]
    E: 19: <th> is missing [scope]
    E: 20: <th> is missing [scope]
    E: 37: <input:id_username> is missing <label>
    E: 41: <input:id_password> is missing <label>
    W: 17: <table> contains no <tr> with [scope]



.. _Derek Payton: http://dmpayton.com
.. _lxml: http://lxml.de/
.. _requests: http://python-requests.org/
.. _json: http://docs.python.org/library/json.html
.. _simplejson: http://pypi.python.org/pypi/simplejson/
.. _django.utils.simplejson: https://www.djangoproject.com/
<commit_msg>add note to README about testing<commit_after>webalin
=======

**Web** **A**\ ccessibility **Lin**\ ter

:Author: `<NAME>`_
:License: MIT

Dependencies
------------

* `lxml`_
* `requests`_
* JSON library (`json`_, `simplejson`_, or `django.utils.simplejson`_)

Install
-------

*Forthcoming...*

Usage
-----

**Library**


``webalin.analyze`` can accept a URL or a full HTML document and returns errors
as a list::

    >>> import webalin
    >>> webalin.analyze('https://www.djangoproject.com/')
    { ... }
    >>> webalin.analyze(open('document.html', 'r').read())
    { ... }

**Command Line**

The command line utility accepts arguments from ``sys.stdin`` or ``sys.argv``
and prints errors to stdout::

    $ webalin http://www.python.org
    ...
    $ cat document.html | webalin
    ...

**Output Sample**

Format: ``[type]: [lineno]: [message]``

::

    E: -: <!DOCTYPE> is missing
    E: -: <title> is missing
    E: 7: <img:/satic/images/logo.png> is missing [alt]
    E: 17: <table> is missing [summary]
    E: 19: <th> is missing [scope]
    E: 20: <th> is missing [scope]
    E: 37: <input:id_username> is missing <label>
    E: 41: <input:id_password> is missing <label>
    W: 17: <table> contains no <tr> with [scope]

Testing
-------

::

    cd tests
    python tests.py

The unit tests are currently a very basic, only checking that an inaccessible
document returns errors and an accessible one doesn't. Better unit tests would
involve testing each accessibility test individually. This is still TODO.


.. _<NAME>: http://dmpayton.com
.. _lxml: http://lxml.de/
.. _requests: http://python-requests.org/
.. _json: http://docs.python.org/library/json.html
.. _simplejson: http://pypi.python.org/pypi/simplejson/
.. _django.utils.simplejson: https://www.djangoproject.com/

{'fraction_non_alphanumeric': 0.1902587519025875, 'fraction_numerical': 0.007914764079147641, 'mean_word_length': 3.0517879161528976, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 48, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1237641', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1117, 'n_words': 318}