Skip to content

Commit

Permalink
chore(crate): add pub engine
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 15, 2023
1 parent 70d2a20 commit a84e1b5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion accessibility-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "accessibility-rs"
version = "0.0.26"
version = "0.0.28"
authors = ["The A11yWatch Project Developers", "Jeff Mendez <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion accessibility-rs/src/engine/rules/techniques.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strum_macros::IntoStaticStr;
#[derive(PartialOrd, Ord, std::cmp::Eq, PartialEq, Hash, Debug, IntoStaticStr)]
/// techniques for WCAG <https://www.w3.org/TR/WCAG20-TECHS/>
pub enum Techniques {
/// <https://www.w3.org/TR/WCAG20-TECHS/H25.html>
/// <https://www.w3.org/TR/WCAG20-TECHS/H25>
H25,
/// <https://www.w3.org/TR/WCAG20-TECHS/H32.html>
H32,
Expand Down
1 change: 1 addition & 0 deletions accessibility-rs/src/engine/rules/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// utilities for node extracting
pub mod nodes;
3 changes: 1 addition & 2 deletions accessibility-rs/src/engine/rules/wcag_rule_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use std::collections::BTreeMap;
use std::collections::HashMap;
use std::ops::Add;

// todo: validate each element and add a shape that can prevent repitiion
lazy_static! {
/// a list of rules that should be applied for WCAG1 A-AAA
/// a list of rules that should be applied for WCAG2.0 A-AAA
pub static ref RULES_A: BTreeMap<&'static str, Vec<Rule>> =
vec![
("html", Vec::from([
Expand Down
2 changes: 2 additions & 0 deletions accessibility-rs/src/engine/styles/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use selectors::parser::SelectorParseErrorKind;
// UnknownUnit(CowRcStr<'i>),
// }

/// rule parsing errors
pub enum RuleParseErrorKind<'i> {
/// selector parse error
Selector(SelectorParseErrorKind<'i>),
}

Expand Down
8 changes: 7 additions & 1 deletion accessibility-rs/src/engine/styles/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@ 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<Simple>,
/// a css block parsed
block: Arc<String>,
},
}

/// css parser
pub struct Parser;

impl<'i> selectors::parser::Parser<'i> for Parser {
type Impl = Simple;
type Error = RuleParseErrorKind<'i>;
}

/// css selector list
pub type SelectorList = selectors::SelectorList<Simple>;
// pub type Selector = selectors::parser::Selector<Simple>;

/// css rules parser
pub struct RulesParser;

impl<'i> QualifiedRuleParser<'i> for RulesParser {
Expand Down Expand Up @@ -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>;
}
1 change: 1 addition & 0 deletions accessibility-rs/src/i18n/locales.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct Messages {
hi: M,
}

/// the languages for auditing results
pub enum Langs {
/// english
En,
Expand Down
6 changes: 3 additions & 3 deletions accessibility-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a84e1b5

Please sign in to comment.