From 12803d7907e5fe2c890a89c162ea274e0bc192e4 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Sun, 15 Oct 2023 19:09:58 -0400 Subject: [PATCH] chore(crate): add pub engine --- Cargo.lock | 2 +- accessibility-rs/Cargo.toml | 2 +- accessibility-rs/src/engine/rules/utils/mod.rs | 1 + accessibility-rs/src/engine/styles/errors.rs | 2 ++ accessibility-rs/src/engine/styles/rules.rs | 8 +++++++- accessibility-rs/src/i18n/locales.rs | 1 + accessibility-rs/src/lib.rs | 6 +++--- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61ea736..07ddfdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "accessibility-rs" -version = "0.0.26" +version = "0.0.27" dependencies = [ "accessibility-scraper", "accessibility-tree", diff --git a/accessibility-rs/Cargo.toml b/accessibility-rs/Cargo.toml index 283dc54..727aeb5 100644 --- a/accessibility-rs/Cargo.toml +++ b/accessibility-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "accessibility-rs" -version = "0.0.26" +version = "0.0.27" authors = ["The A11yWatch Project Developers", "Jeff Mendez "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/accessibility-rs/src/engine/rules/utils/mod.rs b/accessibility-rs/src/engine/rules/utils/mod.rs index 69e3fea..61a4ec0 100644 --- a/accessibility-rs/src/engine/rules/utils/mod.rs +++ b/accessibility-rs/src/engine/rules/utils/mod.rs @@ -1 +1,2 @@ +/// utilities for node extracting pub mod nodes; diff --git a/accessibility-rs/src/engine/styles/errors.rs b/accessibility-rs/src/engine/styles/errors.rs index 3114816..2fbd252 100644 --- a/accessibility-rs/src/engine/styles/errors.rs +++ b/accessibility-rs/src/engine/styles/errors.rs @@ -8,7 +8,9 @@ use selectors::parser::SelectorParseErrorKind; // UnknownUnit(CowRcStr<'i>), // } +/// rule parsing errors pub enum RuleParseErrorKind<'i> { + /// selector parse error Selector(SelectorParseErrorKind<'i>), } diff --git a/accessibility-rs/src/engine/styles/rules.rs b/accessibility-rs/src/engine/styles/rules.rs index 2f96bdf..7b5497b 100644 --- a/accessibility-rs/src/engine/styles/rules.rs +++ b/accessibility-rs/src/engine/styles/rules.rs @@ -4,13 +4,18 @@ use cssparser::{AtRuleParser, ParseError, QualifiedRuleParser}; use std::sync::Arc; #[derive(Debug)] +/// Css rules to match selectors pub enum CssRule { + /// the style rules for css StyleRule { + /// css selectors list with selector trait selectors: selectors::SelectorList, + /// a css block parsed block: Arc, }, } +/// css parser pub struct Parser; impl<'i> selectors::parser::Parser<'i> for Parser { @@ -18,9 +23,11 @@ impl<'i> selectors::parser::Parser<'i> for Parser { type Error = RuleParseErrorKind<'i>; } +/// css selector list pub type SelectorList = selectors::SelectorList; // pub type Selector = selectors::parser::Selector; +/// css rules parser pub struct RulesParser; impl<'i> QualifiedRuleParser<'i> for RulesParser { @@ -51,7 +58,6 @@ impl<'i> QualifiedRuleParser<'i> for RulesParser { impl<'i> AtRuleParser<'i> for RulesParser { type PreludeBlock = (); type PreludeNoBlock = (); - type AtRule = CssRule; type Error = RuleParseErrorKind<'i>; } diff --git a/accessibility-rs/src/i18n/locales.rs b/accessibility-rs/src/i18n/locales.rs index ecc6337..8f2e3bd 100644 --- a/accessibility-rs/src/i18n/locales.rs +++ b/accessibility-rs/src/i18n/locales.rs @@ -25,6 +25,7 @@ pub struct Messages { hi: M, } +/// the languages for auditing results pub enum Langs { /// english En, diff --git a/accessibility-rs/src/lib.rs b/accessibility-rs/src/lib.rs index 879d25b..0413cf2 100644 --- a/accessibility-rs/src/lib.rs +++ b/accessibility-rs/src/lib.rs @@ -37,10 +37,10 @@ extern crate lazy_static; #[macro_use] extern crate rust_i18n; -/// the main engine for audits. -mod engine; +/// the main engine for accessibility auditing. +pub mod engine; /// locales for translations. -mod i18n; +pub mod i18n; use crate::engine::audit::auditor::Auditor; use crate::engine::issue::Issue;