1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[macro_use]
extern crate lazy_static;

/// the main engine for audits.
mod engine;
/// locales for translations.
mod i18n;
/// app utilities.
mod utils;

use crate::engine::audit::auditor::Auditor;
use accessibility_scraper::ElementRef;
use crate::engine::issue::Issue;

/// audit a web page passing the html and css rules.
pub fn audit(html: &str, css_rules: &str) -> Vec<Issue> {
    let document = accessibility_scraper::Html::parse_document(html);
    let mut nth_index_cache = selectors::NthIndexCache::from(Default::default());
    let auditor = Auditor::new(
        &document,
        &css_rules,
        engine::styles::css_cache::build_matching_context(&mut nth_index_cache),
    );
    engine::audit::wcag::WCAG3AA::audit(&auditor)
}