Skip to content

Commit

Permalink
chore(guideline): add simple index handling
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 12, 2023
1 parent f37bd83 commit 8e3a030
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions accessibility-rs/src/engine/rules/wcag_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ impl Principle {
pub enum Guideline {
/// Provide text alternatives for any non-text content so that it can be changed into other forms people need.
TextAlternatives,
/// Create content that can be presented in different ways (for example simpler layout) without losing information or structure.
Adaptable,
/// Make it easier for users to see and hear content including separating foreground from background.
Distinguishable,
/// Provide ways to help users navigate, find content, and determine where they are.
Navigable,
/// Make text content readable and understandable.
Expand All @@ -67,8 +71,6 @@ pub enum Guideline {
Predictable,
/// Provide users enough time to read and use content.
EnoughTime,
/// Create content that can be presented in different ways (for example simpler layout) without losing information or structure.
Adaptable,
}

impl Guideline {
Expand All @@ -77,6 +79,7 @@ impl Guideline {
match self {
Guideline::TextAlternatives => "Guideline1_1",
Guideline::Adaptable => "Guideline1_3",
Guideline::Distinguishable => "Guideline1_4",
Guideline::EnoughTime => "Guideline2_2",
Guideline::Navigable => "Guideline2_4",
Guideline::Readable => "Guideline3_1",
Expand All @@ -85,13 +88,7 @@ impl Guideline {
}
/// the principle index
pub fn as_index(&self) -> &'static str {
match self {
Guideline::TextAlternatives => "1_1",
Guideline::Adaptable => "1_3",
Guideline::EnoughTime => "2_2",
Guideline::Navigable => "2_4",
Guideline::Readable => "3_1",
Guideline::Predictable => "3_2",
}
let s = self.as_str();
&s[9..s.len()]
}
}

0 comments on commit 8e3a030

Please sign in to comment.